Skip to content

Commit a05b542

Browse files
committed
Update pyupgrade version to py3.9+
This update applies various source tree changes as well.
1 parent 1062838 commit a05b542

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
rev: v3.20.0
2121
hooks:
2222
- id: pyupgrade
23-
args: ["--py38-plus"]
23+
args: ["--py39-plus"]
2424
- repo: https://github.com/psf/black-pre-commit-mirror
2525
rev: 25.9.0
2626
hooks:

src/globus_sdk/_internal/extensions/sphinxext/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def derive_doc_url_base(service: str | None) -> str:
6161
raise ValueError(f"Unsupported extdoclink service '{service}'")
6262

6363

64-
@functools.lru_cache(maxsize=None)
64+
@functools.cache
6565
def read_sphinx_params(docstring: str) -> tuple[str, ...]:
6666
"""
6767
Given a docstring, extract the `:param:` declarations into a tuple of strings.

src/globus_sdk/_internal/lazy_import.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,9 @@ def _load_statement(self, statement: ast.AST) -> None:
220220
def _parse_pyi_ast(anchor_module_name: str, pyi_filename: str) -> ast.Module:
221221
import importlib.resources
222222

223-
if sys.version_info >= (3, 9):
224-
source = (
225-
importlib.resources.files(anchor_module_name) # pylint: disable=no-member
226-
.joinpath(pyi_filename)
227-
.read_bytes()
228-
)
229-
else:
230-
source = importlib.resources.read_binary( # pylint: disable=deprecated-method
231-
anchor_module_name, pyi_filename
232-
)
223+
source = (
224+
importlib.resources.files(anchor_module_name) # pylint: disable=no-member
225+
.joinpath(pyi_filename)
226+
.read_bytes()
227+
)
233228
return ast.parse(source)

src/globus_sdk/login_flows/local_server_login_flow_manager/local_server.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import annotations
99

10+
import importlib.resources
1011
import os
1112
import queue
1213
import socket
@@ -21,15 +22,10 @@
2122
from . import html_files
2223
from .errors import LocalServerLoginError
2324

24-
if sys.version_info >= (3, 9):
25-
import importlib.resources as importlib_resources
26-
else: # Python < 3.9
27-
import importlib_resources
28-
2925
_IS_WINDOWS = os.name == "nt"
3026

3127
DEFAULT_HTML_TEMPLATE = Template(
32-
importlib_resources.files(html_files)
28+
importlib.resources.files(html_files)
3329
.joinpath("local_server_landing_page.html")
3430
.read_text()
3531
)

0 commit comments

Comments
 (0)