Skip to content

Commit

Permalink
lint: minor cleanup - part 2
Browse files Browse the repository at this point in the history
Note: The signing key in testdata was changed to accomodate upstream ecdsa change in v0.19.0
  • Loading branch information
tuxuser committed Feb 7, 2025
1 parent 15d6bbb commit 6cce079
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


@pytest_asyncio.fixture(scope="function")
async def auth_mgr(event_loop):
async def auth_mgr():
session = SignedSession()
mgr = AuthenticationManager(session, "abc", "123", "http://localhost")
mgr.oauth = OAuth2TokenResponse.model_validate_json(
Expand All @@ -37,7 +37,7 @@ async def auth_mgr(event_loop):


@pytest_asyncio.fixture(scope="function")
async def xal_mgr(event_loop):
async def xal_mgr():
session = SignedSession()
mgr = XALManager(
session,
Expand Down
6 changes: 3 additions & 3 deletions tests/data/test_signing_key.pem
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIObr5IVtB+DQcn25+R9n4K/EyUUSbVvxIJY7WhVeELUuoAoGCCqGSM49
AwEHoUQDQgAEOKyCQ9qH5U4lZcS0c5/LxIyKvOpKe0l3x4Eg5OgDbzezKNLRgT28
fd4Fq3rU/1OQKmx6jSq0vTB5Ao/48m0iGg==
MHcCAQEEIObr5IVtB+DQcn25+R9n4K/EyUUSbVvxIJY7WhVeELUuoAoGCCqGSM49AwEHoUQDQgAE
OKyCQ9qH5U4lZcS0c5/LxIyKvOpKe0l3x4Eg5OgDbzezKNLRgT28fd4Fq3rU/1OQKmx6jSq0vTB5
Ao/48m0iGg==
-----END EC PRIVATE KEY-----
4 changes: 2 additions & 2 deletions tests/test_ratelimits.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async def helper_reach_and_wait_for_burst(
make_request, start_time, burst_limit: int, expected_counter: int
):
# Make as many requests as possible without exceeding the BURST limit.
for i in range(burst_limit):
for _ in range(burst_limit):
await make_request()

# Make another request, ensure that it raises the exception.
Expand Down Expand Up @@ -202,7 +202,7 @@ async def make_request():
)

# Now, make the rest of the requests (10 left, 20/30 done!)
for i in range(10):
for _ in range(10):
await make_request()

# Wait for the burst limit to 'reset'.
Expand Down
6 changes: 3 additions & 3 deletions xbox/webapi/api/provider/ratelimitedprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def __handle_rate_limit_setup(self):
def __parse_rate_limit_key(
self, key: Union[int, Dict[str, int]], period: TimePeriod
) -> ParsedRateLimit:
key_type = type(key)
if isinstance(key_type, int):
if isinstance(key, int) and not isinstance(key, bool):
# bool is a subclass of int, hence the explicit check
return ParsedRateLimit(read=key, write=key, period=period)
elif isinstance(key_type, dict):
elif isinstance(key, dict):
# TODO: schema here?
# Since the key-value pairs match we can just pass the dict to the model
return ParsedRateLimit(**key, period=period)
Expand Down

0 comments on commit 6cce079

Please sign in to comment.