Skip to content

Commit

Permalink
Use Self consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
hypergonial committed Dec 13, 2023
1 parent 1ef57b2 commit 6660370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions models/journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import datetime
import enum
import typing as t

import asyncpg
import attr
Expand Down Expand Up @@ -63,7 +64,7 @@ def display_content(self) -> str:
return f"{helpers.format_dt(self.created_at, style='d')} **{ENTRY_TYPE_VERB_MAPPING.get(self.entry_type, '')} by {author_mention}**: {content}"

@classmethod
def from_record(cls, record: asyncpg.Record) -> JournalEntry:
def from_record(cls, record: asyncpg.Record) -> t.Self:
"""Create a new instance of JournalEntry from an asyncpg.Record.
Parameters
Expand All @@ -89,7 +90,7 @@ def from_record(cls, record: asyncpg.Record) -> JournalEntry:
@classmethod
async def fetch(
cls, id: int, user: hikari.SnowflakeishOr[hikari.PartialUser], guild: hikari.SnowflakeishOr[hikari.PartialGuild]
) -> JournalEntry | None:
) -> t.Self | None:
"""Fetch a journal entry from the database.
Parameters
Expand Down Expand Up @@ -119,7 +120,7 @@ async def fetch(
@classmethod
async def fetch_journal(
cls, user: hikari.SnowflakeishOr[hikari.PartialUser], guild: hikari.SnowflakeishOr[hikari.PartialGuild]
) -> list[JournalEntry]:
) -> list[t.Self]:
"""Fetch a user's journal from the database.
Parameters
Expand Down
4 changes: 2 additions & 2 deletions models/rolebutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def custom_id(self) -> str:
return self._custom_id

@classmethod
async def fetch(cls, id: int) -> RoleButton | None:
async def fetch(cls, id: int) -> t.Self | None:
"""Fetch a rolebutton stored in the database by ID.
Parameters
Expand Down Expand Up @@ -160,7 +160,7 @@ async def create(
mode: RoleButtonMode,
label: str | None = None,
moderator: hikari.PartialUser | None = None,
) -> RoleButton:
) -> t.Self:
"""Create a new rolebutton with the provided parameters.
Parameters
Expand Down

0 comments on commit 6660370

Please sign in to comment.