pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ipython/ipython/commit/4201c26722bab519547b3851ea7ea04ac2d7f045

a60c69660fa.css" /> Merge branch 'main' into shaperilio/autoreload-verbosity · ipython/ipython@4201c26 · GitHub
Skip to content

Commit 4201c26

Browse files
authored
Merge branch 'main' into shaperilio/autoreload-verbosity
2 parents 8e3376e + 01bc9d9 commit 4201c26

11 files changed

Lines changed: 126 additions & 75 deletions

File tree

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.8]
18+
python-version: ["3.x"]
1919

2020
steps:
2121
- uses: actions/checkout@v3

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: [ubuntu-latest, windows-latest]
22-
python-version: ["3.8", "3.9", "3.10"]
22+
python-version: ["3.8", "3.9", "3.10", "3.11"]
2323
deps: [test_extra]
2424
# Test all on ubuntu, test ends on macos
2525
include:
2626
- os: macos-latest
2727
python-version: "3.8"
2828
deps: test_extra
2929
- os: macos-latest
30-
python-version: "3.10"
30+
python-version: "3.11"
3131
deps: test_extra
3232
# Tests minimal dependencies set
3333
- os: ubuntu-latest
34-
python-version: "3.10"
34+
python-version: "3.11"
3535
deps: test
3636
# Tests latest development Python version
3737
- os: ubuntu-latest
38-
python-version: "3.11-dev"
38+
python-version: "3.12-dev"
3939
deps: test
4040
# Installing optional dependencies stuff takes ages on PyPy
4141
- os: ubuntu-latest

IPython/core/completer.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
6060
6161
Both forward and backward completions can be deactivated by setting the
62-
:any:`Completer.backslash_combining_completions` option to ``False``.
62+
:std:configtrait:`Completer.backslash_combining_completions` option to
63+
``False``.
6364
6465
6566
Experimental
@@ -166,7 +167,7 @@
166167
should not be suppressed to ``MatcherResult`` under ``do_not_suppress`` key.
167168
168169
The suppression behaviour can is user-configurable via
169-
:any:`IPCompleter.suppress_competing_matchers`.
170+
:std:configtrait:`IPCompleter.suppress_competing_matchers`.
170171
"""
171172

172173

@@ -255,7 +256,7 @@
255256
JEDI_INSTALLED = False
256257

257258

258-
if TYPE_CHECKING or GENERATING_DOCUMENTATION:
259+
if TYPE_CHECKING or GENERATING_DOCUMENTATION and sys.version_info >= (3, 11):
259260
from typing import cast
260261
from typing_extensions import TypedDict, NotRequired, Protocol, TypeAlias, TypeGuard
261262
else:
@@ -284,7 +285,7 @@ def cast(type_, obj):
284285
# write this). With below range we cover them all, with a density of ~67%
285286
# biggest next gap we consider only adds up about 1% density and there are 600
286287
# gaps that would need hard coding.
287-
_UNICODE_RANGES = [(32, 0x3134b), (0xe0001, 0xe01f0)]
288+
_UNICODE_RANGES = [(32, 0x323B0), (0xE0001, 0xE01F0)]
288289

289290
# Public API
290291
__all__ = ["Completer", "IPCompleter"]
@@ -972,7 +973,7 @@ class Completer(Configurable):
972973
help="""Activate greedy completion.
973974
974975
.. deprecated:: 8.8
975-
Use :any:`Completer.evaluation` and :any:`Completer.auto_close_dict_keys` instead.
976+
Use :std:configtrait:`Completer.evaluation` and :std:configtrait:`Completer.auto_close_dict_keys` instead.
976977
977978
When enabled in IPython 8.8 or newer, changes configuration as follows:
978979

IPython/core/release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# release. 'dev' as a _version_extra string means this is a development
1717
# version
1818
_version_major = 8
19-
_version_minor = 8
19+
_version_minor = 9
2020
_version_patch = 0
2121
_version_extra = ".dev"
2222
# _version_extra = "rc1"

IPython/core/tests/test_completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_unicode_range():
9999
assert len_exp == len_test, message
100100

