fix: minor ruff updates (#1649)

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner
2023-10-26 10:57:23 -04:00
committed by GitHub
parent c4fdf66efc
commit 1efccd03b5
5 changed files with 24 additions and 14 deletions
+2 -2
View File
@@ -14,12 +14,12 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/psf/black-pre-commit-mirror - repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.0 rev: 23.10.1
hooks: hooks:
- id: black - id: black
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1 rev: v0.1.2
hooks: hooks:
- id: ruff - id: ruff
args: ["--fix", "--show-fixes"] args: ["--fix", "--show-fixes"]
+7 -2
View File
@@ -7,7 +7,7 @@ import shutil
import sys import sys
import textwrap import textwrap
import time import time
from collections import namedtuple import typing
from glob import glob from glob import glob
from pathlib import Path from pathlib import Path
from subprocess import run from subprocess import run
@@ -34,7 +34,12 @@ def generate_basic_project(path):
project.generate(path) project.generate(path)
CIService = namedtuple("CIService", "name dst_config_path badge_md") class CIService(typing.NamedTuple):
name: str
dst_config_path: str
badge_md: str
services = [ services = [
CIService( CIService(
name="appveyor", name="appveyor",
+3 -2
View File
@@ -3,11 +3,12 @@ from __future__ import annotations
import sys import sys
if sys.version_info < (3, 11): if sys.version_info < (3, 11):
from typing_extensions import NotRequired, assert_never from typing_extensions import NotRequired, Self, assert_never
else: else:
from typing import NotRequired, assert_never from typing import NotRequired, Self, assert_never
__all__ = ( __all__ = (
"assert_never", "assert_never",
"NotRequired", "NotRequired",
"Self",
) )
+2 -1
View File
@@ -16,6 +16,7 @@ from pathlib import Path, PurePath, PurePosixPath
from types import TracebackType from types import TracebackType
from typing import IO, Dict, Literal from typing import IO, Dict, Literal
from ._compat.typing import Self
from .typing import PathOrStr, PopenBytes from .typing import PathOrStr, PopenBytes
from .util import ( from .util import (
CIProvider, CIProvider,
@@ -105,7 +106,7 @@ class OCIContainer:
self.name: str | None = None self.name: str | None = None
self.engine = engine self.engine = engine
def __enter__(self) -> OCIContainer: def __enter__(self) -> Self:
self.name = f"cibuildwheel-{uuid.uuid4()}" self.name = f"cibuildwheel-{uuid.uuid4()}"
# work-around for Travis-CI PPC64le Docker runs since 2021: # work-around for Travis-CI PPC64le Docker runs since 2021:
+10 -7
View File
@@ -115,8 +115,10 @@ messages_control.disable = [
] ]
[tool.ruff] [tool.ruff]
select = [ target-version = "py38"
"E", "F", "W", # flake8
[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear "B", # flake8-bugbear
"I", # isort "I", # isort
"ARG", # flake8-unused-arguments "ARG", # flake8-unused-arguments
@@ -136,19 +138,20 @@ select = [
"UP", # pyupgrade "UP", # pyupgrade
"YTT", # flake8-2020 "YTT", # flake8-2020
"EXE", # flake8-executable "EXE", # flake8-executable
"PYI", # flake8-pyi
] ]
extend-ignore = [ ignore = [
"PLR", # Design related pylint codes "PLR", # Design related pylint codes
"E501", # Line too long "E501", # Line too long
"RET504", "RET505", "RET508", # else after control flow "RET504", "RET505", "RET508", # else after control flow
"PT004", # Rename suggested for returnless fixtures "PT004", # Rename suggested for returnless fixtures
"PT007", # False positive (fixed upstream) "PT007", # False positive
"PYI025", # Set as AbstractSet
] ]
target-version = "py38"
typing-modules = ["cibuildwheel._compat.typing"] typing-modules = ["cibuildwheel._compat.typing"]
flake8-unused-arguments.ignore-variadic-names = true flake8-unused-arguments.ignore-variadic-names = true
[tool.ruff.flake8-tidy-imports.banned-api] [tool.ruff.lint.flake8-tidy-imports.banned-api]
"typing.Mapping".msg = "Use collections.abc.Mapping instead." "typing.Mapping".msg = "Use collections.abc.Mapping instead."
"typing.Callable".msg = "Use collections.abc.Callable instead." "typing.Callable".msg = "Use collections.abc.Callable instead."
"typing.Iterator".msg = "Use collections.abc.Iterator instead." "typing.Iterator".msg = "Use collections.abc.Iterator instead."
@@ -159,6 +162,6 @@ flake8-unused-arguments.ignore-variadic-names = true
"tomllib".msg = "Use cibuildwheel._compat.tomllib instead." "tomllib".msg = "Use cibuildwheel._compat.tomllib instead."
"tomli".msg = "Use cibuildwheel._compat.tomllib instead." "tomli".msg = "Use cibuildwheel._compat.tomllib instead."
[tool.ruff.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"unit_test/*" = ["PLC1901"] "unit_test/*" = ["PLC1901"]
"cibuildwheel/_compat/**.py" = ["TID251"] "cibuildwheel/_compat/**.py" = ["TID251"]