classes: use self.__class__.__name__ in __repr__
This commit is contained in:
parent
bfe8fb70f6
commit
d0ba568738
17 changed files with 20 additions and 20 deletions
|
@ -19,7 +19,7 @@ class BadgeDef(Base):
|
|||
description = Column(String)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<BadgeDef(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
class Badge(Base):
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Badge(Base):
|
|||
lazy="joined", innerjoin=True, viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>"
|
||||
return f"<{self.__class__.__name__}(user_id={self.user_id}, badge_id={self.badge_id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -77,7 +77,7 @@ class Comment(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Comment(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -15,4 +15,4 @@ class Exile(Base):
|
|||
exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
||||
return f"<{self.__class__.__name__}(user_id={self.user_id}, sub={self.sub})>"
|
||||
|
|
|
@ -24,7 +24,7 @@ class Flag(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Flag(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
@ -60,7 +60,7 @@ class CommentFlag(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<CommentFlag(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -19,4 +19,4 @@ class Follow(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Follow(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
|
|
@ -14,4 +14,4 @@ class Marsey(Base):
|
|||
Index('marseys_idx', name)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Marsey(name={self.name})>"
|
||||
return f"<{self.__class__.__name__}(name={self.name})>"
|
||||
|
|
|
@ -18,7 +18,7 @@ class Mod(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Mod(user_id={self.user_id}, sub={self.sub})>"
|
||||
return f"<{self.__class__.__name__}(user_id={self.user_id}, sub={self.sub})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -34,7 +34,7 @@ class ModAction(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ModAction(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -24,4 +24,4 @@ class Notification(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Notification(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
|
|
@ -25,7 +25,7 @@ class Sub(Base):
|
|||
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Sub(name={self.name})>"
|
||||
return f"<{self.__class__.__name__}(name={self.name})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -11,4 +11,4 @@ class SubBlock(Base):
|
|||
Index('fki_sub_blocks_sub_fkey', sub)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>"
|
||||
return f"<{self.__class__.__name__}(user_id={self.user_id}, sub={self.sub})>"
|
||||
|
|
|
@ -82,7 +82,7 @@ class Submission(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Submission(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -15,4 +15,4 @@ class Subscription(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Subscription(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
|
|
@ -347,7 +347,7 @@ class User(Base):
|
|||
return f"/@{self.username}"
|
||||
|
||||
def __repr__(self):
|
||||
return f"<User(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -14,4 +14,4 @@ class UserBlock(Base):
|
|||
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", viewonly=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<UserBlock(user={self.user_id}, target={self.target_id})>"
|
||||
return f"<{self.__class__.__name__}(user={self.user_id}, target={self.target_id})>"
|
||||
|
|
|
@ -42,7 +42,7 @@ class UserNote(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<UserNote(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
def json(self):
|
||||
reference = None
|
||||
|
|
|
@ -27,7 +27,7 @@ class Vote(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Vote(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
@ -71,7 +71,7 @@ class CommentVote(Base):
|
|||
super().__init__(*args, **kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<CommentVote(id={self.id})>"
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue