Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#1164) Add types to front.py #1188

Merged
merged 1 commit into from
Dec 29, 2019
Merged
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
10 changes: 8 additions & 2 deletions praw/models/front.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
"""Provide the Front class."""
from typing import Generator, TypeVar, Union
from urllib.parse import urljoin

from .listing.generator import ListingGenerator
from .listing.mixins import SubredditListingMixin
from .reddit.submission import Submission

Reddit = TypeVar("Reddit")


class Front(SubredditListingMixin):
"""Front is a Listing class that represents the front page."""

def __init__(self, reddit):
def __init__(self, reddit: Reddit):
"""Initialize a Front instance."""
super().__init__(reddit, _data=None)
self._path = "/"

def best(self, **generator_kwargs):
def best(
self, **generator_kwargs: Union[str, int]
) -> Generator[Submission, None, None]:
"""Return a :class:`.ListingGenerator` for best items.

Additional keyword arguments are passed in the initialization of
Expand Down