reddit: specify attributes on all protocols
This commit is contained in:
parent
8422c6e420
commit
995554cea9
1 changed files with 48 additions and 5 deletions
|
@ -34,24 +34,67 @@ class RedditBase(Protocol):
|
|||
def text(self) -> str: ...
|
||||
|
||||
|
||||
# TODO: is there some way to handle this with subclasses or inhering protocols?
|
||||
# can't seem to figure it out
|
||||
|
||||
|
||||
# Note: doesn't include GDPR Save's since they don't have the same metadata
|
||||
class Save(Protocol, RedditBase):
|
||||
class Save(Protocol):
|
||||
@property
|
||||
def raw(self) -> Json: ...
|
||||
@property
|
||||
def created(self) -> datetime_aware: ...
|
||||
@property
|
||||
def id(self) -> str: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
@property
|
||||
def subreddit(self) -> str: ...
|
||||
|
||||
# Note: doesn't include GDPR Upvote's since they don't have the same metadata
|
||||
class Upvote(Protocol, RedditBase):
|
||||
class Upvote(Protocol):
|
||||
@property
|
||||
def raw(self) -> Json: ...
|
||||
@property
|
||||
def created(self) -> datetime_aware: ...
|
||||
@property
|
||||
def id(self) -> str: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
@property
|
||||
def title(self) -> str: ...
|
||||
|
||||
|
||||
# From rexport, pushshift and the reddit GDPR export
|
||||
class Comment(Protocol, RedditBase):
|
||||
pass
|
||||
class Comment(Protocol):
|
||||
@property
|
||||
def raw(self) -> Json: ...
|
||||
@property
|
||||
def created(self) -> datetime_aware: ...
|
||||
@property
|
||||
def id(self) -> str: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
|
||||
|
||||
# From rexport and the GDPR export
|
||||
class Submission(Protocol, RedditBase):
|
||||
class Submission(Protocol):
|
||||
@property
|
||||
def raw(self) -> Json: ...
|
||||
@property
|
||||
def created(self) -> datetime_aware: ...
|
||||
@property
|
||||
def id(self) -> str: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
@property
|
||||
def title(self) -> str: ...
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue