Did I find the right examples for you? yes no

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)
Turn a 'no eligible data' message into actual data.

Returns a dict mapping backend name to (reason, supplement), where
'reason' is something like "No setup.py found" and 'supplement' is
any supplementary information (e.g. a string representing a list of
files).  'supplement' can be None if there's nothing useful to include.

        def parse_backend_reasons(data, _backend_re=re.compile(_backend_re)):
    """Turn a 'no eligible data' message into actual data.

    Returns a dict mapping backend name to (reason, supplement), where
    'reason' is something like "No setup.py found" and 'supplement' is
    any supplementary information (e.g. a string representing a list of
    files).  'supplement' can be None if there's nothing useful to include.
    """
    if not data.startswith("No eligible backends for"):
        return
    result = {}
    _, data = data.split('. Tried ', 1)
    data, _ = data.split('. The following ')
    backends = _backend_re.split(data)
    for backend in backends:
        if backend in ('', ', '):
            continue
        name, message = backend.strip().split(' ', 1)
        message = message.strip('()')
        if ':' in message:
            message, supplement = message.split(':')
            supplement = supplement.strip()
        else:
            supplement = None
        result[name] = (message.strip().rstrip('.'), supplement)
    return result
        


src/t/x/txpkgme-0.3/txpkgme/tests/test_nobackend.py   txpkgme(Download)
from testtools import TestCase
 
from txpkgme.nobackend import (
    gather_files_from_backend_reasons,
    gather_no_backend_data,
            "The following backends were disallowed by policy: "
            "cmake, dummy, vala, python, unity-webapps")
        parsed = parse_backend_reasons(data)
        self.assertEqual(
            {'binary': ("No ELF binaries found", None),
            "backends were disallowed by policy: cmake, dummy, vala, "
            "python, unity-webapps.")
        parsed = parse_backend_reasons(data)
        self.assertEqual(
            {'binary': ("No ELF binaries found", None),
        report = gather_no_backend_data(result)
        reasons, supplements = split_supplement_data(
            parse_backend_reasons(data))
        self.assertEqual(
            {'url': 'http://example.com/thing',