Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump black from 23.10.1 to 24.3.0 in /requirements #3569

Merged
merged 3 commits into from
Mar 25, 2024
Merged
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
1 change: 1 addition & 0 deletions bin/_file_formatter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Formatter base class for JSONFormatter and YamlFormatter."""

import argparse
import os
import sys
Expand Down
16 changes: 9 additions & 7 deletions bin/public_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ def _print(signature: Dict[str, inspect.Signature], variables: Set[str]) -> None
result: Dict[str, Any] = {"routines": {}, "variables": sorted(variables)}
for key, value in signature.items():
result["routines"][key] = [
{
"name": parameter.name,
"kind": parameter.kind.name,
"default": parameter.default,
}
if parameter.default != inspect.Parameter.empty
else {"name": parameter.name, "kind": parameter.kind.name}
(
{
"name": parameter.name,
"kind": parameter.kind.name,
"default": parameter.default,
}
if parameter.default != inspect.Parameter.empty
else {"name": parameter.name, "kind": parameter.kind.name}
)
for parameter in value.parameters.values()
]
print(json.dumps(result, indent=2, sort_keys=True))
Expand Down
6 changes: 3 additions & 3 deletions integration/helpers/deployer/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ def describe_changeset(self, change_set_id, stack_name, **kwargs):
{
"LogicalResourceId": resource_props.get("LogicalResourceId"),
"ResourceType": resource_props.get("ResourceType"),
"Replacement": "N/A"
if resource_props.get("Replacement") is None
else resource_props.get("Replacement"),
"Replacement": (
"N/A" if resource_props.get("Replacement") is None else resource_props.get("Replacement")
),
}
)

Expand Down
1 change: 1 addition & 0 deletions integration/helpers/deployer/utils/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Wrapper to generated colored messages for printing in Terminal
This was ported over from the sam-cli repo
"""

from typing import Dict, Literal

SupportedColor = Literal["red", "green", "yellow"]
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/deployer/utils/retry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Retry decorator to retry decorated function based on Exception with exponential backoff and number of attempts built-in.
"""

import math
import random
import time
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/deployer/utils/table_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Utilities for table pretty printing
This was ported over from the sam-cli repo
"""

import shutil
import textwrap
from functools import wraps
Expand Down
1 change: 1 addition & 0 deletions integration/helpers/s3_uploader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Client for uploading files to s3
"""

import logging
from typing import Any

Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tenacity~=8.0
requests~=2.28

# formatter
black==23.10.1
black==24.3.0
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments

# type check
Expand Down
1 change: 1 addition & 0 deletions samtranslator/internal/deprecation_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
If external packages import deprecated interfaces,
it is their responsibility to detect and remove them.
"""

import warnings
from functools import wraps
from typing import Callable, Optional, TypeVar
Expand Down
9 changes: 5 additions & 4 deletions samtranslator/metrics/method_decorator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Method decorator for execution latency collection
"""

import functools
import logging
from datetime import datetime
Expand Down Expand Up @@ -84,13 +85,13 @@ def _send_cw_metric(prefix, name, execution_time_ms, func, args): # type: ignor
@overload
def cw_timer(
*, name: Optional[str] = None, prefix: Optional[str] = None
) -> Callable[[Callable[_PT, _RT]], Callable[_PT, _RT]]:
...
) -> Callable[[Callable[_PT, _RT]], Callable[_PT, _RT]]: ...


@overload
def cw_timer(_func: Callable[_PT, _RT], name: Optional[str] = None, prefix: Optional[str] = None) -> Callable[_PT, _RT]:
...
def cw_timer(
_func: Callable[_PT, _RT], name: Optional[str] = None, prefix: Optional[str] = None
) -> Callable[_PT, _RT]: ...


def cw_timer(
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" CloudFormation Resource serialization, deserialization, and validation """

import inspect
import re
from abc import ABC, ABCMeta, abstractmethod
Expand Down
4 changes: 1 addition & 3 deletions samtranslator/model/api/http_api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,7 @@ def _add_title(self) -> None:
self.definition_body = open_api_editor.openapi

@cw_timer(prefix="Generator", name="HttpApi")
def to_cloudformation(
self, route53_record_set_groups: Dict[str, Route53RecordSetGroup]
) -> Tuple[
def to_cloudformation(self, route53_record_set_groups: Dict[str, Route53RecordSetGroup]) -> Tuple[
ApiGatewayV2HttpApi,
Optional[ApiGatewayV2Stage],
Optional[ApiGatewayV2DomainName],
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/architecture.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Enum for determining type of architectures for Lambda Function.
"""

ARM64 = "arm64"
X86_64 = "x86_64"
1 change: 1 addition & 0 deletions samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" SAM macro definitions """

import copy
from contextlib import suppress
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, cast
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
the Permissions property is an ARN or list of ARNs. In this situation, we validate that the Permissions property is
either a string or a list of strings, but do not validate whether the string(s) are valid IAM policy ARNs.
"""

from typing import Any, Callable, Type, Union

import samtranslator.model.exceptions
Expand Down
1 change: 1 addition & 0 deletions samtranslator/open_api/base_editor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for OpenApiEditor and SwaggerEditor."""

import re
from typing import Any, Dict, Iterator, List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions samtranslator/utils/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Type related utils."""

from typing import Any, Dict, TypeVar, Union

T = TypeVar("T")
Expand Down
1 change: 1 addition & 0 deletions samtranslator/validator/value_validator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A plug-able validator to help raise exception when some value is unexpected."""

from typing import Any, Dict, Generic, Optional, TypeVar, cast

from samtranslator.model.exceptions import (
Expand Down
2 changes: 1 addition & 1 deletion tests/openapi/test_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class TestOpenApiEditor_is_valid(TestCase):
[
param(OpenApiEditor.gen_skeleton()),
# Dict can contain any other unrecognized properties
param({"openapi": "3.1.1", "paths": {}, "foo": "bar", "baz": "bar"})
param({"openapi": "3.1.1", "paths": {}, "foo": "bar", "baz": "bar"}),
# TODO check and update the regex accordingly
# Fails for this: param({"openapi": "3.1.10", "paths": {}, "foo": "bar", "baz": "bar"})
]
Expand Down
12 changes: 6 additions & 6 deletions tests/translator/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ def _compare_transform(self, manifest, expected, partition, region):
"AWSLambdaRole": f"arn:{partition}:iam::aws:policy/service-role/AWSLambdaRole",
}
if partition == "aws":
mock_policy_loader.load.return_value[
"AWSXrayWriteOnlyAccess"
] = "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"
mock_policy_loader.load.return_value["AWSXrayWriteOnlyAccess"] = (
"arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"
)
else:
mock_policy_loader.load.return_value[
"AWSXRayDaemonWriteAccess"
] = f"arn:{partition}:iam::aws:policy/AWSXRayDaemonWriteAccess"
mock_policy_loader.load.return_value["AWSXRayDaemonWriteAccess"] = (
f"arn:{partition}:iam::aws:policy/AWSXRayDaemonWriteAccess"
)

output_fragment = transform(manifest, parameter_values, mock_policy_loader)

Expand Down