Skip to content

Commit

Permalink
Merge pull request #2013 from praw-dev/update/pre-commit-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp authored Jan 29, 2024
2 parents f9d29e9 + b9a9179 commit f9bc804
Show file tree
Hide file tree
Showing 100 changed files with 131 additions and 33 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 praw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
More information about PRAW can be found at https://github.com/praw-dev/praw.
"""

from .const import __version__
from .reddit import Reddit
1 change: 1 addition & 0 deletions praw/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides the code to load PRAW's configuration file ``praw.ini``."""

from __future__ import annotations

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

from .endpoints import API_PATH # noqa: F401

__version__ = "7.7.2.dev0"
Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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

from typing import Any
Expand Down Expand Up @@ -216,12 +217,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 praw/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the 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 praw/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 prawcore import Authorizer, ImplicitAuthorizer, UntrustedAuthenticator, session
Expand Down
1 change: 1 addition & 0 deletions praw/models/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the PRAWBase superclass."""

from __future__ import annotations

from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions praw/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

from heapq import heappop, heappush
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
8 changes: 4 additions & 4 deletions praw/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 @@ -73,10 +74,9 @@ def create(
selftext: str | None = None,
send_replies: bool = True,
spoiler: bool = False,
subreddit: str
| praw.models.Subreddit
| praw.models.UserSubreddit
| None = None,
subreddit: (
str | praw.models.Subreddit | praw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**draft_kwargs: Any,
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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 praw/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 praw/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 praw/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 praw/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 praw/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 praw/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 praw/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 praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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 praw/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, Generator, List, Optional, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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 praw/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 praw/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
23 changes: 12 additions & 11 deletions praw/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 @@ -76,9 +77,11 @@ 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 @@ -144,10 +147,9 @@ def submit(
nsfw: bool | None = None,
selftext: str | None = None,
spoiler: bool | None = None,
subreddit: str
| praw.models.Subreddit
| praw.models.UserSubreddit
| None = None,
subreddit: (
str | praw.models.Subreddit | praw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**submit_kwargs: Any,
Expand Down Expand Up @@ -238,10 +240,9 @@ def update(
selftext: str | None = None,
send_replies: bool | None = None,
spoiler: bool | None = None,
subreddit: str
| praw.models.Subreddit
| praw.models.UserSubreddit
| None = None,
subreddit: (
str | praw.models.Subreddit | praw.models.UserSubreddit | None
) = None,
title: str | None = None,
url: str | None = None,
**draft_kwargs: Any,
Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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 praw/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, Iterable, Iterator
Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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 praw/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 praw/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 praw/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 praw/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 praw/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 praw/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, Generator
Expand Down
1 change: 1 addition & 0 deletions praw/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 praw/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 praw/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
1 change: 1 addition & 0 deletions praw/models/reddit/mixins/votable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide the VotableMixin class."""

from __future__ import annotations

from ....const import API_PATH
Expand Down
Loading

0 comments on commit f9bc804

Please sign in to comment.