Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ jsonschema<5,>=3.2 # TODO: evaluate risk of removing jsonschema 3.x support
typing_extensions>=4.4 # 3.8 doesn't have Required, TypeGuard and ParamSpec

# resource validation & schema generation
# 1.10.15 and 1.10.17 included breaking change from pydantic, more info: https://github.com/aws/serverless-application-model/issues/3617
pydantic>=1.8,<3,!=1.10.15,!=1.10.17
# we should remove support for Python 3.8 soon (and 3.9), but supporting it for now
pydantic>=2.10.6; python_version>="3.8"
pydantic~=2.12.5; python_version>="3.9"
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ black==24.3.0
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments

# type check
mypy~=1.3.0
mypy~=1.10.1

# types
boto3-stubs[appconfig,serverlessrepo]>=1.34.0,<2.0.0
Expand Down
4 changes: 1 addition & 3 deletions samtranslator/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,15 +824,14 @@ def resolve_resource_type(self, resource_dict: Dict[str, Any]) -> Any:


class ResourceResolver:
def __init__(self, resources: Dict[str, Any]) -> None:
def __init__(self, resources: Dict[str, Dict[str, Any]]) -> None:
"""
Instantiate the resolver
:param dict resources: Map of resource
"""

if not isinstance(resources, dict):
raise TypeError("'Resources' is either null or not a valid dictionary.")

self.resources = resources

def get_all_resources(self) -> Dict[str, Any]:
Expand All @@ -850,7 +849,6 @@ def get_resource_by_logical_id(self, _input: str) -> Optional[Dict[str, Any]]:
"""
if not isinstance(_input, str):
raise TypeError(f"Invalid logical ID '{_input}'. Expected a string.")

return self.resources.get(_input, None)


Expand Down
2 changes: 1 addition & 1 deletion samtranslator/model/apigateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def _get_identity_header(self) -> Optional[str]:
if not self.identity or not self.identity.get("Header"):
return "Authorization"

return self.identity.get("Header")
return self.identity.get("Header") # type: ignore[no-any-return]

def _get_reauthorize_every(self) -> Optional[PassThrough]:
if not self.identity:
Expand Down
2 changes: 1 addition & 1 deletion samtranslator/model/stepfunctions/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def _get_paths_to_intrinsics(self, _input, path=None): # type: ignore[no-untype
else:
return dynamic_value_paths

for key, value in sorted(iterator, key=lambda item: item[0]): # type: ignore[no-any-return]
for key, value in sorted(iterator, key=lambda item: item[0]):
if is_intrinsic(value) or is_dynamic_reference(value):
dynamic_value_paths.append([*path, key])
elif isinstance(value, (dict, list)):
Expand Down
Loading