diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:40 +0300 |
commit | 5d50718e66d9c037dc587a0211110b7d25a66185 (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /library/python | |
parent | a6a92afe03e02795227d2641b49819b687f088f8 (diff) | |
download | ydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/python')
-rw-r--r-- | library/python/cores/__init__.py | 8 | ||||
-rw-r--r-- | library/python/cores/ya.make | 2 | ||||
-rw-r--r-- | library/python/resource/__init__.py | 8 | ||||
-rw-r--r-- | library/python/resource/ut/lib/test_simple.py | 4 | ||||
-rw-r--r-- | library/python/resource/ut/lib/ya.make | 4 | ||||
-rw-r--r-- | library/python/runtime_py3/importer.pxi | 42 | ||||
-rw-r--r-- | library/python/runtime_py3/main/main.c | 6 | ||||
-rw-r--r-- | library/python/runtime_py3/main/ya.make | 12 | ||||
-rw-r--r-- | library/python/runtime_py3/test/canondata/result.json | 4 | ||||
-rw-r--r-- | library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt | 10 | ||||
-rw-r--r-- | library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt | 10 | ||||
-rw-r--r-- | library/python/runtime_py3/test/test_traceback.py | 2 | ||||
-rw-r--r-- | library/python/runtime_py3/test/ya.make | 4 | ||||
-rw-r--r-- | library/python/testing/yatest_common/yatest/common/process.py | 24 | ||||
-rw-r--r-- | library/python/ya.make | 26 |
15 files changed, 83 insertions, 83 deletions
diff --git a/library/python/cores/__init__.py b/library/python/cores/__init__.py index d6bd3c828d..fdb1f82a46 100644 --- a/library/python/cores/__init__.py +++ b/library/python/cores/__init__.py @@ -8,8 +8,8 @@ import logging import platform import subprocess -import six - +import six + from library.python.reservoir_sampling import reservoir_sampling @@ -125,9 +125,9 @@ def get_gdb_full_backtrace(binary, core, gdb_path): ] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, stderr = proc.communicate() - output = six.ensure_str(output) + output = six.ensure_str(output) if stderr: - output += "\nstderr >>\n" + six.ensure_str(stderr) + output += "\nstderr >>\n" + six.ensure_str(stderr) return output diff --git a/library/python/cores/ya.make b/library/python/cores/ya.make index c5312bf458..76264e9cce 100644 --- a/library/python/cores/ya.make +++ b/library/python/cores/ya.make @@ -8,7 +8,7 @@ PY23_LIBRARY() PY_SRCS(__init__.py) PEERDIR( - contrib/python/six + contrib/python/six library/python/reservoir_sampling ) diff --git a/library/python/resource/__init__.py b/library/python/resource/__init__.py index 627f4001f4..26503ef7fc 100644 --- a/library/python/resource/__init__.py +++ b/library/python/resource/__init__.py @@ -1,8 +1,8 @@ from __res import find as __find, count, key_by_index, resfs_files as __resfs_files from __res import resfs_read, resfs_resolve, resfs_src # noqa - + import six - + def iterkeys(prefix='', strip_prefix=False): decode = lambda s: s @@ -11,12 +11,12 @@ def iterkeys(prefix='', strip_prefix=False): decode = lambda s: s.decode('utf-8') for i in six.moves.range(count()): - key = key_by_index(i) + key = key_by_index(i) if key.startswith(prefix): if strip_prefix: key = key[len(prefix):] yield decode(key) - + def itervalues(prefix=b''): for key in iterkeys(prefix=prefix): diff --git a/library/python/resource/ut/lib/test_simple.py b/library/python/resource/ut/lib/test_simple.py index 207307242c..52f006ff91 100644 --- a/library/python/resource/ut/lib/test_simple.py +++ b/library/python/resource/ut/lib/test_simple.py @@ -7,8 +7,8 @@ text = b'na gorshke sidel korol\n' def test_find(): assert rs.find('/qw.txt') == text - - + + def test_iter(): assert set(rs.iterkeys()).issuperset({'/qw.txt', '/prefix/1.txt', '/prefix/2.txt'}) assert set(rs.iterkeys(prefix='/prefix/')) == {'/prefix/1.txt', '/prefix/2.txt'} diff --git a/library/python/resource/ut/lib/ya.make b/library/python/resource/ut/lib/ya.make index 3930797334..693e388878 100644 --- a/library/python/resource/ut/lib/ya.make +++ b/library/python/resource/ut/lib/ya.make @@ -10,8 +10,8 @@ PEERDIR( RESOURCE( qw.txt /qw.txt - qw.txt /prefix/1.txt - qw.txt /prefix/2.txt + qw.txt /prefix/1.txt + qw.txt /prefix/2.txt ) END() diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index 643776519e..904f94dea2 100644 --- a/library/python/runtime_py3/importer.pxi +++ b/library/python/runtime_py3/importer.pxi @@ -249,7 +249,7 @@ class ResourceImporter(object): if isinstance(relpath, bytes): relpath = _s(relpath) return relpath or modname - + # PEP-302 extension 3 of 3: packaging introspection. # Used by `linecache` (while printing tracebacks) unless module filename # exists on the filesystem. @@ -265,7 +265,7 @@ class ResourceImporter(object): return _s(file_bytes(abspath)) data = resfs_read(mod_path(fullname)) return _s(data) if data else '' - + def get_code(self, fullname): modname = fullname if self.is_package(fullname): @@ -283,14 +283,14 @@ class ResourceImporter(object): yapyc_data = resfs_read(yapyc_path, builtin=True) if yapyc_data: return marshal.loads(yapyc_data) - else: + else: py_data = resfs_read(path, builtin=True) if py_data: return compile(py_data, _s(relpath), 'exec', dont_inherit=True) else: # This covers packages with no __init__.py in resources. return compile('', modname, 'exec', dont_inherit=True) - + def is_package(self, fullname): if fullname in self.memory: return False @@ -332,7 +332,7 @@ class ResourceImporter(object): if self.arcadia_source_finder: for m in self.arcadia_source_finder.iter_modules(self._package_prefix, prefix): yield m - + def get_resource_reader(self, fullname): try: if not self.is_package(fullname): @@ -393,7 +393,7 @@ class BuiltinSubmoduleImporter(BuiltinImporter): else: return None - + class ArcadiaSourceFinder: """ Search modules and packages in arcadia source tree. @@ -522,17 +522,17 @@ class ArcadiaSourceFinder: paths.add(rel_path) -def excepthook(*args, **kws): - # traceback module cannot be imported at module level, because interpreter - # is not fully initialized yet - - import traceback - - return traceback.print_exception(*args, **kws) - - +def excepthook(*args, **kws): + # traceback module cannot be imported at module level, because interpreter + # is not fully initialized yet + + import traceback + + return traceback.print_exception(*args, **kws) + + importer = ResourceImporter() - + def executable_path_hook(path): if path == executable: @@ -562,10 +562,10 @@ sys.path_importer_cache[executable] = importer # Indicator that modules and resources are built-in rather than on the file system. sys.is_standalone_binary = True sys.frozen = True - + # Set of names of importable modules. sys.extra_modules = importer.memory - -# Use custom implementation of traceback printer. -# Built-in printer (PyTraceBack_Print) does not support custom module loaders -sys.excepthook = excepthook + +# Use custom implementation of traceback printer. +# Built-in printer (PyTraceBack_Print) does not support custom module loaders +sys.excepthook = excepthook diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c index eaf500eaf2..3159800615 100644 --- a/library/python/runtime_py3/main/main.c +++ b/library/python/runtime_py3/main/main.c @@ -183,9 +183,9 @@ static int pymain(int argc, char** argv) { colon[0] = '\0'; func_name = colon + 1; } - if (module_name[0] == '\0') { - module_name = "library.python.runtime_py3.entry_points"; - } + if (module_name[0] == '\0') { + module_name = "library.python.runtime_py3.entry_points"; + } if (!func_name) { sts = RunModule(module_name); diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make index 1a98366774..f308a93b28 100644 --- a/library/python/runtime_py3/main/ya.make +++ b/library/python/runtime_py3/main/ya.make @@ -1,15 +1,15 @@ -LIBRARY() - +LIBRARY() + OWNER( pg orivej ) - + PEERDIR( contrib/tools/python3/src library/cpp/resource ) - + ADDINCL( contrib/tools/python3/src/Include ) @@ -22,5 +22,5 @@ SRCS( main.c get_py_main.cpp ) - -END() + +END() diff --git a/library/python/runtime_py3/test/canondata/result.json b/library/python/runtime_py3/test/canondata/result.json index b60f372fe3..a7d045fc9c 100644 --- a/library/python/runtime_py3/test/canondata/result.json +++ b/library/python/runtime_py3/test/canondata/result.json @@ -1,7 +1,7 @@ { "test_traceback.test_traceback[custom-default]": { "stderr": { - "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", + "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", "uri": "file://test_traceback.test_traceback_custom-default_/stderr.txt" }, "stdout": { @@ -31,7 +31,7 @@ }, "test_traceback.test_traceback[main-default]": { "stderr": { - "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", + "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", "uri": "file://test_traceback.test_traceback_main-default_/stderr.txt" }, "stdout": { diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt index e5e3607e85..5eb7da170a 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt @@ -1,12 +1,12 @@ Traceback (most recent call last): File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main - one() + one() File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one - modfunc(two) # aaa + modfunc(two) # aaa File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc - f() # call back to caller + f() # call back to caller File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two - three(42) + three(42) File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt index e5e3607e85..5eb7da170a 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt @@ -1,12 +1,12 @@ Traceback (most recent call last): File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main - one() + one() File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one - modfunc(two) # aaa + modfunc(two) # aaa File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc - f() # call back to caller + f() # call back to caller File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two - three(42) + three(42) File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/test_traceback.py b/library/python/runtime_py3/test/test_traceback.py index 0504f211c3..82087ce98a 100644 --- a/library/python/runtime_py3/test/test_traceback.py +++ b/library/python/runtime_py3/test/test_traceback.py @@ -33,7 +33,7 @@ def test_traceback(mode, entry_point): filtered_stderr_path = yc.test_output_path('stderr.txt') env = os.environ.copy() - env.pop('PYTHONPATH', None) # Do not let program peek into its sources on filesystem + env.pop('PYTHONPATH', None) # Do not let program peek into its sources on filesystem if entry_point == 'custom': env['Y_PYTHON_ENTRY_POINT'] = 'library.python.runtime_py3.test.traceback.crash:main' diff --git a/library/python/runtime_py3/test/ya.make b/library/python/runtime_py3/test/ya.make index 866f1deeda..4ec3db74f5 100644 --- a/library/python/runtime_py3/test/ya.make +++ b/library/python/runtime_py3/test/ya.make @@ -36,5 +36,5 @@ RESOURCE_FILES( ) END() - -RECURSE_FOR_TESTS(traceback) + +RECURSE_FOR_TESTS(traceback) diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index d252538d13..a8bcc21f51 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -468,23 +468,23 @@ def execute( # if subprocess.PIPE in [stdout, stderr]: # raise ValueError("Don't use pipe to obtain stream data - it may leads to the deadlock") - def get_out_stream(stream, default_name): - if stream is None: - # No stream is supplied: open new temp file + def get_out_stream(stream, default_name): + if stream is None: + # No stream is supplied: open new temp file return _get_command_output_file(command, default_name), False - + if isinstance(stream, six.string_types): - # User filename is supplied: open file for writing + # User filename is supplied: open file for writing return open(stream, 'wb+'), stream.startswith('/dev/') - - # Open file or PIPE sentinel is supplied - is_pipe = stream == subprocess.PIPE - return stream, not is_pipe - + + # Open file or PIPE sentinel is supplied + is_pipe = stream == subprocess.PIPE + return stream, not is_pipe + # to be able to have stdout/stderr and track the process time execution, we don't use subprocess.PIPE, # as it can cause processes hangs, but use tempfiles instead - out_file, user_stdout = get_out_stream(stdout, 'out') - err_file, user_stderr = get_out_stream(stderr, 'err') + out_file, user_stdout = get_out_stream(stdout, 'out') + err_file, user_stderr = get_out_stream(stderr, 'err') in_file = stdin if shell and type(command) == list: diff --git a/library/python/ya.make b/library/python/ya.make index e119b2aac6..2e1eb6e0e1 100644 --- a/library/python/ya.make +++ b/library/python/ya.make @@ -33,7 +33,7 @@ RECURSE( cityhash cityhash/test clickhouse_client - cmain + cmain codecs codecs/gen_corpus codecs/test @@ -47,9 +47,9 @@ RECURSE( cppdemangle cqueue crowd-kit - cyson - cyson/pymodule - cyson/ut + cyson + cyson/pymodule + cyson/ut deploy_formatter deprecated dir-sync @@ -73,7 +73,7 @@ RECURSE( filesys filesys/ut find_root - flask + flask flask_passport fnvhash fnvhash/test @@ -105,15 +105,15 @@ RECURSE( json/compare json/perf json/test - json/test/py2 - json/test/py3 + json/test/py2 + json/test/py3 langdetect langmask langs - luigi - luigi/data + luigi + luigi/data luigi/example - luigi/luigid_static + luigi/luigid_static maths messagebus metrics_framework @@ -128,7 +128,7 @@ RECURSE( nirvana_api/test_lib nirvana_test nstools - nyt + nyt oauth oauth/example ok_client @@ -158,7 +158,7 @@ RECURSE( retry/tests runtime runtime/main - runtime/test + runtime/test runtime_py3 runtime_py3/main runtime_py3/test @@ -209,7 +209,7 @@ RECURSE( yandex_tracker_client yenv yt - yt/test + yt/test ylock ylock/tests zipatch |