Skip to content

Commit d287816

Browse files
authored
Bugfix/modify mypy ci (#789)
* Fix: mypy fatal errors (error: Invalid "type: ignore" comment) * Add mypy.ini - ignore_errors * Fix mypy ci returning always true * Fix typo
1 parent 5244381 commit d287816

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
- run: pip install mypy
1010
- run: pip install -r requirements.txt
1111
- run: mkdir --parents --verbose .mypy_cache
12-
- run: mypy --ignore-missing-imports --install-types --non-interactive . || true
12+
- run: mypy --ignore-missing-imports --install-types --non-interactive .

discord/commands/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async def __call__(self, ctx, *args, **kwargs):
164164
def _prepare_cooldowns(self, ctx: ApplicationContext):
165165
if self._buckets.valid:
166166
current = datetime.datetime.now().timestamp()
167-
bucket = self._buckets.get_bucket(ctx, current) # type: ignore (ctx instead of non-existent message)
167+
bucket = self._buckets.get_bucket(ctx, current) # type: ignore # ctx instead of non-existent message
168168

169169
if bucket is not None:
170170
retry_after = bucket.update_rate_limit(current)
@@ -183,14 +183,14 @@ async def prepare(self, ctx: ApplicationContext) -> None:
183183
if hasattr(self, "_max_concurrency"):
184184
if self._max_concurrency is not None:
185185
# For this application, context can be duck-typed as a Message
186-
await self._max_concurrency.acquire(ctx) # type: ignore (ctx instead of non-existent message)
186+
await self._max_concurrency.acquire(ctx) # type: ignore # ctx instead of non-existent message
187187

188188
try:
189189
self._prepare_cooldowns(ctx)
190190
await self.call_before_hooks(ctx)
191191
except:
192192
if self._max_concurrency is not None:
193-
await self._max_concurrency.release(ctx) # type: ignore (ctx instead of non-existent message)
193+
await self._max_concurrency.release(ctx) # type: ignore # ctx instead of non-existent message
194194
raise
195195

196196
def is_on_cooldown(self, ctx: ApplicationContext) -> bool:
@@ -226,7 +226,7 @@ def reset_cooldown(self, ctx: ApplicationContext) -> None:
226226
The invocation context to reset the cooldown under.
227227
"""
228228
if self._buckets.valid:
229-
bucket = self._buckets.get_bucket(ctx) # type: ignore (ctx instead of non-existent message)
229+
bucket = self._buckets.get_bucket(ctx) # type: ignore # ctx instead of non-existent message
230230
bucket.reset()
231231

232232
def get_cooldown_retry_after(self, ctx: ApplicationContext) -> float:
@@ -630,7 +630,7 @@ def _match_option_param_names(self, params, options):
630630
check_annotations = [
631631
lambda o, a: o.input_type == SlashCommandOptionType.string and o.converter is not None, # pass on converters
632632
lambda o, a: isinstance(o.input_type, SlashCommandOptionType), # pass on slash cmd option type enums
633-
lambda o, a: isinstance(o._raw_type, tuple) and a == Union[o._raw_type], # type: ignore (union types)
633+
lambda o, a: isinstance(o._raw_type, tuple) and a == Union[o._raw_type], # type: ignore # union types
634634
lambda o, a: self._is_typing_optional(a) and not o.required and o._raw_type in a.__args__, # optional
635635
lambda o, a: inspect.isclass(a) and issubclass(a, o._raw_type) # 'normal' types
636636
]

mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
ignore_errors = True

0 commit comments

Comments
 (0)