Skip to content

chore(ci): enable Ruff rule E501 and fix errors #2587

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 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aws_lambda_powertools/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Logger:
service name to be appended in logs, by default "service_undefined"
level : str, int optional
The level to set. Can be a string representing the level name: 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'
or an integer representing the level value: 10 for 'DEBUG', 20 for 'INFO', 30 for 'WARNING', 40 for 'ERROR', 50 for 'CRITICAL'. # noqa: E501
or an integer representing the level value: 10 for 'DEBUG', 20 for 'INFO', 30 for 'WARNING', 40 for 'ERROR', 50 for 'CRITICAL'.
by default "INFO"
child: bool, optional
create a child Logger named <service>.<caller_file_name>, False by default
Expand All @@ -108,7 +108,7 @@ class Logger:
Parameters propagated to LambdaPowertoolsFormatter
--------------------------------------------------
datefmt: str, optional
String directives (strftime) to format log timestamp using `time`, by default it uses 2021-05-03 11:47:12,494+0200. # noqa: E501
String directives (strftime) to format log timestamp using `time`, by default it uses 2021-05-03 11:47:12,494+0200.
use_datetime_directive: bool, optional
Interpret `datefmt` as a format string for `datetime.datetime.strftime`, rather than
`time.strftime`.
Expand Down Expand Up @@ -200,7 +200,7 @@ class Logger:
------
InvalidLoggerSamplingRateError
When sampling rate provided is not a float
"""
""" # noqa: E501

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions aws_lambda_powertools/metrics/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def single_metric(
from aws_lambda_powertools.metrics import MetricUnit
from aws_lambda_powertools.metrics import MetricResolution

with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard, namespace="ServerlessAirline") as metric: # noqa E501
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard, namespace="ServerlessAirline") as metric:
metric.add_dimension(name="function_version", value="47")

**Same as above but set namespace using environment variable**
Expand All @@ -587,7 +587,7 @@ def single_metric(
from aws_lambda_powertools.metrics import MetricUnit
from aws_lambda_powertools.metrics import MetricResolution

with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard) as metric: # noqa E501
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard) as metric:
metric.add_dimension(name="function_version", value="47")

Parameters
Expand Down Expand Up @@ -618,7 +618,7 @@ def single_metric(
When metric value isn't a number
SchemaValidationError
When metric object fails EMF schema validation
"""
""" # noqa: E501
metric_set: Optional[Dict] = None
try:
metric: SingleMetric = SingleMetric(namespace=namespace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TypeDeserializer:
"""
Deserializes DynamoDB types to Python types.

It's based on boto3's [DynamoDB TypeDeserializer](https://boto3.amazonaws.com/v1/documentation/api/latest/_modules/boto3/dynamodb/types.html). # noqa: E501
It's based on boto3's [DynamoDB TypeDeserializer](https://boto3.amazonaws.com/v1/documentation/api/latest/_modules/boto3/dynamodb/types.html).

The only notable difference is that for Binary (`B`, `BS`) values we return Python Bytes directly,
since we don't support Python 2.
Expand Down
10 changes: 5 additions & 5 deletions aws_lambda_powertools/utilities/validation/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ def handler(event, context):
def handler(event, context):
return event

**Unwrap, decode base64 and deserialize JSON string event before validating against actual payload - using built-in functions** # noqa: E501
**Unwrap, decode base64 and deserialize JSON string event before validating against actual payload - using built-in functions**

from aws_lambda_powertools.utilities.validation import validator

@validator(inbound_schema=json_schema_dict, envelope="Records[*].kinesis.powertools_json(powertools_base64(data))")
def handler(event, context):
return event

**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions** # noqa: E501
**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions**

from aws_lambda_powertools.utilities.validation import validator

Expand All @@ -116,7 +116,7 @@ def handler(event, context):
When JSON schema provided is invalid
InvalidEnvelopeExpressionError
When JMESPath expression to unwrap event is invalid
"""
""" # noqa: E501
if envelope:
event = jmespath_utils.extract_data_from_envelope(
data=event, envelope=envelope, jmespath_options=jmespath_options
Expand Down Expand Up @@ -202,7 +202,7 @@ def handler(event, context):
validate(event=event, schema=json_schema_dict, envelope="Records[*].kinesis.powertools_json(powertools_base64(data))")
return event

**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions** # noqa: E501
**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions**

from aws_lambda_powertools.utilities.validation import validate

Expand All @@ -218,7 +218,7 @@ def handler(event, context):
When JSON schema provided is invalid
InvalidEnvelopeExpressionError
When JMESPath expression to unwrap event is invalid
"""
""" # noqa: E501
if envelope:
event = jmespath_utils.extract_data_from_envelope(
data=event, envelope=envelope, jmespath_options=jmespath_options
Expand Down
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ ignore = [
"PLC", # Convention category - disabled temporarily
"PLE", # Error category - disabled temporarily
"ISC", # flake8-implicit-str-concat - disabled temporarily
"E501", # Line too long - disabled temporarily
"I001", # isort - disabled temporarily
]

Expand Down