Skip to content

Commit ad893db

Browse files
committed
Fix type comments
1 parent 80c92f4 commit ad893db

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

plugins/cryptocurrency.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import inspect
1414
import time
15+
import typing
1516
import warnings
1617
from decimal import Decimal
1718
from numbers import Real
@@ -342,12 +343,9 @@ def _hydrate_object(_value, _cls):
342343
_assert_type(_value, dict)
343344
return read_data(_value, _cls)
344345

345-
try:
346-
typing_cls = _cls.__origin__ # type: ignore[union-attr]
347-
except AttributeError:
348-
pass
349-
else:
350-
type_args = _cls.__args__ # type: ignore[union-attr]
346+
typing_cls = typing.get_origin(_cls)
347+
if typing_cls is not None:
348+
type_args = typing.get_args(_cls)
351349
if issubclass(typing_cls, list):
352350
_assert_type(_value, list, _cls)
353351

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ exclude = '''
3030

3131
[tool.darker]
3232
src = ["cloudbot", "plugins", "tests"]
33-
flynt = true
3433
isort = true
3534
lint = ["pylint"]
3635
line-length = 80

tests/plugin_tests/seen_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def test_seen_bad_nick(mock_db, freeze_time):
201201

202202
db = mock_db.session()
203203
conn = MockConn()
204-
conn.is_nick_valid = lambda text: False # type: ignore[assignment]
204+
conn.is_nick_valid = lambda text: False # type: ignore[method-assign]
205205
nick = "bar"
206206
event = CommandEvent(
207207
conn=conn,

tests/plugin_tests/test_core_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MockClient(Client): # pylint: disable=abstract-method
1111
def __init__(self, bot, *args, **kwargs):
1212
super().__init__(bot, "TestClient", *args, **kwargs)
1313
self.active = True
14-
self.join = MagicMock() # type: ignore[assignment]
14+
self.join = MagicMock() # type: ignore[method-assign]
1515

1616

1717
@pytest.mark.asyncio

tests/util/mock_irc_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
class MockIrcClient(IrcClient):
77
def __init__(self, bot, name, nick, config):
88
super().__init__(bot, "irc", name, nick, config=config)
9-
self.connect = MagicMock() # type: ignore[assignment]
10-
self.send = MagicMock() # type: ignore[assignment]
9+
self.connect = MagicMock() # type: ignore[method-assign]
10+
self.send = MagicMock() # type: ignore[method-assign]

0 commit comments

Comments
 (0)