Skip to content

Commit

Permalink
style: format with ciz
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentRPS committed May 1, 2023
1 parent a508c0a commit 407a770
Show file tree
Hide file tree
Showing 38 changed files with 59 additions and 114 deletions.
2 changes: 1 addition & 1 deletion pycord/api/routers/application_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import ATYPE, ApplicationCommandOption
from ...types.application_commands import (
Expand All @@ -26,7 +27,6 @@
GuildApplicationCommandPermissions,
)
from ...types.interaction import InteractionResponse
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined
from ..route import Route
from .base import BaseRouter
Expand Down
2 changes: 1 addition & 1 deletion pycord/api/routers/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import AUDIT_LOG_EVENT_TYPE, AuditLog
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined
from ..route import Route
from .base import BaseRouter
Expand Down
6 changes: 2 additions & 4 deletions pycord/api/routers/auto_moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import (
AUTO_MODERATION_EVENT_TYPES,
Expand All @@ -26,7 +27,6 @@
AutoModerationRule,
AutoModerationTriggerMetadata,
)
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined
from ..route import Route
from .base import BaseRouter
Expand Down Expand Up @@ -100,9 +100,7 @@ async def modify_auto_moderation_rule(
name: str | MissingEnum = MISSING,
event_type: AUTO_MODERATION_EVENT_TYPES | MissingEnum = MISSING,
actions: list[AutoModerationAction] | MissingEnum = MISSING,
trigger_metadata: AutoModerationTriggerMetadata
| MissingEnum
| None = MISSING,
trigger_metadata: AutoModerationTriggerMetadata | MissingEnum | None = MISSING,
enabled: bool | MissingEnum = MISSING,
exempt_roles: list[Snowflake] | MissingEnum = MISSING,
exempt_channels: list[Snowflake] | MissingEnum = MISSING,
Expand Down
2 changes: 1 addition & 1 deletion pycord/api/routers/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import (
CTYPE,
Expand All @@ -32,7 +33,6 @@
Overwrite,
ThreadMember,
)
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined
from ..route import Route
from .base import BaseRouter
Expand Down
2 changes: 1 addition & 1 deletion pycord/api/routers/emojis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import Emoji
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined
from ..route import Route
from .base import BaseRouter
Expand Down
10 changes: 3 additions & 7 deletions pycord/api/routers/guilds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import datetime

from ...file import File
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import (
MFA_LEVEL,
Expand All @@ -45,7 +46,6 @@
Widget,
WidgetSettings,
)
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined, to_datauri
from ..route import Route
from .base import BaseRouter
Expand Down Expand Up @@ -317,9 +317,7 @@ async def modify_guild_member(
mute: bool | None | MissingEnum = MISSING,
deaf: bool | None | MissingEnum = MISSING,
channel_id: Snowflake | None | MissingEnum = MISSING,
communication_disabled_until: datetime.datetime
| None
| MissingEnum = MISSING,
communication_disabled_until: datetime.datetime | None | MissingEnum = MISSING,
flags: int | None | MissingEnum = MISSING,
reason: str | None = None,
) -> GuildMember:
Expand Down Expand Up @@ -748,9 +746,7 @@ async def modify_current_user_voice_state(
*,
channel_id: Snowflake | MissingEnum = MISSING,
suppress: bool | MissingEnum = MISSING,
request_to_speak_timestamp: datetime.datetime
| None
| MissingEnum = MISSING,
request_to_speak_timestamp: datetime.datetime | None | MissingEnum = MISSING,
) -> None:
if request_to_speak_timestamp:
request_to_speak_timestamp = request_to_speak_timestamp.isoformat()
Expand Down
2 changes: 1 addition & 1 deletion pycord/api/routers/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
from urllib.parse import quote

from ...file import File
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import Attachment, Emoji, User
from ...types.channel import AllowedMentions
from ...types.component import Component
from ...types.embed import Embed
from ...types.message import Message, MessageReference
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined
from ..route import Route
from .base import BaseRouter
Expand Down
2 changes: 1 addition & 1 deletion pycord/api/routers/scheduled_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from typing import Literal

from ...file import File
from ...missing import MISSING, MissingEnum
from ...snowflake import Snowflake
from ...types import PRIVACY_LEVEL, EntityMetadata, GuildScheduledEvent
from ...missing import MISSING, MissingEnum
from ...utils import remove_undefined, to_datauri
from ..route import Route
from .base import BaseRouter
Expand Down
10 changes: 3 additions & 7 deletions pycord/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
from typing import TYPE_CHECKING

from .flags import ApplicationFlags, Permissions
from .missing import MISSING, Maybe, MissingEnum
from .snowflake import Snowflake
from .team import Team
from .types import (
SCOPE,
Application as DiscordApplication,
InstallParams as DiscordInstallParams,
)
from .missing import MISSING, MissingEnum, Maybe
from .user import User

if TYPE_CHECKING:
Expand Down Expand Up @@ -132,13 +132,9 @@ def __init__(self, data: DiscordApplication, state: State) -> None:
self.terms_of_service_url: Maybe[str] = data.get(
'terms_of_service_url', MISSING
)
self.privacy_policy_url: Maybe[str] = data.get(
'privacy_policy_url', MISSING
)
self.privacy_policy_url: Maybe[str] = data.get('privacy_policy_url', MISSING)
self.owner: Maybe[User] = (
User(data.get('owner'), state)
if data.get('owner') is not None
else MISSING
User(data.get('owner'), state) if data.get('owner') is not None else MISSING
)
self.verify_key: str = data.get('verify_key')
self.team: Team | None = (
Expand Down
2 changes: 1 addition & 1 deletion pycord/application_role_connection_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
from typing import Sequence

from .enums import ApplicationRoleConnectionMetadataType
from .missing import MISSING, Maybe, MissingEnum
from .types import (
ApplicationRoleConnectionMetadata as DiscordApplicationRoleConnectionMetadata,
)
from .missing import MISSING, MissingEnum, Maybe
from .user import LOCALE
from .utils import remove_undefined

Expand Down
10 changes: 3 additions & 7 deletions pycord/audit_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .channel import Thread
from .enums import AuditLogEvent
from .integration import Integration
from .missing import MISSING, Maybe, MissingEnum
from .scheduled_event import ScheduledEvent
from .snowflake import Snowflake
from .types import (
Expand All @@ -36,7 +37,6 @@
AuditLogEntry as DiscordAuditLogEntry,
OptionalAuditEntryInfo as DiscordOptionalAuditEntryInfo,
)
from .missing import MISSING, MissingEnum, Maybe
from .user import User
from .webhook import GuildWebhook

Expand Down Expand Up @@ -94,9 +94,7 @@ def __init__(self, data: DiscordOptionalAuditEntryInfo) -> None:
int(data['count']) if 'count' in data else MISSING
)
self.delete_member_days: int | MissingEnum = (
int(data['delete_member_days'])
if 'delete_member_days' in data
else MISSING
int(data['delete_member_days']) if 'delete_member_days' in data else MISSING
)
self.id: Snowflake | MissingEnum = (
Snowflake(data['id']) if 'id' in data else MISSING
Expand All @@ -108,9 +106,7 @@ def __init__(self, data: DiscordOptionalAuditEntryInfo) -> None:
Snowflake(data['message_id']) if 'message_id' in data else MISSING
)
self.role_name: str | MissingEnum = data.get('role_name', MISSING)
self.type: int | MissingEnum = (
int(data['type']) if 'type' in data else MISSING
)
self.type: int | MissingEnum = int(data['type']) if 'type' in data else MISSING


class AuditLogChange:
Expand Down
6 changes: 2 additions & 4 deletions pycord/auto_moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
AutoModKeywordPresetType,
AutoModTriggerType,
)
from .missing import MISSING, Maybe, MissingEnum
from .snowflake import Snowflake
from .types import (
AutoModerationAction as DiscordAutoModerationAction,
AutoModerationActionMetadata as DiscordAutoModerationActionMetadata,
AutoModerationRule as DiscordAutoModerationRule,
AutoModerationTriggerMetadata as DiscordAutoModerationTriggerMetadata,
)
from .missing import MISSING, MissingEnum, Maybe

