id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
176,671 | 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 :func:`inspect.getfullargspec` In addition to functions and methods, this can also handle objects with a ``__call__`` attribute. DEPRECATED: Deprecated since 7.10. Do not use, will be removed. |
176,672 | 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... | DEPRECATED since 6.0. Extract call tip data from an oinfo dict. |
176,673 | 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... | Find the line number in a file where an object was defined. This is essentially a robust wrapper around `inspect.getsourcelines`. Returns None if no file can be found. Parameters ---------- obj : any Python object Returns ------- lineno : int The line number where the object definition starts. |
176,674 | 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... | This was mostly taken from inspect.Signature.__str__. Look there for the comments. The only change is to add linebreaks when this gets too long. |
176,675 | from io import BytesIO
from binascii import b2a_base64
from functools import partial
import warnings
from IPython.core.display import _pngxy
from IPython.utils.decorators import flag_calls
The provided code snippet includes necessary dependencies for implementing the `mpl_runner` function. Write a Python function `def... | Factory to return a matplotlib-enabled runner for %run. Parameters ---------- safe_execfile : function This must be a function with the same interface as the :meth:`safe_execfile` method of IPython. Returns ------- A function suitable for use as the ``runner`` argument of the %run magic function. |
176,676 | from io import BytesIO
from binascii import b2a_base64
from functools import partial
import warnings
from IPython.core.display import _pngxy
from IPython.utils.decorators import flag_calls
backends = {
"tk": "TkAgg",
"gtk": "GTKAgg",
"gtk3": "GTK3Agg",
"gtk4": "GTK4Agg",
"wx": "WXAgg",
"qt4": "Q... | Given a gui string return the gui and mpl backend. Parameters ---------- gui : str Can be one of ('tk','gtk','wx','qt','qt4','inline','agg'). gui_select : str Can be one of ('tk','gtk','wx','qt','qt4','inline'). This is any gui already selected by the shell. Returns ------- A tuple of (gui, backend) where backend is on... |
176,677 | from io import BytesIO
from binascii import b2a_base64
from functools import partial
import warnings
from IPython.core.display import _pngxy
from IPython.utils.decorators import flag_calls
def getfigs(*fig_nums):
"""Get a list of matplotlib figures by figure numbers.
If no arguments are given, all available fig... | Populate the namespace with pylab-related values. Imports matplotlib, pylab, numpy, and everything from pylab and numpy. Also imports a few names from IPython (figsize, display, getfigs) |
176,678 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
The provided code snippet includes necessary dependencies for implementing the `leading_empty_lines` function. Write a Python function `def leading_empty_lines(lines)` to solve... | Remove leading empty lines If the leading lines are empty or contain only whitespace, they will be removed. |
176,679 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
_indent_re = re.compile(r'^[ \t]+')
The provided code snippet includes necessary dependencies for implementing the `leading_indent` function. Write a Python function `def leadi... | Remove leading indentation. If the first line starts with a spaces or tabs, the same whitespace will be removed from each following line in the cell. |
176,680 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
def cell_magic(lines):
if not lines or not lines[0].startswith('%%'):
return lines
if re.match(r'%%\w+\?', lines[0]):
# This case will be handled by hel... | null |
176,681 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
Optional: _SpecialForm = ...
The provided code snippet includes necessary dependencies for implementing the `_find_assign_op` function. Write a Python function `def _find_assi... | Get the index of the first assignment in the line ('=' not inside brackets) Note: We don't try to support multiple special assignment (a = b = %foo) |
176,682 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
The provided code snippet includes necessary dependencies for implementing the `find_end_of_continued_line` function. Write a Python function `def find_end_of_continued_line(li... | Find the last line of a line explicitly extended using backslashes. Uses 0-indexed line numbers. |
176,683 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return... | r"""Assemble a single line from multiple continued line pieces Continued lines are lines ending in ``\``, and the line following the last ``\`` in the block. For example, this code continues over multiple lines:: if (assign_ix is not None) \ and (len(line) >= assign_ix + 2) \ and (line[assign_ix+1].string == '%') \ and... |
176,684 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
def _make_help_call(target, esc):
"""Prepares a pinfo(2)/psearch call from a target name and the escape
(i.e. ? or ??)"""
method = 'pinfo2' if esc == '??' \
... | Translate lines escaped with: ? A naked help line should fire the intro help screen (shell.show_usage()) |
176,685 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
def _make_help_call(target, esc):
"""Prepares a pinfo(2)/psearch call from a target name and the escape
(i.e. ? or ??)"""
method = 'pinfo2' if esc == '??' \
... | Translate lines escaped with: ?? A naked help line should fire the intro help screen (shell.show_usage()) |
176,686 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
The provided code snippet includes necessary dependencies for implementing the `_tr_magic` function. Write a Python function `def _tr_magic(content)` to solve the following pro... | Translate lines escaped with a percent sign: % |
176,687 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
The provided code snippet includes necessary dependencies for implementing the `_tr_quote` function. Write a Python function `def _tr_quote(content)` to solve the following pro... | Translate lines escaped with a comma: , |
176,688 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
The provided code snippet includes necessary dependencies for implementing the `_tr_quote2` function. Write a Python function `def _tr_quote2(content)` to solve the following p... | Translate lines escaped with a semicolon: ; |
176,689 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
The provided code snippet includes necessary dependencies for implementing the `_tr_paren` function. Write a Python function `def _tr_paren(content)` to solve the following pro... | Translate lines escaped with a slash: / |
176,690 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
List = _Alias()
The provided code snippet includes necessary dependencies for implementing the `has_sunken_brackets` function. Write a Python function `def has_sunken_brackets... | Check if the depth of brackets in the list of tokens drops below 0 |
176,691 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
def make_tokens_by_line(lines:List[str]):
"""Tokenize a series of lines and group tokens by line.
The tokens for a multiline Python string or expression are grouped as o... | For investigation and debugging |
176,692 | import ast
from codeop import CommandCompiler, Compile
import re
import tokenize
from typing import List, Tuple, Optional, Any
import warnings
_indent_re = re.compile(r'^[ \t]+')
def find_last_indent(lines):
m = _indent_re.match(lines[-1])
if not m:
return 0
return len(m.group(0).replace('\t', ' '*... | null |
176,693 | import inspect
import linecache
import sys
import re
import os
from IPython import get_ipython
from IPython.utils import PyColorize
from IPython.utils import coloransi, py3compat
from IPython.core.excolors import exception_colors
from pdb import Pdb as OldPdb
The provided code snippet includes necessary dependencies f... | Exception hook which handles `BdbQuit` exceptions. All other exceptions are processed using the `excepthook` parameter. |
176,694 | import inspect
import linecache
import sys
import re
import os
from IPython import get_ipython
from IPython.utils import PyColorize
from IPython.utils import coloransi, py3compat
from IPython.core.excolors import exception_colors
from pdb import Pdb as OldPdb
def BdbQuit_IPython_excepthook(self, et, ev, tb, tb_offset=... | null |
176,695 | import inspect
import linecache
import sys
import re
import os
from IPython import get_ipython
from IPython.utils import PyColorize
from IPython.utils import coloransi, py3compat
from IPython.core.excolors import exception_colors
from pdb import Pdb as OldPdb
def strip_indentation(multiline_string):
return RGX_EXTR... | Make new_fn have old_fn's doc string. This is particularly useful for the ``do_...`` commands that hook into the help system. Adapted from from a comp.lang.python posting by Duncan Booth. |
176,696 | import inspect
import linecache
import sys
import re
import os
from IPython import get_ipython
from IPython.utils import PyColorize
from IPython.utils import coloransi, py3compat
from IPython.core.excolors import exception_colors
from pdb import Pdb as OldPdb
class Pdb(OldPdb):
"""Modified Pdb class, does not load ... | Start debugging from `frame`. If frame is not specified, debugging starts from caller's frame. |
176,697 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
def has_comment(src):
"""Indicate whether an input line has (i.e. ends in, or is) a comment.
This uses tokenize, so it can disti... | r"""Join lines following explicit line continuations (\) |
176,698 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
ESC_SHELL = '!'
The provided code snippet includes necessary dependencies for implementing the `_tr_system` function. Write a Python f... | Translate lines escaped with: ! |
176,699 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
The provided code snippet includes necessary dependencies for implementing the `_tr_system2` function. Write a Python function `def _tr... | Translate lines escaped with: !! |
176,700 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
def _make_help_call(target, esc, lspace):
"""Prepares a pinfo(2)/psearch call from a target name and the escape
(i.e. ? or ??)""... | Translate lines escaped with: ?/?? |
176,701 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
ESC_MAGIC = '%'
ESC_MAGIC2 = '%%'
The provided code snippet includes necessary dependencies for implementing the `_tr_magic` funct... | Translate lines escaped with: % |
176,702 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
The provided code snippet includes necessary dependencies for implementing the `_tr_quote` function. Write a Python function `def _tr_q... | Translate lines escaped with: , |
176,703 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
The provided code snippet includes necessary dependencies for implementing the `_tr_quote2` function. Write a Python function `def _tr_... | Translate lines escaped with: ; |
176,704 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
The provided code snippet includes necessary dependencies for implementing the `_tr_paren` function. Write a Python function `def _tr_p... | Translate lines escaped with: / |
176,705 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
tr = { ESC_SHELL : _tr_system,
ESC_SH_CAP : _tr_system2,
ESC_HELP : _tr_help,
ESC_HELP2 : _tr_help,
ESC_... | Transform escaped commands - %magic, !system, ?help + various autocalls. |
176,706 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
def _make_help_call(target, esc, lspace):
"""Prepares a pinfo(2)/psearch call from a target name and the escape
(i.e. ? or ??)""... | Translate lines with ?/?? at the end |
176,707 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
ESC_MAGIC2 = '%%'
The provided code snippet includes necessary dependencies for implementing the `cellmagic` function. Write a Python f... | Captures & transforms cell magics. After a cell magic is started, this stores up any lines it gets until it is reset (sent None). |
176,708 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
def _strip_prompts(prompt_re, initial_re=None, turnoff_re=None):
"""Remove matching input prompts from a block of input.
Paramet... | Strip the >>>/... prompts of the Python interactive shell. |
176,709 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
def _strip_prompts(prompt_re, initial_re=None, turnoff_re=None):
"""Remove matching input prompts from a block of input.
Paramet... | Strip IPython's In [1]:/...: prompts. |
176,710 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
The provided code snippet includes necessary dependencies for implementing the `leading_indent` function. Write a Python function `def ... | Remove leading indentation. If the first line starts with a spaces or tabs, the same whitespace will be removed from each following line until it is reset. |
176,711 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
assign_system_re = re.compile(r'{}!\s*(?P<cmd>.*)'.format(_assign_pat), re.VERBOSE)
assign_system_template = '%s = get_ipython().getoutp... | Transform assignment from system commands (e.g. files = !ls) |
176,712 | import abc
import functools
import re
import tokenize
from tokenize import generate_tokens, untokenize, TokenError
from io import StringIO
from IPython.core.splitinput import LineInfo
ESC_MAGIC = '%'
assign_magic_re = re.compile(r'{}%\s*(?P<cmd>.*)'.format(_assign_pat), re.VERBOSE)
assign_magic_temp... | Transform assignment from magic commands (e.g. a = %who_ls) |
176,713 | import argparse
import re
from IPython.core.error import UsageError
from IPython.utils.decorators import undoc
from IPython.utils.process import arg_split
from IPython.utils.text import dedent
class MagicArgumentParser(argparse.ArgumentParser):
""" An ArgumentParser tweaked for use by IPython magics.
"""
de... | Construct an argument parser using the function decorations. |
176,714 | import argparse
import re
from IPython.core.error import UsageError
from IPython.utils.decorators import undoc
from IPython.utils.process import arg_split
from IPython.utils.text import dedent
The provided code snippet includes necessary dependencies for implementing the `parse_argstring` function. Write a Python func... | Parse the string of arguments for the given magic function. |
176,715 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | null |
176,716 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Check path, but don't let exceptions raise |
176,717 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the pretty (default) representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw text data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata... |
176,718 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the HTML representation of an object. Note: If raw=False and the object does not have a HTML representation, no HTML will be shown. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw HTML data to display. raw : bool Are the data objects raw data or Python objects that need to... |
176,719 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Displays the Markdown representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw markdown data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to... |
176,720 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the SVG representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw svg data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associa... |
176,721 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the PNG representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw png data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be associa... |
176,722 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the JPEG representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw JPEG data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be assoc... |
176,723 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the LaTeX representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw latex data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be ass... |
176,724 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the JSON representation of an object. Note that not many frontends support displaying JSON. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw json data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: ... |
176,725 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the Javascript representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata... |
176,726 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | Display the PDF representation of an object. Parameters ---------- *objs : object The Python objects to display, or if raw=True raw javascript data to display. raw : bool Are the data objects raw data or Python objects that need to be formatted before display? [default: False] metadata : dict (optional) Metadata to be ... |
176,727 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | read the (width, height) from a JPEG header |
176,728 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | read the (width, height) from a GIF header |
176,729 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | .. deprecated:: 7.23 use `matplotlib_inline.backend_inline.set_matplotlib_formats()` Select figure formats for the inline backend. Optionally pass quality for JPEG. For example, this enables PNG and JPEG output with a JPEG quality of 90%:: In [1]: set_matplotlib_formats('png', 'jpeg', quality=90) To set this in your co... |
176,730 | from binascii import b2a_base64, hexlify
import html
import json
import mimetypes
import os
import struct
import warnings
from copy import deepcopy
from os.path import splitext
from pathlib import Path, PurePath
from IPython.utils.py3compat import cast_unicode
from IPython.testing.skipdoctest import skip_doctest
from .... | .. deprecated:: 7.23 use `matplotlib_inline.backend_inline.set_matplotlib_close()` Set whether the inline backend closes all figures automatically or not. By default, the inline backend used in the IPython Notebook will close all matplotlib figures automatically after each cell is run. This means that plots in differen... |
176,731 | import os
from IPython.utils.coloransi import ColorSchemeTable, TermColors, ColorScheme
import os
del os
class TermColors:
"""Color escape sequences.
This class defines the escape sequences for all the standard (ANSI?)
colors in terminals. Also defines a NoColor escape which is just the null
string... | Return a color table with fields for exception reporting. The table is an instance of ColorSchemeTable with schemes added for 'Neutral', 'Linux', 'LightBG' and 'NoColor' and fields for exception handling filled in. Examples: >>> ec = exception_colors() >>> ec.active_scheme_name '' >>> print(ec.active_colors) None Now w... |
176,732 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | This context manager has to be used in any place where unstable completer behavior and API may be called. >>> with provisionalcompleter(): ... completer.do_experimental_things() # works >>> completer.do_experimental_things() # raises. .. note:: Unstable By using this context manager you agree that the API in use may ch... |
176,733 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Return whether a string has open quotes. This simply counts whether the number of quote characters of either type in the string is odd. Returns ------- If there is an open quote, the quote character is returned. Else, return False. |
176,734 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Escape a string to protect certain characters. |
176,735 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | key for sorting completions This does several things: - Demote any completions starting with underscores to the end - Insert any %magic and %%cellmagic completions in the alphabetical order by their name |
176,736 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | null |
176,737 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | null |
176,738 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Check if any result includes any completions. |
176,739 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Adds attributes describing the matcher. Parameters ---------- priority : Optional[float] The priority of the matcher, determines the order of execution of matchers. Higher priority means that the matcher will be executed first. Defaults to 0. identifier : Optional[str] identifier of the matcher allowing users to modify... |
176,740 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | null |
176,741 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | null |
176,742 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Deduplicate a set of completions. .. warning:: Unstable This function is unstable, API may change without warning. Parameters ---------- text : str text that should be completed. completions : Iterator[Completion] iterator over the completions to deduplicate Yields ------ `Completions` objects Completions coming from m... |
176,743 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Rectify a set of completions to all have the same ``start`` and ``end`` .. warning:: Unstable This function is unstable, API may change without warning. It will also raise unless use in proper context manager. Parameters ---------- text : str text that should be completed. completions : Iterator[Completion] iterator ov... |
176,744 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | returns the strings in the __all__ attribute |
176,745 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Used by dict_key_matches, matching the prefix to a list of keys Parameters ---------- keys list of keys in dictionary currently being completed. prefix Part of the text already typed by the user. E.g. `mydict[b'fo` delims String of delimiters to consider when finding the current key. extra_prefix : optional Part of the... |
176,746 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Convert the (line,column) position of the cursor in text to an offset in a string. Parameters ---------- text : str The text in which to calculate the cursor offset line : int Line of the cursor; 0-indexed column : int Column of the cursor 0-indexed Returns ------- Position of the cursor in ``text``, 0-indexed. See Als... |
176,747 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Convert the position of the cursor in text (0 indexed) to a line number(0-indexed) and a column number (0-indexed) pair Position should be a valid position in ``text``. Parameters ---------- text : str The text in which to calculate the cursor offset offset : int Position of the cursor in ``text``, 0-indexed. Returns -... |
176,748 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Checks if obj is an instance of module.class_name if loaded |
176,749 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Match Unicode characters back to Unicode name Same as :any:`back_unicode_name_matches`, but adopted to new Matcher API. |
176,750 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Match latex characters back to unicode name Same as :any:`back_latex_name_matches`, but adopted to new Matcher API. |
176,751 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | Make the signature from a jedi completion Parameters ---------- completion : jedi.Completion object does not complete a function type Returns ------- a string consisting of the function signature, with the parenthesis but without the function name. example: `(a, *args, b=1, **kwargs)` |
176,752 | from __future__ import annotations
import builtins as builtin_mod
import enum
import glob
import inspect
import itertools
import keyword
import os
import re
import string
import sys
import tokenize
import time
import unicodedata
import uuid
import warnings
from ast import literal_eval
from collections import defaultdic... | null |
176,753 | import abc
import sys
import traceback
import warnings
from io import StringIO
from decorator import decorator
from traitlets.config.configurable import Configurable
from .getipython import get_ipython
from ..utils.sentinel import Sentinel
from ..utils.dir2 import get_real_method
from ..lib import pretty
from traitlets... | Try to return a repr of an object always returns a string, at least. |
176,754 | import abc
import sys
import traceback
import warnings
from io import StringIO
from decorator import decorator
from traitlets.config.configurable import Configurable
from .getipython import get_ipython
from ..utils.sentinel import Sentinel
from ..utils.dir2 import get_real_method
from ..lib import pretty
from traitlets... | show traceback on failed format call |
176,755 | import abc
import sys
import traceback
import warnings
from io import StringIO
from decorator import decorator
from traitlets.config.configurable import Configurable
from .getipython import get_ipython
from ..utils.sentinel import Sentinel
from ..utils.dir2 import get_real_method
from ..lib import pretty
from traitlets... | Return a (__module__, __name__) tuple for a type. Used as key in Formatter.deferred_printers. |
176,756 | import abc
import sys
import traceback
import warnings
from io import StringIO
from decorator import decorator
from traitlets.config.configurable import Configurable
from .getipython import get_ipython
from ..utils.sentinel import Sentinel
from ..utils.dir2 import get_real_method
from ..lib import pretty
from traitlets... | Return the type of an instance (old and new-style) |
176,757 | import abc
import sys
import traceback
import warnings
from io import StringIO
from decorator import decorator
from traitlets.config.configurable import Configurable
from .getipython import get_ipython
from ..utils.sentinel import Sentinel
from ..utils.dir2 import get_real_method
from ..lib import pretty
from traitlets... | Return a format data dict for an object. By default all format types will be computed. Parameters ---------- obj : object The Python object whose format data will be computed. Returns ------- format_dict : dict A dictionary of key/value pairs, one or each format that was generated for the object. The keys are the forma... |
176,758 | import os
import subprocess
import sys
from .error import TryNext
import os
del os
class TryNext(IPythonCoreError):
"""Try next hook exception.
Raise this in your hook function to indicate that the next hook handler
should be used to handle the operation.
"""
The provided code snippet includes nec... | Open the default editor at the given filename and linenumber. This is IPython's default editor hook, you can use it as an example to write your own modified one. To set your own editor function as the new editor hook, call ip.set_hook('editor',yourfunc). |
176,759 | import os
import subprocess
import sys
from .error import TryNext
def synchronize_with_editor(self, filename, linenum, column):
pass | null |
176,760 | import os
import subprocess
import sys
from .error import TryNext
class TryNext(IPythonCoreError):
"""Try next hook exception.
Raise this in your hook function to indicate that the next hook handler
should be used to handle the operation.
"""
The provided code snippet includes necessary dependencies ... | Run a string through pager |
176,761 | import os
import subprocess
import sys
from .error import TryNext
The provided code snippet includes necessary dependencies for implementing the `pre_prompt_hook` function. Write a Python function `def pre_prompt_hook(self)` to solve the following problem:
Run before displaying the next prompt Use this e.g. to display... | Run before displaying the next prompt Use this e.g. to display output from asynchronous operations (in order to not mess up text entry) |
176,762 | import os
import subprocess
import sys
from .error import TryNext
class CommandChainDispatcher:
""" Dispatch calls to a chain of commands until some func can handle it
Usage: instantiate, execute "add" to add commands (with optional
priority), execute normally via f() calling mechanism.
"""
def __in... | Get text from the clipboard. |
176,763 | from warnings import warn
import ast
import codeop
import io
import re
import sys
import tokenize
import warnings
from typing import List
from IPython.core.inputtransformer import (leading_indent,
classic_prompt,
ipy_prompt,
... | Return the number of initial spaces in a string. Note that tabs are counted as a single space. For now, we do *not* support mixing of tabs and spaces in the user's input. Parameters ---------- s : string Returns ------- n : int |
176,764 | from warnings import warn
import ast
import codeop
import io
import re
import sys
import tokenize
import warnings
from typing import List
from IPython.core.inputtransformer import (leading_indent,
classic_prompt,
ipy_prompt,
... | Find the number of spaces for the next line of indentation |
176,765 | from warnings import warn
import ast
import codeop
import io
import re
import sys
import tokenize
import warnings
from typing import List
from IPython.core.inputtransformer import (leading_indent,
classic_prompt,
ipy_prompt,
... | Determine if the input source ends in a blank. A blank is either a newline or a line consisting of whitespace. Parameters ---------- src : string A single or multiline string. |
176,766 | from warnings import warn
import ast
import codeop
import io
import re
import sys
import tokenize
import warnings
from typing import List
from IPython.core.inputtransformer import (leading_indent,
classic_prompt,
ipy_prompt,
... | Determine if the input source ends in two blanks. A blank is either a newline or a line consisting of whitespace. Parameters ---------- src : string A single or multiline string. |
176,767 | from warnings import warn
import ast
import codeop
import io
import re
import sys
import tokenize
import warnings
from typing import List
from IPython.core.inputtransformer import (leading_indent,
classic_prompt,
ipy_prompt,
... | Remove all comments from input source. Note: comments are NOT recognized inside of strings! Parameters ---------- src : string A single or multiline input string. Returns ------- String with all Python comments removed. |
176,768 | from warnings import warn
import ast
import codeop
import io
import re
import sys
import tokenize
import warnings
from typing import List
from IPython.core.inputtransformer import (leading_indent,
classic_prompt,
ipy_prompt,
... | Return the default standard input encoding. If sys.stdin has no encoding, 'ascii' is returned. |
176,769 | from typing import (
Any,
Callable,
Dict,
Set,
Sequence,
Tuple,
NamedTuple,
Type,
Literal,
Union,
TYPE_CHECKING,
)
import ast
import builtins
import collections
import operator
import sys
from functools import cached_property
from dataclasses import dataclass, field
from IPyt... | Get unbound method for given bound method. Returns None if cannot get unbound method, or method is already unbound. |
176,770 | from typing import (
Any,
Callable,
Dict,
Set,
Sequence,
Tuple,
NamedTuple,
Type,
Literal,
Union,
TYPE_CHECKING,
)
import ast
import builtins
import collections
import operator
import sys
from functools import cached_property
from dataclasses import dataclass, field
from IPyt... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.