Browse Source

linter

pull/10214/head
makerze 4 weeks ago
parent
commit
89961e52fa
  1. 50
      discord/guild.py
  2. 19
      discord/role.py

50
discord/guild.py

@ -1293,8 +1293,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, TextChannelPayload]: ) -> Coroutine[Any, Any, TextChannelPayload]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1304,8 +1303,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, VoiceChannelPayload]: ) -> Coroutine[Any, Any, VoiceChannelPayload]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1315,8 +1313,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, StageChannelPayload]: ) -> Coroutine[Any, Any, StageChannelPayload]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1326,8 +1323,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, CategoryChannelPayload]: ) -> Coroutine[Any, Any, CategoryChannelPayload]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1337,8 +1333,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, NewsChannelPayload]: ) -> Coroutine[Any, Any, NewsChannelPayload]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1348,8 +1343,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, Union[TextChannelPayload, NewsChannelPayload]]: ) -> Coroutine[Any, Any, Union[TextChannelPayload, NewsChannelPayload]]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1359,8 +1353,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, ForumChannelPayload]: ) -> Coroutine[Any, Any, ForumChannelPayload]: ...
...
@overload @overload
def _create_channel( def _create_channel(
@ -1370,8 +1363,7 @@ class Guild(Hashable):
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ..., overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = ...,
category: Optional[Snowflake] = ..., category: Optional[Snowflake] = ...,
**options: Any, **options: Any,
) -> Coroutine[Any, Any, GuildChannelPayload]: ) -> Coroutine[Any, Any, GuildChannelPayload]: ...
...
def _create_channel( def _create_channel(
self, self,
@ -3202,8 +3194,7 @@ class Guild(Hashable):
description: str = ..., description: str = ...,
image: bytes = ..., image: bytes = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
) -> ScheduledEvent: ) -> ScheduledEvent: ...
...
@overload @overload
async def create_scheduled_event( async def create_scheduled_event(
@ -3218,8 +3209,7 @@ class Guild(Hashable):
description: str = ..., description: str = ...,
image: bytes = ..., image: bytes = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
) -> ScheduledEvent: ) -> ScheduledEvent: ...
...
@overload @overload
async def create_scheduled_event( async def create_scheduled_event(
@ -3233,8 +3223,7 @@ class Guild(Hashable):
description: str = ..., description: str = ...,
image: bytes = ..., image: bytes = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
) -> ScheduledEvent: ) -> ScheduledEvent: ...
...
@overload @overload
async def create_scheduled_event( async def create_scheduled_event(
@ -3248,8 +3237,7 @@ class Guild(Hashable):
description: str = ..., description: str = ...,
image: bytes = ..., image: bytes = ...,
reason: Optional[str] = ..., reason: Optional[str] = ...,
) -> ScheduledEvent: ) -> ScheduledEvent: ...
...
async def create_scheduled_event( async def create_scheduled_event(
self, self,
@ -3617,8 +3605,7 @@ class Guild(Hashable):
primary_color: Union[Colour, int, None] = ..., primary_color: Union[Colour, int, None] = ...,
secondary_color: Union[Colour, int, None] = ..., secondary_color: Union[Colour, int, None] = ...,
tertiary_color: Union[Colour, int, None] = ..., tertiary_color: Union[Colour, int, None] = ...,
) -> Role: ) -> Role: ...
...
@overload @overload
async def create_role( async def create_role(
@ -3634,8 +3621,7 @@ class Guild(Hashable):
primary_color: Union[Colour, int, None] = ..., primary_color: Union[Colour, int, None] = ...,
secondary_color: Union[Colour, int, None] = ..., secondary_color: Union[Colour, int, None] = ...,
tertiary_color: Union[Colour, int, None] = ..., tertiary_color: Union[Colour, int, None] = ...,
) -> Role: ) -> Role: ...
...
async def create_role( async def create_role(
self, self,
@ -3728,17 +3714,13 @@ class Guild(Hashable):
fields['color'] = actual_colour.value fields['color'] = actual_colour.value
solid_color_used = color is not MISSING or colour is not MISSING solid_color_used = color is not MISSING or colour is not MISSING
colors_used = ( colors_used = primary_color is not MISSING or secondary_color is not MISSING or tertiary_color is not MISSING
primary_color is not MISSING or
secondary_color is not MISSING or
tertiary_color is not MISSING
)
if solid_color_used and colors_used: if solid_color_used and colors_used:
raise TypeError( raise TypeError(
"You must choose either only solid color (color/colour) or colors (primary_color/secondary_color/tertiary_color), not both." "You must choose either only solid color (color/colour) or colors (primary_color/secondary_color/tertiary_color), not both."
) )
colors_payload: Dict[str, Any]= {} colors_payload: Dict[str, Any] = {}
if primary_color is not MISSING: if primary_color is not MISSING:
if primary_color is None: if primary_color is None:
colors_payload['primary_color'] = None colors_payload['primary_color'] = None

19
discord/role.py

@ -344,6 +344,7 @@ class Role(Hashable):
def tertiary_color(self) -> Optional[Colour]: def tertiary_color(self) -> Optional[Colour]:
"""Optional[:class:`Colour`]: The role's tertiary color.""" """Optional[:class:`Colour`]: The role's tertiary color."""
return Colour(self._tertiary_color) if self._tertiary_color is not None else None return Colour(self._tertiary_color) if self._tertiary_color is not None else None
@property @property
def permissions(self) -> Permissions: def permissions(self) -> Permissions:
""":class:`Permissions`: Returns the role's permissions.""" """:class:`Permissions`: Returns the role's permissions."""
@ -552,11 +553,7 @@ class Role(Hashable):
payload['mentionable'] = mentionable payload['mentionable'] = mentionable
solid_color_used = color is not MISSING or colour is not MISSING solid_color_used = color is not MISSING or colour is not MISSING
colors_used = ( colors_used = primary_color is not MISSING or secondary_color is not MISSING or tertiary_color is not MISSING
primary_color is not MISSING or
secondary_color is not MISSING or
tertiary_color is not MISSING
)
if solid_color_used and colors_used: if solid_color_used and colors_used:
raise TypeError( raise TypeError(
"You must choose either only solid color (color/colour) or colors (primary_color/secondary_color/tertiary_color), not both." "You must choose either only solid color (color/colour) or colors (primary_color/secondary_color/tertiary_color), not both."
@ -591,20 +588,16 @@ class Role(Hashable):
return Role(guild=self.guild, data=data, state=self._state) return Role(guild=self.guild, data=data, state=self._state)
@overload @overload
async def move(self, *, beginning: bool, offset: int = ..., reason: Optional[str] = ...): async def move(self, *, beginning: bool, offset: int = ..., reason: Optional[str] = ...): ...
...
@overload @overload
async def move(self, *, end: bool, offset: int = ..., reason: Optional[str] = ...): async def move(self, *, end: bool, offset: int = ..., reason: Optional[str] = ...): ...
...
@overload @overload
async def move(self, *, above: Role, offset: int = ..., reason: Optional[str] = ...): async def move(self, *, above: Role, offset: int = ..., reason: Optional[str] = ...): ...
...
@overload @overload
async def move(self, *, below: Role, offset: int = ..., reason: Optional[str] = ...): async def move(self, *, below: Role, offset: int = ..., reason: Optional[str] = ...): ...
...
async def move( async def move(
self, self,

Loading…
Cancel
Save