Skip to content

Commit 82e0f7e

Browse files
committed
Enable ruff flake8-comprehensions rule
1 parent a835b95 commit 82e0f7e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name = "python-xbox"
33
description = "A library to authenticate with Xbox Network and use their API"
44
authors = [
55
{name = "Manfred Dennerlein Rodelo", email = "[email protected]"},
6-
{name = "OpenXbox"},
76
]
87
dependencies = [
98
"ecdsa",
@@ -49,7 +48,7 @@ line-length = 88
4948
target-version = "py311"
5049

5150
[tool.ruff.lint]
52-
select = ["E4", "E7", "E9", "F", "UP", "S", "ANN"]
51+
select = ["E4", "E7", "E9", "F", "UP", "S", "ANN", "C4"]
5352
# select = ["ALL"]
5453
ignore = ["ANN003", "ANN401"]
5554

src/pythonxbox/api/provider/userstats/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async def get_stats_batch(
111111
post_data = {
112112
"arrangebyfield": "xuid",
113113
"groups": [{"name": "Hero", "titleId": title_id}],
114-
"stats": [dict(name=stat, titleId=title_id) for stat in stats_fields],
114+
"stats": [{"name": stat, "titleId": title_id} for stat in stats_fields],
115115
"xuids": xuids,
116116
}
117117
resp = await self.client.session.post(
@@ -150,7 +150,9 @@ async def get_stats_batch_by_scid(
150150
post_data = {
151151
"arrangebyfield": "xuid",
152152
"groups": [{"name": "Hero", "scid": service_config_id}],
153-
"stats": [dict(name=stat, scid=service_config_id) for stat in stats_fields],
153+
"stats": [
154+
{"name": stat, "scid": service_config_id} for stat in stats_fields
155+
],
154156
"xuids": xuids,
155157
}
156158
resp = await self.client.session.post(

src/pythonxbox/common/ratelimits/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def get_counter(self) -> int:
173173
"""
174174

175175
# Map self.__limits to (limit).get_counter()
176-
counter_map = map(lambda limit: limit.get_counter(), self.__limits)
176+
counter_map = (limit.get_counter() for limit in self.__limits)
177177
counters = list(counter_map)
178178

179179
# Sort the counters list by value
@@ -200,7 +200,7 @@ def get_reset_after(self) -> datetime | None:
200200
dates_exceeded_only = filter(lambda limit: limit.is_exceeded(), self.__limits)
201201

202202
# Map self.__limits to (limit).get_reset_after()
203-
dates_map = map(lambda limit: limit.get_reset_after(), dates_exceeded_only)
203+
dates_map = (limit.get_reset_after() for limit in dates_exceeded_only)
204204

205205
# Convert the map object to a list
206206
dates = list(dates_map)
@@ -241,7 +241,7 @@ def is_exceeded(self) -> bool:
241241
"""
242242

243243
# Map self.__limits to (limit).is_exceeded()
244-
is_exceeded_map = map(lambda limit: limit.is_exceeded(), self.__limits)
244+
is_exceeded_map = (limit.is_exceeded() for limit in self.__limits)
245245
is_exceeded_list = list(is_exceeded_map)
246246

247247
# Return True if any variable in list is True

0 commit comments

Comments
 (0)