Skip to content

Commit 4a77982

Browse files
committed
lint対応
1 parent 8d0a8e8 commit 4a77982

2 files changed

Lines changed: 30 additions & 19 deletions

File tree

plugins/analyze.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,33 @@
1111
def analyze_message(message: str) -> Callable[[BaseClient], None]:
1212
"""コマンド解析"""
1313

14-
conditions = {'help': lambda m: hato.help_message,
15-
'eq': lambda m: hato.earth_quake,
16-
'地震': lambda m: hato.earth_quake,
17-
'text list': lambda m: hato.get_text_list,
18-
'text add ': lambda m: partial(hato.add_text, word=m[len('text add '):]),
19-
'text show ': lambda m: partial(hato.show_text, power_word_id=m[len('text show '):]),
20-
'text delete ': lambda m: partial(hato.delete_text, power_word_id=m[len('text delete '):]),
21-
'text random': lambda m: hato.show_random_text,
22-
'text': lambda m: hato.show_random_text,
23-
'>< ': lambda m: partial(hato.totuzensi, message=m[len('>< '):]),
24-
'amesh': lambda m: partial(hato.amesh, place=(m[len('amesh'):]).strip()),
25-
'電力': lambda m: hato.electricity_demand,
26-
'標高': lambda m: partial(hato.altitude, place=(m[len('標高'):]).strip()),
27-
'version': lambda m: hato.version,
28-
'にゃーん': lambda m: hato.yoshiyoshi,
29-
'おみくじ': lambda m: hato.omikuji,
30-
}
14+
conditions = {
15+
'help': lambda m: hato.help_message,
16+
'eq': lambda m: hato.earth_quake,
17+
'地震': lambda m: hato.earth_quake,
18+
'text list': lambda m: hato.get_text_list,
19+
'text add ': lambda m: partial(
20+
hato.add_text,
21+
word=m[len('text add '):]
22+
),
23+
'text show ': lambda m: partial(
24+
hato.show_text,
25+
power_word_id=m[len('text show '):]
26+
),
27+
'text delete ': lambda m: partial(
28+
hato.delete_text,
29+
power_word_id=m[len('text delete '):]
30+
),
31+
'text random': lambda m: hato.show_random_text,
32+
'text': lambda m: hato.show_random_text,
33+
'>< ': lambda m: partial(hato.totuzensi, message=m[len('>< '):]),
34+
'amesh': lambda m: partial(hato.amesh, place=m[len('amesh'):].strip()),
35+
'電力': lambda m: hato.electricity_demand,
36+
'標高': lambda m: partial(hato.altitude, place=m[len('標高'):].strip()),
37+
'version': lambda m: hato.version,
38+
'にゃーん': lambda m: hato.yoshiyoshi,
39+
'おみくじ': lambda m: hato.omikuji,
40+
}
3141

3242
for key, method in conditions.items():
3343
if message.startswith(key):

plugins/hato.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def show_text(power_word_id: str):
128128

129129

130130
@action('text random')
131-
def show_random_text(client: BaseClient):
131+
def show_random_text():
132132
"""パワーワードの一覧からランダムで1つを表示する"""
133133

134134
return show_random_vocabulary()
@@ -200,7 +200,7 @@ def electricity_demand(client: BaseClient):
200200

201201
if res.status_code != 200:
202202
client.post('東京電力管内の電力使用率を取得できなかったっぽ......')
203-
return None
203+
return
204204

205205
res_io = pd.io.stata.BytesIO(res.content)
206206
df_base = pd.read_csv(res_io, encoding='shift_jis',
@@ -221,6 +221,7 @@ def electricity_demand(client: BaseClient):
221221
filename=os.path.extsep.join(['tepco_electricity_demand_graph', ext]))
222222

223223
plt.close('all')
224+
return
224225

225226

226227
@action('標高')

0 commit comments

Comments
 (0)