Skip to content

Commit d15f363

Browse files
authored
Merge pull request #2024 from PyCQA/tests/add-python-3.11
Add Python 3.11 support
2 parents f547290 + e321a67 commit d15f363

File tree

14 files changed

+668
-602
lines changed

14 files changed

+668
-602
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
python-version: ["3.7", "3.8", "3.9", "3.10"]
11+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1212
os: [ubuntu-latest, macos-latest, windows-latest]
1313

1414
steps:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ npm-debug.log
2727
# Unit test / coverage reports
2828
.coverage
2929
.coverage.*
30+
coverage.xml
3031
.pytest_cache
3132
.tox
3233
nosetests.xml
@@ -68,6 +69,7 @@ atlassian-ide-plugin.xml
6869
pip-selfcheck.json
6970

7071
# Python3 Venv Files
72+
.python-version
7173
.venv/
7274
pyvenv.cfg
7375

isort/_vendored/tomli/_re.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333
RE_LOCALTIME = re.compile(_TIME_RE_STR)
3434
RE_DATETIME = re.compile(
35-
fr"""
35+
rf"""
3636
([0-9]{{4}})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) # date, e.g. 1988-10-27
3737
(?:
3838
[T ]

isort/io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from isort._future import dataclass
1010
from isort.exceptions import UnsupportedEncoding
1111

12-
_ENCODING_PATTERN = re.compile(br"^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)")
12+
_ENCODING_PATTERN = re.compile(rb"^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)")
1313

1414

1515
@dataclass(frozen=True)

isort/settings.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
else:
5151
from ._vendored import tomli
5252

53-
_SHEBANG_RE = re.compile(br"^#!.*\bpython[23w]?\b")
53+
_SHEBANG_RE = re.compile(rb"^#!.*\bpython[23w]?\b")
5454
CYTHON_EXTENSIONS = frozenset({"pyx", "pxd"})
5555
SUPPORTED_EXTENSIONS = frozenset({"py", "pyi", *CYTHON_EXTENSIONS})
5656
BLOCKED_EXTENSIONS = frozenset({"pex"})
@@ -251,7 +251,7 @@ def __post_init__(self) -> None:
251251
if sys.version_info.major == 2 and sys.version_info.minor <= 6:
252252
py_version = "2"
253253
elif sys.version_info.major == 3 and (
254-
sys.version_info.minor <= 5 or sys.version_info.minor >= 10
254+
sys.version_info.minor <= 6 or sys.version_info.minor >= 11
255255
):
256256
py_version = "3"
257257
else:

isort/sorting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def section_key(line: str, config: Config) -> str:
7575
line = re.sub("^import ", "", line)
7676
if config.sort_relative_in_force_sorted_sections:
7777
sep = " " if config.reverse_relative else "_"
78-
line = re.sub(r"^(\.+)", fr"\1{sep}", line)
78+
line = re.sub(r"^(\.+)", rf"\1{sep}", line)
7979
if line.split(" ")[0] in config.force_to_top:
8080
section = "A"
8181
# * If honor_case_in_force_sorted_sections is true, and case_sensitive and

isort/stdlibs/py310.py

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"hmac",
8383
"html",
8484
"http",
85+
"idlelib",
8586
"imaplib",
8687
"imghdr",
8788
"imp",

isort/stdlibs/py311.py

+222
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
"""
2+
File contains the standard library of Python 3.11.
3+
4+
DO NOT EDIT. If the standard library changes, a new list should be created
5+
using the mkstdlibs.py script.
6+
"""
7+
8+
stdlib = {
9+
"_ast",
10+
"_thread",
11+
"abc",
12+
"aifc",
13+
"argparse",
14+
"array",
15+
"ast",
16+
"asynchat",
17+
"asyncio",
18+
"asyncore",
19+
"atexit",
20+
"audioop",
21+
"base64",
22+
"bdb",
23+
"binascii",
24+
"bisect",
25+
"builtins",
26+
"bz2",
27+
"cProfile",
28+
"calendar",
29+
"cgi",
30+
"cgitb",
31+
"chunk",
32+
"cmath",
33+
"cmd",
34+
"code",
35+
"codecs",
36+
"codeop",
37+
"collections",
38+
"colorsys",
39+
"compileall",
40+
"concurrent",
41+
"configparser",
42+
"contextlib",
43+
"contextvars",
44+
"copy",
45+
"copyreg",
46+
"crypt",
47+
"csv",
48+
"ctypes",
49+
"curses",
50+
"dataclasses",
51+
"datetime",
52+
"dbm",
53+
"decimal",
54+
"difflib",
55+
"dis",
56+
"distutils",
57+
"doctest",
58+
"email",
59+
"encodings",
60+
"ensurepip",
61+
"enum",
62+
"errno",
63+
"faulthandler",
64+
"fcntl",
65+
"filecmp",
66+
"fileinput",
67+
"fnmatch",
68+
"fractions",
69+
"ftplib",
70+
"functools",
71+
"gc",
72+
"getopt",
73+
"getpass",
74+
"gettext",
75+
"glob",
76+
"graphlib",
77+
"grp",
78+
"gzip",
79+
"hashlib",
80+
"heapq",
81+
"hmac",
82+
"html",
83+
"http",
84+
"idlelib",
85+
"imaplib",
86+
"imghdr",
87+
"imp",
88+
"importlib",
89+
"inspect",
90+
"io",
91+
"ipaddress",
92+
"itertools",
93+
"json",
94+
"keyword",
95+
"lib2to3",
96+
"linecache",
97+
"locale",
98+
"logging",
99+
"lzma",
100+
"mailbox",
101+
"mailcap",
102+
"marshal",
103+
"math",
104+
"mimetypes",
105+
"mmap",
106+
"modulefinder",
107+
"msilib",
108+
"msvcrt",
109+
"multiprocessing",
110+
"netrc",
111+
"nis",
112+
"nntplib",
113+
"ntpath",
114+
"numbers",
115+
"operator",
116+
"optparse",
117+
"os",
118+
"ossaudiodev",
119+
"pathlib",
120+
"pdb",
121+
"pickle",
122+
"pickletools",
123+
"pipes",
124+
"pkgutil",
125+
"platform",
126+
"plistlib",
127+
"poplib",
128+
"posix",
129+
"posixpath",
130+
"pprint",
131+
"profile",
132+
"pstats",
133+
"pty",
134+
"pwd",
135+
"py_compile",
136+
"pyclbr",
137+
"pydoc",
138+
"queue",
139+
"quopri",
140+
"random",
141+
"re",
142+
"readline",
143+
"reprlib",
144+
"resource",
145+
"rlcompleter",
146+
"runpy",
147+
"sched",
148+
"secrets",
149+
"select",
150+
"selectors",
151+
"shelve",
152+
"shlex",
153+
"shutil",
154+
"signal",
155+
"site",
156+
"smtpd",
157+
"smtplib",
158+
"sndhdr",
159+
"socket",
160+
"socketserver",
161+
"spwd",
162+
"sqlite3",
163+
"sre",
164+
"sre_compile",
165+
"sre_constants",
166+
"sre_parse",
167+
"ssl",
168+
"stat",
169+
"statistics",
170+
"string",
171+
"stringprep",
172+
"struct",
173+
"subprocess",
174+
"sunau",
175+
"symtable",
176+
"sys",
177+
"sysconfig",
178+
"syslog",
179+
"tabnanny",
180+
"tarfile",
181+
"telnetlib",
182+
"tempfile",
183+
"termios",
184+
"test",
185+
"textwrap",
186+
"threading",
187+
"time",
188+
"timeit",
189+
"tkinter",
190+
"token",
191+
"tokenize",
192+
"tomllib",
193+
"trace",
194+
"traceback",
195+
"tracemalloc",
196+
"tty",
197+
"turtle",
198+
"turtledemo",
199+
"types",
200+
"typing",
201+
"unicodedata",
202+
"unittest",
203+
"urllib",
204+
"uu",
205+
"uuid",
206+
"venv",
207+
"warnings",
208+
"wave",
209+
"weakref",
210+
"webbrowser",
211+
"winreg",
212+
"winsound",
213+
"wsgiref",
214+
"xdrlib",
215+
"xml",
216+
"xmlrpc",
217+
"zipapp",
218+
"zipfile",
219+
"zipimport",
220+
"zlib",
221+
"zoneinfo",
222+
}

0 commit comments

Comments
 (0)