Skip to content

Commit 0412d0f

Browse files
authored
Ruff linter: enable rule UP028 (#13048)
1 parent 9492ce9 commit 0412d0f

File tree

6 files changed

+7
-15
lines changed

6 files changed

+7
-15
lines changed

localstack-core/localstack/services/sqs/provider.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ def __init__(self) -> None:
397397

398398
def iter_queues(self) -> Iterable[SqsQueue]:
399399
for account_id, region, store in sqs_stores.iter_stores():
400-
for queue in store.queues.values():
401-
yield queue
400+
yield from store.queues.values()
402401

403402
def do_update_all_queues(self):
404403
for queue in self.iter_queues():

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ ignore = [
217217
"E501", # E501 Line too long - handled by black, see https://docs.astral.sh/ruff/faq/#is-ruff-compatible-with-black
218218
"T201", # TODO `print` found
219219
"T203", # TODO `pprint` found
220-
"UP028",# TODO Replace `yield` over `for` loop with `yield from`
221220
"UP031",# TODO Use format specifiers instead of percent format
222221
"UP038",# TODO Use `X | Y` in `isinstance` call instead of `(X, Y)`
223222
]

tests/integration/aws/test_app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def test_chunked_response_streaming(self, cleanups):
105105
chunks = [bytes(f"{n:2}", "utf-8") for n in range(0, 100)]
106106

107107
def chunk_generator():
108-
for chunk in chunks:
109-
yield chunk
108+
yield from chunks
110109

111110
def stream_response_handler(_request) -> Response:
112111
return Response(response=chunk_generator())
@@ -133,8 +132,7 @@ def handler(request: Request) -> Response:
133132
cleanups.append(lambda: ROUTER.remove(rule))
134133

135134
def chunk_generator():
136-
for chunk in chunks:
137-
yield chunk
135+
yield from chunks
138136

139137
response = requests.post(
140138
config.internal_service_url() + "/_test/test_chunked_request", data=chunk_generator()

tests/unit/http_/test_asgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ def __init__(self, data: list[bytes]):
175175
self.closed = False
176176

177177
def __iter__(self):
178-
for packet in self.data:
179-
yield packet
178+
yield from self.data
180179

181180
def close(self):
182181
# should be called through the werkzeug layers

tests/unit/http_/test_hypercorn.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ def handler(request: WerkzeugRequest) -> Response:
107107
proxy_server = ProxyServer(httpserver.url_for("/"), gateway_listen, use_ssl=True)
108108

109109
def chunk_generator():
110-
for chunk in chunks:
111-
yield chunk
110+
yield from chunks
112111

113112
with server_context(proxy_server):
114113
response = requests.get(
@@ -121,8 +120,7 @@ def test_proxy_server_with_streamed_response(httpserver):
121120
chunks = [bytes(f"{n:2}", "utf-8") for n in range(0, 100)]
122121

123122
def chunk_generator():
124-
for chunk in chunks:
125-
yield chunk
123+
yield from chunks
126124

127125
def stream_response_handler(_: WerkzeugRequest) -> Response:
128126
return Response(response=chunk_generator())

tests/unit/state/test_pickle.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def __init__(self, n: int):
2626
self.gen = self._count()
2727

2828
def _count(self):
29-
for i in range(self.n):
30-
yield i
29+
yield from range(self.n)
3130

3231

3332
class SubclassWithGenerator(ClassWithGenerator):

0 commit comments

Comments
 (0)