Skip to content

Commit 2efeb9f

Browse files
Rename "SortType" to "ArticlesSortType"
1 parent d8c6e94 commit 2efeb9f

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ reddit = Reddit("your client ID", "your app secret", "custom user agent")
9090
```python
9191
reddit = Reddit("your client ID", "your app secret")
9292
# reddit.subreddit_articles("subreddit name", load_count, sort_type)
93-
articles = reddit.subreddit_articles("Python", 10, SortType.HOT)
93+
articles = reddit.subreddit_articles("Python", 10, ArticlesSortType.HOT)
9494
```
9595
First argument is a name of a subreddit.
9696

@@ -100,11 +100,11 @@ API can return lower number if there are fewer articles in a given subreddit tha
100100
Third argument specifies sort type.
101101
Following sort types are supported:
102102
```python
103-
SortType.HOT
104-
SortType.NEW
105-
SortType.RISING
106-
SortType.TOP
107-
SortType.CONTROVERSIAL
103+
ArticlesSortType.HOT
104+
ArticlesSortType.NEW
105+
ArticlesSortType.RISING
106+
ArticlesSortType.TOP
107+
ArticlesSortType.CONTROVERSIAL
108108
```
109109

110110

@@ -113,20 +113,20 @@ SortType.CONTROVERSIAL
113113
```python
114114
reddit = Reddit("your client ID", "your app secret")
115115
# reddit.user_articles("username", load_count, sort_type)
116-
articles = reddit.user_articles("spez", 20, SortType.CONTROVERSIAL)
116+
articles = reddit.user_articles("spez", 20, ArticlesSortType.CONTROVERSIAL)
117117
```
118118
General usage is the same as for subreddits.
119119

120120

121121
### Sort types
122122

123-
Sort types are available in `SortType` enum. These sort types are available:
123+
Sort types are available in `ArticlesSortType` enum. These sort types are available:
124124
```python
125-
SortType.HOT
126-
SortType.NEW
127-
SortType.RISING
128-
SortType.TOP
129-
SortType.CONTROVERSIAL
125+
ArticlesSortType.HOT
126+
ArticlesSortType.NEW
127+
ArticlesSortType.RISING
128+
ArticlesSortType.TOP
129+
ArticlesSortType.CONTROVERSIAL
130130
```
131131

132132

redditpythonapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from redditpythonapi.reddit import Reddit, SortType
1+
from redditpythonapi.reddit import Reddit, ArticlesSortType

redditpythonapi/reddit.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from httpx import AsyncClient, BasicAuth, Response
1212

1313

14-
class SortType(Enum):
14+
class ArticlesSortType(Enum):
1515
"""Enum with all viable sorting types"""
1616

1717
HOT = auto()
@@ -51,14 +51,14 @@ def __init__(
5151
self._logger = getLogger(__name__)
5252

5353
async def subreddit_articles(
54-
self, subreddit: str, limit: int, sort: SortType
54+
self, subreddit: str, limit: int, sort: ArticlesSortType
5555
) -> list[dict[str, Any]]:
5656
"""Get a list of Reddit articles from the given subreddit
5757
5858
Args:
5959
subreddit (str): subreddit to load articles from
6060
limit (int): up to how many articles should be loaded
61-
sort (SortType): sort type to use when loading articles
61+
sort (ArticlesSortType): sort type to use when loading articles
6262
6363
Returns:
6464
list[dict[str, Any]: list of loaded articles from the given subreddit
@@ -68,13 +68,13 @@ async def subreddit_articles(
6868
params = {"limit": limit}
6969
return await self._get_articles(url, params)
7070

71-
async def user_articles(self, user: str, limit: int, sort: SortType) -> list[dict[str, Any]]:
71+
async def user_articles(self, user: str, limit: int, sort: ArticlesSortType) -> list[dict[str, Any]]:
7272
"""Get a list of Reddit articles from the given Reddit user
7373
7474
Args:
7575
user (str): Reddit user to load articles from
7676
limit (int): up to how many articles should be loaded
77-
sort (SortType): sort type to use when loading articles
77+
sort (ArticlesSortType): sort type to use when loading articles
7878
7979
Returns:
8080
list[dict[str, Any]: list of loaded articles from the Reddit user

0 commit comments

Comments
 (0)