Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- name: Run ruff format check
run: uv run ruff format --check flickr_api/

- name: Run mypy
run: uv run mypy flickr_api/

test:
runs-on: ubuntu-latest
strategy:
Expand Down
8 changes: 6 additions & 2 deletions flickr_api/method_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ def get_rate_limit_status() -> dict[str, Any]:
- interval_seconds: float - Minimum time between requests (0.0 if disabled)
- last_request_time: float | None - Timestamp of last request
"""
enabled = _RATE_LIMIT_REQUESTS_PER_HOUR is not None
interval = 3600.0 / _RATE_LIMIT_REQUESTS_PER_HOUR if enabled else 0.0
if _RATE_LIMIT_REQUESTS_PER_HOUR is not None:
enabled = True
interval = 3600.0 / _RATE_LIMIT_REQUESTS_PER_HOUR
else:
enabled = False
interval = 0.0
return {
"enabled": enabled,
"requests_per_hour": _RATE_LIMIT_REQUESTS_PER_HOUR,
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@ testpaths = ["test"]

[tool.ruff]
line-length = 100

[tool.mypy]
python_version = "3.10"

# Third-party libraries without type information. `requests_oauthlib` ships no
# stubs, and `PIL` (Pillow) is an optional runtime dependency that is not
# installed by default.
[[tool.mypy.overrides]]
module = [
"requests_oauthlib",
"PIL",
"PIL.*",
]
ignore_missing_imports = true
Loading