diff options
author | smosker <smosker@yandex-team.ru> | 2022-02-10 16:48:22 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:22 +0300 |
commit | 01fa2667d0e5e868b18424bc1906146e5ee340db (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /contrib/python/ipython/py2/IPython/lib | |
parent | dd14d17a747a9c259858faf2fcc3ea6b92df4e15 (diff) | |
download | ydb-01fa2667d0e5e868b18424bc1906146e5ee340db.tar.gz |
Restoring authorship annotation for <smosker@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/ipython/py2/IPython/lib')
7 files changed, 67 insertions, 67 deletions
diff --git a/contrib/python/ipython/py2/IPython/lib/deepreload.py b/contrib/python/ipython/py2/IPython/lib/deepreload.py index aa4836ba76..76b493c0bb 100644 --- a/contrib/python/ipython/py2/IPython/lib/deepreload.py +++ b/contrib/python/ipython/py2/IPython/lib/deepreload.py @@ -327,8 +327,8 @@ except AttributeError: original_reload = imp.reload # Python 3 # Replacement for reload() -def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__', - 'numpy', 'numpy._globals')): +def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__', + 'numpy', 'numpy._globals')): """Recursively reload all modules used in the given module. Optionally takes a list of modules to exclude from reloading. The default exclude list contains sys, __main__, and __builtin__, to prevent, e.g., resetting diff --git a/contrib/python/ipython/py2/IPython/lib/demo.py b/contrib/python/ipython/py2/IPython/lib/demo.py index 419e27a4b3..b0f3503ed7 100644 --- a/contrib/python/ipython/py2/IPython/lib/demo.py +++ b/contrib/python/ipython/py2/IPython/lib/demo.py @@ -106,7 +106,7 @@ the execution. This is probably best explained with the simple example file below. You can copy this into a file named ex_demo.py, and try running it via:: - from IPython.lib.demo import Demo + from IPython.lib.demo import Demo d = Demo('ex_demo.py') d() diff --git a/contrib/python/ipython/py2/IPython/lib/display.py b/contrib/python/ipython/py2/IPython/lib/display.py index 5d0b644c85..9221e2e062 100644 --- a/contrib/python/ipython/py2/IPython/lib/display.py +++ b/contrib/python/ipython/py2/IPython/lib/display.py @@ -251,7 +251,7 @@ class YouTubeVideo(IFrame): start=int(timedelta(hours=1, minutes=46, seconds=40).total_seconds()) Other parameters can be provided as documented at - https://developers.google.com/youtube/player_parameters#Parameters + https://developers.google.com/youtube/player_parameters#Parameters When converting the notebook using nbconvert, a jpeg representation of the video will be inserted in the document. @@ -324,11 +324,11 @@ class FileLink(object): ---------- path : str path to the file or directory that should be formatted - url_prefix : str + url_prefix : str prefix to be prepended to all files to form a working link [default: - ''] + ''] result_html_prefix : str - text to append to beginning to link [default: ''] + text to append to beginning to link [default: ''] result_html_suffix : str text to append at the end of link [default: '<br>'] """ diff --git a/contrib/python/ipython/py2/IPython/lib/editorhooks.py b/contrib/python/ipython/py2/IPython/lib/editorhooks.py index 057580b365..392557b509 100644 --- a/contrib/python/ipython/py2/IPython/lib/editorhooks.py +++ b/contrib/python/ipython/py2/IPython/lib/editorhooks.py @@ -54,7 +54,7 @@ def install_editor(template, wait=False): if sys.platform.startswith('win'): cmd = shlex.split(cmd) proc = subprocess.Popen(cmd, shell=True) - if proc.wait() != 0: + if proc.wait() != 0: raise TryNext() if wait: py3compat.input("Press Enter when done editing:") diff --git a/contrib/python/ipython/py2/IPython/lib/guisupport.py b/contrib/python/ipython/py2/IPython/lib/guisupport.py index b2cc89b57c..5e13d4343c 100644 --- a/contrib/python/ipython/py2/IPython/lib/guisupport.py +++ b/contrib/python/ipython/py2/IPython/lib/guisupport.py @@ -57,10 +57,10 @@ so you don't have to depend on IPython. """ -# Copyright (c) IPython Development Team. -# Distributed under the terms of the Modified BSD License. +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. -from IPython.core.getipython import get_ipython +from IPython.core.getipython import get_ipython #----------------------------------------------------------------------------- # wx @@ -78,15 +78,15 @@ def get_app_wx(*args, **kwargs): def is_event_loop_running_wx(app=None): """Is the wx event loop running.""" - # New way: check attribute on shell instance - ip = get_ipython() - if ip is not None: - if ip.active_eventloop and ip.active_eventloop == 'wx': - return True - # Fall through to checking the application, because Wx has a native way - # to check if the event loop is running, unlike Qt. - - # Old way: check Wx application + # New way: check attribute on shell instance + ip = get_ipython() + if ip is not None: + if ip.active_eventloop and ip.active_eventloop == 'wx': + return True + # Fall through to checking the application, because Wx has a native way + # to check if the event loop is running, unlike Qt. + + # Old way: check Wx application if app is None: app = get_app_wx() if hasattr(app, '_in_event_loop'): @@ -121,12 +121,12 @@ def get_app_qt4(*args, **kwargs): def is_event_loop_running_qt4(app=None): """Is the qt4 event loop running.""" - # New way: check attribute on shell instance - ip = get_ipython() - if ip is not None: - return ip.active_eventloop and ip.active_eventloop.startswith('qt') - - # Old way: check attribute on QApplication singleton + # New way: check attribute on shell instance + ip = get_ipython() + if ip is not None: + return ip.active_eventloop and ip.active_eventloop.startswith('qt') + + # Old way: check attribute on QApplication singleton if app is None: app = get_app_qt4(['']) if hasattr(app, '_in_event_loop'): diff --git a/contrib/python/ipython/py2/IPython/lib/inputhook.py b/contrib/python/ipython/py2/IPython/lib/inputhook.py index b82c85a480..e6e8f2dbbc 100644 --- a/contrib/python/ipython/py2/IPython/lib/inputhook.py +++ b/contrib/python/ipython/py2/IPython/lib/inputhook.py @@ -658,9 +658,9 @@ guis = inputhook_manager.guihooks def _deprecated_disable(): - warn("This function is deprecated since IPython 4.0 use disable_gui() instead", - DeprecationWarning, stacklevel=2) + warn("This function is deprecated since IPython 4.0 use disable_gui() instead", + DeprecationWarning, stacklevel=2) inputhook_manager.disable_gui() - + disable_wx = disable_qt4 = disable_gtk = disable_gtk3 = disable_glut = \ disable_pyglet = disable_osx = _deprecated_disable diff --git a/contrib/python/ipython/py2/IPython/lib/pretty.py b/contrib/python/ipython/py2/IPython/lib/pretty.py index 08ee1de914..28eee523c5 100644 --- a/contrib/python/ipython/py2/IPython/lib/pretty.py +++ b/contrib/python/ipython/py2/IPython/lib/pretty.py @@ -96,9 +96,9 @@ __all__ = ['pretty', 'pprint', 'PrettyPrinter', 'RepresentationPrinter', MAX_SEQ_LENGTH = 1000 -# The language spec says that dicts preserve order from 3.7, but CPython -# does so from 3.6, so it seems likely that people will expect that. -DICT_IS_ORDERED = sys.version_info >= (3, 6) +# The language spec says that dicts preserve order from 3.7, but CPython +# does so from 3.6, so it seems likely that people will expect that. +DICT_IS_ORDERED = sys.version_info >= (3, 6) _re_pattern_type = type(re.compile('')) def _safe_getattr(obj, attr, default=None): @@ -122,21 +122,21 @@ else: cast_unicode(text, encoding=get_stream_enc(sys.stdout))) -def _sorted_for_pprint(items): - """ - Sort the given items for pretty printing. Since some predictable - sorting is better than no sorting at all, we sort on the string - representation if normal sorting fails. - """ - items = list(items) - try: - return sorted(items) - except Exception: - try: - return sorted(items, key=str) - except Exception: - return items - +def _sorted_for_pprint(items): + """ + Sort the given items for pretty printing. Since some predictable + sorting is better than no sorting at all, we sort on the string + representation if normal sorting fails. + """ + items = list(items) + try: + return sorted(items) + except Exception: + try: + return sorted(items, key=str) + except Exception: + return items + def pretty(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH): """ Pretty print the object's representation. @@ -398,10 +398,10 @@ class RepresentationPrinter(PrettyPrinter): meth = cls._repr_pretty_ if callable(meth): return meth(obj, self, cycle) - if cls is not object \ - and callable(cls.__dict__.get('__repr__')): - return _repr_pprint(obj, self, cycle) - + if cls is not object \ + and callable(cls.__dict__.get('__repr__')): + return _repr_pprint(obj, self, cycle) + return _default_pprint(obj, self, cycle) finally: self.end_group() @@ -552,7 +552,7 @@ def _default_pprint(obj, p, cycle): p.end_group(1, '>') -def _seq_pprinter_factory(start, end): +def _seq_pprinter_factory(start, end): """ Factory that returns a pprint function useful for sequences. Used by the default pprint for tuples, dicts, and lists. @@ -574,7 +574,7 @@ def _seq_pprinter_factory(start, end): return inner -def _set_pprinter_factory(start, end): +def _set_pprinter_factory(start, end): """ Factory that returns a pprint function useful for sets and frozensets. """ @@ -583,15 +583,15 @@ def _set_pprinter_factory(start, end): return p.text(start + '...' + end) if len(obj) == 0: # Special case. - p.text(type(obj).__name__ + '()') + p.text(type(obj).__name__ + '()') else: step = len(start) p.begin_group(step, start) # Like dictionary keys, we will try to sort the items if there aren't too many if not (p.max_seq_length and len(obj) >= p.max_seq_length): - items = _sorted_for_pprint(obj) - else: - items = obj + items = _sorted_for_pprint(obj) + else: + items = obj for idx, x in p._enumerate(items): if idx: p.text(',') @@ -601,7 +601,7 @@ def _set_pprinter_factory(start, end): return inner -def _dict_pprinter_factory(start, end): +def _dict_pprinter_factory(start, end): """ Factory that returns a pprint function used by the default pprint of dicts and dict proxies. @@ -613,10 +613,10 @@ def _dict_pprinter_factory(start, end): p.begin_group(step, start) keys = obj.keys() # if dict isn't large enough to be truncated, sort keys before displaying - # From Python 3.7, dicts preserve order by definition, so we don't sort. - if not DICT_IS_ORDERED \ - and not (p.max_seq_length and len(obj) >= p.max_seq_length): - keys = _sorted_for_pprint(keys) + # From Python 3.7, dicts preserve order by definition, so we don't sort. + if not DICT_IS_ORDERED \ + and not (p.max_seq_length and len(obj) >= p.max_seq_length): + keys = _sorted_for_pprint(keys) for idx, key in p._enumerate(keys): if idx: p.text(',') @@ -743,12 +743,12 @@ _type_pprinters = { int: _repr_pprint, float: _repr_pprint, str: _repr_pprint, - tuple: _seq_pprinter_factory('(', ')'), - list: _seq_pprinter_factory('[', ']'), - dict: _dict_pprinter_factory('{', '}'), + tuple: _seq_pprinter_factory('(', ')'), + list: _seq_pprinter_factory('[', ']'), + dict: _dict_pprinter_factory('{', '}'), - set: _set_pprinter_factory('{', '}'), - frozenset: _set_pprinter_factory('frozenset({', '})'), + set: _set_pprinter_factory('{', '}'), + frozenset: _set_pprinter_factory('frozenset({', '})'), super: _super_pprint, _re_pattern_type: _re_pattern_pprint, type: _type_pprint, |