Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
id: ruff
- id: ruff-format
repo: https://github.com/astral-sh/ruff-pre-commit
rev: 01a675ea018f2fb714478a5ffb83fcea8374bb06 # frozen: v0.15.21
rev: 2700fd5671c633760d912769c041bfcde2b9a01b # frozen: v0.15.22

- hooks:
- files: ^(.*\.toml)$
Expand Down
2 changes: 1 addition & 1 deletion prawcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
TrustedAuthenticator,
UntrustedAuthenticator,
)
from prawcore.exceptions import * # noqa: F403
from prawcore.exceptions import * # ruff:ignore[undefined-local-with-import-star]
from prawcore.requestor import Requestor
from prawcore.sessions import Session, session

Expand Down
4 changes: 2 additions & 2 deletions prawcore/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def revoke(self) -> None:
msg = "no token available to revoke"
raise InvalidInvocation(msg)

self._authenticator.revoke_token(self.access_token, token_type="access_token") # noqa: S106
self._authenticator.revoke_token(self.access_token, token_type="access_token") # ruff:ignore[hardcoded-password-func-arg]
self._clear_access_token()


Expand Down Expand Up @@ -268,7 +268,7 @@ def revoke(self, *, only_access: bool = False) -> None:
if only_access or self.refresh_token is None:
super().revoke()
else:
self._authenticator.revoke_token(self.refresh_token, token_type="refresh_token") # noqa: S106
self._authenticator.revoke_token(self.refresh_token, token_type="refresh_token") # ruff:ignore[hardcoded-password-func-arg]
self._clear_access_token()
self.refresh_token = None

Expand Down
6 changes: 3 additions & 3 deletions prawcore/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import os

ACCESS_TOKEN_PATH = "/api/v1/access_token" # noqa: S105
ACCESS_TOKEN_PATH = "/api/v1/access_token" # ruff:ignore[hardcoded-password-string]
AUTHORIZATION_PATH = "/api/v1/authorize"
NANOSECONDS = 1_000_000_000
REVOKE_TOKEN_PATH = "/api/v1/revoke_token" # noqa: S105
REVOKE_TOKEN_PATH = "/api/v1/revoke_token" # ruff:ignore[hardcoded-password-string]
TIMEOUT = float(
os.environ.get(
"PRAWCORE_TIMEOUT",
os.environ.get("prawcore_timeout", "16"), # noqa: SIM112
os.environ.get("prawcore_timeout", "16"), # ruff:ignore[uncapitalized-environment-variables]
),
)
WINDOW_SIZE = 600
2 changes: 1 addition & 1 deletion prawcore/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
]


class PrawcoreException(Exception): # noqa: N818
class PrawcoreException(Exception): # ruff:ignore[error-suffix-on-exception-name]
"""Base exception class for exceptions that occur within this package."""


Expand Down
4 changes: 2 additions & 2 deletions prawcore/requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

"""
# Imported locally to avoid an import cycle, with __init__
from prawcore import __version__ # noqa: PLC0415
from prawcore import __version__ # ruff:ignore[import-outside-top-level]

# ``user_agent`` is typed ``str``, but validate at runtime for untyped callers.
if (
Expand All @@ -73,5 +73,5 @@ def request(self, *args: Any, timeout: float | None = None, **kwargs: Any) -> Re
"""Issue the HTTP request capturing any errors that may occur."""
try:
return self._http.request(*args, timeout=timeout or self.timeout, **kwargs)
except Exception as exc: # noqa: BLE001
except Exception as exc: # ruff:ignore[blind-except]
raise RequestException(exc, args, kwargs) from None
2 changes: 1 addition & 1 deletion prawcore/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FiniteRetryStrategy(RetryStrategy):
def _sleep_seconds(self) -> float | None:
if self.retries < self.DEFAULT_RETRIES:
base = 0 if self.retries > 0 else 2
return base + 2 * random.random() # noqa: S311
return base + 2 * random.random() # ruff:ignore[suspicious-non-cryptographic-random-usage]
return None

def consume_available_retry(self) -> FiniteRetryStrategy:
Expand Down