diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Lib/warnings.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/warnings.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/warnings.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/contrib/tools/python3/src/Lib/warnings.py b/contrib/tools/python3/src/Lib/warnings.py index d00730209a..691ccddfa4 100644 --- a/contrib/tools/python3/src/Lib/warnings.py +++ b/contrib/tools/python3/src/Lib/warnings.py @@ -220,12 +220,12 @@ def _setoption(arg): for s in parts] action = _getaction(action) category = _getcategory(category) - if message or module: - import re - if message: - message = re.escape(message) + if message or module: + import re + if message: + message = re.escape(message) if module: - module = re.escape(module) + r'\Z' + module = re.escape(module) + r'\Z' if lineno: try: lineno = int(lineno) @@ -251,19 +251,19 @@ def _getaction(action): def _getcategory(category): if not category: return Warning - if '.' not in category: - import builtins as m - klass = category + if '.' not in category: + import builtins as m + klass = category else: - module, _, klass = category.rpartition('.') + module, _, klass = category.rpartition('.') try: m = __import__(module, None, None, [klass]) except ImportError: raise _OptionError("invalid module name: %r" % (module,)) from None - try: - cat = getattr(m, klass) - except AttributeError: - raise _OptionError("unknown warning category: %r" % (category,)) from None + try: + cat = getattr(m, klass) + except AttributeError: + raise _OptionError("unknown warning category: %r" % (category,)) from None if not issubclass(cat, Warning): raise _OptionError("invalid warning category: %r" % (category,)) return cat @@ -310,11 +310,11 @@ def warn(message, category=None, stacklevel=1, source=None): raise ValueError except ValueError: globals = sys.__dict__ - filename = "sys" + filename = "sys" lineno = 1 else: globals = frame.f_globals - filename = frame.f_code.co_filename + filename = frame.f_code.co_filename lineno = frame.f_lineno if '__name__' in globals: module = globals['__name__'] |