Esempio n. 1
0
def _format_dependency(dep_info):
    lines = []

    if 'version' not in dep_info:
        lines.append('%s: not found' % dep_info['name'])
    else:
        if 'path' in dep_info:
            source = ' from %s' % dep_info['path']
        else:
            source = ''
        lines.append('%s: %s%s' % (
            dep_info['name'],
            dep_info['version'],
            source,
        ))

    if 'other' in dep_info:
        lines.append(
            '  Detailed information: %s' %
            (formatting.indent(dep_info['other'], places=4)), )

    if dep_info.get('dependencies', []):
        for sub_dep_info in dep_info['dependencies']:
            sub_dep_lines = _format_dependency(sub_dep_info)
            lines.append(
                formatting.indent(sub_dep_lines, places=2, singles=True))

    return '\n'.join(lines)
Esempio n. 2
0
def _format_dependency(dep_info):
    lines = []

    if 'version' not in dep_info:
        lines.append('%s: not found' % dep_info['name'])
    else:
        if 'path' in dep_info:
            source = ' from %s' % dep_info['path']
        else:
            source = ''
        lines.append('%s: %s%s' % (
            dep_info['name'],
            dep_info['version'],
            source,
        ))

    if 'other' in dep_info:
        lines.append('  Detailed information: %s' % (
            formatting.indent(dep_info['other'], places=4)),)

    if dep_info.get('dependencies', []):
        for sub_dep_info in dep_info['dependencies']:
            sub_dep_lines = _format_dependency(sub_dep_info)
            lines.append(
                formatting.indent(sub_dep_lines, places=2, singles=True))

    return '\n'.join(lines)
Esempio n. 3
0
def _format_dependency(dep_info):
    lines = []

    if "version" not in dep_info:
        lines.append(f"{dep_info['name']}: not found")
    else:
        source = f" from {dep_info['path']}" if "path" in dep_info else ""
        lines.append(f"{dep_info['name']}: {dep_info['version']}{source}")

    if "other" in dep_info:
        details = formatting.indent(dep_info["other"], places=4)
        lines.append(f"  Detailed information: {details}")

    if dep_info.get("dependencies", []):
        for sub_dep_info in dep_info["dependencies"]:
            sub_dep_lines = _format_dependency(sub_dep_info)
            lines.append(
                formatting.indent(sub_dep_lines, places=2, singles=True))

    return "\n".join(lines)
Esempio n. 4
0
    def on_line_received(self, line):
        logger.debug('Request from [%s]: %s', self.connection, line)

        response = self.dispatcher.handle_request(line)
        if not response:
            return

        logger.debug('Response to [%s]: %s', self.connection,
                     formatting.indent(self.terminator.join(response)))

        self.send_lines(response)
Esempio n. 5
0
    def _get_request_handlers(self):
        request_handlers = []
        request_handlers.extend(self._get_app_request_handlers())
        request_handlers.extend(self._get_static_request_handlers())
        request_handlers.extend(self._get_mopidy_request_handlers())

        logger.debug(
            "HTTP routes from extensions: %s",
            formatting.indent("\n".join("%r: %r" % (r[0], r[1]) for r in request_handlers)),
        )

        return request_handlers
Esempio n. 6
0
    def _get_request_handlers(self):
        request_handlers = []
        request_handlers.extend(self._get_app_request_handlers())
        request_handlers.extend(self._get_static_request_handlers())
        request_handlers.extend(self._get_mopidy_request_handlers())

        logger.debug(
            'HTTP routes from extensions: %s',
            formatting.indent('\n'.join('%r: %r' % (r[0], r[1])
                                        for r in request_handlers)))

        return request_handlers
Esempio n. 7
0
    def _get_request_handlers(self):
        request_handlers = []
        request_handlers.extend(self._get_app_request_handlers())
        request_handlers.extend(self._get_static_request_handlers())
        request_handlers.extend(self._get_mopidy_request_handlers())

        logger.debug(
            'HTTP routes from extensions: %s',
            formatting.indent('\n'.join(
                '%r: %r' % (r[0], r[1]) for r in request_handlers)))

        return request_handlers
Esempio n. 8
0
    def on_line_received(self, line):
        logger.debug('Request from [%s]:%s: %s', self.host, self.port, line)

        response = self.dispatcher.handle_request(line)
        if not response:
            return

        logger.debug(
            'Response to [%s]:%s: %s', self.host, self.port,
            formatting.indent(self.terminator.join(response)))

        self.send_lines(response)
Esempio n. 9
0
    def _get_request_handlers(self):
        request_handlers = []
        request_handlers.extend(self._get_app_request_handlers())
        request_handlers.extend(self._get_static_request_handlers())
        request_handlers.extend(self._get_default_request_handlers())

        logger.debug(
            "HTTP routes from extensions: %s",
            formatting.indent("\n".join(f"{path!r}: {handler!r}"
                                        for (path, handler,
                                             *_) in request_handlers)),
        )

        return request_handlers