Fix code style issues with Black

This commit is contained in:
Lint Action
2021-09-05 21:34:20 +00:00
parent a23dae8604
commit 7513c2138f
108 changed files with 5369 additions and 4858 deletions

View File

@ -28,9 +28,7 @@ from typing import Optional, TYPE_CHECKING, Union
import os
import io
__all__ = (
'File',
)
__all__ = ("File",)
class File:
@ -64,7 +62,7 @@ class File:
Whether the attachment is a spoiler.
"""
__slots__ = ('fp', 'filename', 'spoiler', '_original_pos', '_owner', '_closer')
__slots__ = ("fp", "filename", "spoiler", "_original_pos", "_owner", "_closer")
if TYPE_CHECKING:
fp: io.BufferedIOBase
@ -80,12 +78,12 @@ class File:
):
if isinstance(fp, io.IOBase):
if not (fp.seekable() and fp.readable()):
raise ValueError(f'File buffer {fp!r} must be seekable and readable')
raise ValueError(f"File buffer {fp!r} must be seekable and readable")
self.fp = fp
self._original_pos = fp.tell()
self._owner = False
else:
self.fp = open(fp, 'rb')
self.fp = open(fp, "rb")
self._original_pos = 0
self._owner = True
@ -100,14 +98,14 @@ class File:
if isinstance(fp, str):
_, self.filename = os.path.split(fp)
else:
self.filename = getattr(fp, 'name', None)
self.filename = getattr(fp, "name", None)
else:
self.filename = filename
if spoiler and self.filename is not None and not self.filename.startswith('SPOILER_'):
self.filename = 'SPOILER_' + self.filename
if spoiler and self.filename is not None and not self.filename.startswith("SPOILER_"):
self.filename = "SPOILER_" + self.filename
self.spoiler = spoiler or (self.filename is not None and self.filename.startswith('SPOILER_'))
self.spoiler = spoiler or (self.filename is not None and self.filename.startswith("SPOILER_"))
def reset(self, *, seek: Union[int, bool] = True) -> None:
# The `seek` parameter is needed because