Skip to content

Commit

Permalink
Merge pull request #2024 from PyCQA/tests/add-python-3.11
Browse files Browse the repository at this point in the history
Add Python 3.11 support
  • Loading branch information
staticdev committed Dec 11, 2022
2 parents f547290 + e321a67 commit d15f363
Show file tree
Hide file tree
Showing 14 changed files with 668 additions and 602 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -27,6 +27,7 @@ npm-debug.log
# Unit test / coverage reports
.coverage
.coverage.*
coverage.xml
.pytest_cache
.tox
nosetests.xml
Expand Down Expand Up @@ -68,6 +69,7 @@ atlassian-ide-plugin.xml
pip-selfcheck.json

# Python3 Venv Files
.python-version
.venv/
pyvenv.cfg

Expand Down
2 changes: 1 addition & 1 deletion isort/_vendored/tomli/_re.py
Expand Up @@ -32,7 +32,7 @@
)
RE_LOCALTIME = re.compile(_TIME_RE_STR)
RE_DATETIME = re.compile(
fr"""
rf"""
([0-9]{{4}})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) # date, e.g. 1988-10-27
(?:
[T ]
Expand Down
2 changes: 1 addition & 1 deletion isort/io.py
Expand Up @@ -9,7 +9,7 @@
from isort._future import dataclass
from isort.exceptions import UnsupportedEncoding

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


@dataclass(frozen=True)
Expand Down
4 changes: 2 additions & 2 deletions isort/settings.py
Expand Up @@ -50,7 +50,7 @@
else:
from ._vendored import tomli

_SHEBANG_RE = re.compile(br"^#!.*\bpython[23w]?\b")
_SHEBANG_RE = re.compile(rb"^#!.*\bpython[23w]?\b")
CYTHON_EXTENSIONS = frozenset({"pyx", "pxd"})
SUPPORTED_EXTENSIONS = frozenset({"py", "pyi", *CYTHON_EXTENSIONS})
BLOCKED_EXTENSIONS = frozenset({"pex"})
Expand Down Expand Up @@ -251,7 +251,7 @@ def __post_init__(self) -> None:
if sys.version_info.major == 2 and sys.version_info.minor <= 6:
py_version = "2"
elif sys.version_info.major == 3 and (
sys.version_info.minor <= 5 or sys.version_info.minor >= 10
sys.version_info.minor <= 6 or sys.version_info.minor >= 11
):
py_version = "3"
else:
Expand Down
2 changes: 1 addition & 1 deletion isort/sorting.py
Expand Up @@ -75,7 +75,7 @@ def section_key(line: str, config: Config) -> str:
line = re.sub("^import ", "", line)
if config.sort_relative_in_force_sorted_sections:
sep = " " if config.reverse_relative else "_"
line = re.sub(r"^(\.+)", fr"\1{sep}", line)
line = re.sub(r"^(\.+)", rf"\1{sep}", line)
if line.split(" ")[0] in config.force_to_top:
section = "A"
# * If honor_case_in_force_sorted_sections is true, and case_sensitive and
Expand Down
1 change: 1 addition & 0 deletions isort/stdlibs/py310.py
Expand Up @@ -82,6 +82,7 @@
"hmac",
"html",
"http",
"idlelib",
"imaplib",
"imghdr",
"imp",
Expand Down
222 changes: 222 additions & 0 deletions isort/stdlibs/py311.py
@@ -0,0 +1,222 @@
"""
File contains the standard library of Python 3.11.
DO NOT EDIT. If the standard library changes, a new list should be created
using the mkstdlibs.py script.
"""

stdlib = {
"_ast",
"_thread",
"abc",
"aifc",
"argparse",
"array",
"ast",
"asynchat",
"asyncio",
"asyncore",
"atexit",
"audioop",
"base64",
"bdb",
"binascii",
"bisect",
"builtins",
"bz2",
"cProfile",
"calendar",
"cgi",
"cgitb",
"chunk",
"cmath",
"cmd",
"code",
"codecs",
"codeop",
"collections",
"colorsys",
"compileall",
"concurrent",
"configparser",
"contextlib",
"contextvars",
"copy",
"copyreg",
"crypt",
"csv",
"ctypes",
"curses",
"dataclasses",
"datetime",
"dbm",
"decimal",
"difflib",
"dis",
"distutils",
"doctest",
"email",
"encodings",
"ensurepip",
"enum",
"errno",
"faulthandler",
"fcntl",
"filecmp",
"fileinput",
"fnmatch",
"fractions",
"ftplib",
"functools",
"gc",
"getopt",
"getpass",
"gettext",
"glob",
"graphlib",
"grp",
"gzip",
"hashlib",
"heapq",
"hmac",
"html",
"http",
"idlelib",
"imaplib",
"imghdr",
"imp",
"importlib",
"inspect",
"io",
"ipaddress",
"itertools",
"json",
"keyword",
"lib2to3",
"linecache",
"locale",
"logging",
"lzma",
"mailbox",
"mailcap",
"marshal",
"math",
"mimetypes",
"mmap",
"modulefinder",
"msilib",
"msvcrt",
"multiprocessing",
"netrc",
"nis",
"nntplib",
"ntpath",
"numbers",
"operator",
"optparse",
"os",
"ossaudiodev",
"pathlib",
"pdb",
"pickle",
"pickletools",
"pipes",
"pkgutil",
"platform",
"plistlib",
"poplib",
"posix",
"posixpath",
"pprint",
"profile",
"pstats",
"pty",
"pwd",
"py_compile",
"pyclbr",
"pydoc",
"queue",
"quopri",
"random",
"re",
"readline",
"reprlib",
"resource",
"rlcompleter",
"runpy",
"sched",
"secrets",
"select",
"selectors",
"shelve",
"shlex",
"shutil",
"signal",
"site",
"smtpd",
"smtplib",
"sndhdr",
"socket",
"socketserver",
"spwd",
"sqlite3",
"sre",
"sre_compile",
"sre_constants",
"sre_parse",
"ssl",
"stat",
"statistics",
"string",
"stringprep",
"struct",
"subprocess",
"sunau",
"symtable",
"sys",
"sysconfig",
"syslog",
"tabnanny",
"tarfile",
"telnetlib",
"tempfile",
"termios",
"test",
"textwrap",
"threading",
"time",
"timeit",
"tkinter",
"token",
"tokenize",
"tomllib",
"trace",
"traceback",
"tracemalloc",
"tty",
"turtle",
"turtledemo",
"types",
"typing",
"unicodedata",
"unittest",
"urllib",
"uu",
"uuid",
"venv",
"warnings",
"wave",
"weakref",
"webbrowser",
"winreg",
"winsound",
"wsgiref",
"xdrlib",
"xml",
"xmlrpc",
"zipapp",
"zipfile",
"zipimport",
"zlib",
"zoneinfo",
}

0 comments on commit d15f363

Please sign in to comment.