Skip to content

Commit 5030431

Browse files
leandrodamascenarafaelgsr
authored andcommitted
chore(ci): enable Ruff rule E501 and fix errors (aws-powertools#2587)
1 parent 9047f41 commit 5030431

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

aws_lambda_powertools/logging/logger.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Logger:
8787
service name to be appended in logs, by default "service_undefined"
8888
level : str, int optional
8989
The level to set. Can be a string representing the level name: 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'
90-
or an integer representing the level value: 10 for 'DEBUG', 20 for 'INFO', 30 for 'WARNING', 40 for 'ERROR', 50 for 'CRITICAL'. # noqa: E501
90+
or an integer representing the level value: 10 for 'DEBUG', 20 for 'INFO', 30 for 'WARNING', 40 for 'ERROR', 50 for 'CRITICAL'.
9191
by default "INFO"
9292
child: bool, optional
9393
create a child Logger named <service>.<caller_file_name>, False by default
@@ -108,7 +108,7 @@ class Logger:
108108
Parameters propagated to LambdaPowertoolsFormatter
109109
--------------------------------------------------
110110
datefmt: str, optional
111-
String directives (strftime) to format log timestamp using `time`, by default it uses 2021-05-03 11:47:12,494+0200. # noqa: E501
111+
String directives (strftime) to format log timestamp using `time`, by default it uses 2021-05-03 11:47:12,494+0200.
112112
use_datetime_directive: bool, optional
113113
Interpret `datefmt` as a format string for `datetime.datetime.strftime`, rather than
114114
`time.strftime`.
@@ -200,7 +200,7 @@ class Logger:
200200
------
201201
InvalidLoggerSamplingRateError
202202
When sampling rate provided is not a float
203-
"""
203+
""" # noqa: E501
204204

205205
def __init__(
206206
self,

aws_lambda_powertools/metrics/base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ def single_metric(
576576
from aws_lambda_powertools.metrics import MetricUnit
577577
from aws_lambda_powertools.metrics import MetricResolution
578578
579-
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard, namespace="ServerlessAirline") as metric: # noqa E501
579+
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard, namespace="ServerlessAirline") as metric:
580580
metric.add_dimension(name="function_version", value="47")
581581
582582
**Same as above but set namespace using environment variable**
@@ -587,7 +587,7 @@ def single_metric(
587587
from aws_lambda_powertools.metrics import MetricUnit
588588
from aws_lambda_powertools.metrics import MetricResolution
589589
590-
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard) as metric: # noqa E501
590+
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, resolution=MetricResolution.Standard) as metric:
591591
metric.add_dimension(name="function_version", value="47")
592592
593593
Parameters
@@ -618,7 +618,7 @@ def single_metric(
618618
When metric value isn't a number
619619
SchemaValidationError
620620
When metric object fails EMF schema validation
621-
"""
621+
""" # noqa: E501
622622
metric_set: Optional[Dict] = None
623623
try:
624624
metric: SingleMetric = SingleMetric(namespace=namespace)

aws_lambda_powertools/utilities/data_classes/dynamo_db_stream_event.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TypeDeserializer:
1818
"""
1919
Deserializes DynamoDB types to Python types.
2020
21-
It's based on boto3's [DynamoDB TypeDeserializer](https://boto3.amazonaws.com/v1/documentation/api/latest/_modules/boto3/dynamodb/types.html). # noqa: E501
21+
It's based on boto3's [DynamoDB TypeDeserializer](https://boto3.amazonaws.com/v1/documentation/api/latest/_modules/boto3/dynamodb/types.html).
2222
2323
The only notable difference is that for Binary (`B`, `BS`) values we return Python Bytes directly,
2424
since we don't support Python 2.

aws_lambda_powertools/utilities/validation/validator.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ def handler(event, context):
8787
def handler(event, context):
8888
return event
8989
90-
**Unwrap, decode base64 and deserialize JSON string event before validating against actual payload - using built-in functions** # noqa: E501
90+
**Unwrap, decode base64 and deserialize JSON string event before validating against actual payload - using built-in functions**
9191
9292
from aws_lambda_powertools.utilities.validation import validator
9393
9494
@validator(inbound_schema=json_schema_dict, envelope="Records[*].kinesis.powertools_json(powertools_base64(data))")
9595
def handler(event, context):
9696
return event
9797
98-
**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions** # noqa: E501
98+
**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions**
9999
100100
from aws_lambda_powertools.utilities.validation import validator
101101
@@ -116,7 +116,7 @@ def handler(event, context):
116116
When JSON schema provided is invalid
117117
InvalidEnvelopeExpressionError
118118
When JMESPath expression to unwrap event is invalid
119-
"""
119+
""" # noqa: E501
120120
if envelope:
121121
event = jmespath_utils.extract_data_from_envelope(
122122
data=event, envelope=envelope, jmespath_options=jmespath_options
@@ -202,7 +202,7 @@ def handler(event, context):
202202
validate(event=event, schema=json_schema_dict, envelope="Records[*].kinesis.powertools_json(powertools_base64(data))")
203203
return event
204204
205-
**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions** # noqa: E501
205+
**Unwrap, decompress ZIP archive and deserialize JSON string event before validating against actual payload - using built-in functions**
206206
207207
from aws_lambda_powertools.utilities.validation import validate
208208
@@ -218,7 +218,7 @@ def handler(event, context):
218218
When JSON schema provided is invalid
219219
InvalidEnvelopeExpressionError
220220
When JMESPath expression to unwrap event is invalid
221-
"""
221+
""" # noqa: E501
222222
if envelope:
223223
event = jmespath_utils.extract_data_from_envelope(
224224
data=event, envelope=envelope, jmespath_options=jmespath_options

ruff.toml

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ ignore = [
4343
"PLC", # Convention category - disabled temporarily
4444
"PLE", # Error category - disabled temporarily
4545
"ISC", # flake8-implicit-str-concat - disabled temporarily
46-
"E501", # Line too long - disabled temporarily
4746
"I001", # isort - disabled temporarily
4847
]
4948

0 commit comments

Comments
 (0)