Skip to content

Commit 7009eec

Browse files
Merge branch 'release-v1.55.0'
2 parents 9c90df7 + b23646c commit 7009eec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1039
-224
lines changed

samtranslator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.54.0"
1+
__version__ = "1.55.0"

samtranslator/feature_toggle/feature_toggle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def config(self): # type: ignore[no-untyped-def]
125125
class FeatureToggleAppConfigConfigProvider(FeatureToggleConfigProvider):
126126
"""Feature toggle config provider which loads config from AppConfig."""
127127

128-
@cw_timer(prefix="External", name="AppConfig") # type: ignore[no-untyped-call]
128+
@cw_timer(prefix="External", name="AppConfig") # type: ignore[misc]
129129
def __init__(self, application_id, environment_id, configuration_profile_id, app_config_client=None): # type: ignore[no-untyped-def]
130130
FeatureToggleConfigProvider.__init__(self)
131131
try:

samtranslator/metrics/method_decorator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from samtranslator.metrics.metrics import DummyMetricsPublisher, Metrics
77
from samtranslator.model import Resource
88
import logging
9+
from typing import Any, Callable, Optional, Union
910

1011
LOG = logging.getLogger(__name__)
1112

@@ -74,7 +75,9 @@ def _send_cw_metric(prefix, name, execution_time_ms, func, args): # type: ignor
7475
LOG.warning("Failed to add metrics", exc_info=e)
7576

7677

77-
def cw_timer(_func=None, name=None, prefix=None): # type: ignore[no-untyped-def]
78+
def cw_timer(
79+
_func: Optional[Callable[..., Any]] = None, name: Optional[str] = None, prefix: Optional[str] = None
80+
) -> Union[Callable[..., Any], Callable[[Callable[..., Any]], Callable[..., Any]]]:
7881
"""
7982
A method decorator, that will calculate execution time of the decorated method, and store this information as a
8083
metric in CloudWatch by calling the metrics singleton instance.
@@ -87,7 +90,7 @@ def cw_timer(_func=None, name=None, prefix=None): # type: ignore[no-untyped-def
8790
If prefix is defined, it will be added in the beginning of what is been generated above
8891
"""
8992

90-
def cw_timer_decorator(func): # type: ignore[no-untyped-def]
93+
def cw_timer_decorator(func: Callable[..., Any]) -> Callable[..., Any]:
9194
@functools.wraps(func)
9295
def wrapper_cw_timer(*args, **kwargs): # type: ignore[no-untyped-def]
9396
start_time = datetime.now()
@@ -102,4 +105,4 @@ def wrapper_cw_timer(*args, **kwargs): # type: ignore[no-untyped-def]
102105

103106
return wrapper_cw_timer
104107

105-
return cw_timer_decorator if _func is None else cw_timer_decorator(_func) # type: ignore[no-untyped-call]
108+
return cw_timer_decorator if _func is None else cw_timer_decorator(_func)

samtranslator/model/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def resources_to_link(self, resources): # type: ignore[no-untyped-def]
376376
"""
377377
return {}
378378

379-
def to_cloudformation(self, **kwargs): # type: ignore[no-untyped-def]
379+
def to_cloudformation(self, **kwargs: Any) -> List[Any]:
380380
"""Returns a list of Resource instances, representing vanilla CloudFormation resources, to which this macro
381381
expands. The caller should be able to update their template with the expanded resources by calling
382382
:func:`to_dict` on each resource returned, then updating their "Resources" mapping with the results.
@@ -455,7 +455,7 @@ def _construct_tag_list(self, tags, additional_tags=None): # type: ignore[no-un
455455
# tags list. Changing this ordering will trigger a update on Lambda Function resource. Even though this
456456
# does not change the actual content of the tags, we don't want to trigger update of a resource without
457457
# customer's knowledge.
458-
return get_tag_list(sam_tag) + get_tag_list(additional_tags) + get_tag_list(tags) # type: ignore[no-untyped-call]
458+
return get_tag_list(sam_tag) + get_tag_list(additional_tags) + get_tag_list(tags)
459459

460460
def _check_tag(self, reserved_tag_name, tags): # type: ignore[no-untyped-def]
461461
if reserved_tag_name in tags:

samtranslator/model/api/api_generator.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,15 @@ def _construct_body_s3_dict(self): # type: ignore[no-untyped-def]
338338
s3_pointer = self.definition_uri
339339

340340
else:
341-
342341
# DefinitionUri is a string
343-
s3_pointer = parse_s3_uri(self.definition_uri) # type: ignore[no-untyped-call]
344-
if s3_pointer is None:
342+
_parsed_s3_pointer = parse_s3_uri(self.definition_uri)
343+
if _parsed_s3_pointer is None:
345344
raise InvalidResourceException(
346345
self.logical_id,
347346
"'DefinitionUri' is not a valid S3 Uri of the form "
348347
"'s3://bucket/key' with optional versionId query parameter.",
349348
)
349+
s3_pointer = _parsed_s3_pointer
350350

351351
if isinstance(self.definition_uri, Py27UniStr):
352352
# self.defintion_uri is a Py27UniStr instance if it is defined in the template
@@ -394,8 +394,8 @@ def _construct_stage(self, deployment, swagger, redeploy_restapi_parameters): #
394394
if stage_name_prefix.isalnum():
395395
stage_logical_id = self.logical_id + stage_name_prefix + "Stage"
396396
else:
397-
generator = LogicalIdGenerator(self.logical_id + "Stage", stage_name_prefix) # type: ignore[no-untyped-call]
398-
stage_logical_id = generator.gen() # type: ignore[no-untyped-call]
397+
generator = LogicalIdGenerator(self.logical_id + "Stage", stage_name_prefix)
398+
stage_logical_id = generator.gen()
399399
stage = ApiGatewayStage(stage_logical_id, attributes=self.passthrough_resource_attributes)
400400
stage.RestApiId = ref(self.logical_id)
401401
stage.update_deployment_ref(deployment.logical_id) # type: ignore[no-untyped-call]
@@ -414,7 +414,7 @@ def _construct_stage(self, deployment, swagger, redeploy_restapi_parameters): #
414414
)
415415

416416
if self.tags is not None:
417-
stage.Tags = get_tag_list(self.tags) # type: ignore[no-untyped-call]
417+
stage.Tags = get_tag_list(self.tags)
418418

419419
return stage
420420

@@ -432,7 +432,7 @@ def _construct_api_domain(self, rest_api, route53_record_set_groups): # type: i
432432
)
433433

434434
self.domain["ApiDomainName"] = "{}{}".format(
435-
"ApiGatewayDomainName", LogicalIdGenerator("", self.domain.get("DomainName")).gen() # type: ignore[no-untyped-call, no-untyped-call]
435+
"ApiGatewayDomainName", LogicalIdGenerator("", self.domain.get("DomainName")).gen()
436436
)
437437

438438
domain = ApiGatewayDomainName(self.domain.get("ApiDomainName"), attributes=self.passthrough_resource_attributes)
@@ -537,7 +537,7 @@ def _construct_api_domain(self, rest_api, route53_record_set_groups): # type: i
537537
"HostedZoneId or HostedZoneName is required to enable Route53 support on Custom Domains.",
538538
)
539539

540-
logical_id_suffix = LogicalIdGenerator( # type: ignore[no-untyped-call, no-untyped-call]
540+
logical_id_suffix = LogicalIdGenerator(
541541
"", route53.get("HostedZoneId") or route53.get("HostedZoneName")
542542
).gen()
543543
logical_id = "RecordSetGroup" + logical_id_suffix
@@ -593,7 +593,7 @@ def _construct_alias_target(self, domain): # type: ignore[no-untyped-def]
593593
alias_target["DNSName"] = route53.get("DistributionDomainName")
594594
return alias_target
595595

596-
@cw_timer(prefix="Generator", name="Api") # type: ignore[no-untyped-call]
596+
@cw_timer(prefix="Generator", name="Api")
597597
def to_cloudformation(self, redeploy_restapi_parameters, route53_record_set_groups): # type: ignore[no-untyped-def]
598598
"""Generates CloudFormation resources from a SAM API resource
599599

0 commit comments

Comments
 (0)