101101
# fail if new unicode symbols have been added.
102-
assert len_exp <= 138552, message
102+
assert len_exp <= 143041, message
103103

104104

105105
@contextmanager

IPython/extensions/tests/test_autoreload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ class TestEnum(Enum):
369369
self.shell.run_code("assert func2() == 'changed'")
370370
self.shell.run_code("t = Test(); assert t.new_func() == 'changed'")
371371
self.shell.run_code("assert number == 1")
372-
self.shell.run_code("assert TestEnum.B.value == 'added'")
372+
if sys.version_info < (3, 12):
373+
self.shell.run_code("assert TestEnum.B.value == 'added'")
373374

374375
# ----------- TEST IMPORT FROM MODULE --------------------------
375376

IPython/lib/tests/test_lexers.py

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
# Distributed under the terms of the Modified BSD License.
55

66
from unittest import TestCase
7+
from pygments import __version__ as pygments_version
78
from pygments.token import Token
89
from pygments.lexers import BashLexer
910

1011
from .. import lexers
1112

13+
pyg214 = tuple(int(x) for x in pygments_version.split(".")[:2]) >= (2, 14)
14+
1215

1316
class TestLexers(TestCase):
1417
"""Collection of lexers tests"""
@@ -18,34 +21,35 @@ def setUp(self):
1821

1922
def testIPythonLexer(self):
2023
fragment = '!echo $HOME\n'
21-
tokens = [
24+
bash_tokens = [
2225
(Token.Operator, '!'),
2326
]
24-
tokens.extend(self.bash_lexer.get_tokens(fragment[1:]))
25-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
27+
bash_tokens.extend(self.bash_lexer.get_tokens(fragment[1:]))
28+
ipylex_token = list(self.lexer.get_tokens(fragment))
29+
assert bash_tokens[:-1] == ipylex_token[:-1]
2630

27-
fragment_2 = '!' + fragment
31+
fragment_2 = "!" + fragment
2832
tokens_2 = [
2933
(Token.Operator, '!!'),
30-
] + tokens[1:]
31-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
34+
] + bash_tokens[1:]
35+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
3236

3337
fragment_2 = '\t %%!\n' + fragment[1:]
3438
tokens_2 = [
3539
(Token.Text, '\t '),
3640
(Token.Operator, '%%!'),
3741
(Token.Text, '\n'),
38-
] + tokens[1:]
39-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
42+
] + bash_tokens[1:]
43+
assert tokens_2 == list(self.lexer.get_tokens(fragment_2))
4044

4145
fragment_2 = 'x = ' + fragment
4246
tokens_2 = [
4347
(Token.Name, 'x'),
4448
(Token.Text, ' '),
4549
(Token.Operator, '='),
4650
(Token.Text, ' '),
47-
] + tokens
48-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
51+
] + bash_tokens
52+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
4953

5054
fragment_2 = 'x, = ' + fragment
5155
tokens_2 = [
@@ -54,8 +58,8 @@ def testIPythonLexer(self):
5458
(Token.Text, ' '),
5559
(Token.Operator, '='),
5660
(Token.Text, ' '),
57-
] + tokens
58-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
61+
] + bash_tokens
62+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
5963

6064
fragment_2 = 'x, = %sx ' + fragment[1:]
6165
tokens_2 = [
@@ -67,8 +71,10 @@ def testIPythonLexer(self):
6771
(Token.Operator, '%'),
6872
(Token.Keyword, 'sx'),
6973
(Token.Text, ' '),
70-
] + tokens[1:]
71-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
74+
] + bash_tokens[1:]
75+
if tokens_2[7] == (Token.Text, " ") and pyg214: # pygments 2.14+
76+
tokens_2[7] = (Token.Text.Whitespace, " ")
77+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
7278

7379
fragment_2 = 'f = %R function () {}\n'
7480
tokens_2 = [
@@ -80,7 +86,7 @@ def testIPythonLexer(self):
8086
(Token.Keyword, 'R'),
8187
(Token.Text, ' function () {}\n'),
8288
]
83-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
89+
assert tokens_2 == list(self.lexer.get_tokens(fragment_2))
8490

