Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 1d26825

Browse files
authored
Re-enable C416 ruff rule (#13025)
1 parent c388ec6 commit 1d26825

7 files changed

Lines changed: 7 additions & 11 deletions

File tree

localstack-core/localstack/services/lambda_/api_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,12 @@ def validate_layer_runtimes_and_architectures(
715715

716716
if compatible_runtimes and set(compatible_runtimes).difference(ALL_RUNTIMES):
717717
constraint = f"Member must satisfy enum value set: {VALID_RUNTIMES}"
718-
validation_msg = f"Value '[{', '.join([s for s in compatible_runtimes])}]' at 'compatibleRuntimes' failed to satisfy constraint: {constraint}"
718+
validation_msg = f"Value '[{', '.join(list(compatible_runtimes))}]' at 'compatibleRuntimes' failed to satisfy constraint: {constraint}"
719719
validations.append(validation_msg)
720720

721721
if compatible_architectures and set(compatible_architectures).difference(ARCHITECTURES):
722722
constraint = "[Member must satisfy enum value set: [x86_64, arm64]]"
723-
validation_msg = f"Value '[{', '.join([s for s in compatible_architectures])}]' at 'compatibleArchitectures' failed to satisfy constraint: Member must satisfy constraint: {constraint}"
723+
validation_msg = f"Value '[{', '.join(list(compatible_architectures))}]' at 'compatibleArchitectures' failed to satisfy constraint: Member must satisfy constraint: {constraint}"
724724
validations.append(validation_msg)
725725

726726
return validations

localstack-core/localstack/services/s3/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def pop(self, object_key: ObjectKey, default=None) -> S3Object | None:
638638

639639
def values(self, *_, **__) -> list[S3Object | S3DeleteMarker]:
640640
# we create a shallow copy with dict to avoid size changed during iteration
641-
return [value for value in dict(self._store).values()]
641+
return list(dict(self._store).values())
642642

643643
def is_empty(self) -> bool:
644644
return not self._store

localstack-core/localstack/utils/analytics/metrics/counter.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ def collect(self) -> list[LabeledCounterPayload]:
200200
)
201201

202202
# Create labels dictionary
203-
labels_dict = {
204-
label_name: label_value
205-
for label_name, label_value in zip(self._labels, label_values)
206-
}
203+
labels_dict = dict(zip(self._labels, label_values))
207204

208205
payload.append(
209206
LabeledCounterPayload(

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ ignore = [
213213
"B024", # TODO x is an abstract base class, but it has no abstract methods
214214
"B027", # TODO `Server.do_shutdown` is an empty method in an abstract base class, but has no abstract decorator
215215
"B904", # TODO Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
216-
"C416", # TODO Unnecessary `set` comprehension
217216
"C901", # TODO function is too complex
218217
"E402", # TODO Module level import not at top of file
219218
"E501", # E501 Line too long - handled by black, see https://docs.astral.sh/ruff/faq/#is-ruff-compatible-with-black

scripts/capture_notimplemented_responses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# will only include available services
3939
response = requests.get("http://localhost:4566/_localstack/health").content.decode("utf-8")
40-
latest_services_pro = [k for k in json.loads(response).get("services").keys()]
40+
latest_services_pro = list(json.loads(response).get("services").keys())
4141

4242
exclude_services = {"azure"}
4343
latest_services_pro = [s for s in latest_services_pro if s not in exclude_services]

tests/aws/services/cloudformation/test_template_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ def test_pyplate_param_type_list(self, deploy_cfn_template, aws_client, snapshot
12101210
assert bucket_name_output
12111211

12121212
tagging = aws_client.s3.get_bucket_tagging(Bucket=bucket_name_output)
1213-
tags_s3 = [tag for tag in tagging["TagSet"]]
1213+
tags_s3 = list(tagging["TagSet"])
12141214

12151215
resp = []
12161216
for tag in tags_s3:

tests/unit/utils/test_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_immutable_dict():
4343
d1 = ImmutableDict({"a": ["b"], "c": 1})
4444

4545
assert dict(d1) == {"a": ["b"], "c": 1}
46-
assert {k for k in d1} == {"a", "c"}
46+
assert set(d1) == {"a", "c"}
4747
assert d1["a"] == ["b"]
4848
assert d1["c"] == 1
4949
assert len(d1) == 2

0 commit comments

Comments
 (0)