Skip to content

Commit e567e13

Browse files
authored
#127: Reformatted code with latest PTB (#128)
fixes #127
1 parent 3ee3264 commit e567e13

File tree

20 files changed

+43
-42
lines changed

20 files changed

+43
-42
lines changed

doc/changes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
## Refactorings
44

55
- #125: Updated exaslct and added check for password leak
6+
- #127: Reformatted code with latest PTB

exasol/slc_ci_setup/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ATTENTION:
22
# This file is generated by exasol/toolbox/nox/_package_version.py when using:
33
# * either "poetry run -- nox -s project:fix"
4-
# * or "poetry run -- nox version:check -- <path/version.py> --fix"
4+
# * or "poetry run -- nox version:check -- --fix"
55
# Do not edit this file manually!
66
# If you need to change the version, do so in the pyproject.toml, e.g. by using `poetry version X.Y.Z`.
77
MAJOR = 2

exasol_script_languages_container_ci_setup/cli/commands/generate_buildspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
help="Configuration file for build (project specific).",
4040
)
4141
def generate_buildspecs(
42-
flavor_root_path: Tuple[str, ...],
42+
flavor_root_path: tuple[str, ...],
4343
log_level: str,
4444
output_path: str,
4545
config_file: Optional[str],

exasol_script_languages_container_ci_setup/cli/commands/generate_release_buildspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
help="Configuration file for build (project specific).",
3939
)
4040
def generate_release_buildspecs(
41-
flavor_root_path: Tuple[str, ...],
41+
flavor_root_path: tuple[str, ...],
4242
log_level: str,
4343
output_path: str,
4444
config_file: Optional[str],

exasol_script_languages_container_ci_setup/health_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import shlex
77
import subprocess
88
import sys
9+
from collections.abc import Iterator
910
from typing import (
10-
Iterator,
1111
Optional,
1212
)
1313

exasol_script_languages_container_ci_setup/lib/aws/aws_access.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import logging
22
import time
3+
from collections.abc import Iterable
34
from typing import (
45
Callable,
56
Dict,
6-
Iterable,
77
List,
88
Optional,
99
)
@@ -127,7 +127,7 @@ def validate_cloudformation_template(self, cloudformation_yml) -> None:
127127
client = self._get_aws_client().create_cloudformation_service()
128128
client.validate_template(template_body=cloudformation_yml)
129129

130-
def get_all_stack_resources(self, stack_name: str) -> List[StackResourceSummary]:
130+
def get_all_stack_resources(self, stack_name: str) -> list[StackResourceSummary]:
131131
"""
132132
This functions uses Boto3 to get all AWS Cloudformation resources for a specific Cloudformation stack,
133133
identified by parameter `stack_name`.
@@ -152,7 +152,7 @@ def get_all_stack_resources(self, stack_name: str) -> List[StackResourceSummary]
152152
def start_codebuild(
153153
self,
154154
project: PhysicalResourceId,
155-
environment_variables_overrides: List[Dict[str, str]],
155+
environment_variables_overrides: list[dict[str, str]],
156156
branch: str,
157157
timeout_in_seconds: int,
158158
poll_interval_seconds: int = 30,

exasol_script_languages_container_ci_setup/lib/aws/wrapper/cloudformation_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def validate_template(
2727
self,
2828
template_body: str,
2929
from_boto: Callable[
30-
[Dict[str, Any]], ValidationResult
30+
[dict[str, Any]], ValidationResult
3131
] = ValidationResult.from_boto,
3232
) -> ValidationResult:
3333
boto_validation_result = self._internal_aws_client.validate_template(
@@ -41,7 +41,7 @@ def list_stack_resources(
4141
stack_name: PhysicalResourceId,
4242
next_token: Optional[NextToken] = None,
4343
from_boto: Callable[
44-
[Dict[str, Any]], ListStackResourcesResult
44+
[dict[str, Any]], ListStackResourcesResult
4545
] = ListStackResourcesResult.from_boto,
4646
) -> ListStackResourcesResult:
4747
if next_token is not None:

exasol_script_languages_container_ci_setup/lib/aws/wrapper/codebuild_service.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def start_build_batch(
2525
self,
2626
project_name: PhysicalResourceId,
2727
source_version: str,
28-
environment_variables_override: List[Dict[str, str]],
29-
from_boto: Callable[[Dict[str, Any]], BuildBatch] = BuildBatch.from_boto,
28+
environment_variables_override: list[dict[str, str]],
29+
from_boto: Callable[[dict[str, Any]], BuildBatch] = BuildBatch.from_boto,
3030
) -> BuildBatch:
3131
boto_build_batch = self._internal_aws_client.start_build_batch(
3232
projectName=project_name.aws_physical_resource_id,
@@ -38,9 +38,9 @@ def start_build_batch(
3838

3939
def batch_get_build_batches(
4040
self,
41-
build_batch_ids: List[PhysicalResourceId],
42-
from_boto: Callable[[Dict[str, Any]], BuildBatch] = BuildBatch.from_boto,
43-
) -> List[BuildBatch]:
41+
build_batch_ids: list[PhysicalResourceId],
42+
from_boto: Callable[[dict[str, Any]], BuildBatch] = BuildBatch.from_boto,
43+
) -> list[BuildBatch]:
4444
aws_ids = [
4545
build_batch_id.aws_physical_resource_id
4646
for build_batch_id in build_batch_ids

exasol_script_languages_container_ci_setup/lib/aws/wrapper/datamodels/cloudformation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class StackResourceSummary:
3131

3232
@classmethod
3333
def from_boto(
34-
cls, boto_stack_resource_summary: Dict[str, Any]
34+
cls, boto_stack_resource_summary: dict[str, Any]
3535
) -> "StackResourceSummary":
3636
physical_resource_id = cls._extract_physcial_resource_id(
3737
boto_stack_resource_summary
@@ -44,7 +44,7 @@ def from_boto(
4444

4545
@classmethod
4646
def _extract_physcial_resource_id(
47-
cls, boto_stack_resource_summary: Dict[str, Any]
47+
cls, boto_stack_resource_summary: dict[str, Any]
4848
) -> PhysicalResourceId:
4949
physical_resource_id = None
5050
if cls._has_physical_resource_id(boto_stack_resource_summary):
@@ -56,7 +56,7 @@ def _extract_physcial_resource_id(
5656
return physical_resource_id
5757

5858
@classmethod
59-
def _has_physical_resource_id(cls, boto_stack_resource_summary: Dict[str, Any]):
59+
def _has_physical_resource_id(cls, boto_stack_resource_summary: dict[str, Any]):
6060
return (
6161
PHYSICAL_RESOURCE_ID in boto_stack_resource_summary
6262
and boto_stack_resource_summary[PHYSICAL_RESOURCE_ID] is not None
@@ -66,11 +66,11 @@ def _has_physical_resource_id(cls, boto_stack_resource_summary: Dict[str, Any]):
6666
@dataclasses.dataclass(frozen=True)
6767
class ListStackResourcesResult:
6868
next_token: Optional[NextToken]
69-
stack_resource_summaries: List[StackResourceSummary]
69+
stack_resource_summaries: list[StackResourceSummary]
7070

7171
@classmethod
7272
def from_boto(
73-
cls, boto_list_stack_resources_result: Dict[str, Any]
73+
cls, boto_list_stack_resources_result: dict[str, Any]
7474
) -> "ListStackResourcesResult":
7575
next_token = None
7676
if cls._has_next_token(boto_list_stack_resources_result):
@@ -97,5 +97,5 @@ def _has_next_token(cls, boto_list_stack_resources_result):
9797
class ValidationResult:
9898

9999
@classmethod
100-
def from_boto(cls, boto_validation_result: Dict[str, Any]) -> "ValidationResult":
100+
def from_boto(cls, boto_validation_result: dict[str, Any]) -> "ValidationResult":
101101
return ValidationResult()

exasol_script_languages_container_ci_setup/lib/aws/wrapper/datamodels/codebuild.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,36 @@ class BuildBatch:
3333
build_batch_status: Optional[BuildBatchStatus]
3434

3535
@classmethod
36-
def from_boto(self, boto_buildbatch: Dict[str, Any]) -> "BuildBatch":
36+
def from_boto(self, boto_buildbatch: dict[str, Any]) -> "BuildBatch":
3737
batch_id = self._extract_build_id(boto_buildbatch)
3838
build_batch_status = self._extract_build_batch_status(boto_buildbatch)
3939
build_batch = BuildBatch(id=batch_id, build_batch_status=build_batch_status)
4040
return build_batch
4141

4242
@classmethod
4343
def _extract_build_id(
44-
cls, boto_buildbatch: Dict[str, Any]
44+
cls, boto_buildbatch: dict[str, Any]
4545
) -> Optional[PhysicalResourceId]:
4646
batch_id = None
4747
if BuildBatch._has_id(boto_buildbatch):
4848
batch_id = PhysicalResourceId(aws_physical_resource_id=boto_buildbatch[ID])
4949
return batch_id
5050

5151
@classmethod
52-
def _has_id(cls, boto_buildbatch: Dict[str, Any]) -> bool:
52+
def _has_id(cls, boto_buildbatch: dict[str, Any]) -> bool:
5353
return ID in boto_buildbatch and boto_buildbatch[ID] is not None
5454

5555
@classmethod
5656
def _extract_build_batch_status(
57-
cls, boto_buildbatch: Dict[str, Any]
57+
cls, boto_buildbatch: dict[str, Any]
5858
) -> Optional[BuildBatchStatus]:
5959
build_batch_status = None
6060
if BuildBatch._has_build_status(boto_buildbatch):
6161
build_batch_status = BuildBatchStatus[boto_buildbatch[BUILD_BATCH_STATUS]]
6262
return build_batch_status
6363

6464
@classmethod
65-
def _has_build_status(cls, boto_buildbatch: Dict[str, Any]) -> bool:
65+
def _has_build_status(cls, boto_buildbatch: dict[str, Any]) -> bool:
6666
return (
6767
BUILD_BATCH_STATUS in boto_buildbatch
6868
and boto_buildbatch[BUILD_BATCH_STATUS] is not None

0 commit comments

Comments
 (0)