Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed more linting issues
Browse files Browse the repository at this point in the history
arya23065 committed Oct 10, 2023
1 parent 18f6d1f commit 2770876
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@ def get_validated_parameters(event: Dict[str, Any]) -> dict:
parameter_pattern_validator(
"SCAN_COMPONENTS",
os.environ.get("SCAN_COMPONENTS"),
pattern=r"(?i)^((ec2|ecr|lambda|lambda_code),?){0,3}(ec2|ecr|lambda|lambda_code){1}$"
pattern=r"(?i)^((ec2|ecr|lambda|lambda_code),?){0,3}(ec2|ecr|lambda|lambda_code){1}$",
)
)
params.update(parameter_pattern_validator("ECR_SCAN_DURATION", os.environ.get("ECR_SCAN_DURATION"), pattern=r"^(LIFETIME|DAYS_30|DAYS_180){1}$"))
Original file line number Diff line number Diff line change
@@ -208,28 +208,28 @@ def create_service_linked_role(
iam_client.create_service_linked_role(AWSServiceName=service_name, Description=description)


def snake_to_camel(s: str) -> str:
"""Convert snake case to camel case
def snake_to_camel(snake_str: str) -> str:
"""Convert snake case to camel case.
Args:
s: String to convert
Returns:
Camel case string
"""
camel_str = s.title().replace("_", "")
camel_str = snake_str.title().replace("_", "")
return camel_str[0].lower() + camel_str[1:]


def camel_to_snake_upper(s: str) -> str:
"""Concert camel case to snake upper case
def camel_to_snake_upper(camel_str: str) -> str:
"""Concert camel case to snake upper case.
Args:
s: String to convert
Returns:
Snake upper case string
"""
snake_chars = ['_' + x.lower() if x.isupper() else x for x in s]
snake_str = ''.join(snake_chars).lstrip('_')
snake_chars = ["_" + x.lower() if x.isupper() else x for x in camel_str]
snake_str = "".join(snake_chars).lstrip("_")
return snake_str.upper()
Original file line number Diff line number Diff line change
@@ -370,8 +370,9 @@ def check_for_updates_to_scan_components(inspector2_client: Inspector2Client, ac
disablement = True
if disablement is True:
LOGGER.info("Disabling some scan components...")
disable_inspector2(inspector2_client, account_id,
[common.camel_to_snake_upper(disabled_component) for disabled_component in disabled_components])
disable_inspector2(
inspector2_client, account_id, [common.camel_to_snake_upper(disabled_component) for disabled_component in disabled_components]
)


def enable_inspector2_in_mgmt_and_delegated_admin(

0 comments on commit 2770876

Please sign in to comment.