Skip to content

Commit 712562e

Browse files
committed
lint対応
1 parent 4151e75 commit 712562e

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

plugins/hato.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@
99
from enum import Enum, auto
1010
from logging import getLogger
1111
from tempfile import NamedTemporaryFile
12-
from typing import List, Callable, Union, Any, TYPE_CHECKING
12+
from typing import List
1313
import requests
1414
from git import Repo
1515
from git.exc import InvalidGitRepositoryError, GitCommandNotFound
1616
import pandas as pd
1717
import matplotlib.pyplot as plt
1818
import slackbot_settings as conf
1919

20-
if TYPE_CHECKING:
21-
from mypy_extensions import VarArg
22-
2320
from library.vocabularydb \
2421
import get_vocabularys, add_vocabulary, show_vocabulary, \
2522
delete_vocabulary, show_random_vocabulary
@@ -41,7 +38,7 @@ def action(plugin_name: str, with_client: bool = False):
4138
4239
"""
4340

44-
def _action(func: Callable[[BaseClient, VarArg(Any)], Union[str, None]]):
41+
def _action(func):
4542
def wrapper(client: BaseClient, *args, **kwargs):
4643
logger.debug("%s called '%s'", client.get_send_user(), plugin_name)
4744
logger.debug("%s app called '%s'", client.get_type(), plugin_name)

tests/plugins/test_analyze.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def test_totuzensi(self):
2424
client1 = TestClient()
2525
analyze_message('>< aaa')(client1)
2626
client2 = TestClient()
27-
hato.totuzensi(client2, message='aaa')
27+
# pylint: disable=E1121
28+
hato.totuzensi(client2, 'aaa')
2829
self.assertEqual(client1.get_post_message(),
2930
client2.get_post_message())
3031
# self.assertEqual(analyze_message('>< aaa'), hato.totuzensi('aaa'))

tests/plugins/test_hato.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def get_amesh_test(self,
7676
mocker.get(jma_image_url, content=image_content)
7777
mocker.get(osm_image_url, content=image_content)
7878
mocker.get(jma_json_url, content=json_content)
79-
amesh(client1, place=place)
79+
actual = amesh(client1, place=place)
80+
self.assertEqual(None, actual)
8081
return client1
8182

8283
def amesh_upload_png_test(self,
@@ -157,7 +158,9 @@ def altitude_test(self,
157158
query = '&'.join([f'{k}={v}' for k, v in params.items()])
158159
mocker.get('https://map.yahooapis.jp/alt/V1/getAltitude?' + query,
159160
content=json.dumps(content).encode())
160-
altitude(client1, place=place)
161+
# pylint: disable=E1121
162+
actual = altitude(client1, place)
163+
self.assertEqual(None, actual)
161164
return client1
162165

163166
def test_altitude_with_no_params(self):
@@ -226,6 +229,7 @@ class TestYoshiyoshi(unittest.TestCase):
226229
def test_yoshiyoshi(self):
227230
""" 正常系のテストケース """
228231
client1 = TestClient()
232+
# pylint: disable=E1121
229233
yoshiyoshi(client1)
230234
self.assertEqual(client1.get_post_message(), 'よしよし')
231235

@@ -241,6 +245,7 @@ def test_omikuji(self):
241245
"""
242246

243247
client1 = TestClient()
248+
# pylint: disable=E1121
244249
omikuji(client1)
245250
self.assertIn(
246251
client1.get_post_message(),

tests/test_run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_telephone_link(self):
2323
]
2424
analyze_slack_message(messages)(client1)
2525
client2 = TestClient()
26+
# pylint: disable=E1121
2627
hato.totuzensi(client2, '09012345678')
2728
self.assertEqual(client1.get_post_message(),
2829
client2.get_post_message())
@@ -36,6 +37,7 @@ def test_code(self):
3637
]
3738
analyze_slack_message(messages)(client1)
3839
client2 = TestClient()
40+
# pylint: disable=E1121
3941
hato.totuzensi(client2, '09012345678')
4042
self.assertEqual(client1.get_post_message(),
4143
client2.get_post_message())

0 commit comments

Comments
 (0)