From: Éric Araujo Date: Mon, 29 Aug 2011 22:45:59 +0000 (+0200) Subject: Cleanup: move code out of a try block X-Git-Tag: v3.3.0a1~1601^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acddb38602d71aded42e53d89b78b82c617e117d;p=thirdparty%2FPython%2Fcpython.git Cleanup: move code out of a try block --- diff --git a/Lib/packaging/command/__init__.py b/Lib/packaging/command/__init__.py index 6a3785061b9d..2b52190b0137 100644 --- a/Lib/packaging/command/__init__.py +++ b/Lib/packaging/command/__init__.py @@ -30,6 +30,8 @@ _COMMANDS = { 'upload': 'packaging.command.upload.upload', 'upload_docs': 'packaging.command.upload_docs.upload_docs'} +# XXX use OrderedDict to preserve the grouping (build-related, install-related, +# distribution-related) STANDARD_COMMANDS = set(_COMMANDS) @@ -48,9 +50,9 @@ def get_command_class(name): """Return the registered command""" try: cls = _COMMANDS[name] - if isinstance(cls, str): - cls = resolve_name(cls) - _COMMANDS[name] = cls - return cls except KeyError: raise PackagingModuleError("Invalid command %s" % name) + if isinstance(cls, str): + cls = resolve_name(cls) + _COMMANDS[name] = cls + return cls