diff --git a/aurora/aurora.py b/aurora/aurora.py index 3eb5a2e..fe9abcb 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -205,7 +205,7 @@ class Aurora(commands.Cog): interaction: discord.Interaction, target: discord.User, reason: str, - silent: bool = None, + silent: bool | None = None, ): """Add a note to a user. @@ -263,7 +263,7 @@ class Aurora(commands.Cog): interaction: discord.Interaction, target: discord.Member, reason: str, - silent: bool = None, + silent: bool | None = None, ): """Warn a user. @@ -322,8 +322,8 @@ class Aurora(commands.Cog): target: discord.Member, role: discord.Role, reason: str, - duration: str = None, - silent: bool = None, + duration: str | None = None, + silent: bool | None = None, ): """Add a role to a user. @@ -427,8 +427,8 @@ class Aurora(commands.Cog): target: discord.Member, role: discord.Role, reason: str, - duration: str = None, - silent: bool = None, + duration: str | None = None, + silent: bool | None = None, ): """Remove a role from a user. @@ -532,7 +532,7 @@ class Aurora(commands.Cog): target: discord.Member, duration: str, reason: str, - silent: bool = None, + silent: bool | None = None, ): """Mute a user. @@ -617,8 +617,8 @@ class Aurora(commands.Cog): self, interaction: discord.Interaction, target: discord.Member, - reason: str = None, - silent: bool = None, + reason: str | None = None, + silent: bool | None = None, ): """Unmute a user. @@ -692,7 +692,7 @@ class Aurora(commands.Cog): interaction: discord.Interaction, target: discord.Member, reason: str, - silent: bool = None, + silent: bool | None = None, ): """Kick a user. @@ -762,9 +762,9 @@ class Aurora(commands.Cog): interaction: discord.Interaction, target: discord.User, reason: str, - duration: str = None, - delete_messages: Choice[int] = None, - silent: bool = None, + duration: str | None = None, + delete_messages: Choice[int] | None = None, + silent: bool | None = None, ): """Ban a user. @@ -901,8 +901,8 @@ class Aurora(commands.Cog): self, interaction: discord.Interaction, target: discord.User, - reason: str = None, - silent: bool = None, + reason: str | None = None, + silent: bool | None = None, ): """Unban a user. @@ -976,12 +976,12 @@ class Aurora(commands.Cog): async def history( self, interaction: discord.Interaction, - target: discord.User = None, - moderator: discord.User = None, - pagesize: app_commands.Range[int, 1, 20] = None, + target: discord.User | None = None, + moderator: discord.User | None = None, + pagesize: app_commands.Range[int, 1, 20] | None = None, page: int = 1, - ephemeral: bool = None, - inline: bool = None, + ephemeral: bool | None = None, + inline: bool | None = None, export: bool = False, ): """List previous infractions. @@ -1179,7 +1179,7 @@ class Aurora(commands.Cog): @app_commands.command(name="resolve") async def resolve( - self, interaction: discord.Interaction, case: int, reason: str = None + self, interaction: discord.Interaction, case: int, reason: str | None = None ): """Resolve a specific case. @@ -1251,10 +1251,10 @@ class Aurora(commands.Cog): self, interaction: discord.Interaction, case: int, - ephemeral: bool = None, + ephemeral: bool | None = None, evidenceformat: bool = False, changes: bool = False, - export: Choice[str] = None, + export: Choice[str] | None = None, ): """Check the details of a specific case. @@ -1355,7 +1355,7 @@ class Aurora(commands.Cog): interaction: discord.Interaction, case: int, reason: str, - duration: str = None, + duration: str | None = None, ): """Edit the reason of a specific case. diff --git a/aurora/menus/addrole.py b/aurora/menus/addrole.py index 11f6b32..9f4d1ff 100644 --- a/aurora/menus/addrole.py +++ b/aurora/menus/addrole.py @@ -7,7 +7,7 @@ from aurora.utilities.factory import addrole_embed class Addrole(ui.View): - def __init__(self, ctx: commands.Context, message: Message, timeout: int = None): + def __init__(self, ctx: commands.Context, message: Message, timeout: int | None = None): super().__init__() self.ctx = ctx self.message = message diff --git a/aurora/menus/guild.py b/aurora/menus/guild.py index f99e552..ece8131 100644 --- a/aurora/menus/guild.py +++ b/aurora/menus/guild.py @@ -7,7 +7,7 @@ from aurora.utilities.utils import create_pagesize_options class Guild(ui.View): - def __init__(self, ctx: commands.Context, message: Message, timeout: int = None): + def __init__(self, ctx: commands.Context, message: Message, timeout: int | None = None): super().__init__() self.ctx = ctx self.message = message diff --git a/aurora/menus/immune.py b/aurora/menus/immune.py index 2a5c007..7d85d12 100644 --- a/aurora/menus/immune.py +++ b/aurora/menus/immune.py @@ -7,7 +7,7 @@ from aurora.utilities.factory import immune_embed class Immune(ui.View): - def __init__(self, ctx: commands.Context, message: Message, timeout: int = None): + def __init__(self, ctx: commands.Context, message: Message, timeout: int | None = None): super().__init__() self.ctx = ctx self.message = message diff --git a/aurora/menus/overrides.py b/aurora/menus/overrides.py index c5d0e68..beefaef 100644 --- a/aurora/menus/overrides.py +++ b/aurora/menus/overrides.py @@ -7,7 +7,7 @@ from aurora.utilities.utils import create_pagesize_options class Overrides(ui.View): - def __init__(self, ctx: commands.Context, message: Message, timeout: int = None): + def __init__(self, ctx: commands.Context, message: Message, timeout: int | None = None): super().__init__() self.ctx = ctx self.message = message diff --git a/aurora/models/base.py b/aurora/models/base.py index 31d01ac..45c8a60 100644 --- a/aurora/models/base.py +++ b/aurora/models/base.py @@ -9,7 +9,7 @@ class AuroraBaseModel(BaseModel): model_config = ConfigDict(ignored_types=(Red,), arbitrary_types_allowed=True) bot: Red - def to_json(self, indent: int = None, file: Any = None, **kwargs): + def to_json(self, indent: int | None = None, file: Any | None = None, **kwargs): from aurora.utilities.json import ( # pylint: disable=cyclic-import dump, dumps) return dump(self.model_dump(exclude={"bot"}), file, indent=indent, **kwargs) if file else dumps(self.model_dump(exclude={"bot"}), indent=indent, **kwargs) @@ -18,7 +18,7 @@ class AuroraGuildModel(AuroraBaseModel): """Subclass of AuroraBaseModel that includes a guild_id attribute, and a modified to_json() method to match.""" guild_id: int - def to_json(self, indent: int = None, file: Any = None, **kwargs): + def to_json(self, indent: int | None = None, file: Any | None = None, **kwargs): from aurora.utilities.json import ( # pylint: disable=cyclic-import dump, dumps) return dump(self.model_dump(exclude={"bot", "guild_id"}), file, indent=indent, **kwargs) if file else dumps(self.model_dump(exclude={"bot", "guild_id"}), indent=indent, **kwargs) diff --git a/aurora/models/moderation.py b/aurora/models/moderation.py index 7bea736..11678b6 100644 --- a/aurora/models/moderation.py +++ b/aurora/models/moderation.py @@ -223,16 +223,16 @@ class Moderation(AuroraGuildModel): target_type: str, target_id: int, role_id: int, - duration: timedelta = None, - reason: str = None, - database: sqlite3.Connection = None, - timestamp: datetime = None, + duration: timedelta | None = None, + reason: str | None = None, + database: sqlite3.Connection | None = None, + timestamp: datetime | None = None, resolved: bool = False, - resolved_by: int = None, - resolved_reason: str = None, - expired: bool = None, - changes: list = None, - metadata: dict = None, + resolved_by: int | None = None, + resolved_reason: str | None = None, + expired: bool | None = None, + changes: list | None = None, + metadata: dict | None = None, ) -> "Moderation": from aurora.utilities.database import connect from aurora.utilities.json import dumps diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index d5978c7..e7886ff 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -20,10 +20,10 @@ async def message_factory( guild: Guild, reason: str, moderation_type: str, - moderator: Union[Member, User] = None, - duration: timedelta = None, - response: InteractionMessage = None, - role: Role = None, + moderator: Union[Member, User] | None = None, + duration: timedelta | None = None, + response: InteractionMessage | None = None, + role: Role | None = None, ) -> Embed: """This function creates a message from set parameters, meant for contacting the moderated user. diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index e85fd58..ff950b1 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -14,8 +14,8 @@ from aurora.utilities.config import config def check_permissions( user: User, permissions: list, - ctx: Union[commands.Context, Interaction] = None, - guild: Guild = None, + ctx: Union[commands.Context, Interaction] | None = None, + guild: Guild | None = None, ) -> Union[bool, str]: """Checks if a user has a specific permission (or a list of permissions) in a channel.""" if ctx: