Skip to content

Commit

Permalink
Merge pull request #274 from praw-dev/update/pre-commit-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Jan 29, 2024
2 parents f739ca0 + 15baf6e commit 7bc8c10
Show file tree
Hide file tree
Showing 97 changed files with 135 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -51,7 +51,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
1 change: 1 addition & 0 deletions asyncpraw/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the code to load Async PRAW's configuration file ``praw.ini``."""

from __future__ import annotations

import configparser
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Async PRAW constants."""

from .endpoints import API_PATH # noqa: F401

__version__ = "7.7.2.dev0"
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""List of API endpoints PRAW knows about."""

# fmt: off
API_PATH = {
"about_edited": "r/{subreddit}/about/edited/",
Expand Down
15 changes: 9 additions & 6 deletions asyncpraw/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
All other exceptions are subclassed from :class:`.ClientException`.
"""

from __future__ import annotations

import sys
Expand Down Expand Up @@ -240,12 +241,14 @@ def parse_exception_list(
) -> list[RedditErrorItem]:
"""Covert an exception list into a :class:`.RedditErrorItem` list."""
return [
exception
if isinstance(exception, RedditErrorItem)
else RedditErrorItem(
error_type=exception[0],
field=exception[2] if bool(exception[2]) else "",
message=exception[1] if bool(exception[1]) else "",
(
exception
if isinstance(exception, RedditErrorItem)
else RedditErrorItem(
error_type=exception[0],
field=exception[2] if bool(exception[2]) else "",
message=exception[1] if bool(exception[1]) else "",
)
)
for exception in exceptions
]
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Async PRAW models."""

from .auth import Auth
from .front import Front
from .helpers import DraftHelper, LiveHelper, MultiredditHelper, SubredditHelper
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Auth class."""

from __future__ import annotations

from asyncprawcore import (
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the AsyncPRAWBase superclass."""

from __future__ import annotations

from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/comment_forest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide CommentForest for submission comments."""

from __future__ import annotations

import inspect
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/front.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Front class."""

from __future__ import annotations

from typing import TYPE_CHECKING, AsyncIterator
Expand Down
8 changes: 4 additions & 4 deletions asyncpraw/models/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the helper classes."""

from __future__ import annotations

from json import dumps
Expand Down Expand Up @@ -89,10 +90,9 @@ async def create(
selftext: str | None = None,
send_replies: bool = True,
spoiler: bool = False,
subreddit: str
| asyncpraw.models.Subreddit
| asyncpraw.models.UserSubreddit
| None = None,
subreddit: (
str | asyncpraw.models.Subreddit | asyncpraw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**draft_kwargs: Any,
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/inbox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Front class."""

from __future__ import annotations

from typing import TYPE_CHECKING, AsyncIterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/list/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the BaseList class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Iterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/list/draft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the DraftList class."""

from .base import BaseList


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/list/moderated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the ModeratedList class."""

from .base import BaseList


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/list/redditor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the RedditorList class."""

from .base import BaseList


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/list/trophy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the TrophyList class."""

from .base import BaseList


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/domain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the DomainListing class."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the ListingGenerator class."""

from __future__ import annotations

from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/listing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Listing class."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Package providing models that pertain to listing mixins."""

from .base import BaseListingMixin
from .redditor import RedditorListingMixin
from .rising import RisingListingMixin
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the BaseListingMixin class."""

from __future__ import annotations

from typing import Any, AsyncIterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/gilded.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the GildedListingMixin class."""

from __future__ import annotations

from typing import Any, AsyncIterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/redditor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the RedditorListingMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING, AsyncIterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/rising.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the RisingListingMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING, AsyncIterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/submission.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the SubmissionListingMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING, AsyncIterator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/listing/mixins/subreddit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the SubredditListingMixin class."""

from __future__ import annotations

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

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/mod_note.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the ModNote class."""

from __future__ import annotations

from ..endpoints import API_PATH
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/mod_notes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides classes for interacting with moderator notes."""

from itertools import islice
from typing import TYPE_CHECKING, Any, AsyncGenerator, List, Optional, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/preferences.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Preferences class."""

from __future__ import annotations

from json import dumps
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the RedditBase class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/collections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide Collections functionality."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Generator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/comment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Comment class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any
Expand Down
29 changes: 15 additions & 14 deletions asyncpraw/models/reddit/draft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the draft class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any
Expand Down Expand Up @@ -55,9 +56,9 @@ async def _prepare_data(
selftext: str | None = None,
send_replies: bool | None = None,
spoiler: bool | None = None,
subreddit: asyncpraw.models.Subreddit
| asyncpraw.models.UserSubreddit
| None = None,
subreddit: (
asyncpraw.models.Subreddit | asyncpraw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**draft_kwargs: Any,
Expand All @@ -80,9 +81,11 @@ async def _prepare_data(
data.update(
{
"subreddit": subreddit.fullname,
"target": "profile"
if subreddit.display_name.startswith("u_")
else "subreddit",
"target": (
"profile"
if subreddit.display_name.startswith("u_")
else "subreddit"
),
}
)
data.update(draft_kwargs)
Expand Down Expand Up @@ -151,10 +154,9 @@ async def submit(
nsfw: bool | None = None,
selftext: str | None = None,
spoiler: bool | None = None,
subreddit: str
| asyncpraw.models.Subreddit
| asyncpraw.models.UserSubreddit
| None = None,
subreddit: (
str | asyncpraw.models.Subreddit | asyncpraw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**submit_kwargs: Any,
Expand Down Expand Up @@ -245,10 +247,9 @@ async def update(
selftext: str | None = None,
send_replies: bool | None = None,
spoiler: bool | None = None,
subreddit: str
| asyncpraw.models.Subreddit
| asyncpraw.models.UserSubreddit
| None = None,
subreddit: (
str | asyncpraw.models.Subreddit | asyncpraw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**draft_kwargs: Any,
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/emoji.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Emoji class."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/inline_media.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide classes related to inline media."""

from __future__ import annotations

from ..util import _deprecate_args
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/live.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the LiveThread class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, AsyncIterator, Iterable
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/message.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the Message class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Package providing reddit class mixins."""

from __future__ import annotations

from json import dumps
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/editable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the EditableMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/gildable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the GildableMixin class."""

from warnings import warn

from ....const import API_PATH
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/inboxable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the InboxableMixin class."""

from ....const import API_PATH


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/inboxtoggleable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the InboxToggleableMixin class."""

from ....const import API_PATH


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/messageable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the MessageableMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/modnote.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the ModNoteMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, AsyncGenerator
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/replyable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the ReplyableMixin class."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/reportable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the ReportableMixin class."""

from ....const import API_PATH


Expand Down
1 change: 1 addition & 0 deletions asyncpraw/models/reddit/mixins/savable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the SavableMixin class."""

from __future__ import annotations

from ....const import API_PATH
Expand Down
Loading

0 comments on commit 7bc8c10

Please sign in to comment.