/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/commands.py

  • Committer: Martin
  • Date: 2017-06-05 20:48:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6658.
  • Revision ID: gzlist@googlemail.com-20170605204831-20accykspjcrx0a8
Apply 2to3 dict fixer and clean up resulting mess using view helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        # only load once
170
170
        return
171
171
    import breezy.builtins
172
 
    for cmd_class in _scan_module_for_commands(breezy.builtins).values():
 
172
    for cmd_class in _scan_module_for_commands(breezy.builtins):
173
173
        builtin_command_registry.register(cmd_class)
174
174
    breezy.builtins._register_lazy_builtins()
175
175
 
176
176
 
177
177
def _scan_module_for_commands(module):
178
 
    r = {}
179
 
    for name, obj in module.__dict__.items():
 
178
    module_dict = module.__dict__
 
179
    for name in module_dict:
180
180
        if name.startswith("cmd_"):
181
 
            real_name = _unsquish_command_name(name)
182
 
            r[real_name] = obj
183
 
    return r
 
181
            yield module_dict[name]
184
182
 
185
183
 
186
184
def _list_bzr_commands(names):
628
626
 
629
627
        Maps from long option name to option object."""
630
628
        r = Option.STD_OPTIONS.copy()
631
 
        std_names = r.keys()
 
629
        std_names = set(r)
632
630
        for o in self.takes_options:
633
631
            if isinstance(o, string_types):
634
632
                o = option.Option.OPTIONS[o]
824
822
        raise errors.BzrCommandError(
825
823
            gettext('Only ASCII permitted in option names'))
826
824
 
827
 
    opts = dict([(k, v) for k, v in options.__dict__.items() if
828
 
                 v is not option.OptionParser.DEFAULT_VALUE])
 
825
    opts = dict((k, v) for k, v in options.__dict__.items() if
 
826
                v is not option.OptionParser.DEFAULT_VALUE)
829
827
    return args, opts
830
828
 
831
829