Skip to content

Commit

Permalink
apply linting, fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
krittick committed May 1, 2022
1 parent 171de4b commit 116e00c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 63 deletions.
2 changes: 1 addition & 1 deletion discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
from .client import Client
from .embeds import Embed
from .enums import InviteTarget
from .flags import ChannelFlags
from .guild import Guild
from .member import Member
from .message import Message, MessageReference, PartialMessage
Expand All @@ -97,7 +98,6 @@
from .types.channel import PermissionOverwrite as PermissionOverwritePayload
from .ui.view import View
from .user import ClientUser
from .flags import ChannelFlags

PartialMessageableChannel = Union[TextChannel, VoiceChannel, Thread, DMChannel, PartialMessageable]
MessageableChannel = Union[PartialMessageableChannel, GroupChannel]
Expand Down
55 changes: 27 additions & 28 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import discord.abc

from . import utils
from .file import File
from .asset import Asset
from .enums import (
ChannelType,
Expand All @@ -60,6 +59,7 @@
try_enum,
)
from .errors import ClientException, InvalidArgument
from .file import File
from .flags import ChannelFlags
from .invite import Invite
from .iterators import ArchivedThreadIterator
Expand Down Expand Up @@ -91,11 +91,11 @@
from .state import ConnectionState
from .types.channel import CategoryChannel as CategoryChannelPayload
from .types.channel import DMChannel as DMChannelPayload
from .types.channel import ForumChannel as ForumChannelPayload
from .types.channel import GroupDMChannel as GroupChannelPayload
from .types.channel import StageChannel as StageChannelPayload
from .types.channel import TextChannel as TextChannelPayload
from .types.channel import VoiceChannel as VoiceChannelPayload
from .types.channel import ForumChannel as ForumChannelPayload
from .types.snowflake import SnowflakeList
from .types.threads import ThreadArchiveDuration
from .user import BaseUser, ClientUser, User
Expand Down Expand Up @@ -724,13 +724,13 @@ def is_news(self) -> bool:
return self._type == ChannelType.news.value

async def create_thread(
self,
*,
name: str,
message: Optional[Snowflake] = None,
auto_archive_duration: ThreadArchiveDuration = MISSING,
type: Optional[ChannelType] = None,
reason: Optional[str] = None,
self,
*,
name: str,
message: Optional[Snowflake] = None,
auto_archive_duration: ThreadArchiveDuration = MISSING,
type: Optional[ChannelType] = None,
reason: Optional[str] = None,
) -> Thread:
"""|coro|
Expand Down Expand Up @@ -804,27 +804,26 @@ def _update(self, guild: Guild, data: ForumChannelPayload) -> None:

@property
def guidelines(self) -> Optional[str]:
"""Optional[:class:`str`]: The channel's guidelines. An alias of :attr:`topic`.
"""
"""Optional[:class:`str`]: The channel's guidelines. An alias of :attr:`topic`."""
return self.topic

async def create_thread(
self,
name: str,
content=None,
*,
embed=None,
embeds=None,
file=None,
files=None,
stickers=None,
delete_message_after=None,
nonce=None,
allowed_mentions=None,
view=None,
auto_archive_duration: ThreadArchiveDuration = MISSING,
slowmode_delay: int = MISSING,
reason: Optional[str] = None,
self,
name: str,
content=None,
*,
embed=None,
embeds=None,
file=None,
files=None,
stickers=None,
delete_message_after=None,
nonce=None,
allowed_mentions=None,
view=None,
auto_archive_duration: ThreadArchiveDuration = MISSING,
slowmode_delay: int = MISSING,
reason: Optional[str] = None,
) -> Thread:
"""|coro|
Expand Down Expand Up @@ -978,7 +977,7 @@ async def create_thread(
reason=reason,
)
ret = Thread(guild=self.guild, state=self._state, data=data)
msg = ret.get_partial_message(data['last_message_id'])
msg = ret.get_partial_message(data["last_message_id"])
if view:
state.store_view(view, msg.id)

Expand Down
34 changes: 17 additions & 17 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
from .abc import Snowflake, SnowflakeTime
from .channel import (
CategoryChannel,
ForumChannel,
StageChannel,
TextChannel,
VoiceChannel,
ForumChannel,
)
from .permissions import Permissions
from .state import ConnectionState
Expand Down Expand Up @@ -1365,16 +1365,16 @@ async def create_stage_channel(
return channel

async def create_forum_channel(
self,
name: str,
*,
reason: Optional[str] = None,
category: Optional[CategoryChannel] = None,
position: int = MISSING,
topic: str = MISSING,
slowmode_delay: int = MISSING,
nsfw: bool = MISSING,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
self,
name: str,
*,
reason: Optional[str] = None,
category: Optional[CategoryChannel] = None,
position: int = MISSING,
topic: str = MISSING,
slowmode_delay: int = MISSING,
nsfw: bool = MISSING,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
) -> ForumChannel:
"""|coro|
Expand Down Expand Up @@ -1482,12 +1482,12 @@ async def create_forum_channel(
return channel

async def create_category(
self,
name: str,
*,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
reason: Optional[str] = None,
position: int = MISSING,
self,
name: str,
*,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
reason: Optional[str] = None,
position: int = MISSING,
) -> CategoryChannel:
"""|coro|
Expand Down
30 changes: 15 additions & 15 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,21 +1085,21 @@ def start_thread_without_message(
return self.request(route, json=payload, reason=reason)

def start_forum_thread(
self,
channel_id: Snowflake,
content: Optional[str],
*,
name: str,
auto_archive_duration: threads.ThreadArchiveDuration,
rate_limit_per_user: int,
invitable: bool = True,
reason: Optional[str] = None,
embed: Optional[embed.Embed] = None,
embeds: Optional[List[embed.Embed]] = None,
nonce: Optional[str] = None,
allowed_mentions: Optional[message.AllowedMentions] = None,
stickers: Optional[List[sticker.StickerItem]] = None,
components: Optional[List[components.Component]] = None,
self,
channel_id: Snowflake,
content: Optional[str],
*,
name: str,
auto_archive_duration: threads.ThreadArchiveDuration,
rate_limit_per_user: int,
invitable: bool = True,
reason: Optional[str] = None,
embed: Optional[embed.Embed] = None,
embeds: Optional[List[embed.Embed]] = None,
nonce: Optional[str] = None,
allowed_mentions: Optional[message.AllowedMentions] = None,
stickers: Optional[List[sticker.StickerItem]] = None,
components: Optional[List[components.Component]] = None,
) -> Response[threads.Thread]:
payload = {
"name": name,
Expand Down
4 changes: 2 additions & 2 deletions discord/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

if TYPE_CHECKING:
from .abc import Snowflake, SnowflakeTime
from .channel import CategoryChannel, TextChannel, ForumChannel
from .channel import CategoryChannel, ForumChannel, TextChannel
from .guild import Guild
from .member import Member
from .message import Message, PartialMessage
Expand Down Expand Up @@ -576,7 +576,7 @@ async def edit(
# copy the ChannelFlags object to avoid mutating the original
flags = ChannelFlags._from_value(self.flags.value)
flags.pinned = pinned
payload['flags'] = flags.value
payload["flags"] = flags.value

data = await self._state.http.edit_channel(self.id, **payload, reason=reason)
# The data payload will always be a Thread payload
Expand Down

0 comments on commit 116e00c

Please sign in to comment.