repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
ipython
IPython/core/formatters.py
.py
"""Display formatters. This module defines the base instances in order to implement custom formatters/mimetypes got objects: As we want to see internal IPython working we are going to use the following function to diaply objects instead of the normal print or display method: >>> ip = get_ipython() >>> ip.dis...
1,090
36,429
ipython
IPython/core/guarded_eval.py
.py
from copy import copy from inspect import get_annotations, isclass, signature, Signature, getmodule from typing import ( Annotated, AnyStr, Literal, NamedTuple, NewType, Protocol, TypeGuard, Union, get_args, get_origin, is_typeddict, ) from collections.abc import Callable, Se...
1,663
57,855
ipython
IPython/core/application.py
.py
""" An application for IPython. All top-level applications should use the classes in this module for handling configuration and creating configurables. The job of an :class:`Application` is to create the master configuration object and then create the configurable objects, passing the config to them. """ # Copyright...
500
19,274
ipython
IPython/core/prefilter.py
.py
""" Prefiltering components. Prefilters transform user input before it is exec'd by Python. These transforms are used to implement additional syntax such as !ls and %magic. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from keyword import iskeyword import r...
707
25,717
ipython
IPython/core/hooks.py
.py
"""Hooks for IPython. In Python, it is possible to overwrite any method of any object if you really want to. But IPython exposes a few 'hooks', methods which are *designed* to be overwritten by users for customization purposes. This module defines the default versions of all such hooks, which get used by IPython if ...
164
5,452
ipython
IPython/core/page.py
.py
""" Paging capabilities for IPython.core Notes ----- For now this uses IPython hooks, so it can't be in IPython.utils. If we can get rid of that dependency, we could move it there. ----- """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import io im...
346
11,793
ipython
IPython/core/payload.py
.py
"""Payload system for IPython. Authors: * Fernando Perez * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, di...
54
1,739
ipython
IPython/core/extensions.py
.py
"""A class for managing IPython extensions.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import os.path import sys from importlib import import_module, reload from traitlets.config.configurable import Configurable from IPython.utils.path import ens...
135
4,980
ipython
IPython/core/magic.py
.py
from __future__ import annotations """Magic functions for InteractiveShell.""" # ----------------------------------------------------------------------------- # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and # Copyright (C) 2001 Fernando Perez <fperez@colorado.edu> # Copyright (C) 2008 The IPython Develop...
829
30,953
ipython
IPython/core/ultratb.py
.py
""" Verbose and colourful traceback formatting. **ColorTB** I've always found it a bit hard to visually parse tracebacks in Python. The ColorTB class is a solution to that problem. It colors the different parts of a traceback in a manner similar to what you would expect from a syntax-highlighting text editor. Inst...
1,371
51,349
ipython
IPython/core/usage.py
.py
"""Usage information for the main IPython applications. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu> # # Distributed under the terms of the BSD License. The f...
341
13,382
ipython
IPython/core/completerlib.py
.py
"""Implementations for various useful completers. These are all loaded by default by IPython. """ #----------------------------------------------------------------------------- # Copyright (C) 2010-2011 The IPython Development Team. # # Distributed under the terms of the BSD License. # # The full license is in the ...
380
12,626
ipython
IPython/core/display_trap.py
.py
""" A context manager for handling sys.displayhook. Authors: * Robert Kern * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the fi...
73
2,149
ipython
IPython/core/async_helpers.py
.py
""" Async helper function that are invalid syntax on Python 3.5 and below. This code is best effort, and may have edge cases not behaving as expected. In particular it contain a number of heuristics to detect whether code is effectively async and need to run in an event loop or not. Some constructs (like top-level `r...
163
4,407
ipython
IPython/core/interactiveshell.py
.py
"""Main IPython class.""" #----------------------------------------------------------------------------- # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu> # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of t...
4,243
164,967
ipython
IPython/core/history.py
.py
"""History related magics and functionality""" from __future__ import annotations # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import atexit import datetime import os import re import weakref import threading from pathlib import Path import functools from c...
1,398
47,475
ipython
IPython/core/oinspect.py
.py
"""Tools for inspecting Python objects. Uses syntax highlighting for presenting the various information elements. Similar in spirit to the inspect module, but all calls take a name argument to reference the name under which an object is being read. """ from __future__ import annotations # Copyright (c) IPython Devel...
1,197
39,530
ipython
IPython/core/displayhook.py
.py
"""Displayhook for IPython. This defines a callable class that IPython uses for `sys.displayhook`. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import builtins as builtin_mod import sys import io as _io import tokenize from traitlets.config.configurable im...
346
13,225
ipython
IPython/core/compilerop.py
.py
"""Compiler tools with improved interactive support. Provides compilation machinery similar to codeop, but with caching support so we can provide interactive tracebacks. Authors ------- * Robert Kern * Fernando Perez * Thomas Kluyver """ # Note: though it might be more natural to name this module 'compiler', that # ...
197
7,265
ipython
IPython/core/release.py
.py
"""Release data for the IPython project.""" #----------------------------------------------------------------------------- # Copyright (c) 2008, IPython Development Team. # Copyright (c) 2001, Fernando Perez <fernando.perez@colorado.edu> # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> # Copyright (c) 2001, ...
45
1,484
ipython
IPython/core/historyapp.py
.py
""" An application for managing IPython history. To be invoked as the `ipython history` subcommand. """ import sqlite3 from contextlib import closing from pathlib import Path from traitlets.config.application import Application from .application import BaseIPythonApplication from traitlets import Bool, Int, Dict fro...
159
6,162
ipython
IPython/core/displaypub.py
.py
"""An interface for publishing rich data to frontends. There are two components of the display system: * Display formatters, which take a Python object and compute the representation of the object in various formats (text, HTML, SVG, etc.). * The display publisher that is used to send the representation data to the...
205
6,841
ipython
IPython/core/shellapp.py
.py
""" A mixin for :class:`~IPython.core.application.Application` classes that launch InteractiveShell instances, load extensions, etc. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import glob from itertools import chain impo...
502
19,596
ipython
IPython/core/inputtransformer2.py
.py
"""Input transformer machinery to support IPython special syntax. This includes the machinery to recognise and transform ``%magic`` commands, ``!system`` commands, ``help?`` querying, prompt stripping, and so forth. Added: IPython 7.0. Replaces inputsplitter and inputtransformer which were deprecated in 7.0 and remov...
945
33,166
ipython
IPython/core/kitty.py
.py
# Implements https://sw.kovidgoyal.net/kitty/graphics-protocol/ from base64 import b64encode, b64decode import os import sys import warnings #: Set ``IPYTHON_KITTY_GRAPHICS`` to ``1``/``true`` or ``0``/``false`` to state #: outright whether the terminal speaks the kitty graphics protocol. Unset (or #: empty) autodete...
114
3,516
ipython
IPython/core/getipython.py
.py
"""Simple function to call to get the current InteractiveShell instance""" # ----------------------------------------------------------------------------- # Copyright (C) 2013 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as...
28
1,042
ipython
IPython/core/profileapp.py
.py
""" An application for managing IPython profiles. To be invoked as the `ipython profile` subcommand. Authors: * Min RK """ #----------------------------------------------------------------------------- # Copyright (C) 2008 The IPython Development Team # # Distributed under the terms of the BSD License. The ful...
315
10,603
ipython
IPython/core/display_functions.py
.py
"""Top-level display functions for displaying object in different formats.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from binascii import b2a_hex import os import sys __all__ = ['display', 'clear_output', 'publish_display_data', 'update_display', 'Displa...
371
12,399
ipython
IPython/core/tips.py
.py
from __future__ import annotations from datetime import datetime import importlib.util import os import sys from typing import Any _tips: Any = { # (month, day) "every_year": { (1, 1): "Happy new year!", # European time: # [2/8/25, 23:28:24] Fernando Perez: Hi! Yes, this was my first pu...
136
6,907
ipython
IPython/core/builtin_trap.py
.py
""" A context manager for managing things injected into :mod:`builtins`. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import builtins as builtin_mod from typing import Any, Literal, TYPE_CHECKING from traitlets.config.confi...
100
3,249
ipython
IPython/core/profiledir.py
.py
"""An object for managing IPython profile directories.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import errno from pathlib import Path from traitlets.config.configurable import LoggingConfigurable from ..paths import get_ipython_package_dir from...
240
8,278
ipython
IPython/core/events.py
.py
"""Infrastructure for registering and firing callbacks on application events. Unlike :mod:`IPython.core.hooks`, which lets end users set single functions to be called at specific times, or a collection of alternative methods to try, callbacks are designed to be used by extension authors. A number of callbacks can be r...
181
6,017
ipython
IPython/core/pylabtools.py
.py
"""Pylab (matplotlib) support utilities.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from io import BytesIO from binascii import b2a_base64 from functools import partial from IPython.core.display import _pngxy from IPython.utils.decorators import flag_calls...
501
16,932
ipython
IPython/core/magics/packaging.py
.py
"""Implementation of packaging-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2018 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
182
6,030
ipython
IPython/core/magics/logging.py
.py
"""Implementation of magic functions for IPython's own logging. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distribut...
196
6,884
ipython
IPython/core/magics/display.py
.py
"""Simple magics for display formats""" #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #----...
94
3,130
ipython
IPython/core/magics/script.py
.py
"""Magic functions for running cells in various scripts.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import atexit import errno import os import sys import time import weakref from codecs import getincrementaldecoder from threading import Thread from traitl...
444
15,346
ipython
IPython/core/magics/extension.py
.py
"""Implementation of magic functions for the extension machinery. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distrib...
64
2,453
ipython
IPython/core/magics/namespace.py
.py
"""Implementation of namespace-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
724
25,296
ipython
IPython/core/magics/pylab.py
.py
"""Implementation of magic functions for matplotlib/pylab support. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distri...
174
6,624
ipython
IPython/core/magics/history.py
.py
"""Implementation of magic functions related to History. """ #----------------------------------------------------------------------------- # Copyright (c) 2012, IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with th...
362
13,297
ipython
IPython/core/magics/ast_mod.py
.py
""" This module contains utility function and classes to inject simple ast transformations based on code strings into IPython. While it is already possible with ast-transformers it is not easy to directly manipulate ast. IPython has pre-code and post-code hooks, but are ran from within the IPython machinery so may be...
329
10,226
ipython
IPython/core/magics/code.py
.py
"""Implementation of code management magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with th...
771
28,359
ipython
IPython/core/magics/basic.py
.py
"""Implementation of basic magic functions.""" from __future__ import annotations from logging import error import io import os import platform from pprint import pformat import sys from warnings import warn from traitlets.utils.importstring import import_item from IPython.core import magic_arguments, page from IPyt...
772
28,157
ipython
IPython/core/magics/execution.py
.py
"""Implementation of execution-related magic functions.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import ast import builtins as builtin_mod import gc import itertools import os import re import shlex import sys import time import timeit from typing import...
1,720
64,413
ipython
IPython/core/magics/osm.py
.py
"""Implementation of magic functions for interaction with the OS. Note: this module is named 'osm' instead of 'os' to avoid a collision with the builtin. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import io import os import pathlib import re import sys fro...
857
30,660
ipython
IPython/core/magics/config.py
.py
"""Implementation of configuration-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed w...
141
4,846
ipython
IPython/core/magics/auto.py
.py
"""Implementation of magic functions that control various automatic behaviors. """ from __future__ import annotations #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The ...
146
4,835
ipython
IPython/utils/contexts.py
.py
"""Miscellaneous context managers.""" from __future__ import annotations from types import TracebackType from typing import Any # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. class preserve_keys: """Preserve a set of keys in a dictionary. Upon entering...
68
1,866
ipython
IPython/utils/_process_common.py
.py
"""Common utilities for the various process_* implementations. This file is only meant to be imported by the platform-specific implementations of subprocess utilities, and it contains tools that are common to all of them. """ #----------------------------------------------------------------------------- # Copyright ...
282
9,445
ipython
IPython/utils/process.py
.py
""" Utilities for working with external processes. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import sys if sys.platform == 'win32': from ._process_win32 import system, getoutput, arg_split, check_pid elif sys.platform == "emscripten": ...
74
1,922
ipython
IPython/utils/tempdir.py
.py
"""This module contains classes - NamedFileInTemporaryDirectory, TemporaryWorkingDirectory. These classes add extra features such as creating a named file in temporary directory and creating a context manager for the working directory which is also temporary. """ from __future__ import annotations import os as _os f...
64
2,094
ipython
IPython/utils/module_paths.py
.py
"""Utility functions for finding modules Utility functions for finding modules on sys.path. """ from __future__ import annotations #----------------------------------------------------------------------------- # Copyright (c) 2011, the IPython Development Team. # # Distributed under the terms of the Modified BSD Lic...
80
2,657
ipython
IPython/utils/io.py
.py
""" IO related utilities. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import sys from pathlib import Path from .capture import CapturedIO, capture_output from io import StringIO class Tee: """A class to duplicate an output stream to stdout/err. ...
133
3,951
ipython
IPython/utils/PyColorize.py
.py
import keyword import os import sys import token import tokenize import warnings from io import StringIO from typing import TYPE_CHECKING, Any, TypeAlias import pygments from pygments.style import Style from pygments.token import Token, _TokenType from functools import cache from typing import TypedDict if TYPE_CHEC...
600
18,495
ipython
IPython/utils/importstring.py
.py
""" A simple utility to import something by its string name. """ from __future__ import annotations # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from typing import Any def import_item(name: str) -> Any: """Import and return ``bar`` given the string ``foo.b...
42
1,099
ipython
IPython/utils/coloransi.py
.py
# Deprecated/should be removed, but we break older version of ipyparallel # https://github.com/ipython/ipyparallel/pull/924 # minimal subset of TermColors, removed from IPython # not for public consumption, beyond ipyparallel. class TermColors: Normal = "\033[0m" Red = "\033[0;31m"
10
293
ipython
IPython/utils/ipstruct.py
.py
"""A dict subclass that supports attribute style access. Authors: * Fernando Perez (original) * Brian Granger (refactoring to a dict subclass) """ from __future__ import annotations from typing import Any #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The I...
380
11,927
ipython
IPython/utils/frame.py
.py
""" Utilities for working with stack frames. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software...
32
1,145
ipython
IPython/utils/_sysinfo.py
.py
# GENERATED BY setup.py commit = ""
3
36
ipython
IPython/utils/timing.py
.py
""" Utilities for timing code execution. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #-...
136
4,600
ipython
IPython/utils/dir2.py
.py
"""A fancy version of Python's builtin :func:`dir` function.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import inspect import types from typing import Any from collections.abc import Callable def safe_hasattr(obj: objec...
87
2,403
ipython
IPython/utils/tokenutil.py
.py
"""Token-related utilities""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import itertools import tokenize from io import StringIO from keyword import iskeyword from tokenize import TokenInfo from typing import NamedTuple from...
211
7,029
ipython
IPython/utils/generics.py
.py
"""Generic functions for extending IPython.""" from __future__ import annotations import warnings from typing import Any from IPython.core.error import TryNext from functools import singledispatch @singledispatch def _inspect_object(obj: Any) -> None: """Called when you do obj? .. deprecated:: 9.15 ...
52
1,498
ipython
IPython/utils/data.py
.py
"""Utilities for working with data structures like lists, dicts and tuples. """ from __future__ import annotations #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full licen...
51
1,689
ipython
IPython/utils/docs.py
.py
import os GENERATING_DOCUMENTATION = os.environ.get("IN_SPHINX_RUN", None) == "True"
4
86
ipython
IPython/utils/terminal.py
.py
""" Utilities for working with terminals. Authors: * Brian E. Granger * Fernando Perez * Alexander Belchenko (e-mail: bialix AT ukr.net) """ from __future__ import annotations # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import re import sys import w...
131
3,580
ipython
IPython/utils/path.py
.py
""" Utilities for path handling. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import sys import errno import glob import warnings #----------------------------------------------------------------------------- # Code #------------------------------...
360
11,458
ipython
IPython/utils/syspathcontext.py
.py
from __future__ import annotations import sys from types import TracebackType from typing import Literal, Self class prepended_to_syspath: """A context for prepending a directory to sys.path for a second.""" dir: str added: bool def __init__(self, dir: str) -> None: self.dir = dir ...
40
947
ipython
IPython/utils/encoding.py
.py
""" Utilities for dealing with text encodings """ from __future__ import annotations # ----------------------------------------------------------------------------- # Copyright (C) 2008-2012 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING...
92
3,452
ipython
IPython/utils/wildcard.py
.py
"""Support for wildcard pattern matching in object inspection. Authors ------- - Jörgen Stenarson <jorgen.stenarson@bostream.nu> - Thomas Kluyver """ #***************************************************************************** # Copyright (C) 2005 Jörgen Stenarson <jorgen.stenarson@bostream.nu> # # Distribut...
111
4,591
ipython
IPython/utils/decorators.py
.py
"""Decorators that don't go anywhere else. This module contains misc. decorators that don't really go with another module in :mod:`IPython.utils`. Before putting something here please see if it should go into another topical module in :mod:`IPython.utils`. """ #--------------------------------------------------------...
87
3,005
ipython
IPython/utils/text.py
.py
""" Utilities for working with strings and text. Inheritance diagram: .. inheritance-diagram:: IPython.utils.text :parts: 3 """ from __future__ import annotations import builtins import os import re import string import textwrap from string import Formatter from pathlib import Path from typing import ( Any...
598
17,331
ipython
IPython/utils/openpy.py
.py
""" Tools to open .py files as Unicode, using the encoding specified within the file, as per PEP 263. Much of the code is taken from the tokenize module in Python 3.2. """ from __future__ import annotations import io from collections.abc import Generator, Iterable from io import TextIOWrapper, BytesIO from pathlib im...
107
3,605
ipython
IPython/utils/sentinel.py
.py
"""Sentinel class for constants with useful reprs""" from __future__ import annotations # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. class Sentinel: def __init__(self, name: str, module: str, docstring: str | None = None) -> None: self.name = name ...
17
489
ipython
IPython/utils/_process_posix.py
.py
"""Posix-specific implementation of process utilities. This file is only meant to be imported by process.py, not by end-users. """ from __future__ import annotations #----------------------------------------------------------------------------- # Imports #--------------------------------------------------------------...
195
7,497
ipython
IPython/utils/strdispatch.py
.py
"""String dispatch class to match regexps and dispatch commands. """ # Stdlib imports import re # Our own modules from IPython.core.hooks import CommandChainDispatcher from collections.abc import Callable # Code begins class StrDispatch: """Dispatch (lookup) a set of strings / regexps for match. Example: ...
70
1,893
ipython
IPython/utils/sysinfo.py
.py
""" Utilities for getting information about IPython and the system it's running in. """ from __future__ import annotations #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The fu...
121
3,737
ipython
IPython/utils/capture.py
.py
"""IO capturing utilities.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import sys from io import StringIO from types import TracebackType from typing import Any #-----------------------------------------------------------...
178
5,448
ipython
IPython/utils/_process_emscripten.py
.py
"""Emscripten-specific implementation of process utilities. This file is only meant to be imported by process.py, not by end-users. """ from ._process_common import arg_split def system(cmd): raise OSError("Not available") def getoutput(cmd): raise OSError("Not available") def check_pid(cmd): raise ...
23
503
ipython
IPython/utils/_process_win32.py
.py
"""Windows-specific implementation of process utilities. This file is only meant to be imported by process.py, not by end-users. """ import ctypes import os import subprocess import sys import time from ctypes import POINTER, c_int from ctypes.wintypes import HLOCAL, LPCWSTR from subprocess import STDOUT from threadi...
209
6,549
ipython
IPython/external/__init__.py
.py
""" This package contains all third-party modules bundled with IPython. """ __all__: list[str] = []
6
101
ipython
IPython/external/qt_loaders.py
.py
""" This module contains factory functions that attempt to return Qt submodules from the various python Qt bindings. It also protects against double-importing Qt with different bindings, which is unstable and likely to crash This is used primarily by qt and qt_for_kernel, and shouldn't be accessed directly from the o...
424
11,867
ipython
IPython/external/qt_for_kernel.py
.py
"""Import Qt in a manner suitable for an IPython kernel. This is the import used for the `gui=qt` or `matplotlib=qt` initialization. Import Priority: if Qt has been imported anywhere else: use that if matplotlib has been imported and doesn't support v2 (<= 1.0.1): use PyQt4 @v1 Next, ask QT_API env variable...
125
3,442
ipython
IPython/external/pickleshare.py
.py
""" Vendoring of pickleshare, reduced to used functionalities. --- PickleShare - a small 'shelve' like datastore with concurrency support Like shelve, a PickleShareDB object acts like a normal dictionary. Unlike shelve, many processes can access the database simultaneously. Changing a value in database is immediatel...
297
8,701
jupytext
demo/World population.lgt.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # formats: ipynb,.pct.py:percent,.lgt.py:light,.spx.py:sphinx,md,Rmd,.pandoc.md:pandoc # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.0 # kernelspec: # ...
96
2,732
jupytext
demo/Benchmarking Jupytext.py
.py
# In this notebook, we benchmark the Jupytext formats for Jupyter notebooks against the base format # Open this script as a notebook in Jupyter to run it and see the plots import time import copy import pandas as pd import plotly.graph_objects as go from plotly.colors import DEFAULT_PLOTLY_COLORS import nbformat impo...
100
3,317
jupytext
demo/World population.pct.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # formats: ipynb,.pct.py:percent,.lgt.py:light,.spx.py:sphinx,md,Rmd,.pandoc.md:pandoc # text_representation: # extension: .py # format_name: percent # format_version: '1.2' # jupytext_version: 1.1.0 # kernelspec: # ...
112
2,891
jupytext
demo/Jupytext's word cloud.py
.py
# This is a notebook that I used to generate Jupytext's word cloud. # To open this script as a notebook in JupyterLab, right-click on this file, and select _Open with/Notebook_. from wordcloud import WordCloud text = """ Jupytext Notebook JupyterLab Git GitHub Version control Markdown R Markdown Text Scripts Code Not...
62
860
jupytext
demo/World population.spx.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # formats: ipynb,.pct.py:percent,.lgt.py:light,.spx.py:sphinx,md,Rmd,.pandoc.md:pandoc # text_representation: # extension: .py # format_name: sphinx # format_version: '1.1' # jupytext_version: 1.1.0 # kernelspec: # ...
104
3,333
jupytext
jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/jupyter_server_test_config.py
.py
"""Server configuration for integration tests. !! Never use this configuration in production because it opens the server to the world and provide access to JupyterLab JavaScript objects through the global window variable. """ from jupyterlab.galata import configure_jupyter_server configure_jupyter_server(c) # noqa:...
14
412
jupytext
jupyterlab/scripts/install_extension.py
.py
# This script does the "same" job as `jupyter labextension develop --overwrite .` # # Seems like we cannot use the upstream script on our repo organization. # If we want to use the upstream script we need to have a setup.py or pyproject.toml # in jupyterlab/jupyterlab-jupytext folder with the name of the package. # # W...
49
1,461
jupytext
jupyterlab/jupyterlab_jupytext/__init__.py
.py
"""Jupyter server and lab extension entry points""" import asyncio from jupytext.reraise import reraise try: from jupytext.async_contentsmanager import ( build_async_jupytext_contents_manager_class, ) except ImportError as err: build_async_jupytext_contents_manager_class = reraise(err) try: ...
76
2,598
jupytext
tools/absolute_links_in_readme.py
.py
import re from pathlib import Path from hatchling.metadata.plugin.interface import MetadataHookInterface class AbsoluteLinksInReadme(MetadataHookInterface): """Hook that processes README.md to make relative links absolute.""" def update(self, metadata): """Process README.md when metadata is being pr...
42
1,627
jupytext
docs/conf.py
.py
# Minimal Sphinx configuration — serves HTTP redirects from jupytext.readthedocs.io # to the new jupytext.org site via sphinx-reredirects. # The actual documentation now lives in website/ (Astro + Starlight). project = "Jupytext" extensions = ["myst_parser", "sphinx_reredirects"] source_suffix = {".md": "markdown"} r...
32
1,596
jupytext
tests/conftest.py
.py
import contextlib import itertools import os.path import re import sys import unittest.mock as mock from pathlib import Path import pytest from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec import nbformat from nbformat import reads as nb_reads, validate from nbformat.v4 import nbbase from nbform...
487
15,234
jupytext
tests/integration/jupytext_config/test_jupytext_config.py
.py
from jupytext.cli import system def test_jupytext_config_cli(tmp_path): settings_file = tmp_path / "default_setting_overrides.json" system("jupytext-config", "-h") system( "jupytext-config", "--settings-file", str(settings_file), "set-default-viewer", "python", ...
27
833
jupytext
tests/integration/contents_manager/test_cm_config.py
.py
import logging import os import sys import unittest.mock as mock import pytest from jupyter_server.utils import ensure_async from nbformat import read from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook from tornado.web import HTTPError import jupytext from jupytext.compare import compare_ce...
261
9,840
jupytext
tests/integration/contents_manager/test_contentsmanager.py
.py
import inspect import os import re import shutil import time import pytest from jupyter_server.utils import ensure_async from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook from tornado.web import HTTPError import jupytext from jupytext.cli import jupytext as jupytext_cli from jupytext.compa...
2,058
68,078
jupytext
tests/integration/contents_manager/test_load_multiple.py
.py
import pytest from jupyter_server.utils import ensure_async from nbformat.v4.nbbase import new_notebook from tornado.web import HTTPError import jupytext @pytest.mark.asyncio async def test_combine_same_version_ok(tmpdir, cm): tmp_ipynb = "notebook.ipynb" tmp_nbpy = "notebook.py" with open(str(tmpdir.jo...
64
1,471