Skip to content

Commit 7ed3b09

Browse files
authored
chore: Upgrade black to 23.1.0 (depending on click 8) and format files (#2892)
1 parent 504f1b3 commit 7ed3b09

Some content is hidden

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

50 files changed

+4
-198
lines changed

integration/helpers/deployer/deployer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ def wait_for_changeset(self, changeset_id, stack_name):
265265
try:
266266
waiter.wait(ChangeSetName=changeset_id, StackName=stack_name, WaiterConfig=waiter_config)
267267
except botocore.exceptions.WaiterError as ex:
268-
269268
LOG.error("Waiter exception waiting for changeset", exc_info=ex)
270269

271270
resp = ex.last_response

integration/helpers/deployer/utils/artifact_exporter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030

3131

3232
def parse_s3_url(url, bucket_name_property="Bucket", object_key_property="Key", version_property=None):
33-
3433
if isinstance(url, str) and url.startswith("s3://"):
35-
3634
parsed = urlparse(url)
3735
query = parse_qs(parsed.query)
3836

requirements/dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pytest~=6.2.5
1111
parameterized~=0.7.4
1212

1313
# Integration tests
14-
click~=7.1
14+
click~=8.0
1515
dateparser~=0.7
1616
boto3>=1.23,<2
1717
tenacity~=7.0.0
@@ -20,7 +20,7 @@ tenacity~=7.0.0
2020
requests~=2.25.0
2121

2222
# formatter
23-
black==20.8b1
23+
black==23.1.0
2424
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments
2525

2626
# type check

samtranslator/intrinsics/resource_refs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class SupportedResourceReferences:
99
"""
1010

1111
def __init__(self) -> None:
12-
1312
# This is a two level map like:
1413
# { "LogicalId": {"Property": "Value"} }
1514
self._refs: Dict[str, Dict[str, Any]] = {}

samtranslator/model/api/api_generator.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def _set_condition(self, condition, template_conditions): # type: ignore[no-unt
140140
return
141141

142142
if condition and condition not in self.conditions:
143-
144143
if template_conditions is None:
145144
raise InvalidTemplateException(
146145
"Can't have condition without having 'Conditions' section in the template"
@@ -641,7 +640,6 @@ def _add_cors(self) -> None:
641640
# Just set Origin property. Others will be defaults
642641
properties = CorsProperties(AllowOrigin=self.cors) # type: ignore[call-arg]
643642
elif isinstance(self.cors, dict):
644-
645643
# Make sure keys in the dict are recognized
646644
if not all(key in CorsProperties._fields for key in self.cors):
647645
raise InvalidResourceException(self.logical_id, INVALID_ERROR)

samtranslator/model/eventsources/push.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ def _inject_notification_configuration(self, function, bucket, bucket_id): # ty
439439

440440
event_mappings = []
441441
for event_type in event_types:
442-
443442
lambda_event = copy.deepcopy(base_event_mapping)
444443
lambda_event["Event"] = event_type
445444
if CONDITION in function.resource_attributes:
@@ -652,13 +651,11 @@ def resources_to_link(self, resources): # type: ignore[no-untyped-def]
652651
explicit_api = None
653652
rest_api_id = self.get_rest_api_id_string(self.RestApiId)
654653
if isinstance(rest_api_id, str):
655-
656654
if (
657655
rest_api_id in resources
658656
and "Properties" in resources[rest_api_id]
659657
and "StageName" in resources[rest_api_id]["Properties"]
660658
):
661-
662659
explicit_api = resources[rest_api_id]["Properties"]
663660
permitted_stage = explicit_api["StageName"]
664661

@@ -844,7 +841,6 @@ def _add_swagger_integration( # type: ignore[no-untyped-def] # noqa: too-many-s
844841

845842
# Checking if any of the fields are defined as it can be false we are checking if the field are not None
846843
if validate_body is not None or validate_parameters is not None:
847-
848844
# as we are setting two different fields we are here setting as default False
849845
# In case one of them are not defined
850846
validate_body = False if validate_body is None else validate_body
@@ -869,14 +865,11 @@ def _add_swagger_integration( # type: ignore[no-untyped-def] # noqa: too-many-s
869865
)
870866

871867
if self.RequestParameters:
872-
873868
default_value = {"Required": False, "Caching": False}
874869

875870
parameters = []
876871
for parameter in self.RequestParameters:
877-
878872
if isinstance(parameter, dict):
879-
880873
parameter_name, parameter_value = next(iter(parameter.items()))
881874

882875
if not re.match(r"method\.request\.(querystring|path|header)\.", parameter_name):

samtranslator/model/intrinsics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def is_intrinsic(_input: Any) -> bool:
146146
"""
147147

148148
if _input is not None and isinstance(_input, dict) and len(_input) == 1:
149-
150149
key: str = list(_input.keys())[0]
151150
return key == "Ref" or key == "Condition" or key.startswith("Fn::")
152151

samtranslator/model/preferences/deployment_preference_collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def _replace_deployment_types(self, value, key=None): # type: ignore[no-untyped
278278
value[i] = self._replace_deployment_types(v) # type: ignore[no-untyped-call]
279279
return value
280280
if is_intrinsic(value):
281-
for (k, v) in value.items():
281+
for k, v in value.items():
282282
value[k] = self._replace_deployment_types(v, k) # type: ignore[no-untyped-call]
283283
return value
284284
if value in CODEDEPLOY_PREDEFINED_CONFIGURATIONS_LIST:

samtranslator/model/role_utils/role_constructor.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ def construct_role_for_resource( # type: ignore[no-untyped-def] # noqa: too-man
4444

4545
for index, policy_entry in enumerate(resource_policies.get()):
4646
if policy_entry.type is PolicyTypes.POLICY_STATEMENT:
47-
4847
if is_intrinsic_if(policy_entry.data):
49-
5048
intrinsic_if = policy_entry.data
5149
then_statement = intrinsic_if["Fn::If"][1]
5250
else_statement = intrinsic_if["Fn::If"][2]
@@ -76,7 +74,6 @@ def construct_role_for_resource( # type: ignore[no-untyped-def] # noqa: too-man
7674
)
7775

7876
elif policy_entry.type is PolicyTypes.MANAGED_POLICY:
79-
8077
# There are three options:
8178
# Managed Policy Name (string): Try to convert to Managed Policy ARN
8279
# Managed Policy Arn (string): Insert it directly into the list

samtranslator/model/stepfunctions/events.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,11 @@ def resources_to_link(self, resources): # type: ignore[no-untyped-def]
316316
explicit_api = None
317317
rest_api_id = PushApi.get_rest_api_id_string(self.RestApiId)
318318
if isinstance(rest_api_id, str):
319-
320319
if (
321320
rest_api_id in resources
322321
and "Properties" in resources[rest_api_id]
323322
and "StageName" in resources[rest_api_id]["Properties"]
324323
):
325-
326324
explicit_api = resources[rest_api_id]["Properties"]
327325
permitted_stage = explicit_api["StageName"]
328326

0 commit comments

Comments
 (0)