diff --git a/poetry.lock b/poetry.lock index ee6ab06c9..585abdc7d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2866,29 +2866,29 @@ files = [ [[package]] name = "ruff" -version = "0.7.4" +version = "0.9.2" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.7.4-py3-none-linux_armv6l.whl", hash = "sha256:a4919925e7684a3f18e18243cd6bea7cfb8e968a6eaa8437971f681b7ec51478"}, - {file = "ruff-0.7.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:cfb365c135b830778dda8c04fb7d4280ed0b984e1aec27f574445231e20d6c63"}, - {file = "ruff-0.7.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:63a569b36bc66fbadec5beaa539dd81e0527cb258b94e29e0531ce41bacc1f20"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d06218747d361d06fd2fdac734e7fa92df36df93035db3dc2ad7aa9852cb109"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e0cea28d0944f74ebc33e9f934238f15c758841f9f5edd180b5315c203293452"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:80094ecd4793c68b2571b128f91754d60f692d64bc0d7272ec9197fdd09bf9ea"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:997512325c6620d1c4c2b15db49ef59543ef9cd0f4aa8065ec2ae5103cedc7e7"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00b4cf3a6b5fad6d1a66e7574d78956bbd09abfd6c8a997798f01f5da3d46a05"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7dbdc7d8274e1422722933d1edddfdc65b4336abf0b16dfcb9dedd6e6a517d06"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e92dfb5f00eaedb1501b2f906ccabfd67b2355bdf117fea9719fc99ac2145bc"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3bd726099f277d735dc38900b6a8d6cf070f80828877941983a57bca1cd92172"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2e32829c429dd081ee5ba39aef436603e5b22335c3d3fff013cd585806a6486a"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:662a63b4971807623f6f90c1fb664613f67cc182dc4d991471c23c541fee62dd"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:876f5e09eaae3eb76814c1d3b68879891d6fde4824c015d48e7a7da4cf066a3a"}, - {file = "ruff-0.7.4-py3-none-win32.whl", hash = "sha256:75c53f54904be42dd52a548728a5b572344b50d9b2873d13a3f8c5e3b91f5cac"}, - {file = "ruff-0.7.4-py3-none-win_amd64.whl", hash = "sha256:745775c7b39f914238ed1f1b0bebed0b9155a17cd8bc0b08d3c87e4703b990d6"}, - {file = "ruff-0.7.4-py3-none-win_arm64.whl", hash = "sha256:11bff065102c3ae9d3ea4dc9ecdfe5a5171349cdd0787c1fc64761212fc9cf1f"}, - {file = "ruff-0.7.4.tar.gz", hash = "sha256:cd12e35031f5af6b9b93715d8c4f40360070b2041f81273d0527683d5708fce2"}, + {file = "ruff-0.9.2-py3-none-linux_armv6l.whl", hash = "sha256:80605a039ba1454d002b32139e4970becf84b5fee3a3c3bf1c2af6f61a784347"}, + {file = "ruff-0.9.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b9aab82bb20afd5f596527045c01e6ae25a718ff1784cb92947bff1f83068b00"}, + {file = "ruff-0.9.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:fbd337bac1cfa96be615f6efcd4bc4d077edbc127ef30e2b8ba2a27e18c054d4"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82b35259b0cbf8daa22a498018e300b9bb0174c2bbb7bcba593935158a78054d"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8b6a9701d1e371bf41dca22015c3f89769da7576884d2add7317ec1ec8cb9c3c"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9cc53e68b3c5ae41e8faf83a3b89f4a5d7b2cb666dff4b366bb86ed2a85b481f"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8efd9da7a1ee314b910da155ca7e8953094a7c10d0c0a39bfde3fcfd2a015684"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3292c5a22ea9a5f9a185e2d131dc7f98f8534a32fb6d2ee7b9944569239c648d"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1a605fdcf6e8b2d39f9436d343d1f0ff70c365a1e681546de0104bef81ce88df"}, + {file = "ruff-0.9.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c547f7f256aa366834829a08375c297fa63386cbe5f1459efaf174086b564247"}, + {file = "ruff-0.9.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d18bba3d3353ed916e882521bc3e0af403949dbada344c20c16ea78f47af965e"}, + {file = "ruff-0.9.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b338edc4610142355ccf6b87bd356729b62bf1bc152a2fad5b0c7dc04af77bfe"}, + {file = "ruff-0.9.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:492a5e44ad9b22a0ea98cf72e40305cbdaf27fac0d927f8bc9e1df316dcc96eb"}, + {file = "ruff-0.9.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:af1e9e9fe7b1f767264d26b1075ac4ad831c7db976911fa362d09b2d0356426a"}, + {file = "ruff-0.9.2-py3-none-win32.whl", hash = "sha256:71cbe22e178c5da20e1514e1e01029c73dc09288a8028a5d3446e6bba87a5145"}, + {file = "ruff-0.9.2-py3-none-win_amd64.whl", hash = "sha256:c5e1d6abc798419cf46eed03f54f2e0c3adb1ad4b801119dedf23fcaf69b55b5"}, + {file = "ruff-0.9.2-py3-none-win_arm64.whl", hash = "sha256:a1b63fa24149918f8b37cef2ee6fff81f24f0d74b6f0bdc37bc3e1f2143e41c6"}, + {file = "ruff-0.9.2.tar.gz", hash = "sha256:b5eceb334d55fae5f316f783437392642ae18e16dcf4f1858d55d3c2a0f8f5d0"}, ] [[package]] @@ -3551,4 +3551,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9, <3.13" -content-hash = "e72114f70fd4dc8a756d13069f7eeaa8b0f589d5ce16bc08c1fc378c8fa31e59" +content-hash = "0db7c5865bcafbcaf55d99c3e320f2f41a46a0788798b93462c6e70df201b96d" diff --git a/pyproject.toml b/pyproject.toml index bd602d7e1..0b3449a84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ sphinxcontrib-programoutput = "^0.17" [tool.poetry.group.lint.dependencies] black = "^24.10.0" -ruff = "^0.7.4" +ruff = "^0.9.2" [tool.poetry.group.test.dependencies] coverage = {extras = ["toml"], version = "^7.6.10"} @@ -248,8 +248,6 @@ extend-safe-fixes = [ "UP040", ] ignore = [ - "ANN101", # Missing type annotation for `self` in method - "ANN102", # Missing type annotation for `cls` in classmethod "ANN401", # Dynamically typed expressions (typing.Any) are disallowed # TODO (kyle): improve type annotations "COM812", # Trailing comma missing "D203", # 1 blank line required before class docstring @@ -293,7 +291,6 @@ select = ["ALL"] "N999", # Invalid module name # NOTE (kyle): these are fine here ] "tests/*" = [ - "PT004", # Fixture does not return anything, add leading underscore "S101", # Use of `assert` detected # NOTE (kyle): this is fine here "SLF001", # Private member accessed # NOTE (kyle): fine in tests ] diff --git a/runway/_cli/commands/_gen_sample/__init__.py b/runway/_cli/commands/_gen_sample/__init__.py index 2f8bc1229..f057baf4d 100644 --- a/runway/_cli/commands/_gen_sample/__init__.py +++ b/runway/_cli/commands/_gen_sample/__init__.py @@ -27,8 +27,8 @@ "cfn", "cfngin", "k8s_cfn_repo", - "k8s_tf_repo", "k8s_flux_repo", + "k8s_tf_repo", "sls_py", "sls_tsc", "static_angular", diff --git a/runway/cfngin/blueprints/variables/types.py b/runway/cfngin/blueprints/variables/types.py index 6d1e833be..8ee6755e7 100644 --- a/runway/cfngin/blueprints/variables/types.py +++ b/runway/cfngin/blueprints/variables/types.py @@ -1,4 +1,4 @@ -"""CFNgin blueprint variable types.""" +"""CFNgin blueprint variable types.""" # noqa: A005 from __future__ import annotations diff --git a/runway/cfngin/hooks/awslambda/deployment_package.py b/runway/cfngin/hooks/awslambda/deployment_package.py index 335488134..1412770cd 100644 --- a/runway/cfngin/hooks/awslambda/deployment_package.py +++ b/runway/cfngin/hooks/awslambda/deployment_package.py @@ -61,7 +61,7 @@ class DeploymentPackage(DelCachedPropMixin, Generic[_ProjectTypeVar]): } """Mapping of metadata to the tag-key is is stored in on the S3 object.""" - SIZE_EOCD: Final[Literal[22]] = 22 + SIZE_EOCD: Final = 22 """Size of a zip file's End of Central Directory Record (empty zip).""" ZIPFILE_PERMISSION_MASK: ClassVar[int] = (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) << 16 diff --git a/runway/cfngin/hooks/protocols.py b/runway/cfngin/hooks/protocols.py index 9e0ddbcdf..672c68289 100644 --- a/runway/cfngin/hooks/protocols.py +++ b/runway/cfngin/hooks/protocols.py @@ -30,14 +30,14 @@ class CfnginHookArgsProtocol(Protocol): @overload @abstractmethod - def get(self, __name: str) -> Any | None: ... + def get(self, _name: str) -> Any | None: ... @overload @abstractmethod - def get(self, __name: str, __default: Any | _T) -> Any | _T: ... + def get(self, _name: str, _default: Any | _T) -> Any | _T: ... @abstractmethod - def get(self, __name: str, __default: Any | _T = None) -> Any | _T: + def get(self, _name: str, _default: Any | _T = None) -> Any | _T: """Safely get the value of an attribute. Args: @@ -48,19 +48,19 @@ def get(self, __name: str, __default: Any | _T = None) -> Any | _T: raise NotImplementedError @abstractmethod - def __contains__(self, __name: str) -> bool: # noqa: D105 + def __contains__(self, _name: str) -> bool: # noqa: D105 raise NotImplementedError @abstractmethod - def __getattribute__(self, __name: str) -> Any: # noqa: D105 + def __getattribute__(self, _name: str) -> Any: # noqa: D105 raise NotImplementedError @abstractmethod - def __getitem__(self, __name: str) -> Any: # noqa: D105 + def __getitem__(self, _name: str) -> Any: # noqa: D105 raise NotImplementedError @abstractmethod - def __setitem__(self, __name: str, _value: Any) -> None: # noqa: D105 + def __setitem__(self, _name: str, _value: Any) -> None: # noqa: D105 raise NotImplementedError diff --git a/runway/cfngin/utils.py b/runway/cfngin/utils.py index c04b5b02d..7e54911d4 100644 --- a/runway/cfngin/utils.py +++ b/runway/cfngin/utils.py @@ -913,7 +913,7 @@ def sanitize_git_path(self, uri: str, ref: str | None = None) -> str: Directory name for the supplied uri """ - dir_name = uri[:-4] if uri.endswith(".git") else uri # drop .git + dir_name = uri.removesuffix(".git") # drop .git dir_name = self.sanitize_uri_path(dir_name) if ref is not None: dir_name += f"-{ref}" diff --git a/runway/core/providers/aws/s3/_helpers/sync_strategy/__init__.py b/runway/core/providers/aws/s3/_helpers/sync_strategy/__init__.py index da933552d..724ce36b8 100644 --- a/runway/core/providers/aws/s3/_helpers/sync_strategy/__init__.py +++ b/runway/core/providers/aws/s3/_helpers/sync_strategy/__init__.py @@ -17,7 +17,7 @@ "ExactTimestampsSync", "MissingFileSync", "NeverSync", - "register_sync_strategies", "SizeAndLastModifiedSync", "SizeOnlySync", + "register_sync_strategies", ] diff --git a/runway/core/providers/aws/s3/_helpers/utils.py b/runway/core/providers/aws/s3/_helpers/utils.py index cac0c94f3..d8c32995a 100644 --- a/runway/core/providers/aws/s3/_helpers/utils.py +++ b/runway/core/providers/aws/s3/_helpers/utils.py @@ -903,8 +903,7 @@ def split_s3_bucket_key(s3_path: str) -> tuple[str, str]: Bucket name, key """ - if s3_path.startswith("s3://"): - s3_path = s3_path[5:] + s3_path = s3_path.removeprefix("s3://") return find_bucket_key(s3_path) diff --git a/runway/lookups/handlers/base.py b/runway/lookups/handlers/base.py index d651c08b5..e5b859208 100644 --- a/runway/lookups/handlers/base.py +++ b/runway/lookups/handlers/base.py @@ -58,7 +58,7 @@ class LookupHandler(ABC, Generic[ContextTypeVar]): """Name that the Lookup is registered as.""" @classmethod - def dependencies(cls, __lookup_query: VariableValue) -> set[str]: + def dependencies(cls, _lookup_query: VariableValue) -> set[str]: """Calculate any dependencies required to perform this lookup. Note that lookup_query may not be (completely) resolved at this time. diff --git a/runway/variables.py b/runway/variables.py index ce0810bd8..510e151c9 100644 --- a/runway/variables.py +++ b/runway/variables.py @@ -397,13 +397,13 @@ def resolve( for item in self.values(): item.resolve(context, provider=provider, variables=variables, **kwargs) - def __delitem__(self, __key: str) -> None: + def __delitem__(self, _key: str) -> None: """Delete item by index.""" - del self._data[__key] + del self._data[_key] - def __getitem__(self, __key: str) -> VariableValue: + def __getitem__(self, _key: str) -> VariableValue: """Get item by index.""" - return self._data[__key] + return self._data[_key] def __iter__(self) -> Iterator[str]: """How the object is iterated.""" @@ -417,9 +417,9 @@ def __repr__(self) -> str: """Return object representation.""" return f"dict[{', '.join(f'{k}={v}' for k, v in self.items())}]" - def __setitem__(self, __key: str, __value: VariableValue) -> None: + def __setitem__(self, _key: str, _value: VariableValue) -> None: """Set item by index.""" - self._data[__key] = __value + self._data[_key] = _value class VariableValueList(VariableValue, MutableSequence[VariableValue]): @@ -507,30 +507,28 @@ def __delitem__(self, index: int | slice) -> None: del self._data[index] @overload - def __getitem__(self, __index: int) -> VariableValue: ... + def __getitem__(self, _index: int) -> VariableValue: ... @overload - def __getitem__(self, __index: slice) -> list[VariableValue]: ... + def __getitem__(self, _index: slice) -> list[VariableValue]: ... - def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] - self, __index: int | slice - ) -> MutableSequence[VariableValue] | VariableValue: + def __getitem__(self, _index: int | slice) -> MutableSequence[VariableValue] | VariableValue: """Get item by index.""" - return self._data[__index] + return self._data[_index] @overload - def __setitem__(self, __index: int, __value: VariableValue) -> None: ... + def __setitem__(self, _index: int, _value: VariableValue) -> None: ... @overload - def __setitem__(self, __index: slice, __value: list[VariableValue]) -> None: ... + def __setitem__(self, _index: slice, _value: list[VariableValue]) -> None: ... def __setitem__( # pyright: ignore[reportIncompatibleMethodOverride] self, - __index: int | slice, - __value: list[VariableValue] | VariableValue, + _index: int | slice, + _value: list[VariableValue] | VariableValue, ) -> None: """Set item by index.""" - self._data[__index] = __value # type: ignore + self._data[_index] = _value # type: ignore def __iter__(self) -> Iterator[VariableValue]: """Object iteration.""" @@ -688,33 +686,33 @@ def resolve( for value in self: value.resolve(context, provider=provider, variables=variables, **kwargs) - def __delitem__(self, __index: int) -> None: + def __delitem__(self, _index: int) -> None: """Delete item by index.""" - del self._data[__index] + del self._data[_index] @overload - def __getitem__(self, __index: int) -> _VariableValue: ... + def __getitem__(self, _index: int) -> _VariableValue: ... @overload - def __getitem__(self, __index: slice) -> list[_VariableValue]: ... + def __getitem__(self, _index: slice) -> list[_VariableValue]: ... - def __getitem__(self, __index: int | slice) -> list[_VariableValue] | _VariableValue: + def __getitem__(self, _index: int | slice) -> list[_VariableValue] | _VariableValue: """Get item by index.""" - return self._data[__index] + return self._data[_index] @overload - def __setitem__(self, __index: int, __value: _VariableValue) -> None: ... + def __setitem__(self, _index: int, _value: _VariableValue) -> None: ... @overload - def __setitem__(self, __index: slice, __value: list[_VariableValue]) -> None: ... + def __setitem__(self, _index: slice, _value: list[_VariableValue]) -> None: ... def __setitem__( self, - __index: int | slice, - __value: list[_VariableValue] | _VariableValue, + _index: int | slice, + _value: list[_VariableValue] | _VariableValue, ) -> None: """Set item by index.""" - self._data[__index] = __value + self._data[_index] = _value def __iter__(self) -> Iterator[_VariableValue]: """Object iteration.""" @@ -940,13 +938,13 @@ def resolve( for item in self._data.values(): item.resolve(context, provider=provider, variables=variables, **kwargs) - def __delitem__(self, __key: str) -> None: + def __delitem__(self, _key: str) -> None: """Delete item by index.""" - del self._data[__key] + del self._data[_key] - def __getitem__(self, __key: str) -> VariableValue: + def __getitem__(self, _key: str) -> VariableValue: """Get item by index.""" - return self._data[__key] + return self._data[_key] def __iter__(self) -> Iterator[str]: """How the object is iterated.""" @@ -962,6 +960,6 @@ def __repr__(self) -> str: self._model_class.__name__ + f"[{', '.join(f'{k}={v}' for k, v in self._data.items())}]" ) - def __setitem__(self, __key: str, __value: VariableValue) -> None: + def __setitem__(self, _key: str, _value: VariableValue) -> None: """Set item by index.""" - self._data[__key] = __value + self._data[_key] = _value diff --git a/tests/unit/cfngin/fixtures/mock_lookups.py b/tests/unit/cfngin/fixtures/mock_lookups.py index 3faef3eea..3de200121 100644 --- a/tests/unit/cfngin/fixtures/mock_lookups.py +++ b/tests/unit/cfngin/fixtures/mock_lookups.py @@ -5,6 +5,6 @@ TYPE_NAME = "mock" -def handler(__value: Any, *, _: Any) -> str: +def handler(_value: Any, *, _: Any) -> str: """Mock handler.""" return "mock" diff --git a/tests/unit/utils/pydantic_validators/test__lax_str.py b/tests/unit/utils/pydantic_validators/test__lax_str.py index 635d25926..86a1d1816 100644 --- a/tests/unit/utils/pydantic_validators/test__lax_str.py +++ b/tests/unit/utils/pydantic_validators/test__lax_str.py @@ -30,7 +30,7 @@ class Model(BaseModel): ("foo", "foo"), (5, "5"), (1.0, "1.0"), - (Decimal(1.0), "1"), + (Decimal("1.0"), "1.0"), (SomeEnum.FOO, "foo"), (b"foo", "foo"), (None, None),