8591
fragment_2 = '\t%%xyz\n$foo\n'
8692
tokens_2 = [
@@ -89,7 +95,7 @@ def testIPythonLexer(self):
8995
(Token.Keyword, 'xyz'),
9096
(Token.Text, '\n$foo\n'),
9197
]
92-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
98+
assert tokens_2 == list(self.lexer.get_tokens(fragment_2))
9399

94100
fragment_2 = '%system?\n'
95101
tokens_2 = [
@@ -98,7 +104,7 @@ def testIPythonLexer(self):
98104
(Token.Operator, '?'),
99105
(Token.Text, '\n'),
100106
]
101-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
107+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
102108

103109
fragment_2 = 'x != y\n'
104110
tokens_2 = [
@@ -109,7 +115,7 @@ def testIPythonLexer(self):
109115
(Token.Name, 'y'),
110116
(Token.Text, '\n'),
111117
]
112-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
118+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
113119

114120
fragment_2 = ' ?math.sin\n'
115121
tokens_2 = [
@@ -118,15 +124,15 @@ def testIPythonLexer(self):
118124
(Token.Text, 'math.sin'),
119125
(Token.Text, '\n'),
120126
]
121-
self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
127+
assert tokens_2[:-1] == list(self.lexer.get_tokens(fragment_2))[:-1]
122128

123129
fragment = ' *int*?\n'
124130
tokens = [
125131
(Token.Text, ' *int*'),
126132
(Token.Operator, '?'),
127133
(Token.Text, '\n'),
128134
]
129-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
135+
assert tokens == list(self.lexer.get_tokens(fragment))
130136

131137
fragment = '%%writefile -a foo.py\nif a == b:\n pass'
132138
tokens = [
@@ -145,7 +151,9 @@ def testIPythonLexer(self):
145151
(Token.Keyword, 'pass'),
146152
(Token.Text, '\n'),
147153
]
148-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
154+
if tokens[10] == (Token.Text, "\n") and pyg214: # pygments 2.14+
155+
tokens[10] = (Token.Text.Whitespace, "\n")
156+
assert tokens[:-1] == list(self.lexer.get_tokens(fragment))[:-1]
149157

150158
fragment = '%%timeit\nmath.sin(0)'
151159
tokens = [
@@ -173,4 +181,4 @@ def testIPythonLexer(self):
173181
(Token.Punctuation, '>'),
174182
(Token.Text, '\n'),
175183
]
176-
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
184+
assert tokens == list(self.lexer.get_tokens(fragment))

IPython/terminal/shortcuts.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,15 @@ def reformat_and_execute(event):
6868
reformat_text_before_cursor(event.current_buffer, event.current_buffer.document, shell)
6969
event.current_buffer.validate_and_handle()
7070

71-
kb.add('escape', 'enter', filter=(has_focus(DEFAULT_BUFFER)
72-
& ~has_selection
73-
& insert_mode
74-
))(reformat_and_execute)
71+
@Condition
72+
def ebivim():
73+
return shell.emacs_bindings_in_vi_insert_mode
74+
75+
kb.add(
76+
"escape",
77+
"enter",
78+
filter=(has_focus(DEFAULT_BUFFER) & ~has_selection & insert_mode & ebivim),
79+
)(reformat_and_execute)
7580

7681
kb.add("c-\\")(quit)
7782

@@ -333,10 +338,6 @@ def _(event):
333338
if sys.platform == "win32":
334339
kb.add("c-v", filter=(has_focus(DEFAULT_BUFFER) & ~vi_mode))(win_paste)
335340

336-
@Condition
337-
def ebivim():
338-
return shell.emacs_bindings_in_vi_insert_mode
339-
340341
focused_insert_vi = has_focus(DEFAULT_BUFFER) & vi_insert_mode
341342

342343
@kb.add("end", filter=has_focus(DEFAULT_BUFFER) & (ebivim | ~vi_insert_mode))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy