Mercurial > libervia-backend
comparison sat_frontends/jp/cmd_uri.py @ 2624:56f94936df1e
code style reformatting using black
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 20:14:46 +0200 |
parents | 26edcf3a30eb |
children | 003b8b4b56a7 |
comparison
equal
deleted
inserted
replaced
2623:49533de4540b | 2624:56f94936df1e |
---|---|
25 | 25 |
26 __commands__ = ["Uri"] | 26 __commands__ = ["Uri"] |
27 | 27 |
28 | 28 |
29 class Parse(base.CommandBase): | 29 class Parse(base.CommandBase): |
30 | |
31 def __init__(self, host): | 30 def __init__(self, host): |
32 base.CommandBase.__init__(self, host, 'parse', use_profile=False, use_output=C.OUTPUT_DICT, help=_(u'parse URI')) | 31 base.CommandBase.__init__( |
32 self, | |
33 host, | |
34 "parse", | |
35 use_profile=False, | |
36 use_output=C.OUTPUT_DICT, | |
37 help=_(u"parse URI"), | |
38 ) | |
33 | 39 |
34 def add_parser_options(self): | 40 def add_parser_options(self): |
35 self.parser.add_argument("uri", type=base.unicode_decoder, help=_(u"XMPP URI to parse")) | 41 self.parser.add_argument( |
42 "uri", type=base.unicode_decoder, help=_(u"XMPP URI to parse") | |
43 ) | |
36 | 44 |
37 def start(self): | 45 def start(self): |
38 self.output(uri.parseXMPPUri(self.args.uri)) | 46 self.output(uri.parseXMPPUri(self.args.uri)) |
39 | 47 |
40 | 48 |
41 class Build(base.CommandBase): | 49 class Build(base.CommandBase): |
42 | |
43 def __init__(self, host): | 50 def __init__(self, host): |
44 base.CommandBase.__init__(self, host, 'build', use_profile=False, help=_(u'build URI')) | 51 base.CommandBase.__init__( |
52 self, host, "build", use_profile=False, help=_(u"build URI") | |
53 ) | |
45 | 54 |
46 def add_parser_options(self): | 55 def add_parser_options(self): |
47 self.parser.add_argument("type", type=base.unicode_decoder, help=_(u"URI type")) | 56 self.parser.add_argument("type", type=base.unicode_decoder, help=_(u"URI type")) |
48 self.parser.add_argument("path", type=base.unicode_decoder, help=_(u"URI path")) | 57 self.parser.add_argument("path", type=base.unicode_decoder, help=_(u"URI path")) |
49 self.parser.add_argument("-f", | 58 self.parser.add_argument( |
59 "-f", | |
50 "--field", | 60 "--field", |
51 type=base.unicode_decoder, | 61 type=base.unicode_decoder, |
52 action='append', | 62 action="append", |
53 nargs=2, | 63 nargs=2, |
54 dest='fields', | 64 dest="fields", |
55 metavar=(u"KEY", u"VALUE"), | 65 metavar=(u"KEY", u"VALUE"), |
56 help=_(u"URI fields")) | 66 help=_(u"URI fields"), |
67 ) | |
57 | 68 |
58 def start(self): | 69 def start(self): |
59 fields = dict(self.args.fields) if self.args.fields else {} | 70 fields = dict(self.args.fields) if self.args.fields else {} |
60 self.disp(uri.buildXMPPUri(self.args.type, path=self.args.path, **fields)) | 71 self.disp(uri.buildXMPPUri(self.args.type, path=self.args.path, **fields)) |
61 | 72 |
62 | 73 |
63 class Uri(base.CommandBase): | 74 class Uri(base.CommandBase): |
64 subcommands = (Parse, Build) | 75 subcommands = (Parse, Build) |
65 | 76 |
66 def __init__(self, host): | 77 def __init__(self, host): |
67 super(Uri, self).__init__(host, 'uri', use_profile=False, help=_('XMPP URI parsing/generation')) | 78 super(Uri, self).__init__( |
79 host, "uri", use_profile=False, help=_("XMPP URI parsing/generation") | |
80 ) |