if TYPE_CHECKING:
from .state import State
Expand Down Expand Up @@ -68,9 +68,7 @@ def __init__(self, data: DiscordAutoModerationActionMetadata) -> None:
if data.get('channel_id') is not None
else MISSING
)
self.duration_seconds: int | MissingEnum = data.get(
'duration_seconds', MISSING
)
self.duration_seconds: int | MissingEnum = data.get('duration_seconds', MISSING)


class AutoModAction:
Expand Down
2 changes: 1 addition & 1 deletion pycord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
from .gateway import PassThrough, ShardCluster, ShardManager
from .guild import Guild, GuildPreview
from .interface import print_banner, start_logging
from .missing import MISSING, Maybe, MissingEnum
from .snowflake import Snowflake
from .state import State
from .types import AsyncFunc
from .types.audit_log import AUDIT_LOG_EVENT_TYPE
from .missing import MISSING, MissingEnum, Maybe
from .user import User
from .utils import chunk, get_arg_defaults

Expand Down
10 changes: 3 additions & 7 deletions pycord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .flags import ChannelFlags, Permissions
from .member import Member
from .message import AllowedMentions, Message, MessageReference
from .missing import MISSING, Maybe, MissingEnum
from .snowflake import Snowflake
from .types import (
Channel as DiscordChannel,
Expand All @@ -41,7 +42,6 @@
ThreadMetadata as DiscordThreadMetadata,
)
from .typing import Typing
from .missing import MISSING, MissingEnum, Maybe

