From d545568bea2b680d35f24b85b4f01a7cbb9df7f4 Mon Sep 17 00:00:00 2001 From: Saska Karsi Date: Wed, 16 Oct 2019 01:19:15 +0300 Subject: [PATCH 1/3] CLN: fix mypy error pandas/tests/plotting/test_backend.py GH28926, mypy didn't like setting non-existant attribute on module. Dummy function, circumvented with __setattr__ --- pandas/tests/plotting/test_backend.py | 2 +- setup.cfg | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pandas/tests/plotting/test_backend.py b/pandas/tests/plotting/test_backend.py index 6511d94aa4c09..45a777e44e7f4 100644 --- a/pandas/tests/plotting/test_backend.py +++ b/pandas/tests/plotting/test_backend.py @@ -9,7 +9,7 @@ import pandas dummy_backend = types.ModuleType("pandas_dummy_backend") -dummy_backend.plot = lambda *args, **kwargs: None +dummy_backend.__setattr__("plot", lambda *args, **kwargs: None) @pytest.fixture diff --git a/setup.cfg b/setup.cfg index 55d25abde585c..636145c13e863 100644 --- a/setup.cfg +++ b/setup.cfg @@ -208,9 +208,6 @@ ignore_errors=True [mypy-pandas.tests.io.test_sql] ignore_errors=True -[mypy-pandas.tests.plotting.test_backend] -ignore_errors=True - [mypy-pandas.tests.series.test_constructors] ignore_errors=True From 0187f73643cc0d187110354ea43f563a9f44aa26 Mon Sep 17 00:00:00 2001 From: Saska Karsi Date: Wed, 16 Oct 2019 13:29:15 +0300 Subject: [PATCH 2/3] Amended #29016 according to comments Switched from obj.__setattr__(...) to setattr(obj, ...) https://github.com/python/mypy/issues/7171#issuecomment-520407743 --- pandas/tests/plotting/test_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/plotting/test_backend.py b/pandas/tests/plotting/test_backend.py index 45a777e44e7f4..41b1a88b15acb 100644 --- a/pandas/tests/plotting/test_backend.py +++ b/pandas/tests/plotting/test_backend.py @@ -9,7 +9,7 @@ import pandas dummy_backend = types.ModuleType("pandas_dummy_backend") -dummy_backend.__setattr__("plot", lambda *args, **kwargs: None) +setattr(dummy_backend, "plot", lambda *args, **kwargs: None) @pytest.fixture From 5a700a22b3763a224a8e9110282d6a913ff722f2 Mon Sep 17 00:00:00 2001 From: Saska Karsi Date: Wed, 16 Oct 2019 17:37:52 +0300 Subject: [PATCH 3/3] Fix broken merge commit c7f03eb7cef276f9e5251ca2bcfee75b03751cbd --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 636145c13e863..c9ebb9c305516 100644 --- a/setup.cfg +++ b/setup.cfg @@ -205,9 +205,6 @@ ignore_errors=True [mypy-pandas.tests.io.json.test_ujson] ignore_errors=True -[mypy-pandas.tests.io.test_sql] -ignore_errors=True - [mypy-pandas.tests.series.test_constructors] ignore_errors=True