mirror of
https://github.com/stoatchat/python-client-sdk.git
synced 2026-07-22 18:45:22 -04:00
remove trailing whitespace
This commit is contained in:
+4
-4
@@ -17,7 +17,7 @@ __all__ = ("Asset", "PartialAsset")
|
||||
|
||||
class Asset:
|
||||
"""Represents a file on revolt
|
||||
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
id: :class:`str`
|
||||
@@ -40,7 +40,7 @@ class Asset:
|
||||
The assets url
|
||||
"""
|
||||
__slots__ = ("state", "id", "tag", "size", "filename", "content_type", "width", "height", "type", "url")
|
||||
|
||||
|
||||
def __init__(self, data: FilePayload, state: State):
|
||||
self.state = state
|
||||
|
||||
@@ -48,7 +48,7 @@ class Asset:
|
||||
self.tag = data['tag']
|
||||
self.size = data['size']
|
||||
self.filename = data['filename']
|
||||
|
||||
|
||||
metadata = data['metadata']
|
||||
|
||||
if metadata["type"] == "Image" or metadata["type"] == "Video": # cannot use `in` because type narrowing will not happen
|
||||
@@ -70,7 +70,7 @@ class Asset:
|
||||
|
||||
async def save(self, fp: IOBase):
|
||||
"""Reads the files content and saves it to a file
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
fp: IOBase
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ class EditableChannel:
|
||||
|
||||
class Channel:
|
||||
"""Base class for all channels
|
||||
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
id: :class:`str`
|
||||
|
||||
+7
-7
@@ -99,12 +99,12 @@ class Client:
|
||||
|
||||
def get_user(self, id: str) -> User:
|
||||
"""Gets a user from the cache
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
id: :class:`str`
|
||||
The id of the user
|
||||
|
||||
|
||||
Returns
|
||||
--------
|
||||
:class:`User`
|
||||
@@ -114,12 +114,12 @@ class Client:
|
||||
|
||||
def get_channel(self, id: str) -> Channel:
|
||||
"""Gets a channel from the cache
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
id: :class:`str`
|
||||
The id of the channel
|
||||
|
||||
|
||||
Returns
|
||||
--------
|
||||
:class:`Channel`
|
||||
@@ -129,12 +129,12 @@ class Client:
|
||||
|
||||
def get_server(self, id: str) -> Server:
|
||||
"""Gets a server from the cache
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
id: :class:`str`
|
||||
The id of the server
|
||||
|
||||
|
||||
Returns
|
||||
--------
|
||||
:class:`Server`
|
||||
@@ -144,7 +144,7 @@ class Client:
|
||||
|
||||
async def wait_for(self, event: str, *, check: Optional[Callable[..., bool]] = None, timeout: Optional[float] = None) -> Any:
|
||||
"""Waits for an event
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
event: :class:`str`
|
||||
|
||||
+4
-4
@@ -6,7 +6,7 @@ __all__ = ("File",)
|
||||
|
||||
class File:
|
||||
"""Respresents a file about to be uploaded to revolt
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
file: Union[str, bytes]
|
||||
@@ -17,7 +17,7 @@ class File:
|
||||
Determines if the file will be a spoiler, this prefexes the filename with `SPOILER_`
|
||||
"""
|
||||
__slots__ = ("f", "spoiler", "filename")
|
||||
|
||||
|
||||
def __init__(self, file: Union[str, bytes], *, filename: Optional[str] = None, spoiler: bool = False):
|
||||
if isinstance(file, str):
|
||||
self.f = open(file, "rb")
|
||||
@@ -26,10 +26,10 @@ class File:
|
||||
|
||||
if filename is None and isinstance(file, str):
|
||||
filename = self.f.name
|
||||
|
||||
|
||||
self.spoiler = spoiler or (filename and filename.startswith("SPOILER_"))
|
||||
|
||||
if self.spoiler and (filename and not filename.startswith("SPOILER_")):
|
||||
filename = f"SPOILER_{filename}"
|
||||
|
||||
self.filename = filename
|
||||
self.filename = filename
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ def flattern_user(member: Member, user: User):
|
||||
|
||||
class Member(User):
|
||||
"""Represents a member of a server, subclasses :class:`User`
|
||||
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
nickname: Optional[:class:`str`]
|
||||
@@ -32,7 +32,7 @@ class Member(User):
|
||||
The member's guild avatar if any
|
||||
"""
|
||||
__slots__ = ("_state", "nickname", "roles", "server", "guild_avatar")
|
||||
|
||||
|
||||
def __init__(self, data: MemberPayload, server: Server, state: State):
|
||||
user = state.get_user(data["_id"]["user"])
|
||||
flattern_user(self, user)
|
||||
|
||||
+6
-6
@@ -161,12 +161,12 @@ class Server:
|
||||
|
||||
def get_role(self, role_id: str) -> Role:
|
||||
"""Gets a role from the cache
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
id: :class:`str`
|
||||
The id of the role
|
||||
|
||||
|
||||
Returns
|
||||
--------
|
||||
:class:`Role`
|
||||
@@ -176,12 +176,12 @@ class Server:
|
||||
|
||||
def get_member(self, member_id: str) -> Member:
|
||||
"""Gets a member from the cache
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
id: :class:`str`
|
||||
The id of the member
|
||||
|
||||
|
||||
Returns
|
||||
--------
|
||||
:class:`Member`
|
||||
@@ -191,12 +191,12 @@ class Server:
|
||||
|
||||
def get_channel(self, channel_id: str) -> Channel:
|
||||
"""Gets a channel from the cache
|
||||
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
id: :class:`str`
|
||||
The id of the channel
|
||||
|
||||
|
||||
Returns
|
||||
--------
|
||||
:class:`Channel`
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class UserProfile(NamedTuple):
|
||||
|
||||
class User(Messageable):
|
||||
"""Represents a user
|
||||
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
id: :class:`str`
|
||||
|
||||
Reference in New Issue
Block a user