Skip to content

Commit 9af67ca

Browse files
committed
Fix code style issues with Black
1 parent 6b3849b commit 9af67ca

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

twitchio/ext/commands/bot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
if TYPE_CHECKING:
4141
from twitchio import Message
4242

43+
4344
class Bot(Client):
4445
def __init__(
4546
self,
@@ -277,7 +278,7 @@ def load_module(self, name: str) -> None:
277278
module = importlib.import_module(name)
278279

279280
if hasattr(module, "prepare"):
280-
module.prepare(self) # type: ignore
281+
module.prepare(self) # type: ignore
281282
else:
282283
del module
283284
del sys.modules[name]
@@ -300,7 +301,7 @@ def unload_module(self, name: str) -> None:
300301

301302
if hasattr(module, "breakdown"):
302303
try:
303-
module.breakdown(self) # type: ignore
304+
module.breakdown(self) # type: ignore
304305
except:
305306
pass
306307

@@ -345,7 +346,7 @@ def reload_module(self, name: str):
345346
self.load_module(name)
346347
except Exception as e:
347348
sys.modules.update(modules)
348-
module.prepare(self) # type: ignore
349+
module.prepare(self) # type: ignore
349350
raise
350351

351352
def add_cog(self, cog: Cog):

twitchio/ext/commands/builtin_converter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ async def convert_PartialChatter(ctx: Context, arg: str) -> Chatter:
6565
async def convert_Clip(ctx: Context, arg: str) -> Clip:
6666
finder = re.search(r"(https://clips.twitch.tv/)?(?P<slug>.*)", arg)
6767
if not finder:
68-
raise RuntimeError("regex failed to match") # this should never ever raise, but its here to make type checkers happy
68+
raise RuntimeError(
69+
"regex failed to match"
70+
) # this should never ever raise, but its here to make type checkers happy
6971

7072
slug = finder.group("slug")
7173
clips = await ctx.bot.fetch_clips([slug])

twitchio/ext/commands/core.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ def __init__(self, name: str, func: Callable, **attrs) -> None:
6868
self.parent: Optional[Group] = attrs.get("parent")
6969

7070
try:
71-
self._checks.extend(func.__checks__) # type: ignore
71+
self._checks.extend(func.__checks__) # type: ignore
7272
except AttributeError:
7373
pass
7474

7575
try:
76-
self._cooldowns.extend(func.__cooldowns__) # type: ignore
76+
self._cooldowns.extend(func.__cooldowns__) # type: ignore
7777
except AttributeError:
7878
pass
7979

@@ -88,7 +88,7 @@ def __init__(self, name: str, func: Callable, **attrs) -> None:
8888

8989
for key, value in self.params.items():
9090
if isinstance(value.annotation, str):
91-
self.params[key] = value.replace(annotation=eval(value.annotation, func.__globals__)) # type: ignore
91+
self.params[key] = value.replace(annotation=eval(value.annotation, func.__globals__)) # type: ignore
9292

9393
@property
9494
def name(self) -> str:
@@ -278,7 +278,7 @@ async def handle_checks(self, context: Context) -> Union[Literal[True], Exceptio
278278
result = predicate(context)
279279

280280
if inspect.isawaitable(result):
281-
result = await result # type: ignore
281+
result = await result # type: ignore
282282

283283
if not result:
284284
raise CheckFailure(f"The check {predicate} for command {self.name} failed.")
@@ -307,7 +307,7 @@ async def __call__(self, context: Context, *, index=0) -> None:
307307
if not context.view.words:
308308
return await self.invoke(context, index=index)
309309

310-
arg: Tuple[int, str] = list(context.view.words.items())[0] # type: ignore
310+
arg: Tuple[int, str] = list(context.view.words.items())[0] # type: ignore
311311
if arg[1] in self._sub_commands:
312312
_ctx = copy.copy(context)
313313
_ctx.view = _ctx.view.copy()
@@ -498,8 +498,10 @@ def decorator(func: Callable) -> cls:
498498

499499
return decorator
500500

501+
501502
FN = TypeVar("FN")
502503

504+
503505
def cooldown(rate, per, bucket=Bucket.default):
504506
def decorator(func: FN) -> FN:
505507
if isinstance(func, Command):

twitchio/ext/commands/meta.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def prepare(bot: commands.Bot):
103103
# Load our cog with this module...
104104
bot.add_cog(MyCog(bot))
105105
"""
106+
106107
_commands: Dict[str, Command]
107108
_events: Dict[str, List[Callable]]
108109

@@ -172,12 +173,12 @@ def decorator(func) -> CogEvent:
172173
@property
173174
def name(self) -> str:
174175
"""This cogs name."""
175-
return self.__cogname__ # type: ignore
176+
return self.__cogname__ # type: ignore
176177

177178
@property
178179
def commands(self) -> dict:
179180
"""The commands associated with this cog as a mapping."""
180-
return self._commands # type: ignore
181+
return self._commands # type: ignore
181182

182183
async def cog_error(self, exception: Exception) -> None:
183184
pass

twitchio/ext/commands/stringparser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from __future__ import annotations
2727
from typing import Dict
2828

29+
2930
class StringParser:
3031
def __init__(self):
3132
self.count = 0

twitchio/ext/commands/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
K = TypeVar("K", bound=str)
2828
V = TypeVar("V")
2929

30+
3031
class _CaseInsensitiveDict(dict):
3132
def __getitem__(self, key: K) -> V:
3233
return super().__getitem__(key.lower())
@@ -37,7 +38,7 @@ def __setitem__(self, key: K, value: V) -> None:
3738
def __delitem__(self, key: K) -> None:
3839
return super().__delitem__(key.lower())
3940

40-
def __contains__(self, key: K) -> bool: # type: ignore
41+
def __contains__(self, key: K) -> bool: # type: ignore
4142
return super().__contains__(key.lower())
4243

4344
def get(self, key: K, default: Any = None) -> Optional[V]:

0 commit comments

Comments
 (0)