Beispiel #1
0
 def format_slot(self, slot):
     white = self.colored.white
     yellow = self.colored.yellow
     parts = ['+ {0}: '.format(white(slot.name))]
     parts.extend([indent(s, 4) for s in (
         'listen: {0}:{1}'.format(yellow(slot.listener.host),
                                  yellow(slot.listener.port or 0)),
         'backlog: {0}'.format(yellow(slot.listener.backlog)),
         'processor: {0}'.format(yellow(slot.service.Processor)),
         'handler: {0}'.format(yellow(slot.service.Handler)),
     )])
     return '\n'.join(parts).strip()
Beispiel #2
0
    def _metavar_formatter(self, action, default_metavar):
        if action.choices is None:
            return super(Formatter, self)._metavar_formatter(action, default_metavar)

        white = self.umbrella.colored.white
        parts = []
        for name, parser in action.choices.items():
            parts.append(indent('+ {0}: {1}'.format(white(name),
                                                    parser.description), 2))
        result = '\n' + '\n'.join(parts)

        return lambda tuple_size: (result, ) * tuple_size
Beispiel #3
0
    def _metavar_formatter(self, action, default_metavar):
        if action.choices is None:
            return super(Formatter,
                         self)._metavar_formatter(action, default_metavar)

        white = self.umbrella.colored.white
        parts = []
        for name, parser in action.choices.items():
            parts.append(
                indent('+ {0}: {1}'.format(white(name), parser.description),
                       2))
        result = '\n' + '\n'.join(parts)

        return lambda tuple_size: (result, ) * tuple_size
Beispiel #4
0
 def format_slot(self, slot):
     white = self.colored.white
     yellow = self.colored.yellow
     parts = ['+ {0}: '.format(white(slot.name))]
     parts.extend([
         indent(s, 4) for s in (
             'listen: {0}:{1}'.format(yellow(slot.listener.host),
                                      yellow(slot.listener.port or 0)),
             'backlog: {0}'.format(yellow(slot.listener.backlog)),
             'processor: {0}'.format(yellow(slot.service.Processor)),
             'handler: {0}'.format(yellow(slot.service.Handler)),
         )
     ])
     return '\n'.join(parts).strip()