Skip to content

Commit 395f118

Browse files
committed
ruff check --select UP --target-version py310 --fix
1 parent 035b5c2 commit 395f118

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

ci-matrix.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def meets_conditional_version(version: str, min_version: str) -> bool:
3939
return Version(version) >= Version(min_version)
4040

4141

42-
def parse_labels(labels: Optional[str]) -> dict[str, set[str]]:
42+
def parse_labels(labels: str | None) -> dict[str, set[str]]:
4343
"""Parse labels into a dict of category filters."""
4444
if not labels:
4545
return {}
@@ -106,7 +106,7 @@ def should_include_entry(entry: dict[str, str], filters: dict[str, set[str]]) ->
106106

107107
def generate_docker_matrix_entries(
108108
runners: dict[str, Any],
109-
platform_filter: Optional[str] = None,
109+
platform_filter: str | None = None,
110110
) -> list[dict[str, str]]:
111111
"""Generate matrix entries for docker image builds."""
112112
if platform_filter and platform_filter != "linux":
@@ -132,7 +132,7 @@ def generate_crate_build_matrix_entries(
132132
runners: dict[str, Any],
133133
config: dict[str, Any],
134134
force_crate_build: bool = False,
135-
platform_filter: Optional[str] = None,
135+
platform_filter: str | None = None,
136136
) -> list[dict[str, str]]:
137137
"""Generate matrix entries for crate builds based on python build matrix."""
138138
needed_builds = set()
@@ -181,8 +181,8 @@ def generate_crate_build_matrix_entries(
181181
def generate_python_build_matrix_entries(
182182
config: dict[str, Any],
183183
runners: dict[str, Any],
184-
platform_filter: Optional[str] = None,
185-
label_filters: Optional[dict[str, set[str]]] = None,
184+
platform_filter: str | None = None,
185+
label_filters: dict[str, set[str]] | None = None,
186186
) -> list[dict[str, str]]:
187187
"""Generate matrix entries for python builds."""
188188
matrix_entries = []
@@ -348,10 +348,10 @@ def main() -> None:
348348
args = parse_args()
349349
labels = parse_labels(args.labels)
350350

351-
with open(CI_TARGETS_YAML, "r") as f:
351+
with open(CI_TARGETS_YAML) as f:
352352
config = yaml.safe_load(f)
353353

354-
with open(CI_RUNNERS_YAML, "r") as f:
354+
with open(CI_RUNNERS_YAML) as f:
355355
runners = yaml.safe_load(f)
356356

357357
# If only free runners are allowed, reduce to a subset

cpython-unix/build.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,7 @@ def python_build_info(
483483
arch = platform.removeprefix("linux_")
484484

485485
bi["core"]["static_lib"] = (
486-
"install/lib/python{version}/config-{version}{binary_suffix}-{arch}-linux-gnu/libpython{version}{binary_suffix}.a".format(
487-
version=version,
488-
binary_suffix=binary_suffix,
489-
arch=arch,
490-
)
486+
f"install/lib/python{version}/config-{version}{binary_suffix}-{arch}-linux-gnu/libpython{version}{binary_suffix}.a"
491487
)
492488

493489
if not static:
@@ -508,9 +504,7 @@ def python_build_info(
508504
object_file_format = "elf"
509505
elif platform.startswith("macos_"):
510506
bi["core"]["static_lib"] = (
511-
"install/lib/python{version}/config-{version}{binary_suffix}-darwin/libpython{version}{binary_suffix}.a".format(
512-
version=version, binary_suffix=binary_suffix
513-
)
507+
f"install/lib/python{version}/config-{version}{binary_suffix}-darwin/libpython{version}{binary_suffix}.a"
514508
)
515509
bi["core"]["shared_lib"] = "install/lib/libpython%s%s.dylib" % (
516510
version,

pythonbuild/buildenv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
)
2424

2525

26-
class ContainerContext(object):
26+
class ContainerContext:
2727
def __init__(self, container):
2828
self.container = container
2929

@@ -139,7 +139,7 @@ def find_output_files(self, base_path, pattern):
139139
yield line[len("/build/out/%s/" % base_path) :].decode("ascii")
140140

141141

142-
class TempdirContext(object):
142+
class TempdirContext:
143143
def __init__(self, td):
144144
self.td = pathlib.Path(td)
145145

pythonbuild/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def add_env_common(env):
569569

570570
env_path = os.path.expanduser("~/.python-build-standalone-env")
571571
try:
572-
with open(env_path, "r") as fh:
572+
with open(env_path) as fh:
573573
for line in fh:
574574
line = line.strip()
575575
if line.startswith("#"):

0 commit comments

Comments
 (0)