Skip to content

Commit

Permalink
Merge pull request #1204 from PokestarFan/add-types-base-mixins
Browse files Browse the repository at this point in the history
(#1164) Add types to listing/mixins/base.py
  • Loading branch information
bboe authored Dec 29, 2019
2 parents 1c0dcb6 + bae4d20 commit c10984a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 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 typing import Any, Dict, Generator, Union
from urllib.parse import urljoin

from ...base import PRAWBase
Expand Down Expand Up @@ -28,7 +29,11 @@ def _validate_time_filter(time_filter):
)
)

def controversial(self, time_filter="all", **generator_kwargs):
def controversial(
self,
time_filter: str = "all",
**generator_kwargs: Union[str, int, Dict[str, str]]
) -> Generator[Any, None, None]:
"""Return a :class:`.ListingGenerator` for controversial submissions.
:param time_filter: Can be one of: all, day, hour, month, week, year
Expand Down Expand Up @@ -56,7 +61,9 @@ def controversial(self, time_filter="all", **generator_kwargs):
url = _prepare(self, generator_kwargs, "controversial")
return ListingGenerator(self._reddit, url, **generator_kwargs)

def hot(self, **generator_kwargs):
def hot(
self, **generator_kwargs: Union[str, int, Dict[str, str]]
) -> Generator[Any, None, None]:
"""Return a :class:`.ListingGenerator` for hot items.
Additional keyword arguments are passed in the initialization of
Expand All @@ -78,7 +85,9 @@ def hot(self, **generator_kwargs):
url = _prepare(self, generator_kwargs, "hot")
return ListingGenerator(self._reddit, url, **generator_kwargs)

def new(self, **generator_kwargs):
def new(
self, **generator_kwargs: Union[str, int, Dict[str, str]]
) -> Generator[Any, None, None]:
"""Return a :class:`.ListingGenerator` for new items.
Additional keyword arguments are passed in the initialization of
Expand All @@ -100,7 +109,11 @@ def new(self, **generator_kwargs):
url = _prepare(self, generator_kwargs, "new")
return ListingGenerator(self._reddit, url, **generator_kwargs)

def top(self, time_filter="all", **generator_kwargs):
def top(
self,
time_filter: str = "all",
**generator_kwargs: Union[str, int, Dict[str, str]]
) -> Generator[Any, None, None]:
"""Return a :class:`.ListingGenerator` for top submissions.
:param time_filter: Can be one of: all, day, hour, month, week, year
Expand Down

0 comments on commit c10984a

Please sign in to comment.