Skip to content

Commit 18b9b19

Browse files
chore(deps-dev): bump flake8-bugbear from 23.1.20 to 23.2.13 (#1924)
* chore(deps-dev): bump flake8-bugbear from 23.1.20 to 23.2.13 Bumps [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) from 23.1.20 to 23.2.13. - [Release notes](https://github.com/PyCQA/flake8-bugbear/releases) - [Commits](PyCQA/flake8-bugbear@23.1.20...23.2.13) --- updated-dependencies: - dependency-name: flake8-bugbear dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * fix: bugbear issues --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ruben Fonseca <[email protected]>
1 parent 7fc30f0 commit 18b9b19

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ def register_resolver(func: Callable):
501501
self._routes.append(Route(item, self._compile_regex(rule), func, cors_enabled, compress, cache_control))
502502
route_key = item + rule
503503
if route_key in self._route_keys:
504-
warnings.warn(f"A route like this was already registered. method: '{item}' rule: '{rule}'")
504+
warnings.warn(
505+
f"A route like this was already registered. method: '{item}' rule: '{rule}'", stacklevel=2
506+
)
505507
self._route_keys.append(route_key)
506508
if cors_enabled:
507509
logger.debug(f"Registering method {item.upper()} to Allow Methods in CORS")
@@ -526,7 +528,9 @@ def resolve(self, event, context) -> Dict[str, Any]:
526528
"""
527529
if isinstance(event, BaseProxyEvent):
528530
warnings.warn(
529-
"You don't need to serialize event to Event Source Data Class when using Event Handler; see issue #1152"
531+
"You don't need to serialize event to Event Source Data Class when using Event Handler; "
532+
"see issue #1152",
533+
stacklevel=2,
530534
)
531535
event = event.raw_event
532536

aws_lambda_powertools/metrics/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def decorate(event, context):
391391
self._add_cold_start_metric(context=context)
392392
finally:
393393
if not raise_on_empty_metrics and not self.metric_set:
394-
warnings.warn("No metrics to publish, skipping")
394+
warnings.warn("No metrics to publish, skipping", stacklevel=2)
395395
else:
396396
metrics = self.serialize_metric_set()
397397
self.clear_metrics()

aws_lambda_powertools/shared/functions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ def bytes_to_string(value: bytes) -> str:
106106
def powertools_dev_is_set() -> bool:
107107
is_on = strtobool(os.getenv(constants.POWERTOOLS_DEV_ENV, "0"))
108108
if is_on:
109-
warnings.warn("POWERTOOLS_DEV environment variable is enabled. Increasing verbosity across utilities.")
109+
warnings.warn(
110+
"POWERTOOLS_DEV environment variable is enabled. Increasing verbosity across utilities.", stacklevel=2
111+
)
110112
return True
111113

112114
return False
@@ -115,7 +117,7 @@ def powertools_dev_is_set() -> bool:
115117
def powertools_debug_is_set() -> bool:
116118
is_on = strtobool(os.getenv(constants.POWERTOOLS_DEBUG_ENV, "0"))
117119
if is_on:
118-
warnings.warn("POWERTOOLS_DEBUG environment variable is enabled. Setting logging level to DEBUG.")
120+
warnings.warn("POWERTOOLS_DEBUG environment variable is enabled. Setting logging level to DEBUG.", stacklevel=2)
119121
return True
120122

121123
return False

aws_lambda_powertools/shared/headers_serializer.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def serialize(self, headers: Dict[str, Union[str, List[str]]], cookies: List[Coo
9797
if len(cookies) > 1:
9898
warnings.warn(
9999
"Can't encode more than one cookie in the response. Sending the last cookie only. "
100-
"Did you enable multiValueHeaders on the ALB Target Group?"
100+
"Did you enable multiValueHeaders on the ALB Target Group?",
101+
stacklevel=2,
101102
)
102103

103104
# We can only send one cookie, send the last one
@@ -114,7 +115,8 @@ def serialize(self, headers: Dict[str, Union[str, List[str]]], cookies: List[Coo
114115
if len(values) > 1:
115116
warnings.warn(
116117
f"Can't encode more than one header value for the same key ('{key}') in the response. "
117-
"Did you enable multiValueHeaders on the ALB Target Group?"
118+
"Did you enable multiValueHeaders on the ALB Target Group?",
119+
stacklevel=2,
118120
)
119121

120122
# We can only set one header per key, send the last one

aws_lambda_powertools/utilities/idempotency/persistence/base.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def _get_hashed_idempotency_key(self, data: Dict[str, Any]) -> str:
182182
if self.is_missing_idempotency_key(data=data):
183183
if self.raise_on_no_idempotency_key:
184184
raise IdempotencyKeyError("No data found to create a hashed idempotency_key")
185-
warnings.warn(f"No value found for idempotency_key. jmespath: {self.event_key_jmespath}")
185+
warnings.warn(f"No value found for idempotency_key. jmespath: {self.event_key_jmespath}", stacklevel=2)
186186

187187
generated_hash = self._generate_hash(data=data)
188188
return f"{self.function_name}#{generated_hash}"
@@ -359,7 +359,8 @@ def save_inprogress(self, data: Dict[str, Any], remaining_time_in_millis: Option
359359
else:
360360
warnings.warn(
361361
"Couldn't determine the remaining time left. "
362-
"Did you call register_lambda_context on IdempotencyConfig?"
362+
"Did you call register_lambda_context on IdempotencyConfig?",
363+
stacklevel=2,
363364
)
364365

365366
logger.debug(f"Saving in progress record for idempotency key: {data_record.idempotency_key}")

poetry.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ bandit = "^1.7.1"
5858
radon = "^5.1.0"
5959
xenon = "^0.9.0"
6060
flake8-eradicate = "^1.2.1"
61-
flake8-bugbear = "^23.1.20"
61+
flake8-bugbear = "^23.2.13"
6262
mkdocs-git-revision-date-plugin = "^0.3.2"
6363
mike = "^1.1.2"
6464
retry = "^0.9.2"

0 commit comments

Comments
 (0)