From 719d53299d5edc4bbf7267927e6670baa50684ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 08:43:45 +0000 Subject: [PATCH 1/2] chore(deps-dev): bump black from 24.10.0 to 25.1.0 in /requirements Bumps [black](https://github.com/psf/black) from 24.10.0 to 25.1.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/24.10.0...25.1.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 5a3402f6cc..feccec3f5a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -46,6 +46,6 @@ filelock==3.18.0; python_version>="3.9" filelock==3.16.1; python_version<"3.9" # formatter -black==24.10.0; python_version>="3.9" +black==25.1.0; python_version>="3.9" black==24.8.0; python_version<"3.9" psutil==7.0.0 From 7fe047642c606fb2f2bd156c30287dbe9bfa1111 Mon Sep 17 00:00:00 2001 From: Renato Valenzuela Date: Mon, 21 Apr 2025 20:28:24 +0000 Subject: [PATCH 2/2] Fix format with new version of Black --- .../copy_terraform_built_artifacts.py | 4 +-- .../terraform/hooks/prepare/types.py | 2 +- .../terraform/hooks/prepare/utilities.py | 2 +- samcli/hook_packages/terraform/lib/utils.py | 2 +- .../companion_stack_builder.py | 2 +- .../companion_stack_manager.py | 2 +- .../bootstrap/companion_stack/data_types.py | 2 +- samcli/lib/cookiecutter/exceptions.py | 2 +- .../cookiecutter/interactive_flow_creator.py | 2 +- samcli/lib/cookiecutter/processor.py | 2 +- samcli/lib/cookiecutter/question.py | 2 +- samcli/lib/package/stream_cursor_utils.py | 2 +- samcli/lib/pipeline/bootstrap/resource.py | 2 +- samcli/lib/pipeline/bootstrap/stage.py | 2 +- samcli/lib/schemas/schemas_api_caller.py | 2 +- samcli/lib/schemas/schemas_aws_config.py | 2 +- samcli/lib/schemas/schemas_code_manager.py | 2 +- samcli/lib/schemas/schemas_constants.py | 2 +- .../schemas_directory_hierarchy_builder.py | 2 +- samcli/lib/sync/sync_flow.py | 2 +- samcli/lib/utils/configuration.py | 2 +- samcli/lib/utils/git_repo.py | 2 +- samcli/lib/utils/graphql_api.py | 3 +- .../lib/utils/managed_cloudformation_stack.py | 2 +- .../invoke/test_integration_cli_images.py | 2 +- .../local/invoke/test_integrations_cli.py | 2 +- .../unit/commands/samconfig/test_samconfig.py | 32 +++++++++---------- .../lib/schemas/test_schemas_aws_config.py | 2 +- 28 files changed, 44 insertions(+), 45 deletions(-) diff --git a/samcli/hook_packages/terraform/copy_terraform_built_artifacts.py b/samcli/hook_packages/terraform/copy_terraform_built_artifacts.py index d4be990d61..e0f186d5e3 100644 --- a/samcli/hook_packages/terraform/copy_terraform_built_artifacts.py +++ b/samcli/hook_packages/terraform/copy_terraform_built_artifacts.py @@ -1,5 +1,5 @@ """ -Python script that prepares artifacts for SAM CLI to invoke. +Python script that prepares artifacts for SAM CLI to invoke. This script will work in both Linux/MacOS and Windows. It consists of 5 steps: @@ -7,7 +7,7 @@ 2. run `terraform init -reconfigure` 3. run `terraform apply` on the SAM CLI Metadata resource 4. run `terraform out` to produce an output -5. parse the output to locate the built artifact, and move it to the SAM CLI +5. parse the output to locate the built artifact, and move it to the SAM CLI build artifact directory (find_and_copy_assets) Note: This script intentionally does not use Python3 specific syntax. diff --git a/samcli/hook_packages/terraform/hooks/prepare/types.py b/samcli/hook_packages/terraform/hooks/prepare/types.py index 30e27085eb..43b5f4abee 100644 --- a/samcli/hook_packages/terraform/hooks/prepare/types.py +++ b/samcli/hook_packages/terraform/hooks/prepare/types.py @@ -1,4 +1,4 @@ -""" Contains the data types used in the TF prepare hook""" +"""Contains the data types used in the TF prepare hook""" from abc import ABC from copy import deepcopy diff --git a/samcli/hook_packages/terraform/hooks/prepare/utilities.py b/samcli/hook_packages/terraform/hooks/prepare/utilities.py index c58104eaa7..9c5daf6297 100644 --- a/samcli/hook_packages/terraform/hooks/prepare/utilities.py +++ b/samcli/hook_packages/terraform/hooks/prepare/utilities.py @@ -1,4 +1,4 @@ -""" Maintain the utilities functions used in prepare hook """ +"""Maintain the utilities functions used in prepare hook""" from samcli.hook_packages.terraform.hooks.prepare.constants import COMPILED_REGULAR_EXPRESSION diff --git a/samcli/hook_packages/terraform/lib/utils.py b/samcli/hook_packages/terraform/lib/utils.py index 8fae5f9d96..dd25c1be5f 100644 --- a/samcli/hook_packages/terraform/lib/utils.py +++ b/samcli/hook_packages/terraform/lib/utils.py @@ -52,7 +52,7 @@ def build_cfn_logical_id(tf_address: str) -> str: def _calculate_configuration_attribute_value_hash( - configuration_attribute_value: Union[str, List[Union[ConstantValue, ResolvedReference]]] + configuration_attribute_value: Union[str, List[Union[ConstantValue, ResolvedReference]]], ) -> str: """ Create a hash value of an attribute value of the resource configuration. diff --git a/samcli/lib/bootstrap/companion_stack/companion_stack_builder.py b/samcli/lib/bootstrap/companion_stack/companion_stack_builder.py index a8d21c3f0a..4bc8a13a36 100644 --- a/samcli/lib/bootstrap/companion_stack/companion_stack_builder.py +++ b/samcli/lib/bootstrap/companion_stack/companion_stack_builder.py @@ -1,5 +1,5 @@ """ - Companion stack template builder +Companion stack template builder """ from typing import Dict, cast diff --git a/samcli/lib/bootstrap/companion_stack/companion_stack_manager.py b/samcli/lib/bootstrap/companion_stack/companion_stack_manager.py index 4e647793b7..cfe95e675d 100644 --- a/samcli/lib/bootstrap/companion_stack/companion_stack_manager.py +++ b/samcli/lib/bootstrap/companion_stack/companion_stack_manager.py @@ -1,5 +1,5 @@ """ - Companion stack manager +Companion stack manager """ import logging diff --git a/samcli/lib/bootstrap/companion_stack/data_types.py b/samcli/lib/bootstrap/companion_stack/data_types.py index 2725804220..e9bf469dba 100644 --- a/samcli/lib/bootstrap/companion_stack/data_types.py +++ b/samcli/lib/bootstrap/companion_stack/data_types.py @@ -1,5 +1,5 @@ """ - Date type classes for companion stacks +Date type classes for companion stacks """ import posixpath diff --git a/samcli/lib/cookiecutter/exceptions.py b/samcli/lib/cookiecutter/exceptions.py index 5d379228d8..32c2461c41 100644 --- a/samcli/lib/cookiecutter/exceptions.py +++ b/samcli/lib/cookiecutter/exceptions.py @@ -1,4 +1,4 @@ -""" Exceptions raised from the cookiecutter workflow""" +"""Exceptions raised from the cookiecutter workflow""" class CookiecutterErrorException(Exception): diff --git a/samcli/lib/cookiecutter/interactive_flow_creator.py b/samcli/lib/cookiecutter/interactive_flow_creator.py index 8a7b9c5bae..801a068557 100644 --- a/samcli/lib/cookiecutter/interactive_flow_creator.py +++ b/samcli/lib/cookiecutter/interactive_flow_creator.py @@ -1,4 +1,4 @@ -""" This module parses a json/yaml file that defines a flow of questions to fulfill the cookiecutter context""" +"""This module parses a json/yaml file that defines a flow of questions to fulfill the cookiecutter context""" from typing import Dict, Optional, Tuple diff --git a/samcli/lib/cookiecutter/processor.py b/samcli/lib/cookiecutter/processor.py index bab7f88770..7967c8c4df 100644 --- a/samcli/lib/cookiecutter/processor.py +++ b/samcli/lib/cookiecutter/processor.py @@ -1,4 +1,4 @@ -""" Define a processor to process the cookiecutter context before/after generating a cookiecutter project""" +"""Define a processor to process the cookiecutter context before/after generating a cookiecutter project""" from abc import ABC, abstractmethod from typing import Dict diff --git a/samcli/lib/cookiecutter/question.py b/samcli/lib/cookiecutter/question.py index 76412307f4..653e523e60 100644 --- a/samcli/lib/cookiecutter/question.py +++ b/samcli/lib/cookiecutter/question.py @@ -1,4 +1,4 @@ -""" This module represents the questions to ask to the user to fulfill the cookiecutter context. """ +"""This module represents the questions to ask to the user to fulfill the cookiecutter context.""" from abc import ABC, abstractmethod from enum import Enum diff --git a/samcli/lib/package/stream_cursor_utils.py b/samcli/lib/package/stream_cursor_utils.py index 5f31b3b772..a9120b5c33 100644 --- a/samcli/lib/package/stream_cursor_utils.py +++ b/samcli/lib/package/stream_cursor_utils.py @@ -7,7 +7,7 @@ # NOTE: ANSI escape codes. # NOTE: Still needs investigation on non terminal environments. -ESC = "\u001B[" +ESC = "\u001b[" # Enables ANSI escape codes on Windows if platform.system().lower() == "windows": diff --git a/samcli/lib/pipeline/bootstrap/resource.py b/samcli/lib/pipeline/bootstrap/resource.py index 8f4f451808..97148839af 100644 --- a/samcli/lib/pipeline/bootstrap/resource.py +++ b/samcli/lib/pipeline/bootstrap/resource.py @@ -1,4 +1,4 @@ -""" Represents AWS resource""" +"""Represents AWS resource""" from typing import Optional diff --git a/samcli/lib/pipeline/bootstrap/stage.py b/samcli/lib/pipeline/bootstrap/stage.py index 7bca9dc315..95fa47e288 100644 --- a/samcli/lib/pipeline/bootstrap/stage.py +++ b/samcli/lib/pipeline/bootstrap/stage.py @@ -1,4 +1,4 @@ -""" Application Environment """ +"""Application Environment""" import hashlib import json diff --git a/samcli/lib/schemas/schemas_api_caller.py b/samcli/lib/schemas/schemas_api_caller.py index 95f0432606..097077ba72 100644 --- a/samcli/lib/schemas/schemas_api_caller.py +++ b/samcli/lib/schemas/schemas_api_caller.py @@ -1,4 +1,4 @@ -""" To isolate Schemas API calls """ +"""To isolate Schemas API calls""" import json import logging diff --git a/samcli/lib/schemas/schemas_aws_config.py b/samcli/lib/schemas/schemas_aws_config.py index a1fb95791f..aa50c8e474 100644 --- a/samcli/lib/schemas/schemas_aws_config.py +++ b/samcli/lib/schemas/schemas_aws_config.py @@ -1,4 +1,4 @@ -""" configure Schemas client based on AWS configuration provided by user """ +"""configure Schemas client based on AWS configuration provided by user""" import click from boto3.session import Session diff --git a/samcli/lib/schemas/schemas_code_manager.py b/samcli/lib/schemas/schemas_code_manager.py index 112902ed5e..aa227e9986 100644 --- a/samcli/lib/schemas/schemas_code_manager.py +++ b/samcli/lib/schemas/schemas_code_manager.py @@ -1,4 +1,4 @@ -""" Isolates code download and merge logic for dynamic Schemas template """ +"""Isolates code download and merge logic for dynamic Schemas template""" import json import os diff --git a/samcli/lib/schemas/schemas_constants.py b/samcli/lib/schemas/schemas_constants.py index 9a5c94259c..1aef43ed2f 100644 --- a/samcli/lib/schemas/schemas_constants.py +++ b/samcli/lib/schemas/schemas_constants.py @@ -1,4 +1,4 @@ -""" Constant related to Schemas """ +"""Constant related to Schemas""" # cookiecutter template parameter SCHEMAS_REGISTRY = "AWS_Schema_registry" diff --git a/samcli/lib/schemas/schemas_directory_hierarchy_builder.py b/samcli/lib/schemas/schemas_directory_hierarchy_builder.py index e6393ee1ca..cd5632043e 100644 --- a/samcli/lib/schemas/schemas_directory_hierarchy_builder.py +++ b/samcli/lib/schemas/schemas_directory_hierarchy_builder.py @@ -1,4 +1,4 @@ -""" Responsible for building schema code directory hierarchy based on schema name """ +"""Responsible for building schema code directory hierarchy based on schema name""" import re diff --git a/samcli/lib/sync/sync_flow.py b/samcli/lib/sync/sync_flow.py index 1110297f22..3f0539e2cc 100644 --- a/samcli/lib/sync/sync_flow.py +++ b/samcli/lib/sync/sync_flow.py @@ -1,4 +1,4 @@ -"""SyncFlow base class """ +"""SyncFlow base class""" import logging from abc import ABC, abstractmethod diff --git a/samcli/lib/utils/configuration.py b/samcli/lib/utils/configuration.py index 304fc6cb5f..76a6603dda 100644 --- a/samcli/lib/utils/configuration.py +++ b/samcli/lib/utils/configuration.py @@ -1,4 +1,4 @@ -""" Read info from runtime_config.json file""" +"""Read info from runtime_config.json file""" import json import logging diff --git a/samcli/lib/utils/git_repo.py b/samcli/lib/utils/git_repo.py index b8fad0ba0e..4931eed77c 100644 --- a/samcli/lib/utils/git_repo.py +++ b/samcli/lib/utils/git_repo.py @@ -1,4 +1,4 @@ -""" Manage Git repo """ +"""Manage Git repo""" import logging import os diff --git a/samcli/lib/utils/graphql_api.py b/samcli/lib/utils/graphql_api.py index a10c2a0c2c..f619a34087 100644 --- a/samcli/lib/utils/graphql_api.py +++ b/samcli/lib/utils/graphql_api.py @@ -1,5 +1,4 @@ -"""Helper functions to work with SAM GraphQLApi resource -""" +"""Helper functions to work with SAM GraphQLApi resource""" from typing import Any, Dict, List, Tuple, Union diff --git a/samcli/lib/utils/managed_cloudformation_stack.py b/samcli/lib/utils/managed_cloudformation_stack.py index 19d1bc2c50..1ebd06bea4 100644 --- a/samcli/lib/utils/managed_cloudformation_stack.py +++ b/samcli/lib/utils/managed_cloudformation_stack.py @@ -296,7 +296,7 @@ def _update_stack( def _generate_stack_parameters( - parameter_overrides: Optional[Dict[str, Union[str, List[str]]]] = None + parameter_overrides: Optional[Dict[str, Union[str, List[str]]]] = None, ) -> List[Dict[str, str]]: parameters = [] if parameter_overrides: diff --git a/tests/integration/local/invoke/test_integration_cli_images.py b/tests/integration/local/invoke/test_integration_cli_images.py index 2ccb3ae171..136831611e 100644 --- a/tests/integration/local/invoke/test_integration_cli_images.py +++ b/tests/integration/local/invoke/test_integration_cli_images.py @@ -188,7 +188,7 @@ def test_invoke_with_env_vars_with_functionname_defined(self, function_name): process_stdout = stdout.strip() self.assertEqual(process_stdout.decode("utf-8"), '"MyVar"') - @parameterized.expand([("EchoGlobalCustomEnvVarFunction")]) + @parameterized.expand(["EchoGlobalCustomEnvVarFunction"]) @pytest.mark.flaky(reruns=3) def test_invoke_with_global_env_vars_function(self, function_name): command_list = InvokeIntegBase.get_command_list( diff --git a/tests/integration/local/invoke/test_integrations_cli.py b/tests/integration/local/invoke/test_integrations_cli.py index 41d70345d1..da09bd2d5a 100644 --- a/tests/integration/local/invoke/test_integrations_cli.py +++ b/tests/integration/local/invoke/test_integrations_cli.py @@ -220,7 +220,7 @@ def test_invoke_with_env_vars_with_functionname_defined(self, function_name): process_stdout = stdout.strip() self.assertEqual(process_stdout.decode("utf-8"), '"MyVar"') - @parameterized.expand([("EchoGlobalCustomEnvVarFunction")]) + @parameterized.expand(["EchoGlobalCustomEnvVarFunction"]) @pytest.mark.flaky(reruns=3) def test_invoke_with_global_env_vars_function(self, function_name): command_list = InvokeIntegBase.get_command_list( diff --git a/tests/unit/commands/samconfig/test_samconfig.py b/tests/unit/commands/samconfig/test_samconfig.py index fd4d8cefa8..666a54d0e3 100644 --- a/tests/unit/commands/samconfig/test_samconfig.py +++ b/tests/unit/commands/samconfig/test_samconfig.py @@ -117,10 +117,10 @@ def test_build(self, do_cli_mock): "docker_network": "mynetwork", "skip_pull_image": True, "parameter_overrides": "ParameterKey=Key,ParameterValue=Value ParameterKey=Key2,ParameterValue=Value2", - "container_env_var": [("")], + "container_env_var": [""], "container_env_var_file": "file", - "build_image": [("")], - "exclude": [("")], + "build_image": [""], + "exclude": [""], "mount_with": "read", "mount_symlinks": True, } @@ -178,10 +178,10 @@ def test_build_with_no_use_container(self, do_cli_mock): "docker_network": "mynetwork", "skip_pull_image": True, "parameter_overrides": "ParameterKey=Key,ParameterValue=Value ParameterKey=Key2,ParameterValue=Value2", - "container_env_var": [("")], + "container_env_var": [""], "container_env_var_file": "file", - "build_image": [("")], - "exclude": [("")], + "build_image": [""], + "exclude": [""], "mount_with": "read", } @@ -237,10 +237,10 @@ def test_build_with_no_use_container_option(self, do_cli_mock): "docker_network": "mynetwork", "skip_pull_image": True, "parameter_overrides": "ParameterKey=Key,ParameterValue=Value ParameterKey=Key2,ParameterValue=Value2", - "container_env_var": [("")], + "container_env_var": [""], "container_env_var_file": "file", - "build_image": [("")], - "exclude": [("")], + "build_image": [""], + "exclude": [""], "mount_with": "read", } @@ -297,10 +297,10 @@ def test_build_with_no_use_container_override(self, do_cli_mock): "docker_network": "mynetwork", "skip_pull_image": True, "parameter_overrides": "ParameterKey=Key,ParameterValue=Value ParameterKey=Key2,ParameterValue=Value2", - "container_env_var": [("")], + "container_env_var": [""], "container_env_var_file": "file", - "build_image": [("")], - "exclude": [("")], + "build_image": [""], + "exclude": [""], "mount_with": "read", } @@ -358,10 +358,10 @@ def test_build_with_no_cached_override(self, do_cli_mock): "docker_network": "mynetwork", "skip_pull_image": True, "parameter_overrides": "ParameterKey=Key,ParameterValue=Value ParameterKey=Key2,ParameterValue=Value2", - "container_env_var": [("")], + "container_env_var": [""], "container_env_var_file": "file", - "build_image": [("")], - "exclude": [("")], + "build_image": [""], + "exclude": [""], "mount_with": "read", } @@ -418,7 +418,7 @@ def test_build_with_container_env_vars(self, do_cli_mock): "docker_network": "mynetwork", "skip_pull_image": True, "parameter_overrides": "ParameterKey=Key,ParameterValue=Value ParameterKey=Key2,ParameterValue=Value2", - "container_env_var": [("")], + "container_env_var": [""], "container_env_var_file": "env_vars_file", "mount_with": "read", } diff --git a/tests/unit/lib/schemas/test_schemas_aws_config.py b/tests/unit/lib/schemas/test_schemas_aws_config.py index 25e7f6ce74..de11d723c6 100644 --- a/tests/unit/lib/schemas/test_schemas_aws_config.py +++ b/tests/unit/lib/schemas/test_schemas_aws_config.py @@ -1,4 +1,4 @@ -""" Test AWS configuration """ +"""Test AWS configuration""" from unittest import TestCase from unittest.mock import patch, ANY, Mock