Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp authored Jan 29, 2024
1 parent 2454ad1 commit 2283c13
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
files: ^(.*\.toml)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.1.14
hooks:
- id: ruff
args: [ --exit-non-zero-on-fix, --fix ]
Expand All @@ -33,7 +33,7 @@ repos:
- repo: https://github.com/psf/black
hooks:
- id: black
rev: 23.12.1
rev: 24.1.1

- repo: https://github.com/LilSpazJoekp/docstrfmt
hooks:
Expand Down
17 changes: 11 additions & 6 deletions asyncprawcore/auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides Authentication and Authorization classes."""

from __future__ import annotations

import inspect
Expand Down Expand Up @@ -241,12 +242,16 @@ def __init__(
self,
authenticator: BaseAuthenticator,
*,
post_refresh_callback: Callable[[Authorizer], Awaitable[None]]
| Callable[[Authorizer], None]
| None = None,
pre_refresh_callback: Callable[[Authorizer], Awaitable[None]]
| Callable[[Authorizer], None]
| None = None,
post_refresh_callback: (
Callable[[Authorizer], Awaitable[None]]
| Callable[[Authorizer], None]
| None
) = None,
pre_refresh_callback: (
Callable[[Authorizer], Awaitable[None]]
| Callable[[Authorizer], None]
| None
) = None,
refresh_token: str | None = None,
):
"""Represent a single authorization to Reddit's API.
Expand Down
1 change: 1 addition & 0 deletions asyncprawcore/codes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Use our own codes instead of importing them."""

from __future__ import annotations


Expand Down
1 change: 1 addition & 0 deletions asyncprawcore/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for the asyncprawcore package."""

import os

ACCESS_TOKEN_PATH = "/api/v1/access_token" # noqa: S105
Expand Down
1 change: 1 addition & 0 deletions asyncprawcore/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide exception classes for the asyncprawcore package."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any
Expand Down
1 change: 1 addition & 0 deletions asyncprawcore/rate_limit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the RateLimiter class."""

from __future__ import annotations

import asyncio
Expand Down
7 changes: 4 additions & 3 deletions asyncprawcore/requestor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the HTTP request handling interface."""

from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -59,9 +60,9 @@ def __init__(
self._http = session or aiohttp.ClientSession(
loop=self.loop, timeout=aiohttp.ClientTimeout(total=None)
)
self._http._default_headers[
"User-Agent"
] = f"{user_agent} asyncprawcore/{__version__}"
self._http._default_headers["User-Agent"] = (
f"{user_agent} asyncprawcore/{__version__}"
)

self.oauth_url = oauth_url
self.reddit_url = reddit_url
Expand Down
1 change: 1 addition & 0 deletions asyncprawcore/sessions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""asyncprawcore.sessions: Provides asyncprawcore.Session and asyncprawcore.session."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions asyncprawcore/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide utility for the asyncprawcore package."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Prepare pytest."""

import asyncio
import os
from base64 import b64encode
Expand Down
1 change: 1 addition & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""asyncprawcore Integration test suite."""

import os

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_authenticator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for subclasses of asyncprawcore.auth.BaseAuthenticator class."""

import pytest

import asyncprawcore
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_authorizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for asyncprawcore.auth.Authorizer classes."""

import pytest

import asyncprawcore
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_sessions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for asyncprawcore.Sessions module."""

import logging
from json import dumps

Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_authenticator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for subclasses of asyncprawcore.auth.BaseAuthenticator class."""

import pytest

import asyncprawcore
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_authorizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for asyncprawcore.auth.Authorizer classes."""

import pytest

import asyncprawcore
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_rate_limit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for asyncprawcore.Sessions module."""

from copy import copy
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_requestor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for asyncprawcore.self.requestor.Requestor class."""

import asyncio
from unittest.mock import MagicMock, patch

Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_sessions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for asyncprawcore.Sessions module."""

import logging
from unittest.mock import AsyncMock, patch

Expand Down
1 change: 1 addition & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest utils for integration tests."""

from __future__ import annotations
import json
import os
Expand Down

0 comments on commit 2283c13

Please sign in to comment.