Skip to content

Commit ece6393

Browse files
committed
style: fix formatting issues across codebase
1 parent cfbd520 commit ece6393

11 files changed

Lines changed: 103 additions & 42 deletions

File tree

samcli/commands/init/interactive_init_flow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def _generate_from_location(
193193
-----------------------
194194
Location: {location}
195195
Output Directory: {output_dir}
196-
""".format(location=location, output_dir=output_dir)
196+
""".format(
197+
location=location, output_dir=output_dir
198+
)
197199
click.echo(summary_msg)
198200
do_generate(
199201
location,

samcli/commands/pipeline/bootstrap/cli.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,17 @@ def do_cli(
338338
if interactive:
339339
if standalone:
340340
click.echo(
341-
dedent("""\
341+
dedent(
342+
"""\
342343
343344
sam pipeline bootstrap generates the required AWS infrastructure resources to connect
344345
to your CI/CD system. This step must be run for each deployment stage in your pipeline,
345346
prior to running the sam pipeline init command.
346347
347348
We will ask for [1] stage definition, [2] account details, and
348349
[3] references to existing resources in order to bootstrap these pipeline resources.
349-
"""),
350+
"""
351+
),
350352
)
351353

352354
guided_context = GuidedContext(
@@ -419,18 +421,26 @@ def do_cli(
419421
config_dir=PIPELINE_CONFIG_DIR, filename=PIPELINE_CONFIG_FILENAME, cmd_names=_get_bootstrap_command_names()
420422
)
421423

422-
click.secho(dedent(f"""\
424+
click.secho(
425+
dedent(
426+
f"""\
423427
View the definition in {os.path.join(PIPELINE_CONFIG_DIR, PIPELINE_CONFIG_FILENAME)},
424428
run sam pipeline bootstrap to generate another set of resources, or proceed to
425429
sam pipeline init to create your pipeline configuration file.
426-
"""))
430+
"""
431+
)
432+
)
427433

428434
if not environment.pipeline_user.is_user_provided and not environment.use_oidc_provider:
429-
click.secho(dedent(f"""\
435+
click.secho(
436+
dedent(
437+
f"""\
430438
Before running {Colored().bold("sam pipeline init")}, we recommend first setting up AWS credentials
431439
in your CI/CD account. Read more about how to do so with your provider in
432440
{CONFIG_AWS_CRED_ON_CICD_URL}.
433-
"""))
441+
"""
442+
)
443+
)
434444

435445

436446
def _get_pipeline_oidc_provider(

samcli/commands/pipeline/bootstrap/guided_context.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,14 @@ def __init__(
8383
def _prompt_account_id(self) -> None:
8484
profiles = list_available_profiles()
8585
click.echo("The following AWS credential sources are available to use.")
86-
click.echo(dedent(f"""\
86+
click.echo(
87+
dedent(
88+
f"""\
8789
To know more about configuration AWS credentials, visit the link below:
8890
{CONFIG_AWS_CRED_DOC_URL}\
89-
"""))
91+
"""
92+
)
93+
)
9094
has_env_creds = os.getenv(EnvProvider.ACCESS_KEY) and os.getenv(EnvProvider.SECRET_KEY)
9195
click.echo(f"\t1 - Environment variables{' (not available)' if not has_env_creds else ''}")
9296
for i, profile in enumerate(profiles):

samcli/commands/pipeline/init/interactive_init_flow.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ def do_interactive(self) -> None:
5858
runs its specific questionnaire then generates the pipeline config file
5959
based on the template and user's responses
6060
"""
61-
click.echo(dedent("""\
61+
click.echo(
62+
dedent(
63+
"""\
6264
6365
sam pipeline init generates a pipeline configuration file that your CI/CD system
6466
can use to deploy serverless applications using AWS SAM.
6567
We will guide you through the process to bootstrap resources for each stage,
6668
then walk through the details necessary for creating the pipeline config file.
6769
6870
Please ensure you are in the root folder of your SAM application before you begin.
69-
"""))
71+
"""
72+
)
73+
)
7074

7175
pipeline_template_source_question = Choice(
7276
key="pipeline-template-source",
@@ -172,7 +176,9 @@ def _prompt_run_bootstrap_within_pipeline_init(
172176
"you can still reference other bootstrapped resources.",
173177
default=True,
174178
):
175-
click.secho(dedent("""\
179+
click.secho(
180+
dedent(
181+
"""\
176182
177183
For each stage, we will ask for [1] stage definition, [2] account details, and [3]
178184
reference application build resources in order to bootstrap these pipeline
@@ -181,7 +187,9 @@ def _prompt_run_bootstrap_within_pipeline_init(
181187
We recommend using an individual AWS account profiles for each stage in your
182188
pipeline. You can set these profiles up using aws configure or ~/.aws/credentials. See
183189
[https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-set-up-credentials.html].
184-
""")) # pylint: disable=C0301
190+
"""
191+
)
192+
) # pylint: disable=C0301
185193

186194
click.echo(Colored().bold(f"\nStage {len(stage_configuration_names) + 1} Setup\n"))
187195
do_bootstrap(
@@ -213,11 +221,15 @@ def _prompt_run_bootstrap_within_pipeline_init(
213221
)
214222
return True
215223
else:
216-
click.echo(dedent("""\
224+
click.echo(
225+
dedent(
226+
"""\
217227
To set up stage(s), please quit the process using Ctrl+C and use one of the following commands:
218228
sam pipeline init --bootstrap To be guided through the stage and config file creation process.
219229
sam pipeline bootstrap To specify details for an individual stage.
220-
"""))
230+
"""
231+
)
232+
)
221233
click.prompt(
222234
"To reference stage resources bootstrapped in a different account, press enter to proceed", default=""
223235
)

samcli/commands/publish/command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
for publishing. For more details on this metadata section, see
3333
{}
3434
\b
35-
""".format(SAM_PUBLISH_DOC)
35+
""".format(
36+
SAM_PUBLISH_DOC
37+
)
3638
SHORT_HELP = "Publish a packaged AWS SAM template to the AWS Serverless Application Repository."
3739
SERVERLESSREPO_CONSOLE_URL = "https://console.aws.amazon.com/serverlessrepo/home?region={}#/published-applications/{}"
3840
SEMANTIC_VERSION_HELP = "Optional. The value provided here overrides SemanticVersion in the template metadata."

samcli/commands/sync/command.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,10 @@ def do_cli(
316316

317317
# Note: ADL with use-container is not supported yet. Remove this logic once its supported.
318318
if use_container and dependency_layer:
319-
LOG.info("Note: Automatic Dependency Layer is not yet supported with use-container. \
320-
sam sync will be run without Automatic Dependency Layer.")
319+
LOG.info(
320+
"Note: Automatic Dependency Layer is not yet supported with use-container. \
321+
sam sync will be run without Automatic Dependency Layer."
322+
)
321323
dependency_layer = False
322324

323325
build_dir = DEFAULT_BUILD_DIR_WITH_AUTO_DEPENDENCY_LAYER if dependency_layer else DEFAULT_BUILD_DIR

samcli/lib/deploy/deployer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,4 +874,6 @@ def _gen_deploy_failed_with_rollback_disabled_msg(stack_name):
874874
=========================
875875
[*] Fix issues and try deploying again
876876
[*] Roll back stack to the last known stable state: aws cloudformation rollback-stack --stack-name {stack_name}
877-
""".format(stack_name=stack_name)
877+
""".format(
878+
stack_name=stack_name
879+
)

samcli/lib/observability/xray_traces/xray_event_mappers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ def map(self, event: XRayTraceEvent) -> XRayTraceEvent:
2626
formatted_segments = self.format_segments(event.segments)
2727
iso_formatted_timestamp = datetime.fromtimestamp(event.timestamp).isoformat()
2828
revision_info = f"[revision {event.revision}] " if event.revision else ""
29-
mapped_message = f"\nXRay Event {revision_info}at ({iso_formatted_timestamp}) with \
30-
id ({event.id}) and duration ({event.duration:.3f}s)" f"{formatted_segments}"
29+
mapped_message = (
30+
f"\nXRay Event {revision_info}at ({iso_formatted_timestamp}) with \
31+
id ({event.id}) and duration ({event.duration:.3f}s)"
32+
f"{formatted_segments}"
33+
)
3134
event.message = mapped_message
3235

3336
return event

tests/integration/local/invoke/test_integrations_cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,9 @@ def _create_config_file(self, profile):
792792

793793
def _create_cred_file(self, profile):
794794
cred_file_content = "[{}]\naws_access_key_id = someaccesskeyid\naws_secret_access_key = shhhhhthisisasecret \
795-
\naws_session_token = sessiontoken".format(profile)
795+
\naws_session_token = sessiontoken".format(
796+
profile
797+
)
796798
custom_cred = os.path.join(self.config_dir, "customcred")
797799
with open(custom_cred, "w") as file:
798800
file.write(cred_file_content)

tests/integration/pipeline/test_init_command.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def test_with_pipelineconfig_has_all_stage_values(self, with_bootstrap):
152152
Path(PIPELINE_CONFIG_DIR).mkdir(parents=True, exist_ok=True)
153153
pipelineconfig_path = Path(PIPELINE_CONFIG_DIR, PIPELINE_CONFIG_FILENAME)
154154
with open(pipelineconfig_path, "w") as f:
155-
f.write(dedent("""\
155+
f.write(
156+
dedent(
157+
"""\
156158
version = 0.1
157159
[default]
158160
[default.pipeline_bootstrap]
@@ -176,7 +178,9 @@ def test_with_pipelineconfig_has_all_stage_values(self, with_bootstrap):
176178
artifacts_bucket = "prod-bucket"
177179
image_repository = "prod-ecr"
178180
region = "us-west-2"
179-
"""))
181+
"""
182+
)
183+
)
180184

181185
inputs = [
182186
"1", # quick start

0 commit comments

Comments
 (0)