Skip to content

Commit

Permalink
Update dependency pyright to ^1.1.382 (#2575)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kyle Finley <kyle@finley.sh>
  • Loading branch information
renovate[bot] and ITProKyle committed Sep 27, 2024
1 parent 635917f commit 91af8ba
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 25 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"cspell": "^8.14.4",
"pyright": "^1.1.377"
"pyright": "^1.1.382"
},
"name": "runway",
"version": "0.0.0"
Expand Down
2 changes: 2 additions & 0 deletions runway/cfngin/blueprints/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
class CFNParameter:
"""Wrapper around a value to indicate a CloudFormation Parameter."""

value: list[Any] | str

def __init__(self, name: str, value: bool | float | list[Any] | str | Any) -> None:
"""Instantiate class.
Expand Down
2 changes: 1 addition & 1 deletion runway/cfngin/dag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def from_dict(self, graph_dict: dict[str, Iterable[str] | Any]) -> None:
for ind_node, dep_nodes in graph_dict.items():
if not isinstance(dep_nodes, collections.abc.Iterable):
raise TypeError(f"{ind_node}: dict values must be lists")
for dep_node in dep_nodes:
for dep_node in cast("list[str]", dep_nodes):
self.add_edge(ind_node, dep_node)

def reset_graph(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion runway/cfngin/hooks/docker/hook_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def client(self) -> DockerClient:
return DockerClient.from_env()

@overload
def update_context(self, context: CfnginContext = ...) -> DockerHookData: ...
def update_context(self, context: CfnginContext) -> DockerHookData: ...

@overload
def update_context(self, context: None = ...) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion runway/cfngin/hooks/docker/image/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _set_docker(
v.setdefault("tag", repo)
elif isinstance(v, DockerImageBuildApiOptions) and not v.tag:
v.tag = repo
return v
return v # pyright: ignore[reportUnknownVariableType]

@field_validator("ecr_repo", mode="before")
@classmethod
Expand Down
8 changes: 4 additions & 4 deletions runway/cfngin/hooks/ssm/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def _convert_policies(cls, v: list[dict[str, Any]] | str | Any) -> str:
@classmethod
def _convert_tags(cls, v: dict[str, str] | list[dict[str, str]] | Any) -> list[dict[str, str]]:
"""Convert tags to acceptable value."""
if isinstance(v, list):
return v
if isinstance(v, dict):
return [{"Key": k, "Value": v} for k, v in v.items()]
if isinstance(v, list): # TODO (kyle): improve with `typing.TypeIs` narrowing
return cast("list[dict[str, str]]", v)
if isinstance(v, dict): # TODO (kyle): improve with `typing.TypeIs` narrowing
return [{"Key": k, "Value": v} for k, v in cast("dict[str, str]", v).items()]
raise ValueError(
f"unexpected type {type(v)}; permitted: dict[str, str] | list[dict[str, str]] | none"
)
Expand Down
12 changes: 8 additions & 4 deletions runway/cfngin/lookups/handlers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import collections.abc
import json
import re
from typing import TYPE_CHECKING, Any, Callable, ClassVar, overload
from typing import TYPE_CHECKING, Any, Callable, ClassVar, cast, overload

import yaml
from pydantic import field_validator
Expand Down Expand Up @@ -121,7 +121,7 @@ def parameterized_codec(raw: str, b64: Literal[False] = ...) -> GenericHelperFn:


@overload
def parameterized_codec(raw: str, b64: Literal[True] = ...) -> Base64: ...
def parameterized_codec(raw: str, b64: Literal[True]) -> Base64: ...


def parameterized_codec(raw: str, b64: bool = False) -> Any:
Expand Down Expand Up @@ -175,9 +175,13 @@ def _parameterize_obj(
if isinstance(obj, str):
return _parameterize_string(obj)
if isinstance(obj, collections.abc.Mapping):
return {key: _parameterize_obj(value) for key, value in obj.items()}
# TODO (kyle): improve with `typing.TypeIs` narrowing
return {
key: _parameterize_obj(value) for key, value in cast("Mapping[str, Any]", obj).items()
}
if isinstance(obj, collections.abc.Sequence):
return [_parameterize_obj(item) for item in obj]
# TODO (kyle): improve with `typing.TypeIs` narrowing
return [_parameterize_obj(item) for item in cast("Sequence[Any]", obj)]
return obj


Expand Down
2 changes: 1 addition & 1 deletion runway/cfngin/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def json_serial(obj: set[Any] | Any) -> Any:
"""
if isinstance(obj, set):
return list(obj)
return list(obj) # pyright: ignore[reportUnknownArgumentType]
raise TypeError


Expand Down
2 changes: 1 addition & 1 deletion runway/context/_runway.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def no_color(self) -> bool:
"""
colorize = self.env.vars.get("RUNWAY_COLORIZE") # explicitly enable/disable
try:
if isinstance(colorize, bool):
if isinstance(colorize, bool): # pyright: ignore[reportUnnecessaryIsInstance]
# catch False
return not colorize
if colorize and isinstance(colorize, str): # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion runway/core/components/_module_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def parse_obj(
definition=obj.path,
deploy_environment=deploy_environment,
)
if isinstance(obj, (type(None), Path, str)):
if isinstance(obj, (type(None), Path, str)): # pyright: ignore[reportUnnecessaryIsInstance]
return cls(
cache_dir=cache_dir,
definition=obj,
Expand Down
6 changes: 3 additions & 3 deletions runway/env_mgr/tfenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def _flatten_lists(data: dict[str, Any] | list[Any] | Any) -> dict[str, Any] | A
data: Dict with lists to flatten.
"""
if not isinstance(data, dict):
if not isinstance(data, dict): # TODO (kyle): improve with `typing.TypeIs` narrowing
return data
copy_data = data.copy()
copy_data = cast("dict[str, Any]", data).copy()
for attr, val in copy_data.items():
if isinstance(val, list):
if len(cast("list[Any]", val)) == 1:
Expand All @@ -210,7 +210,7 @@ def _flatten_lists(data: dict[str, Any] | list[Any] | Any) -> dict[str, Any] | A
data[attr] = [_flatten_lists(v) for v in cast("list[Any]", val)]
elif isinstance(val, dict):
data[attr] = _flatten_lists(cast("dict[str, Any]", val))
return data
return cast("dict[str, Any]", data)

try:
result: dict[str, Any] | list[dict[str, Any]] = load_terraform_module(
Expand Down

0 comments on commit 91af8ba

Please sign in to comment.