diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Lib/inspect.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/inspect.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/inspect.py | 346 |
1 files changed, 173 insertions, 173 deletions
diff --git a/contrib/tools/python3/src/Lib/inspect.py b/contrib/tools/python3/src/Lib/inspect.py index ffe0a781f7..626e408e9f 100644 --- a/contrib/tools/python3/src/Lib/inspect.py +++ b/contrib/tools/python3/src/Lib/inspect.py @@ -32,7 +32,7 @@ __author__ = ('Ka-Ping Yee <ping@lfw.org>', 'Yury Selivanov <yselivanov@sprymix.com>') import abc -import ast +import ast import dis import collections.abc import enum @@ -111,7 +111,7 @@ def ismethoddescriptor(object): def isdatadescriptor(object): """Return true if the object is a data descriptor. - Data descriptors have a __set__ or a __delete__ attribute. Examples are + Data descriptors have a __set__ or a __delete__ attribute. Examples are properties (defined in Python) and getsets and members (defined in C). Typically, data descriptors will also have __name__ and __doc__ attributes (properties, getsets, and members have both of these attributes), but this @@ -120,7 +120,7 @@ def isdatadescriptor(object): # mutual exclusion return False tp = type(object) - return hasattr(tp, "__set__") or hasattr(tp, "__delete__") + return hasattr(tp, "__set__") or hasattr(tp, "__delete__") if hasattr(types, 'MemberDescriptorType'): # CPython and equivalent @@ -169,38 +169,38 @@ def isfunction(object): __kwdefaults__ dict of keyword only parameters with defaults""" return isinstance(object, types.FunctionType) -def _has_code_flag(f, flag): - """Return true if ``f`` is a function (or a method or functools.partial - wrapper wrapping a function) whose code object has the given ``flag`` - set in its flags.""" - while ismethod(f): - f = f.__func__ - f = functools._unwrap_partial(f) - if not isfunction(f): - return False - return bool(f.__code__.co_flags & flag) - -def isgeneratorfunction(obj): +def _has_code_flag(f, flag): + """Return true if ``f`` is a function (or a method or functools.partial + wrapper wrapping a function) whose code object has the given ``flag`` + set in its flags.""" + while ismethod(f): + f = f.__func__ + f = functools._unwrap_partial(f) + if not isfunction(f): + return False + return bool(f.__code__.co_flags & flag) + +def isgeneratorfunction(obj): """Return true if the object is a user-defined generator function. Generator function objects provide the same attributes as functions. See help(isfunction) for a list of attributes.""" - return _has_code_flag(obj, CO_GENERATOR) + return _has_code_flag(obj, CO_GENERATOR) -def iscoroutinefunction(obj): +def iscoroutinefunction(obj): """Return true if the object is a coroutine function. Coroutine functions are defined with "async def" syntax. """ - return _has_code_flag(obj, CO_COROUTINE) + return _has_code_flag(obj, CO_COROUTINE) -def isasyncgenfunction(obj): +def isasyncgenfunction(obj): """Return true if the object is an asynchronous generator function. Asynchronous generator functions are defined with "async def" syntax and have "yield" expressions in their body. """ - return _has_code_flag(obj, CO_ASYNC_GENERATOR) + return _has_code_flag(obj, CO_ASYNC_GENERATOR) def isasyncgen(object): """Return true if the object is an asynchronous generator.""" @@ -273,11 +273,11 @@ def iscode(object): | 16=nested | 32=generator | 64=nofree | 128=coroutine | 256=iterable_coroutine | 512=async_generator co_freevars tuple of names of free variables - co_posonlyargcount number of positional only arguments + co_posonlyargcount number of positional only arguments co_kwonlyargcount number of keyword only arguments (not including ** arg) co_lnotab encoded mapping of line numbers to bytecode indices co_name name with which this code object was defined - co_names tuple of names other than arguments and function locals + co_names tuple of names other than arguments and function locals co_nlocals number of local variables co_stacksize virtual machine stack space required co_varnames tuple of names of arguments and local variables""" @@ -589,10 +589,10 @@ def _finddoc(obj): cls = obj.__objclass__ if getattr(cls, name) is not obj: return None - if ismemberdescriptor(obj): - slots = getattr(cls, '__slots__', None) - if isinstance(slots, dict) and name in slots: - return slots[name] + if ismemberdescriptor(obj): + slots = getattr(cls, '__slots__', None) + if isinstance(slots, dict) and name in slots: + return slots[name] else: return None for base in cls.__mro__: @@ -660,9 +660,9 @@ def getfile(object): raise TypeError('{!r} is a built-in module'.format(object)) if isclass(object): if hasattr(object, '__module__'): - module = sys.modules.get(object.__module__) - if getattr(module, '__file__', None) is not None: - return module.__file__ + module = sys.modules.get(object.__module__) + if getattr(module, '__file__', None) is not None: + return module.__file__ raise TypeError('{!r} is a built-in class'.format(object)) if ismethod(object): object = object.__func__ @@ -736,13 +736,13 @@ def getmodule(object, _filename=None): # Try the cache again with the absolute file name try: file = getabsfile(object, _filename) - except (TypeError, FileNotFoundError): + except (TypeError, FileNotFoundError): return None if file in modulesbyfile: return sys.modules.get(modulesbyfile[file]) # Update the filename to module name cache and check yet again # Copy sys.modules in order to cope with changes while iterating - for modname, module in sys.modules.copy().items(): + for modname, module in sys.modules.copy().items(): if ismodule(module) and hasattr(module, '__file__'): f = module.__file__ if f == _filesbymodname.get(modname, None): @@ -770,42 +770,42 @@ def getmodule(object, _filename=None): if builtinobject is object: return builtin - -class ClassFoundException(Exception): - pass - - -class _ClassFinder(ast.NodeVisitor): - - def __init__(self, qualname): - self.stack = [] - self.qualname = qualname - - def visit_FunctionDef(self, node): - self.stack.append(node.name) - self.stack.append('<locals>') - self.generic_visit(node) - self.stack.pop() - self.stack.pop() - - visit_AsyncFunctionDef = visit_FunctionDef - - def visit_ClassDef(self, node): - self.stack.append(node.name) - if self.qualname == '.'.join(self.stack): - # Return the decorator for the class if present - if node.decorator_list: - line_number = node.decorator_list[0].lineno - else: - line_number = node.lineno - - # decrement by one since lines starts with indexing by zero - line_number -= 1 - raise ClassFoundException(line_number) - self.generic_visit(node) - self.stack.pop() - - + +class ClassFoundException(Exception): + pass + + +class _ClassFinder(ast.NodeVisitor): + + def __init__(self, qualname): + self.stack = [] + self.qualname = qualname + + def visit_FunctionDef(self, node): + self.stack.append(node.name) + self.stack.append('<locals>') + self.generic_visit(node) + self.stack.pop() + self.stack.pop() + + visit_AsyncFunctionDef = visit_FunctionDef + + def visit_ClassDef(self, node): + self.stack.append(node.name) + if self.qualname == '.'.join(self.stack): + # Return the decorator for the class if present + if node.decorator_list: + line_number = node.decorator_list[0].lineno + else: + line_number = node.lineno + + # decrement by one since lines starts with indexing by zero + line_number -= 1 + raise ClassFoundException(line_number) + self.generic_visit(node) + self.stack.pop() + + def findsource(object): """Return the entire source file and starting line number for an object. @@ -838,15 +838,15 @@ def findsource(object): return lines, 0 if isclass(object): - qualname = object.__qualname__ - source = ''.join(lines) - tree = ast.parse(source) - class_finder = _ClassFinder(qualname) - try: - class_finder.visit(tree) - except ClassFoundException as e: - line_number = e.args[0] - return lines, line_number + qualname = object.__qualname__ + source = ''.join(lines) + tree = ast.parse(source) + class_finder = _ClassFinder(qualname) + try: + class_finder.visit(tree) + except ClassFoundException as e: + line_number = e.args[0] + return lines, line_number else: raise OSError('could not find class definition') @@ -864,12 +864,12 @@ def findsource(object): lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)') while lnum > 0: - try: - line = lines[lnum] - except IndexError: - raise OSError('lineno is out of bounds') - if pat.match(line): - break + try: + line = lines[lnum] + except IndexError: + raise OSError('lineno is out of bounds') + if pat.match(line): + break lnum = lnum - 1 return lines, lnum raise OSError('could not find code object') @@ -931,7 +931,7 @@ class BlockFinder: self.indecorator = False self.decoratorhasargs = False self.last = 1 - self.body_col0 = None + self.body_col0 = None def tokeneater(self, type, token, srowcol, erowcol, line): if not self.started and not self.indecorator: @@ -963,8 +963,8 @@ class BlockFinder: elif self.passline: pass elif type == tokenize.INDENT: - if self.body_col0 is None and self.started: - self.body_col0 = erowcol[1] + if self.body_col0 is None and self.started: + self.body_col0 = erowcol[1] self.indent = self.indent + 1 self.passline = True elif type == tokenize.DEDENT: @@ -974,10 +974,10 @@ class BlockFinder: # not e.g. for "if: else:" or "try: finally:" blocks) if self.indent <= 0: raise EndOfBlock - elif type == tokenize.COMMENT: - if self.body_col0 is not None and srowcol[1] >= self.body_col0: - # Include comments if indented at least as much as the block - self.last = srowcol[0] + elif type == tokenize.COMMENT: + if self.body_col0 is not None and srowcol[1] >= self.body_col0: + # Include comments if indented at least as much as the block + self.last = srowcol[0] elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL): # any other token on the same indentation level end the previous # block as well, except the pseudo-tokens COMMENT and NL. @@ -1049,7 +1049,7 @@ def getclasstree(classes, unique=False): for c in classes: if c.__bases__: for parent in c.__bases__: - if parent not in children: + if parent not in children: children[parent] = [] if c not in children[parent]: children[parent].append(c) @@ -1074,7 +1074,7 @@ def getargs(co): if not iscode(co): raise TypeError('{!r} is not a code object'.format(co)) - names = co.co_varnames + names = co.co_varnames nargs = co.co_argcount nkwargs = co.co_kwonlyargcount args = list(names[:nargs]) @@ -1089,7 +1089,7 @@ def getargs(co): varkw = None if co.co_flags & CO_VARKEYWORDS: varkw = co.co_varnames[nargs] - return Arguments(args + kwonlyargs, varargs, varkw) + return Arguments(args + kwonlyargs, varargs, varkw) ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults') @@ -1120,7 +1120,7 @@ def getargspec(func): getfullargspec(func) if kwonlyargs or ann: raise ValueError("Function has keyword-only parameters or annotations" - ", use inspect.signature() API which can support them") + ", use inspect.signature() API which can support them") return ArgSpec(args, varargs, varkw, defaults) FullArgSpec = namedtuple('FullArgSpec', @@ -1173,7 +1173,7 @@ def getfullargspec(func): args = [] varargs = None varkw = None - posonlyargs = [] + posonlyargs = [] kwonlyargs = [] annotations = {} defaults = () @@ -1187,9 +1187,9 @@ def getfullargspec(func): name = param.name if kind is _POSITIONAL_ONLY: - posonlyargs.append(name) - if param.default is not param.empty: - defaults += (param.default,) + posonlyargs.append(name) + if param.default is not param.empty: + defaults += (param.default,) elif kind is _POSITIONAL_OR_KEYWORD: args.append(name) if param.default is not param.empty: @@ -1214,7 +1214,7 @@ def getfullargspec(func): # compatibility with 'func.__defaults__' defaults = None - return FullArgSpec(posonlyargs + args, varargs, varkw, defaults, + return FullArgSpec(posonlyargs + args, varargs, varkw, defaults, kwonlyargs, kwdefaults, annotations) @@ -1233,8 +1233,8 @@ def getargvalues(frame): def formatannotation(annotation, base_module=None): if getattr(annotation, '__module__', None) == 'typing': return repr(annotation).replace('typing.', '') - if isinstance(annotation, types.GenericAlias): - return str(annotation) + if isinstance(annotation, types.GenericAlias): + return str(annotation) if isinstance(annotation, type): if annotation.__module__ in ('builtins', base_module): return annotation.__qualname__ @@ -1365,7 +1365,7 @@ def _too_many(f_name, args, kwonly, varargs, defcount, given, values): (f_name, sig, "s" if plural else "", given, kwonly_sig, "was" if given == 1 and not kwonly_given else "were")) -def getcallargs(func, /, *positional, **named): +def getcallargs(func, /, *positional, **named): """Get the mapping of arguments to values. A dict is returned, with keys the function argument names (including the @@ -2035,7 +2035,7 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): def parse_name(node): assert isinstance(node, ast.arg) - if node.annotation is not None: + if node.annotation is not None: raise ValueError("Annotations are not currently supported") return node.arg @@ -2048,8 +2048,8 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): except NameError: raise RuntimeError() - if isinstance(value, (str, int, float, bytes, bool, type(None))): - return ast.Constant(value) + if isinstance(value, (str, int, float, bytes, bool, type(None))): + return ast.Constant(value) raise RuntimeError() class RewriteSymbolics(ast.NodeTransformer): @@ -2149,7 +2149,7 @@ def _signature_from_builtin(cls, func, skip_bound_arg=True): return _signature_fromstr(cls, func, s, skip_bound_arg) -def _signature_from_function(cls, func, skip_bound_arg=True): +def _signature_from_function(cls, func, skip_bound_arg=True): """Private helper: constructs Signature for the given python function.""" is_duck_function = False @@ -2161,20 +2161,20 @@ def _signature_from_function(cls, func, skip_bound_arg=True): # of pure function: raise TypeError('{!r} is not a Python function'.format(func)) - s = getattr(func, "__text_signature__", None) - if s: - return _signature_fromstr(cls, func, s, skip_bound_arg) - + s = getattr(func, "__text_signature__", None) + if s: + return _signature_fromstr(cls, func, s, skip_bound_arg) + Parameter = cls._parameter_cls # Parameter information. func_code = func.__code__ pos_count = func_code.co_argcount arg_names = func_code.co_varnames - posonly_count = func_code.co_posonlyargcount - positional = arg_names[:pos_count] + posonly_count = func_code.co_posonlyargcount + positional = arg_names[:pos_count] keyword_only_count = func_code.co_kwonlyargcount - keyword_only = arg_names[pos_count:pos_count + keyword_only_count] + keyword_only = arg_names[pos_count:pos_count + keyword_only_count] annotations = func.__annotations__ defaults = func.__defaults__ kwdefaults = func.__kwdefaults__ @@ -2186,27 +2186,27 @@ def _signature_from_function(cls, func, skip_bound_arg=True): parameters = [] - non_default_count = pos_count - pos_default_count - posonly_left = posonly_count - + non_default_count = pos_count - pos_default_count + posonly_left = posonly_count + # Non-keyword-only parameters w/o defaults. for name in positional[:non_default_count]: - kind = _POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD + kind = _POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD annotation = annotations.get(name, _empty) parameters.append(Parameter(name, annotation=annotation, - kind=kind)) - if posonly_left: - posonly_left -= 1 + kind=kind)) + if posonly_left: + posonly_left -= 1 # ... w/ defaults. for offset, name in enumerate(positional[non_default_count:]): - kind = _POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD + kind = _POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD annotation = annotations.get(name, _empty) parameters.append(Parameter(name, annotation=annotation, - kind=kind, + kind=kind, default=defaults[offset])) - if posonly_left: - posonly_left -= 1 + if posonly_left: + posonly_left -= 1 # *args if func_code.co_flags & CO_VARARGS: @@ -2252,18 +2252,18 @@ def _signature_from_callable(obj, *, callable objects. """ - _get_signature_of = functools.partial(_signature_from_callable, - follow_wrapper_chains=follow_wrapper_chains, - skip_bound_arg=skip_bound_arg, - sigcls=sigcls) - + _get_signature_of = functools.partial(_signature_from_callable, + follow_wrapper_chains=follow_wrapper_chains, + skip_bound_arg=skip_bound_arg, + sigcls=sigcls) + if not callable(obj): raise TypeError('{!r} is not a callable object'.format(obj)) if isinstance(obj, types.MethodType): # In this case we skip the first parameter of the underlying # function (usually `self` or `cls`). - sig = _get_signature_of(obj.__func__) + sig = _get_signature_of(obj.__func__) if skip_bound_arg: return _signature_bound_method(sig) @@ -2277,7 +2277,7 @@ def _signature_from_callable(obj, *, # If the unwrapped object is a *method*, we might want to # skip its first parameter (self). # See test_signature_wrapped_bound_method for details. - return _get_signature_of(obj) + return _get_signature_of(obj) try: sig = obj.__signature__ @@ -2304,7 +2304,7 @@ def _signature_from_callable(obj, *, # (usually `self`, or `cls`) will not be passed # automatically (as for boundmethods) - wrapped_sig = _get_signature_of(partialmethod.func) + wrapped_sig = _get_signature_of(partialmethod.func) sig = _signature_get_partial(wrapped_sig, partialmethod, (None,)) first_wrapped_param = tuple(wrapped_sig.parameters.values())[0] @@ -2322,15 +2322,15 @@ def _signature_from_callable(obj, *, if isfunction(obj) or _signature_is_functionlike(obj): # If it's a pure Python function, or an object that is duck type # of a Python function (Cython functions, for instance), then: - return _signature_from_function(sigcls, obj, - skip_bound_arg=skip_bound_arg) + return _signature_from_function(sigcls, obj, + skip_bound_arg=skip_bound_arg) if _signature_is_builtin(obj): return _signature_from_builtin(sigcls, obj, skip_bound_arg=skip_bound_arg) if isinstance(obj, functools.partial): - wrapped_sig = _get_signature_of(obj.func) + wrapped_sig = _get_signature_of(obj.func) return _signature_get_partial(wrapped_sig, obj) sig = None @@ -2341,26 +2341,26 @@ def _signature_from_callable(obj, *, # in its metaclass call = _signature_get_user_defined_method(type(obj), '__call__') if call is not None: - sig = _get_signature_of(call) + sig = _get_signature_of(call) else: - factory_method = None + factory_method = None new = _signature_get_user_defined_method(obj, '__new__') - init = _signature_get_user_defined_method(obj, '__init__') - # Now we check if the 'obj' class has an own '__new__' method - if '__new__' in obj.__dict__: - factory_method = new - # or an own '__init__' method - elif '__init__' in obj.__dict__: - factory_method = init - # If not, we take inherited '__new__' or '__init__', if present - elif new is not None: - factory_method = new - elif init is not None: - factory_method = init - - if factory_method is not None: - sig = _get_signature_of(factory_method) - + init = _signature_get_user_defined_method(obj, '__init__') + # Now we check if the 'obj' class has an own '__new__' method + if '__new__' in obj.__dict__: + factory_method = new + # or an own '__init__' method + elif '__init__' in obj.__dict__: + factory_method = init + # If not, we take inherited '__new__' or '__init__', if present + elif new is not None: + factory_method = new + elif init is not None: + factory_method = init + + if factory_method is not None: + sig = _get_signature_of(factory_method) + if sig is None: # At this point we know, that `obj` is a class, with no user- # defined '__init__', '__new__', or class-level '__call__' @@ -2392,7 +2392,7 @@ def _signature_from_callable(obj, *, if (obj.__init__ is object.__init__ and obj.__new__ is object.__new__): # Return a signature of 'object' builtin. - return sigcls.from_callable(object) + return sigcls.from_callable(object) else: raise ValueError( 'no signature found for builtin type {!r}'.format(obj)) @@ -2405,7 +2405,7 @@ def _signature_from_callable(obj, *, call = _signature_get_user_defined_method(type(obj), '__call__') if call is not None: try: - sig = _get_signature_of(call) + sig = _get_signature_of(call) except ValueError as ex: msg = 'no signature found for {!r}'.format(obj) raise ValueError(msg) from ex @@ -2444,9 +2444,9 @@ class _ParameterKind(enum.IntEnum): def __str__(self): return self._name_ - @property - def description(self): - return _PARAM_NAME_MAPPING[self] + @property + def description(self): + return _PARAM_NAME_MAPPING[self] _POSITIONAL_ONLY = _ParameterKind.POSITIONAL_ONLY _POSITIONAL_OR_KEYWORD = _ParameterKind.POSITIONAL_OR_KEYWORD @@ -2503,7 +2503,7 @@ class Parameter: if default is not _empty: if self._kind in (_VAR_POSITIONAL, _VAR_KEYWORD): msg = '{} parameters cannot have default values' - msg = msg.format(self._kind.description) + msg = msg.format(self._kind.description) raise ValueError(msg) self._default = default self._annotation = annotation @@ -2525,7 +2525,7 @@ class Parameter: 'implicit arguments must be passed as ' 'positional or keyword arguments, not {}' ) - msg = msg.format(self._kind.description) + msg = msg.format(self._kind.description) raise ValueError(msg) self._kind = _POSITIONAL_ONLY name = 'implicit{}'.format(name[1:]) @@ -2624,7 +2624,7 @@ class BoundArguments: Has the following public attributes: - * arguments : dict + * arguments : dict An ordered mutable mapping of parameters' names to arguments' values. Does not contain arguments' default values. * signature : Signature @@ -2724,7 +2724,7 @@ class BoundArguments: # Signature.bind_partial(). continue new_arguments.append((name, val)) - self.arguments = dict(new_arguments) + self.arguments = dict(new_arguments) def __eq__(self, other): if self is other: @@ -2792,7 +2792,7 @@ class Signature: top_kind = _POSITIONAL_ONLY kind_defaults = False - for param in parameters: + for param in parameters: kind = param.kind name = param.name @@ -2801,8 +2801,8 @@ class Signature: 'wrong parameter order: {} parameter before {} ' 'parameter' ) - msg = msg.format(top_kind.description, - kind.description) + msg = msg.format(top_kind.description, + kind.description) raise ValueError(msg) elif kind > top_kind: kind_defaults = False @@ -2827,7 +2827,7 @@ class Signature: params[name] = param else: - params = OrderedDict((param.name, param) for param in parameters) + params = OrderedDict((param.name, param) for param in parameters) self._parameters = types.MappingProxyType(params) self._return_annotation = return_annotation @@ -2909,7 +2909,7 @@ class Signature: def _bind(self, args, kwargs, *, partial=False): """Private method. Don't use directly.""" - arguments = {} + arguments = {} parameters = iter(self.parameters.values()) parameters_ex = () @@ -2980,7 +2980,7 @@ class Signature: arguments[param.name] = tuple(values) break - if param.name in kwargs and param.kind != _POSITIONAL_ONLY: + if param.name in kwargs and param.kind != _POSITIONAL_ONLY: raise TypeError( 'multiple values for argument {arg!r}'.format( arg=param.name)) from None @@ -3037,19 +3037,19 @@ class Signature: return self._bound_arguments_cls(self, arguments) - def bind(self, /, *args, **kwargs): + def bind(self, /, *args, **kwargs): """Get a BoundArguments object, that maps the passed `args` and `kwargs` to the function's signature. Raises `TypeError` if the passed arguments can not be bound. """ - return self._bind(args, kwargs) + return self._bind(args, kwargs) - def bind_partial(self, /, *args, **kwargs): + def bind_partial(self, /, *args, **kwargs): """Get a BoundArguments object, that partially maps the passed `args` and `kwargs` to the function's signature. Raises `TypeError` if the passed arguments can not be bound. """ - return self._bind(args, kwargs, partial=True) + return self._bind(args, kwargs, partial=True) def __reduce__(self): return (type(self), @@ -3138,7 +3138,7 @@ def _main(): type(exc).__name__, exc) print(msg, file=sys.stderr) - sys.exit(2) + sys.exit(2) if has_attrs: parts = attrs.split(".") @@ -3148,7 +3148,7 @@ def _main(): if module.__name__ in sys.builtin_module_names: print("Can't get info for builtin modules.", file=sys.stderr) - sys.exit(1) + sys.exit(1) if args.details: print('Target: {}'.format(target)) |