Skip to content
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

fix(data-classes): docstring typos and clean up #937

Merged
merged 9 commits into from
Jan 12, 2022
2 changes: 1 addition & 1 deletion aws_lambda_powertools/event_handler/api_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(
only be used during development.
allow_headers: Optional[List[str]]
The list of additional allowed headers. This list is added to list of
built in allowed headers: `Authorization`, `Content-Type`, `X-Amz-Date`,
built-in allowed headers: `Authorization`, `Content-Type`, `X-Amz-Date`,
`X-Api-Key`, `X-Amz-Security-Token`.
expose_headers: Optional[List[str]]
A list of values to return for the Access-Control-Expose-Headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(

@property
def arn(self) -> str:
"""Build an arn from it's parts
"""Build an arn from its parts
eg: arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/request"""
return (
f"arn:{self.partition}:execute-api:{self.region}:{self.aws_account_id}:{self.api_id}/{self.stage}/"
Expand Down Expand Up @@ -168,7 +168,7 @@ def get_header_value(
default_value: str, optional
Default value if no value was found by name
case_sensitive: bool
Whether to use a case sensitive look up
Whether to use a case-sensitive look up
Returns
-------
str, optional
Expand Down Expand Up @@ -270,7 +270,7 @@ def get_header_value(
default_value: str, optional
Default value if no value was found by name
case_sensitive: bool
Whether to use a case sensitive look up
Whether to use a case-sensitive look up
Returns
-------
str, optional
Expand Down Expand Up @@ -440,7 +440,7 @@ def _add_route(self, effect: str, http_method: str, resource: str, conditions: O
if not self._resource_pattern.match(resource):
raise ValueError(f"Invalid resource path: {resource}. Path should match {self.path_regex}")

if resource[:1] == "/":
if resource.startswith("/"):
michaelbrewer marked this conversation as resolved.
Show resolved Hide resolved
resource = resource[1:]

resource_arn = APIGatewayRouteArn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def source_ip(self) -> List[str]:

@property
def username(self) -> str:
"""The user name of the authenticated user. IAM user principal"""
"""The username of the authenticated user. IAM user principal"""
return self["username"]

@property
Expand Down Expand Up @@ -72,7 +72,7 @@ def source_ip(self) -> List[str]:

@property
def username(self) -> str:
"""The user name of the authenticated user."""
"""The username of the authenticated user."""
return self["username"]

@property
Expand Down Expand Up @@ -172,7 +172,7 @@ def arguments(self) -> Dict[str, Any]:
def identity(self) -> Union[None, AppSyncIdentityIAM, AppSyncIdentityCognito]:
"""An object that contains information about the caller.

Depending of the type of identify found:
Depending on the type of identify found:

- API_KEY authorization - returns None
- AWS_IAM authorization - returns AppSyncIdentityIAM
Expand Down Expand Up @@ -223,7 +223,7 @@ def get_header_value(
default_value: str, optional
Default value if no value was found by name
case_sensitive: bool
Whether to use a case sensitive look up
Whether to use a case-sensitive look up
Returns
-------
str, optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def final_user_status(self) -> Optional[str]:
@final_user_status.setter
def final_user_status(self, value: str):
"""During sign-in, this attribute can be set to CONFIRMED, or not set, to auto-confirm your users and
allow them to sign-in with their previous passwords. This is the simplest experience for the user.
allow them to sign in with their previous passwords. This is the simplest experience for the user.

If this attribute is set to RESET_REQUIRED, the user is required to change his or her password immediately
after migration at the time of sign-in, and your client app needs to handle the PasswordResetRequiredException
Expand Down Expand Up @@ -333,7 +333,7 @@ class CustomMessageTriggerEvent(BaseTriggerEvent):
verification code automatically to the user. Cannot be used for other attributes.
- `CustomMessage_VerifyUserAttribute` This trigger sends a verification code to the user when they manually
request it for a new email or phone number.
- `CustomMessage_Authentication` To send MFA code during authentication.
- `CustomMessage_Authentication` To send MFA codes during authentication.

Documentation:
--------------
Expand Down Expand Up @@ -590,7 +590,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 (username, email address, etc.) did not match any existing users."""
return self["request"].get("userNotFound")

@property
Expand All @@ -601,7 +601,7 @@ def session(self) -> List[ChallengeResult]:
@property
def client_metadata(self) -> Optional[Dict[str, str]]:
"""One or more key-value pairs that you can provide as custom input to the Lambda function that you specify
for the define auth challenge trigger."""
for the defined auth challenge trigger."""
return self["request"].get("clientMetadata")


Expand Down Expand Up @@ -687,7 +687,7 @@ def session(self) -> List[ChallengeResult]:
@property
def client_metadata(self) -> Optional[Dict[str, str]]:
"""One or more key-value pairs that you can provide as custom input to the Lambda function that you
specify for the create auth challenge trigger."""
specify for the creation auth challenge trigger."""
return self["request"].get("clientMetadata")


Expand All @@ -699,7 +699,7 @@ def public_challenge_parameters(self) -> Dict[str, str]:
@public_challenge_parameters.setter
def public_challenge_parameters(self, value: Dict[str, str]):
"""One or more key-value pairs for the client app to use in the challenge to be presented to the user.
This parameter should contain all of the necessary information to accurately present the challenge to
This parameter should contain all the necessary information to accurately present the challenge to
the user."""
self["response"]["publicChallengeParameters"] = value

Expand All @@ -709,8 +709,8 @@ def private_challenge_parameters(self) -> Dict[str, str]:

@private_challenge_parameters.setter
def private_challenge_parameters(self, value: Dict[str, str]):
"""This parameter is only used by the Verify Auth Challenge Response Lambda trigger.
This parameter should contain all of the information that is required to validate the user's
"""This parameter is only used by the "Verify Auth Challenge" Response Lambda trigger.
This parameter should contain all the information that is required to validate the user's
response to the challenge. In other words, the publicChallengeParameters parameter contains the
question that is presented to the user and privateChallengeParameters contains the valid answers
for the question."""
Expand All @@ -730,7 +730,7 @@ class CreateAuthChallengeTriggerEvent(BaseTriggerEvent):
"""Create Auth Challenge Lambda Trigger

Amazon Cognito invokes this trigger after Define Auth Challenge if a custom challenge has been
specified as part of the Define Auth Challenge trigger.
specified as part of the "Define Auth Challenge" trigger.
It creates a custom authentication flow.

Notes:
Expand Down Expand Up @@ -775,7 +775,7 @@ def challenge_answer(self) -> Any:
@property
def client_metadata(self) -> Optional[Dict[str, str]]:
"""One or more key-value pairs that you can provide as custom input to the Lambda function that
you specify for the verify auth challenge trigger."""
you specify for the "Verify Auth Challenge" trigger."""
return self["request"].get("clientMetadata")

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def aws_region(self) -> Optional[str]:

@property
def dynamodb(self) -> Optional[StreamRecord]:
"""The main body of the stream record, containing all of the DynamoDB-specific fields."""
"""The main body of the stream record, containing all the DynamoDB-specific fields."""
stream_record = self.get("dynamodb")
return None if stream_record is None else StreamRecord(stream_record)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_header_value(
default_value: str, optional
Default value if no value was found by name
case_sensitive: bool
Whether to use a case sensitive look up
Whether to use a case-sensitive look up
Returns
-------
str, optional
Expand Down Expand Up @@ -128,7 +128,7 @@ def creation_date(self) -> str:
@property
def mfa_authenticated(self) -> str:
"""The value is true if the root user or IAM user whose credentials were used for the request also was
authenticated with an MFA device; otherwise, false.."""
authenticated with an MFA device; otherwise, false."""
return self["mfaAuthenticated"]


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

class SQSMessageAttributes(Dict[str, SQSMessageAttribute]):
def __getitem__(self, key: str) -> Optional[SQSMessageAttribute]: # type: ignore
item = super(SQSMessageAttributes, self).get(key)
item = super().get(key)
return None if item is None else SQSMessageAttribute(item) # type: ignore


Expand Down