Show More
@@ -18,7 +18,6 b' https://ipython.org' | |||||
18 | # Imports |
|
18 | # Imports | |
19 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
20 |
|
20 | |||
21 | import os |
|
|||
22 | import sys |
|
21 | import sys | |
23 |
|
22 | |||
24 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- |
@@ -14,7 +14,6 b' object and then create the configurable objects, passing the config to them.' | |||||
14 |
|
14 | |||
15 | import atexit |
|
15 | import atexit | |
16 | from copy import deepcopy |
|
16 | from copy import deepcopy | |
17 | import glob |
|
|||
18 | import logging |
|
17 | import logging | |
19 | import os |
|
18 | import os | |
20 | import shutil |
|
19 | import shutil |
@@ -19,7 +19,6 b' Authors:' | |||||
19 | # Imports |
|
19 | # Imports | |
20 | #----------------------------------------------------------------------------- |
|
20 | #----------------------------------------------------------------------------- | |
21 |
|
21 | |||
22 | import os |
|
|||
23 | import sys |
|
22 | import sys | |
24 | import traceback |
|
23 | import traceback | |
25 | from pprint import pformat |
|
24 | from pprint import pformat |
@@ -104,7 +104,6 b' All the changes since then are under the same license as IPython.' | |||||
104 | import inspect |
|
104 | import inspect | |
105 | import linecache |
|
105 | import linecache | |
106 | import sys |
|
106 | import sys | |
107 | import warnings |
|
|||
108 | import re |
|
107 | import re | |
109 | import os |
|
108 | import os | |
110 |
|
109 |
@@ -4,7 +4,6 b' Color schemes for exception handling code in IPython.' | |||||
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 | import os |
|
6 | import os | |
7 | import warnings |
|
|||
8 |
|
7 | |||
9 | #***************************************************************************** |
|
8 | #***************************************************************************** | |
10 | # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu> |
|
9 | # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu> |
@@ -11,7 +11,6 b' Inheritance diagram:' | |||||
11 | # Distributed under the terms of the Modified BSD License. |
|
11 | # Distributed under the terms of the Modified BSD License. | |
12 |
|
12 | |||
13 | import abc |
|
13 | import abc | |
14 | import json |
|
|||
15 | import sys |
|
14 | import sys | |
16 | import traceback |
|
15 | import traceback | |
17 | import warnings |
|
16 | import warnings |
@@ -11,7 +11,6 b' deprecated in 7.0.' | |||||
11 | # Distributed under the terms of the Modified BSD License. |
|
11 | # Distributed under the terms of the Modified BSD License. | |
12 |
|
12 | |||
13 | import ast |
|
13 | import ast | |
14 | import sys |
|
|||
15 | from codeop import CommandCompiler, Compile |
|
14 | from codeop import CommandCompiler, Compile | |
16 | import re |
|
15 | import re | |
17 | import tokenize |
|
16 | import tokenize |
@@ -1,7 +1,6 b'' | |||||
1 | """Implementation of basic magic functions.""" |
|
1 | """Implementation of basic magic functions.""" | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | import argparse |
|
|||
5 | from logging import error |
|
4 | from logging import error | |
6 | import io |
|
5 | import io | |
7 | import os |
|
6 | import os |
@@ -31,7 +31,6 b' from IPython.lib.pretty import pretty' | |||||
31 | from IPython.testing.skipdoctest import skip_doctest |
|
31 | from IPython.testing.skipdoctest import skip_doctest | |
32 | from IPython.utils import PyColorize |
|
32 | from IPython.utils import PyColorize | |
33 | from IPython.utils import openpy |
|
33 | from IPython.utils import openpy | |
34 | from IPython.utils import py3compat |
|
|||
35 | from IPython.utils.dir2 import safe_hasattr |
|
34 | from IPython.utils.dir2 import safe_hasattr | |
36 | from IPython.utils.path import compress_user |
|
35 | from IPython.utils.path import compress_user | |
37 | from IPython.utils.text import indent |
|
36 | from IPython.utils.text import indent |
@@ -19,7 +19,6 b' from IPython.core.application import SYSTEM_CONFIG_DIRS, ENV_CONFIG_DIRS' | |||||
19 | from IPython.core import pylabtools |
|
19 | from IPython.core import pylabtools | |
20 | from IPython.utils.contexts import preserve_keys |
|
20 | from IPython.utils.contexts import preserve_keys | |
21 | from IPython.utils.path import filefind |
|
21 | from IPython.utils.path import filefind | |
22 | import traitlets |
|
|||
23 | from traitlets import ( |
|
22 | from traitlets import ( | |
24 | Unicode, Instance, List, Bool, CaselessStrEnum, observe, |
|
23 | Unicode, Instance, List, Bool, CaselessStrEnum, observe, | |
25 | DottedObjectName, |
|
24 | DottedObjectName, |
@@ -17,9 +17,6 b'' | |||||
17 | import linecache |
|
17 | import linecache | |
18 | import sys |
|
18 | import sys | |
19 |
|
19 | |||
20 | # Third-party imports |
|
|||
21 | import pytest |
|
|||
22 |
|
||||
23 | # Our own imports |
|
20 | # Our own imports | |
24 | from IPython.core import compilerop |
|
21 | from IPython.core import compilerop | |
25 |
|
22 |
@@ -4,7 +4,6 b'' | |||||
4 | # Copyright (c) IPython Development Team. |
|
4 | # Copyright (c) IPython Development Team. | |
5 | # Distributed under the terms of the Modified BSD License. |
|
5 | # Distributed under the terms of the Modified BSD License. | |
6 |
|
6 | |||
7 | import bdb |
|
|||
8 | import builtins |
|
7 | import builtins | |
9 | import os |
|
8 | import os | |
10 | import sys |
|
9 | import sys |
@@ -1,6 +1,5 b'' | |||||
1 | """Tests for the Formatters.""" |
|
1 | """Tests for the Formatters.""" | |
2 |
|
2 | |||
3 | import warnings |
|
|||
4 | from math import pi |
|
3 | from math import pi | |
5 |
|
4 | |||
6 | try: |
|
5 | try: |
@@ -7,7 +7,6 b'' | |||||
7 |
|
7 | |||
8 | # stdlib |
|
8 | # stdlib | |
9 | import io |
|
9 | import io | |
10 | import sqlite3 |
|
|||
11 | import sys |
|
10 | import sys | |
12 | import tempfile |
|
11 | import tempfile | |
13 | from datetime import datetime |
|
12 | from datetime import datetime |
@@ -3,7 +3,6 b'' | |||||
3 | Line-based transformers are the simpler ones; token-based transformers are |
|
3 | Line-based transformers are the simpler ones; token-based transformers are | |
4 | more complex. See test_inputtransformer2 for tests for token-based transformers. |
|
4 | more complex. See test_inputtransformer2 for tests for token-based transformers. | |
5 | """ |
|
5 | """ | |
6 | import pytest |
|
|||
7 |
|
6 | |||
8 | from IPython.core import inputtransformer2 as ipt2 |
|
7 | from IPython.core import inputtransformer2 as ipt2 | |
9 |
|
8 |
@@ -4,8 +4,6 b'' | |||||
4 | # Module imports |
|
4 | # Module imports | |
5 | #----------------------------------------------------------------------------- |
|
5 | #----------------------------------------------------------------------------- | |
6 |
|
6 | |||
7 | # third party |
|
|||
8 | import pytest |
|
|||
9 |
|
7 | |||
10 | # our own packages |
|
8 | # our own packages | |
11 |
|
9 |
@@ -1,7 +1,6 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Tests for various magic functions.""" |
|
2 | """Tests for various magic functions.""" | |
3 |
|
3 | |||
4 | import asyncio |
|
|||
5 | import gc |
|
4 | import gc | |
6 | import io |
|
5 | import io | |
7 | import os |
|
6 | import os |
@@ -1,7 +1,6 b'' | |||||
1 | import errno |
|
1 | import errno | |
2 | import os |
|
2 | import os | |
3 | import shutil |
|
3 | import shutil | |
4 | import sys |
|
|||
5 | import tempfile |
|
4 | import tempfile | |
6 | import warnings |
|
5 | import warnings | |
7 | from unittest.mock import patch |
|
6 | from unittest.mock import patch |
@@ -155,9 +155,6 b' def test_import_pylab():' | |||||
155 | assert ns["np"] == np |
|
155 | assert ns["np"] == np | |
156 |
|
156 | |||
157 |
|
157 | |||
158 | from traitlets.config import Config |
|
|||
159 |
|
||||
160 |
|
||||
161 | class TestPylabSwitch(object): |
|
158 | class TestPylabSwitch(object): | |
162 | class Shell(InteractiveShell): |
|
159 | class Shell(InteractiveShell): | |
163 | def init_history(self): |
|
160 | def init_history(self): |
@@ -2,7 +2,6 b'' | |||||
2 | """Tests for IPython.core.ultratb |
|
2 | """Tests for IPython.core.ultratb | |
3 | """ |
|
3 | """ | |
4 | import io |
|
4 | import io | |
5 | import logging |
|
|||
6 | import os.path |
|
5 | import os.path | |
7 | import platform |
|
6 | import platform | |
8 | import re |
|
7 | import re |
@@ -12,7 +12,7 b' import subprocess' | |||||
12 | from base64 import encodebytes |
|
12 | from base64 import encodebytes | |
13 | import textwrap |
|
13 | import textwrap | |
14 |
|
14 | |||
15 |
from pathlib import Path |
|
15 | from pathlib import Path | |
16 |
|
16 | |||
17 | from IPython.utils.process import find_cmd, FindCmdError |
|
17 | from IPython.utils.process import find_cmd, FindCmdError | |
18 | from traitlets.config import get_config |
|
18 | from traitlets.config import get_config |
@@ -1,7 +1,6 b'' | |||||
1 | """Find files and directories which IPython uses. |
|
1 | """Find files and directories which IPython uses. | |
2 | """ |
|
2 | """ | |
3 | import os.path |
|
3 | import os.path | |
4 | import shutil |
|
|||
5 | import tempfile |
|
4 | import tempfile | |
6 | from warnings import warn |
|
5 | from warnings import warn | |
7 |
|
6 |
@@ -106,20 +106,40 b' def create_ipython_shortcuts(shell):' | |||||
106 | def auto_match(): |
|
106 | def auto_match(): | |
107 | return shell.auto_match |
|
107 | return shell.auto_match | |
108 |
|
108 | |||
|
109 | def all_quotes_paired(quote, buf): | |||
|
110 | paired = True | |||
|
111 | i = 0 | |||
|
112 | while i < len(buf): | |||
|
113 | c = buf[i] | |||
|
114 | if c == quote: | |||
|
115 | paired = not paired | |||
|
116 | elif c == "\\": | |||
|
117 | i += 1 | |||
|
118 | i += 1 | |||
|
119 | return paired | |||
|
120 | ||||
109 | focused_insert = (vi_insert_mode | emacs_insert_mode) & has_focus(DEFAULT_BUFFER) |
|
121 | focused_insert = (vi_insert_mode | emacs_insert_mode) & has_focus(DEFAULT_BUFFER) | |
110 | _preceding_text_cache = {} |
|
122 | _preceding_text_cache = {} | |
111 | _following_text_cache = {} |
|
123 | _following_text_cache = {} | |
112 |
|
124 | |||
113 | def preceding_text(pattern): |
|
125 | def preceding_text(pattern): | |
114 | try: |
|
126 | if pattern in _preceding_text_cache: | |
115 | return _preceding_text_cache[pattern] |
|
127 | return _preceding_text_cache[pattern] | |
116 | except KeyError: |
|
|||
117 | pass |
|
|||
118 | m = re.compile(pattern) |
|
|||
119 |
|
128 | |||
120 | def _preceding_text(): |
|
129 | if callable(pattern): | |
121 | app = get_app() |
|
130 | ||
122 | return bool(m.match(app.current_buffer.document.current_line_before_cursor)) |
|
131 | def _preceding_text(): | |
|
132 | app = get_app() | |||
|
133 | before_cursor = app.current_buffer.document.current_line_before_cursor | |||
|
134 | return bool(pattern(before_cursor)) | |||
|
135 | ||||
|
136 | else: | |||
|
137 | m = re.compile(pattern) | |||
|
138 | ||||
|
139 | def _preceding_text(): | |||
|
140 | app = get_app() | |||
|
141 | before_cursor = app.current_buffer.document.current_line_before_cursor | |||
|
142 | return bool(m.match(before_cursor)) | |||
123 |
|
143 | |||
124 | condition = Condition(_preceding_text) |
|
144 | condition = Condition(_preceding_text) | |
125 | _preceding_text_cache[pattern] = condition |
|
145 | _preceding_text_cache[pattern] = condition | |
@@ -173,6 +193,7 b' def create_ipython_shortcuts(shell):' | |||||
173 | filter=focused_insert |
|
193 | filter=focused_insert | |
174 | & auto_match |
|
194 | & auto_match | |
175 | & not_inside_unclosed_string |
|
195 | & not_inside_unclosed_string | |
|
196 | & preceding_text(lambda line: all_quotes_paired('"', line)) | |||
176 | & following_text(r"[,)}\]]|$"), |
|
197 | & following_text(r"[,)}\]]|$"), | |
177 | ) |
|
198 | ) | |
178 | def _(event): |
|
199 | def _(event): | |
@@ -184,6 +205,7 b' def create_ipython_shortcuts(shell):' | |||||
184 | filter=focused_insert |
|
205 | filter=focused_insert | |
185 | & auto_match |
|
206 | & auto_match | |
186 | & not_inside_unclosed_string |
|
207 | & not_inside_unclosed_string | |
|
208 | & preceding_text(lambda line: all_quotes_paired("'", line)) | |||
187 | & following_text(r"[,)}\]]|$"), |
|
209 | & following_text(r"[,)}\]]|$"), | |
188 | ) |
|
210 | ) | |
189 | def _(event): |
|
211 | def _(event): |
@@ -36,7 +36,6 b' import shutil' | |||||
36 | import sys |
|
36 | import sys | |
37 | import tempfile |
|
37 | import tempfile | |
38 | import unittest |
|
38 | import unittest | |
39 | import warnings |
|
|||
40 | from importlib import import_module |
|
39 | from importlib import import_module | |
41 |
|
40 | |||
42 | from decorator import decorator |
|
41 | from decorator import decorator |
@@ -12,7 +12,6 b' done.' | |||||
12 | import builtins as builtin_mod |
|
12 | import builtins as builtin_mod | |
13 | import sys |
|
13 | import sys | |
14 | import types |
|
14 | import types | |
15 | import warnings |
|
|||
16 |
|
15 | |||
17 | from pathlib import Path |
|
16 | from pathlib import Path | |
18 |
|
17 |
@@ -21,7 +21,6 b' Limitations:' | |||||
21 | # From the standard library |
|
21 | # From the standard library | |
22 | import doctest |
|
22 | import doctest | |
23 | import logging |
|
23 | import logging | |
24 | import os |
|
|||
25 | import re |
|
24 | import re | |
26 |
|
25 | |||
27 | from testpath import modified_env |
|
26 | from testpath import modified_env |
@@ -9,7 +9,6 b' import sys' | |||||
9 | import os |
|
9 | import os | |
10 | import string |
|
10 | import string | |
11 | import subprocess |
|
11 | import subprocess | |
12 | import time |
|
|||
13 |
|
12 | |||
14 |
|
13 | |||
15 | def test_cve_2022_21699(): |
|
14 | def test_cve_2022_21699(): |
@@ -12,7 +12,6 b' import atexit' | |||||
12 | import os |
|
12 | import os | |
13 | import sys |
|
13 | import sys | |
14 | import tempfile |
|
14 | import tempfile | |
15 | import warnings |
|
|||
16 | from pathlib import Path |
|
15 | from pathlib import Path | |
17 | from warnings import warn |
|
16 | from warnings import warn | |
18 |
|
17 |
@@ -17,7 +17,6 b' Utility functions for finding modules on sys.path.' | |||||
17 |
|
17 | |||
18 | # Stdlib imports |
|
18 | # Stdlib imports | |
19 | import importlib |
|
19 | import importlib | |
20 | import os |
|
|||
21 | import sys |
|
20 | import sys | |
22 |
|
21 | |||
23 | # Third-party imports |
|
22 | # Third-party imports |
@@ -12,10 +12,8 b' import errno' | |||||
12 | import shutil |
|
12 | import shutil | |
13 | import random |
|
13 | import random | |
14 | import glob |
|
14 | import glob | |
15 | from warnings import warn |
|
|||
16 |
|
15 | |||
17 | from IPython.utils.process import system |
|
16 | from IPython.utils.process import system | |
18 | from IPython.utils.decorators import undoc |
|
|||
19 |
|
17 | |||
20 | #----------------------------------------------------------------------------- |
|
18 | #----------------------------------------------------------------------------- | |
21 | # Code |
|
19 | # Code |
@@ -8,7 +8,6 b'' | |||||
8 | import sys |
|
8 | import sys | |
9 | from io import StringIO |
|
9 | from io import StringIO | |
10 |
|
10 | |||
11 | from subprocess import Popen, PIPE |
|
|||
12 | import unittest |
|
11 | import unittest | |
13 |
|
12 | |||
14 | from IPython.utils.io import Tee, capture_output |
|
13 | from IPython.utils.io import Tee, capture_output |
@@ -18,8 +18,6 b' import tempfile' | |||||
18 |
|
18 | |||
19 | from pathlib import Path |
|
19 | from pathlib import Path | |
20 |
|
20 | |||
21 | from IPython.testing.tools import make_tempfile |
|
|||
22 |
|
||||
23 | import IPython.utils.module_paths as mp |
|
21 | import IPython.utils.module_paths as mp | |
24 |
|
22 | |||
25 | TEST_FILE_PATH = Path(__file__).resolve().parent |
|
23 | TEST_FILE_PATH = Path(__file__).resolve().parent |
@@ -15,7 +15,6 b'' | |||||
15 | import os |
|
15 | import os | |
16 | import math |
|
16 | import math | |
17 | import random |
|
17 | import random | |
18 | import sys |
|
|||
19 |
|
18 | |||
20 | from pathlib import Path |
|
19 | from pathlib import Path | |
21 |
|
20 |
@@ -26,7 +26,7 b' the following tools are needed to build the documentation:' | |||||
26 | In a conda environment, or a Python 3 ``venv``, you should be able to run:: |
|
26 | In a conda environment, or a Python 3 ``venv``, you should be able to run:: | |
27 |
|
27 | |||
28 | cd ipython |
|
28 | cd ipython | |
29 | pip install -U -r docs/requirements.txt |
|
29 | pip install .[doc] -U | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | Build Commands |
|
32 | Build Commands |
@@ -1,10 +1,1 b'' | |||||
1 |
-e .[ |
|
1 | -e .[doc] | |
2 | ipykernel |
|
|||
3 | setuptools>=18.5 |
|
|||
4 | sphinx |
|
|||
5 | sphinx-rtd-theme |
|
|||
6 | docrepr |
|
|||
7 | matplotlib |
|
|||
8 | stack_data |
|
|||
9 | pytest<7 |
|
|||
10 | typing_extensions |
|
@@ -46,7 +46,16 b' install_requires =' | |||||
46 | black = |
|
46 | black = | |
47 | black |
|
47 | black | |
48 | doc = |
|
48 | doc = | |
49 | Sphinx>=1.3 |
|
49 | ipykernel | |
|
50 | setuptools>=18.5 | |||
|
51 | sphinx>=1.3 | |||
|
52 | sphinx-rtd-theme | |||
|
53 | docrepr | |||
|
54 | matplotlib | |||
|
55 | stack_data | |||
|
56 | pytest<7 | |||
|
57 | typing_extensions | |||
|
58 | %(test)s | |||
50 | kernel = |
|
59 | kernel = | |
51 | ipykernel |
|
60 | ipykernel | |
52 | nbconvert = |
|
61 | nbconvert = |
General Comments 0
You need to be logged in to leave comments.
Login now