Skip to content

fix(deps): Bump dependencies and fix some of the dev tooling #354

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

Merged
merged 12 commits into from
Mar 22, 2021
Merged
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ dev:
pre-commit install

format:
poetry run isort -rc aws_lambda_powertools tests
poetry run isort aws_lambda_powertools tests
poetry run black aws_lambda_powertools tests

lint: format
poetry run flake8 aws_lambda_powertools/* tests/*

test:
poetry run pytest -m "not perf" --cov=./ --cov-report=xml
poetry run pytest -m "not perf" --cov=aws_lambda_powertools --cov-report=xml
poetry run pytest --cache-clear tests/performance

coverage-html:
poetry run pytest -m "not perf" --cov-report=html
poetry run pytest -m "not perf" --cov=aws_lambda_powertools --cov-report=html

pr: lint test security-baseline complexity-baseline

Expand Down
4 changes: 2 additions & 2 deletions aws_lambda_powertools/shared/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


def resolve_truthy_env_var_choice(env: Any, choice: bool = None) -> bool:
""" Pick explicit choice over truthy env value, if available, otherwise return truthy env value
"""Pick explicit choice over truthy env value, if available, otherwise return truthy env value

NOTE: Environment variable should be resolved by the caller.

Expand All @@ -23,7 +23,7 @@ def resolve_truthy_env_var_choice(env: Any, choice: bool = None) -> bool:


def resolve_env_var_choice(env: Any, choice: bool = None) -> Union[bool, Any]:
""" Pick explicit choice over env, if available, otherwise return env value received
"""Pick explicit choice over env, if available, otherwise return env value received

NOTE: Environment variable should be resolved by the caller.

Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/utilities/batch/sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _clean(self):
else:
logger.debug(f"{len(self.fail_messages)} records failed processing, raising exception")
raise SQSBatchProcessingError(
msg=f"Not all records processed succesfully. {len(self.exceptions)} individual errors logged "
msg=f"Not all records processed successfully. {len(self.exceptions)} individual errors logged "
f"separately below.",
child_exceptions=self.exceptions,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def account_id(self) -> Optional[str]:
@property
def api_key(self) -> Optional[str]:
"""For API methods that require an API key, this variable is the API key associated with the method request.
For methods that don't require an API key, this variable is null. """
For methods that don't require an API key, this variable is null."""
return self["requestContext"]["identity"].get("apiKey")

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ def parent_type_name(self) -> str:
return self["parentTypeName"]

@property
def variables(self) -> Dict[str, str]:
def variables(self) -> Optional[Dict[str, str]]:
"""A map which holds all variables that are passed into the GraphQL request."""
return self.get("variables")

@property
def selection_set_list(self) -> List[str]:
def selection_set_list(self) -> Optional[List[str]]:
"""A list representation of the fields in the GraphQL selection set. Fields that are aliased will
only be referenced by the alias name, not the field name."""
return self.get("selectionSetList")
Expand All @@ -147,7 +147,7 @@ class AppSyncResolverEvent(DictWrapper):
def __init__(self, data: dict):
super().__init__(data)

info: dict = data.get("info")
info: Optional[dict] = data.get("info")
if not info:
info = {"fieldName": self.get("fieldName"), "parentTypeName": self.get("typeName")}

Expand All @@ -164,7 +164,7 @@ def field_name(self) -> str:
return self.info.field_name

@property
def arguments(self) -> Dict[str, any]:
def arguments(self) -> Dict[str, Any]:
"""A map that contains all GraphQL arguments for this field."""
return self["arguments"]

Expand All @@ -181,7 +181,7 @@ def identity(self) -> Union[None, AppSyncIdentityIAM, AppSyncIdentityCognito]:
return get_identity_object(self.get("identity"))

@property
def source(self) -> Dict[str, any]:
def source(self) -> Optional[Dict[str, Any]]:
"""A map that contains the resolution of the parent field."""
return self.get("source")

Expand All @@ -191,7 +191,7 @@ def request_headers(self) -> Dict[str, str]:
return self["request"]["headers"]

@property
def prev_result(self) -> Optional[Dict[str, any]]:
def prev_result(self) -> Optional[Dict[str, Any]]:
"""It represents the result of whatever previous operation was executed in a pipeline resolver."""
prev = self.get("prev")
if not prev:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def user_attributes(self) -> Dict[str, str]:
@property
def user_not_found(self) -> Optional[bool]:
"""A Boolean that is populated when PreventUserExistenceErrors is set to ENABLED for your user pool client.
A value of true means that the user id (user name, email address, etc.) did not match any existing users. """
A value of true means that the user id (user name, email address, etc.) did not match any existing users."""
return self["request"].get("userNotFound")

@property
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/utilities/data_classes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def query_string_parameters(self) -> Optional[Dict[str, str]]:
return self.get("queryStringParameters")

@property
def is_base64_encoded(self) -> bool:
def is_base64_encoded(self) -> Optional[bool]:
return self.get("isBase64Encoded")

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def address(self) -> str:

@property
def endpoint_type(self) -> ConnectContactFlowEndpointType:
"""The enpoint type."""
"""The endpoint type."""
return ConnectContactFlowEndpointType[self["Type"]]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def __init__(
boto3_session : boto3.session.Session, optional
Boto3 session to use for AWS API communication

args
kwargs

Examples
--------
**Create a DynamoDB persistence layer with custom settings**
Expand Down Expand Up @@ -161,4 +158,4 @@ def _update_record(self, data_record: DataRecord):

def _delete_record(self, data_record: DataRecord) -> None:
logger.debug(f"Deleting record for idempotency key: {data_record.idempotency_key}")
self.table.delete_item(Key={self.key_attr: data_record.idempotency_key},)
self.table.delete_item(Key={self.key_attr: data_record.idempotency_key})
4 changes: 1 addition & 3 deletions aws_lambda_powertools/utilities/parameters/appconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ class AppConfigProvider(BaseProvider):

client = None

def __init__(
self, environment: str, application: Optional[str] = None, config: Optional[Config] = None,
):
def __init__(self, environment: str, application: Optional[str] = None, config: Optional[Config] = None):
"""
Initialize the App Config client
"""
Expand Down
4 changes: 2 additions & 2 deletions aws_lambda_powertools/utilities/parameters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get(
if transform is not None:
value = transform_value(value, transform)

self.store[key] = ExpirableValue(value, datetime.now() + timedelta(seconds=max_age),)
self.store[key] = ExpirableValue(value, datetime.now() + timedelta(seconds=max_age))

return value

Expand Down Expand Up @@ -164,7 +164,7 @@ def get_multiple(

values[key] = transform_value(value, _transform, raise_on_transform_error)

self.store[key] = ExpirableValue(values, datetime.now() + timedelta(seconds=max_age),)
self.store[key] = ExpirableValue(values, datetime.now() + timedelta(seconds=max_age))

return values

Expand Down
4 changes: 1 addition & 3 deletions aws_lambda_powertools/utilities/parameters/ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ class SSMProvider(BaseProvider):

client = None

def __init__(
self, config: Optional[Config] = None,
):
def __init__(self, config: Optional[Config] = None):
"""
Initialize the SSM Parameter Store client
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class DynamoDBStreamEnvelope(BaseEnvelope):
""" DynamoDB Stream Envelope to extract data within NewImage/OldImage
"""DynamoDB Stream Envelope to extract data within NewImage/OldImage

Note: Values are the parsed models. Images' values can also be None, and
length of the list is the record's amount in the original event.
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/utilities/parser/envelopes/sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SnsEnvelope(BaseEnvelope):

Note: Records will be parsed the same way so if model is str,
all items in the list will be parsed as str and npt as JSON (and vice versa)
"""
"""

def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Optional[Model]]:
"""Parses records found with model provided
Expand Down
4 changes: 1 addition & 3 deletions aws_lambda_powertools/utilities/typing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

from .lambda_context import LambdaContext

__all__ = [
"LambdaContext",
]
__all__ = ["LambdaContext"]
4 changes: 0 additions & 4 deletions aws_lambda_powertools/utilities/validation/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
class SchemaValidationError(Exception):
"""When serialization fail schema validation"""

pass


class InvalidSchemaFormatError(Exception):
"""When JSON Schema is in invalid format"""

pass


class InvalidEnvelopeExpressionError(Exception):
"""When JMESPath fails to parse expression"""
Loading