id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
176,571 | import re
import textwrap
from ast import literal_eval
from inspect import cleandoc
from weakref import WeakKeyDictionary
from parso.python import tree
from parso.cache import parser_cache
from parso import split_lines
The provided code snippet includes necessary dependencies for implementing the `expr_is_dotted` func... | Checks if a path looks like `name` or `name.foo.bar` and not `name()`. |
176,572 | import re
import textwrap
from ast import literal_eval
from inspect import cleandoc
from weakref import WeakKeyDictionary
from parso.python import tree
from parso.cache import parser_cache
from parso import split_lines
def _function_is_x_method(*method_names):
def wrapper(function_node):
"""
This i... | null |
176,573 | import sys
from os.path import join, dirname, abspath, isdir
The provided code snippet includes necessary dependencies for implementing the `_start_linter` function. Write a Python function `def _start_linter()` to solve the following problem:
This is a pre-alpha API. You're not supposed to use it at all, except for t... | This is a pre-alpha API. You're not supposed to use it at all, except for testing. It will very likely change. |
176,574 | import sys
from os.path import join, dirname, abspath, isdir
def _complete():
import jedi
import pdb
if '-d' in sys.argv:
sys.argv.remove('-d')
jedi.set_debug_function()
try:
completions = jedi.Script(sys.argv[2]).complete()
for c in completions:
c.docstrin... | null |
176,575 | import time
from functools import wraps
from typing import Any, Dict, Tuple
from jedi import settings
from parso.cache import parser_cache
_time_caches: Dict[str, Dict[Any, Tuple[float, Any]]] = {}
parser_cache: Dict[str, Any] = {}
The provided code snippet includes necessary dependencies for implementing the `clear_... | Jedi caches many things, that should be completed after each completion finishes. :param delete_all: Deletes also the cache that is normally not deleted, like parser cache, which is important for faster parsing. |
176,576 | import time
from functools import wraps
from typing import Any, Dict, Tuple
from jedi import settings
from parso.cache import parser_cache
_time_caches: Dict[str, Dict[Any, Tuple[float, Any]]] = {}
The provided code snippet includes necessary dependencies for implementing the `signature_time_cache` function. Write a P... | This decorator works as follows: Call it with a setting and after that use the function with a callable that returns the key. But: This function is only called if the key is not available. After a certain amount of time (`time_add_setting`) the cache is invalid. If the given key is None, the function will not be cached... |
176,577 | import time
from functools import wraps
from typing import Any, Dict, Tuple
from jedi import settings
from parso.cache import parser_cache
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_T], _T]: ...
def time_cache(seconds):
def decorator(func):
... | null |
176,578 | import time
from functools import wraps
from typing import Any, Dict, Tuple
from jedi import settings
from parso.cache import parser_cache
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_T], _T]: ...
The provided code snippet includes necessary dependencies ... | A normal memoize function. |
176,579 | import os
import time
from contextlib import contextmanager
from typing import Callable, Optional
_debug_indent = 0
_start_time = time.time()
def reset_time():
global _start_time, _debug_indent
_start_time = time.time()
_debug_indent = 0 | null |
176,580 | import os
import time
from contextlib import contextmanager
from typing import Callable, Optional
def increase_indent_cm(title=None, color='MAGENTA'):
global _debug_indent
if title:
dbg('Start: ' + title, color=color)
_debug_indent += 1
try:
yield
finally:
_debug_indent -= 1
... | Decorator for makin |
176,581 | import os
import time
from contextlib import contextmanager
from typing import Callable, Optional
enable_speed = False
debug_function: Optional[Callable[[str, str], None]] = None
_debug_indent = 0
_start_time = time.time()
def speed(name):
if debug_function and enable_speed:
now = time.time()
i = '... | null |
176,582 | import os
import time
from contextlib import contextmanager
from typing import Callable, Optional
def _lazy_colorama_init():
"""
Lazily init colorama if necessary, not to screw up stdout if debugging is
not enabled.
This version of the function does nothing.
"""
try:
if os.name == 'nt':
... | The default debug function that prints to standard out. :param str color: A string that is an attribute of ``colorama.Fore``. |
176,583 | import errno
import sys
import pickle
def pickle_load(file):
try:
return pickle.load(file)
# Python on Windows don't throw EOF errors for pipes. So reraise them with
# the correct type, which is caught upwards.
except OSError:
if sys.platform == 'win32':
raise EOFError()
... | null |
176,584 | import errno
import sys
import pickle
def pickle_dump(data, file, protocol):
try:
pickle.dump(data, file, protocol)
# On Python 3.3 flush throws sometimes an error even though the writing
# operation should be completed.
file.flush()
# Python on Windows don't throw EPIPE errors ... | null |
176,585 | from contextlib import contextmanager
The provided code snippet includes necessary dependencies for implementing the `monkeypatch` function. Write a Python function `def monkeypatch(obj, attribute_name, new_value)` to solve the following problem:
Like pytest's monkeypatch, but as a value manager.
Here is the function... | Like pytest's monkeypatch, but as a value manager. |
176,586 |
The provided code snippet includes necessary dependencies for implementing the `import_module` function. Write a Python function `def import_module(callback)` to solve the following problem:
Handle "magic" Flask extension imports: ``flask.ext.foo`` is really ``flask_foo`` or ``flaskext.foo``.
Here is the function:
... | Handle "magic" Flask extension imports: ``flask.ext.foo`` is really ``flask_foo`` or ``flaskext.foo``. |
176,587 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,588 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,589 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,590 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,591 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,592 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,593 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,594 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,595 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,596 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,597 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,598 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | Implementation of the namedtuple function. This has to be done by processing the namedtuple class template and inferring the result. |
176,599 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,600 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,601 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,602 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,603 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,604 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,605 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,606 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,607 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,608 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,609 | import parso
import os
from inspect import Parameter
from jedi import debug
from jedi.inference.utils import safe_property
from jedi.inference.helpers import get_str_or_none
from jedi.inference.arguments import iterate_argument_clinic, ParamIssue, \
repack_with_argument_clinic, AbstractArguments, TreeArgumentsWrapp... | null |
176,610 | from inspect import Parameter
from jedi import debug
from jedi.inference.cache import inference_state_function_cache
from jedi.inference.base_value import ValueSet, iterator_to_value_set, ValueWrapper
from jedi.inference.filters import DictFilter, AttributeOverwrite
from jedi.inference.names import NameWrapper, BaseTre... | null |
176,611 | from inspect import Parameter
from jedi import debug
from jedi.inference.cache import inference_state_function_cache
from jedi.inference.base_value import ValueSet, iterator_to_value_set, ValueWrapper
from jedi.inference.filters import DictFilter, AttributeOverwrite
from jedi.inference.names import NameWrapper, BaseTre... | null |
176,612 | from inspect import Parameter
from jedi import debug
from jedi.inference.cache import inference_state_function_cache
from jedi.inference.base_value import ValueSet, iterator_to_value_set, ValueWrapper
from jedi.inference.filters import DictFilter, AttributeOverwrite
from jedi.inference.names import NameWrapper, BaseTre... | null |
176,613 | from inspect import Parameter
from jedi import debug
from jedi.inference.cache import inference_state_function_cache
from jedi.inference.base_value import ValueSet, iterator_to_value_set, ValueWrapper
from jedi.inference.filters import DictFilter, AttributeOverwrite
from jedi.inference.names import NameWrapper, BaseTre... | null |
176,614 | import os.path
import tempfile
from warnings import warn
import IPython
from IPython.utils.importstring import import_item
from IPython.utils.path import (
get_home_dir,
get_xdg_dir,
get_xdg_cache_dir,
compress_user,
_writable_dir,
ensure_dir_exists,
)
def get_ipython_dir() -> str:
"""Get th... | Get the cache directory it is created if it does not exist. |
176,615 | import os.path
import tempfile
from warnings import warn
import IPython
from IPython.utils.importstring import import_item
from IPython.utils.path import (
get_home_dir,
get_xdg_dir,
get_xdg_cache_dir,
compress_user,
_writable_dir,
ensure_dir_exists,
)
def get_ipython_package_dir() -> str:
"... | Find the path to an IPython module in this version of IPython. This will always find the version of the module that is in this importable IPython package. This will always return the path to the ``.py`` version of the module. |
176,616 | import os.path
import tempfile
from warnings import warn
import IPython
from IPython.utils.importstring import import_item
from IPython.utils.path import (
get_home_dir,
get_xdg_dir,
get_xdg_cache_dir,
compress_user,
_writable_dir,
ensure_dir_exists,
)
def get_ipython_dir() -> str:
"""Get th... | Find the path to the folder associated with a given profile. I.e. find $IPYTHONDIR/profile_whatever. |
176,617 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
MAX_SEQ_LENGTH = 1000
def pr... | Like `pretty` but print to stdout. |
176,618 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def _safe_getattr(obj, attr,... | The default print function. Used if an object does not provide one and it's none of the builtin objects. |
176,619 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | Factory that returns a pprint function useful for sequences. Used by the default pprint for tuples and lists. |
176,620 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def _sorted_for_pprint(items... | Factory that returns a pprint function useful for sets and frozensets. |
176,621 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | Factory that returns a pprint function used by the default pprint of dicts and dict proxies. |
176,622 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | The pprint for the super type. |
176,623 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | The pprint function for regular expression patterns. |
176,624 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | The pprint function for types.SimpleNamespace. |
176,625 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def _safe_getattr(obj, attr,... | The pprint for classes and types. |
176,626 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def _safe_getattr(obj, attr,... | Base pprint for all functions and builtin functions. |
176,627 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | Base pprint for all exceptions. |
176,628 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
_type_pprinters = {
int:... | Add a pretty printer for a given type. |
176,629 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
_deferred_type_pprinters = {... | Add a pretty printer for a type specified by the module and name of a type rather than the type object itself. |
176,630 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | null |
176,631 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | null |
176,632 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | null |
176,633 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | null |
176,634 | from contextlib import contextmanager
import datetime
import os
import re
import sys
import types
from collections import deque
from inspect import signature
from io import StringIO
from warnings import warn
from IPython.utils.decorators import undoc
from IPython.utils.py3compat import PYPY
def pretty(obj, verbose=Fals... | null |
176,635 | from IPython.core.getipython import get_ipython
def get_app_wx(*args, **kwargs):
"""Create a new wx app or return an exiting one."""
import wx
app = wx.GetApp()
if app is None:
if 'redirect' not in kwargs:
kwargs['redirect'] = False
app = wx.PySimpleApp(*args, **kwargs)
r... | Start the wx event loop in a consistent manner. |
176,636 | from IPython.core.getipython import get_ipython
def get_app_qt4(*args, **kwargs):
"""Create a new Qt app or return an existing one."""
from IPython.external.qt_for_kernel import QtGui
app = QtGui.QApplication.instance()
if app is None:
if not args:
args = ([""],)
app = QtGui.... | Start the qt event loop in a consistent manner. |
176,637 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | Activestate Komodo [Edit] |
176,638 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | SciTE or Sc1 |
176,639 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | Notepad++ http://notepad-plus.sourceforge.net |
176,640 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | JED, the lightweight emacsish editor |
176,641 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | Idle, the editor bundled with python Parameters ---------- exe : str, None If none, should be pretty smart about finding the executable. |
176,642 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | TextMate, the missing editor |
176,643 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | null |
176,644 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
"""Installs the editor that is called by IPython for the %edit magic.
This overrides the default editor, which ... | null |
176,645 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
def crimson_editor(exe=u'cedt.exe'):
install_editor(exe + u' /L:{line} {filename}') | null |
176,646 | import os
import shlex
import subprocess
import sys
from IPython import get_ipython
from IPython.core.error import TryNext
from IPython.utils import py3compat
def install_editor(template, wait=False):
def kate(exe=u'kate'):
install_editor(exe + u' -u -l {line} {filename}') | null |
176,647 | import os
import re
import shlex
import sys
import pygments
from pathlib import Path
from IPython.utils.text import marquee
from IPython.utils import openpy
from IPython.utils import py3compat
def re_mark(mark):
return re.compile(r'^\s*#\s+<demo>\s+%s\s*$' % mark,re.MULTILINE) | null |
176,648 | import os
import re
import shlex
import sys
import pygments
from pathlib import Path
from IPython.utils.text import marquee
from IPython.utils import openpy
from IPython.utils import py3compat
class Demo(object):
re_stop = re_mark(r'-*\s?stop\s?-*')
re_silent = re_mark('silent')
re_auto = re_mark(... | null |
176,649 | import re
from pygments.lexers import (
BashLexer, HtmlLexer, JavascriptLexer, RubyLexer, PerlLexer, PythonLexer,
Python3Lexer, TexLexer)
from pygments.lexer import (
Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using,
)
from pygments.token import (
Generic, Keyword, Literal, Name, Opera... | Builds IPython lexers depending on the value of `python3`. The lexer inherits from an appropriate Python lexer and then adds information about IPython specific keywords (i.e. magic commands, shell commands, etc.) Parameters ---------- python3 : bool If `True`, then build an IPython lexer from a Python 3 lexer. |
176,650 | from io import BytesIO, open
import os
import tempfile
import shutil
import subprocess
from base64 import encodebytes
import textwrap
from pathlib import Path
from IPython.utils.process import find_cmd, FindCmdError
from traitlets.config import get_config
from traitlets.config.configurable import SingletonConfigurable
... | Render LaTeX to HTML with embedded PNG data using data URIs. Parameters ---------- s : str The raw string containing valid inline LateX. alt : str The alt text to use for the HTML. |
176,651 | import abc
import ast
import atexit
import bdb
import builtins as builtin_mod
import functools
import inspect
import os
import re
import runpy
import subprocess
import sys
import tempfile
import traceback
import types
import warnings
from ast import stmt
from io import open as io_open
from logging import error
from pat... | null |
176,652 | import abc
import ast
import atexit
import bdb
import builtins as builtin_mod
import functools
import inspect
import os
import re
import runpy
import subprocess
import sys
import tempfile
import traceback
import types
import warnings
from ast import stmt
from io import open as io_open
from logging import error
from pat... | Variant of "str.isnumeric()" that allow negative values and other ints. |
176,653 | import abc
import ast
import atexit
import bdb
import builtins as builtin_mod
import functools
import inspect
import os
import re
import runpy
import subprocess
import sys
import tempfile
import traceback
import types
import warnings
from ast import stmt
from io import open as io_open
from logging import error
from pat... | Copied from code.py, to remove the dependency |
176,654 | import abc
import ast
import atexit
import bdb
import builtins as builtin_mod
import functools
import inspect
import os
import re
import runpy
import subprocess
import sys
import tempfile
import traceback
import types
import warnings
from ast import stmt
from io import open as io_open
from logging import error
from pat... | null |
176,655 | import abc
import ast
import atexit
import bdb
import builtins as builtin_mod
import functools
import inspect
import os
import re
import runpy
import subprocess
import sys
import tempfile
import traceback
import types
import warnings
from ast import stmt
from io import open as io_open
from logging import error
from pat... | null |
176,656 | import ast
import asyncio
import inspect
from functools import wraps
The provided code snippet includes necessary dependencies for implementing the `_curio_runner` function. Write a Python function `def _curio_runner(coroutine)` to solve the following problem:
handler for curio autoawait
Here is the function:
def _c... | handler for curio autoawait |
176,657 | import ast
import asyncio
import inspect
from functools import wraps
def _trio_runner(async_fn):
import trio
async def loc(coro):
"""
We need the dummy no-op async def to protect from
trio's internal. See https://github.com/python-trio/trio/issues/89
"""
return await co... | null |
176,658 | import ast
import asyncio
import inspect
from functools import wraps
The provided code snippet includes necessary dependencies for implementing the `_pseudo_sync_runner` function. Write a Python function `def _pseudo_sync_runner(coro)` to solve the following problem:
A runner that does not really allow async execution... | A runner that does not really allow async execution, and just advance the coroutine. See discussion in https://github.com/python-trio/trio/issues/608, Credit to Nathaniel Smith |
176,659 | import ast
import asyncio
import inspect
from functools import wraps
The provided code snippet includes necessary dependencies for implementing the `_should_be_async` function. Write a Python function `def _should_be_async(cell: str) -> bool` to solve the following problem:
Detect if a block of code need to be wrapped... | Detect if a block of code need to be wrapped in an `async def` Attempt to parse the block of code, it it compile we're fine. Otherwise we wrap if and try to compile. If it works, assume it should be async. Otherwise Return False. Not handled yet: If the block of code has a return statement as the top level, it will be ... |
176,660 | from backcall import callback_prototype
available_events = {}
def _define_event(callback_function):
callback_proto = callback_prototype(callback_function)
available_events[callback_function.__name__] = callback_proto
return callback_proto | null |
176,661 | from backcall import callback_prototype
The provided code snippet includes necessary dependencies for implementing the `pre_execute` function. Write a Python function `def pre_execute()` to solve the following problem:
Fires before code is executed in response to user/frontend action. This includes comm and widget mes... | Fires before code is executed in response to user/frontend action. This includes comm and widget messages and silent execution, as well as user code cells. |
176,662 | from backcall import callback_prototype
The provided code snippet includes necessary dependencies for implementing the `pre_run_cell` function. Write a Python function `def pre_run_cell(info)` to solve the following problem:
Fires before user-entered code runs. Parameters ---------- info : :class:`~IPython.core.intera... | Fires before user-entered code runs. Parameters ---------- info : :class:`~IPython.core.interactiveshell.ExecutionInfo` An object containing information used for the code execution. |
176,663 | from backcall import callback_prototype
The provided code snippet includes necessary dependencies for implementing the `post_execute` function. Write a Python function `def post_execute()` to solve the following problem:
Fires after code is executed in response to user/frontend action. This includes comm and widget me... | Fires after code is executed in response to user/frontend action. This includes comm and widget messages and silent execution, as well as user code cells. |
176,664 | from backcall import callback_prototype
The provided code snippet includes necessary dependencies for implementing the `post_run_cell` function. Write a Python function `def post_run_cell(result)` to solve the following problem:
Fires after user-entered code runs. Parameters ---------- result : :class:`~IPython.core.i... | Fires after user-entered code runs. Parameters ---------- result : :class:`~IPython.core.interactiveshell.ExecutionResult` The object which will be returned as the execution result. |
176,665 | from backcall import callback_prototype
The provided code snippet includes necessary dependencies for implementing the `shell_initialized` function. Write a Python function `def shell_initialized(ip)` to solve the following problem:
Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`... | Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`. This is before extensions and startup scripts are loaded, so it can only be set by subclassing. Parameters ---------- ip : :class:`~IPython.core.interactiveshell.InteractiveShell` The newly initialised shell. |
176,666 | import os
import re
import sys
from traitlets.config.configurable import Configurable
from .error import UsageError
from traitlets import List, Instance
from logging import error
import os
del os
import sys
if 'setuptools' in sys.modules:
have_setuptools = True
from setuptools import setup as old_setup
... | Return list of shell aliases to auto-define. |
176,667 | from dataclasses import dataclass
from inspect import signature
from textwrap import dedent
import ast
import html
import inspect
import io as stdlib_io
import linecache
import os
import sys
import types
import warnings
from typing import Any, Optional, Dict, Union, List, Tuple
from IPython.core import page
from IPytho... | null |
176,668 | from dataclasses import dataclass
from inspect import signature
from textwrap import dedent
import ast
import html
import inspect
import io as stdlib_io
import linecache
import os
import sys
import types
import warnings
from typing import Any, Optional, Dict, Union, List, Tuple
from IPython.core import page
from IPytho... | Make an object info dict with all fields present. |
176,669 | from dataclasses import dataclass
from inspect import signature
from textwrap import dedent
import ast
import html
import inspect
import io as stdlib_io
import linecache
import os
import sys
import types
import warnings
from typing import Any, Optional, Dict, Union, List, Tuple
from IPython.core import page
from IPytho... | Stable wrapper around inspect.getdoc. This can't crash because of attribute problems. It also attempts to call a getdoc() method on the given object. This allows objects which provide their docstrings via non-standard mechanisms (like Pyro proxies) to still be inspected by ipython's ? system. |
176,670 | from dataclasses import dataclass
from inspect import signature
from textwrap import dedent
import ast
import html
import inspect
import io as stdlib_io
import linecache
import os
import sys
import types
import warnings
from typing import Any, Optional, Dict, Union, List, Tuple
from IPython.core import page
from IPytho... | Wrapper around inspect.getsource. This can be modified by other projects to provide customized source extraction. Parameters ---------- obj : object an object whose source code we will attempt to extract oname : str (optional) a name under which the object is known Returns ------- src : unicode or None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.