Skip to content

Commit 8979261

Browse files
valerenavicheeyVandita2020
authored
chore(deps): update Pydantic library to v2 (but still use v1) (#3858)
Co-authored-by: vicheey <181402101+vicheey@users.noreply.github.com> Co-authored-by: Vandita Patidar <vandita.vk20@gmail.com>
1 parent b633d4a commit 8979261

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

requirements/base.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ jsonschema<5,>=3.2 # TODO: evaluate risk of removing jsonschema 3.x support
33
typing_extensions>=4.4 # 3.8 doesn't have Required, TypeGuard and ParamSpec
44

55
# resource validation & schema generation
6-
# 1.10.15 and 1.10.17 included breaking change from pydantic, more info: https://github.com/aws/serverless-application-model/issues/3617
7-
pydantic>=1.8,<3,!=1.10.15,!=1.10.17
6+
# we should remove support for Python 3.8 soon (and 3.9), but supporting it for now
7+
pydantic>=2.10.6; python_version>="3.8"
8+
pydantic~=2.12.5; python_version>="3.9"

requirements/dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ black==24.3.0
2323
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments
2424

2525
# type check
26-
mypy~=1.3.0
26+
mypy~=1.10.1
2727

2828
# types
2929
boto3-stubs[appconfig,serverlessrepo]>=1.34.0,<2.0.0

samtranslator/model/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,15 +824,14 @@ def resolve_resource_type(self, resource_dict: Dict[str, Any]) -> Any:
824824

825825

826826
class ResourceResolver:
827-
def __init__(self, resources: Dict[str, Any]) -> None:
827+
def __init__(self, resources: Dict[str, Dict[str, Any]]) -> None:
828828
"""
829829
Instantiate the resolver
830830
:param dict resources: Map of resource
831831
"""
832832

833833
if not isinstance(resources, dict):
834834
raise TypeError("'Resources' is either null or not a valid dictionary.")
835-
836835
self.resources = resources
837836

838837
def get_all_resources(self) -> Dict[str, Any]:
@@ -850,7 +849,6 @@ def get_resource_by_logical_id(self, _input: str) -> Optional[Dict[str, Any]]:
850849
"""
851850
if not isinstance(_input, str):
852851
raise TypeError(f"Invalid logical ID '{_input}'. Expected a string.")
853-
854852
return self.resources.get(_input, None)
855853

856854

samtranslator/model/apigateway.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def _get_identity_header(self) -> Optional[str]:
522522
if not self.identity or not self.identity.get("Header"):
523523
return "Authorization"
524524

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

527527
def _get_reauthorize_every(self) -> Optional[PassThrough]:
528528
if not self.identity:

samtranslator/model/stepfunctions/generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def _get_paths_to_intrinsics(self, _input, path=None): # type: ignore[no-untype
396396
else:
397397
return dynamic_value_paths
398398

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

0 commit comments

Comments
 (0)