aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/runtime_py3/entry_points.py
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /library/python/runtime_py3/entry_points.py
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/python/runtime_py3/entry_points.py')
-rw-r--r--library/python/runtime_py3/entry_points.py86
1 files changed, 43 insertions, 43 deletions
diff --git a/library/python/runtime_py3/entry_points.py b/library/python/runtime_py3/entry_points.py
index 05098723cb..0639bc4aaf 100644
--- a/library/python/runtime_py3/entry_points.py
+++ b/library/python/runtime_py3/entry_points.py
@@ -1,47 +1,47 @@
-import sys
-
-import __res
-
-
-def repl():
- user_ns = {}
- py_main = __res.find('PY_MAIN')
-
- if py_main:
- mod_name, func_name = (py_main.split(b':', 1) + [None])[:2]
- try:
- import importlib
- mod = importlib.import_module(mod_name.decode('UTF-8'))
- user_ns = mod.__dict__
- except:
- import traceback
- traceback.print_exc()
-
- if func_name and '__main__' not in user_ns:
- def run(args):
+import sys
+
+import __res
+
+
+def repl():
+ user_ns = {}
+ py_main = __res.find('PY_MAIN')
+
+ if py_main:
+ mod_name, func_name = (py_main.split(b':', 1) + [None])[:2]
+ try:
+ import importlib
+ mod = importlib.import_module(mod_name.decode('UTF-8'))
+ user_ns = mod.__dict__
+ except:
+ import traceback
+ traceback.print_exc()
+
+ if func_name and '__main__' not in user_ns:
+ def run(args):
if isinstance(args, str):
- import shlex
- args = shlex.split(args)
-
- import sys
- sys.argv = [sys.argv[0]] + args
- getattr(mod, func_name)()
-
- user_ns['__main__'] = run
-
- try:
- import IPython
- except ModuleNotFoundError:
- pass
- else:
- return IPython.start_ipython(user_ns=user_ns)
-
- import code
- code.interact(local=user_ns)
-
-
-def resource_files():
- sys.stdout.buffer.write(b'\n'.join(sorted(__res.resfs_files()) + [b'']))
+ import shlex
+ args = shlex.split(args)
+
+ import sys
+ sys.argv = [sys.argv[0]] + args
+ getattr(mod, func_name)()
+
+ user_ns['__main__'] = run
+
+ try:
+ import IPython
+ except ModuleNotFoundError:
+ pass
+ else:
+ return IPython.start_ipython(user_ns=user_ns)
+
+ import code
+ code.interact(local=user_ns)
+
+
+def resource_files():
+ sys.stdout.buffer.write(b'\n'.join(sorted(__res.resfs_files()) + [b'']))
def run_constructors():