if TYPE_CHECKING:
from .state import State
Expand Down Expand Up @@ -276,9 +276,7 @@ class GuildChannel(Channel):
def __init__(self, data: DiscordChannel, state: State) -> None:
super().__init__(data, state)
self.guild_id: Snowflake | MissingEnum = (
Snowflake(data['guild_id'])
if data.get('guild_id') is not None
else MISSING
Snowflake(data['guild_id']) if data.get('guild_id') is not None else MISSING
)
self.position: int | MissingEnum = data.get('position', MISSING)
self.permission_overwrites: list[_Overwrite] = [
Expand Down Expand Up @@ -602,9 +600,7 @@ def __init__(self, data: DiscordChannel, state: State) -> None:
else MISSING
)
self.owner_id: Snowflake | MissingEnum = (
Snowflake(data['owner_id'])
if data.get('owner_id') is not None
else MISSING
Snowflake(data['owner_id']) if data.get('owner_id') is not None else MISSING
)

async def edit(
Expand Down
2 changes: 1 addition & 1 deletion pycord/commands/application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
:license: MIT
"""
from .command import *
from .errors import *
from .context import *
from .errors import *
16 changes: 1 addition & 15 deletions pycord/commands/application/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,7 @@ def _to_dict(self) -> dict[str, Any]:
}


if TYPE_CHECKING:
# this is a little type hack to
# make LSPs and type checkers think that
# doing something like "opt: str = pycord.Option()" is fine
# since pycord.Option "subclasses" str. Though this may break with boolean types.
class _BaseOption(str, int, float, User, Channel, Role, Attachment): # type: ignore
...

else:

class _BaseOption:
...


class Option(_BaseOption):
class Option:
"""
An option of a Chat Input Command.
Expand Down
2 changes: 1 addition & 1 deletion pycord/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
from typing import TYPE_CHECKING

from .enums import VisibilityType
from .missing import MISSING, Maybe, MissingEnum
from .snowflake import Snowflake
from .types import (
SERVICE,
Connection as DiscordConnection,
Integration as DiscordIntegration,
)
from .missing import MISSING, MissingEnum, Maybe

if TYPE_CHECKING:
from .state import State
Expand Down
2 changes: 1 addition & 1 deletion pycord/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from typing import Any

from .color import Color
from .missing import MISSING, Maybe, MissingEnum
from .types import (
Author as DiscordAuthor,
Embed as DiscordEmbed,
Expand All @@ -32,7 +33,6 @@
Thumbnail as DiscordThumbnail,
Video as DiscordVideo,
)
from .missing import MISSING, MissingEnum, Maybe
from .utils import remove_undefined


Expand Down
2 changes: 1 addition & 1 deletion pycord/ext/gears/gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from ...commands import Command, Group
from ...commands.application.command import ApplicationCommand
from ...events.event_manager import Event
from ...types import AsyncFunc
from ...missing import MISSING, MissingEnum
from ...types import AsyncFunc

if TYPE_CHECKING:
from ...bot import Bot
Expand Down
Loading

0 comments on commit 407a770

Please sign in to comment.