Skip to content

Commit

Permalink
Standardize __repr__ docstring description
Browse files Browse the repository at this point in the history
(cherry picked from commit f046f2bd98ce3bbdcdb0a3a2ffee973d0d0e7d16)
  • Loading branch information
LilSpazJoekp committed Dec 27, 2021
1 parent 5615cb9 commit f81c9a2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions asyncpraw/exceptions.py
Expand Up @@ -59,8 +59,8 @@ def __eq__(self, other: Union["RedditErrorItem", List[str]]):
)
return super().__eq__(other)

def __repr__(self):
"""Return repr(self)."""
def __repr__(self) -> str:
"""Return an object initialization representation of the instance."""
return (
f"{self.__class__.__name__}(error_type={self.error_type!r},"
f" message={self.message!r}, field={self.field!r})"
Expand Down
2 changes: 1 addition & 1 deletion asyncpraw/models/reddit/draft.py
Expand Up @@ -108,7 +108,7 @@ def __init__(
super().__init__(reddit, _data=_data, _fetched=fetched)

def __repr__(self) -> str:
"""Return a string representation of the :class:`.Draft` instance."""
"""Return an object initialization representation of the instance."""
if self._fetched:
subreddit = (
f" subreddit={self.subreddit.display_name!r}" if self.subreddit else ""
Expand Down
2 changes: 1 addition & 1 deletion asyncpraw/models/reddit/inline_media.py
Expand Up @@ -27,7 +27,7 @@ def __eq__(self, other: "InlineMedia"):
)

def __repr__(self) -> str:
"""Return a string representation of the :class:`.InlineMedia` instance."""
"""Return an object initialization representation of the instance."""
return f"<{self.__class__.__name__} caption={self.caption!r}>"

def __str__(self):
Expand Down
2 changes: 1 addition & 1 deletion asyncpraw/models/reddit/more.py
Expand Up @@ -33,7 +33,7 @@ def __lt__(self, other: "MoreComments") -> bool:
return self.count > other.count

def __repr__(self) -> str:
"""Return a string representation of the :class:`.MoreComments` instance."""
"""Return an object initialization representation of the instance."""
children = self.children[:4]
if len(self.children) > 4:
children[-1] = "..."
Expand Down
4 changes: 2 additions & 2 deletions asyncpraw/models/reddit/poll.py
Expand Up @@ -32,8 +32,8 @@ class PollOption(AsyncPRAWBase):
"""

def __repr__(self):
"""Make a string representation of the :class:`.PollData`."""
def __repr__(self) -> str:
"""Return an object initialization representation of the instance."""
return f"PollOption(id={self.id!r})"

def __str__(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions asyncpraw/models/reddit/widgets.py
Expand Up @@ -343,8 +343,8 @@ def __init__(self, subreddit):

super().__init__(subreddit._reddit, {})

def __repr__(self):
"""Return an object initialization representation of the object."""
def __repr__(self) -> str:
"""Return an object initialization representation of the instance."""
return f"SubredditWidgets(subreddit={self.subreddit!r})"

async def _fetch(self):
Expand Down
2 changes: 1 addition & 1 deletion asyncpraw/models/trophy.py
Expand Up @@ -50,5 +50,5 @@ def __str__(self) -> str:
return self.name # pylint: disable=no-member

def __repr__(self) -> str:
"""Return the object's REPR status."""
"""Return an object initialization representation of the instance."""
return f"{self.__class__.__name__}(name={self.name!r})"
2 changes: 1 addition & 1 deletion asyncpraw/util/cache.py
Expand Up @@ -45,5 +45,5 @@ def __get__(self, obj: Optional[Any], objtype: Optional[Any] = None) -> Any:
return value

def __repr__(self) -> str:
"""Return repr(self)."""
"""Return an object initialization representation of the instance."""
return f"<{self.__class__.__name__} {self.func}>"

0 comments on commit f81c9a2

Please sign in to comment.