Skip to content

Commit 88a6391

Browse files
cclausswang0618
authored andcommitted
lint.yml: Fix flake8 --select=E3,W391,E401,E231,E701
1 parent 3f733f6 commit 88a6391

File tree

11 files changed

+16
-10
lines changed

11 files changed

+16
-10
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ jobs:
2828
- name: Lint with flake8
2929
run: |
3030
pip install flake8
31-
flake8 --ignore=E126,E127,E128,E131,E226,E231,E302,E303,E305,E401,E402,E701,E731,F401,F403,F405,W291,W292,W293,W391 \
31+
flake8 --ignore=E126,E127,E128,E131,E226,,E402,E731,F401,F403,F405,W291,W292,W293 \
3232
--max-complexity=32 --max-line-length=525 --show-source --statistics .

demos/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
104104
""".format(charts_demo_host=charts_demo_host)
105105

106+
106107
def index():
107108
"""PyWebIO demos
108109

demos/chat_room.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
chat_msgs = [] # 聊天记录 (name, msg)
1212
online_users = set() # 在线用户
1313

14+
1415
def t(eng, chinese):
1516
"""return English or Chinese text according to the user's browser language"""
1617
return chinese if 'zh' in session_info.user_language else eng

demos/gomoku_game.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import pywebio, time
1+
import time
2+
3+
import pywebio
24
from pywebio.output import *
35
from pywebio.session import *
46

@@ -9,6 +11,7 @@
911
for _ in range(goboard_size)
1012
]
1113

14+
1215
def winner(): # return winner piece, return None if no winner
1316
for x in range(2, goboard_size - 2):
1417
for y in range(2, goboard_size - 2):
@@ -21,9 +24,12 @@ def winner(): # return winner piece, return None if no winner
2124
]):
2225
return ['⚫', '⚪'][goboard[x][y]]
2326

27+
2428
session_id = 0 # auto incremented id for each session
2529
current_turn = 0 # 0 for black, 1 for white
2630
player_count = [0, 0] # count of player for two roles
31+
32+
2733
def main():
2834
"""Online Shared Gomoku Game
2935

demos/input_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def check_age(p): # 检验函数校验通过时返回None,否则返回错误
149149
if p > 60:
150150
return 'Too old!!'
151151

152-
age = input("How old are you?", type=NUMBER, validate=check_age, help_text=t('Try to input some illegal values, such as "8", "65"','尝试输入一些非法值,比如"8"、"65"'))
152+
age = input("How old are you?", type=NUMBER, validate=check_age, help_text=t('Try to input some illegal values, such as "8", "65"', '尝试输入一些非法值,比如"8"、"65"'))
153153
put_markdown('`age = %r`' % age)
154154

155155
# Codemirror

demos/output_usage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ def btn_click(btn_val):
211211
put_markdown(t("The return value of `onclick()` method is the object itself so it can be used in combined output.",
212212
"`onclick()` 方法的返回值为对象本身,所以可以继续用于组合输出中。"))
213213

214-
215214
put_markdown(t(r"""### Output Scope
216215
217216
PyWebIO uses the scope model to give more control to the location of content output. The output area of PyWebIO can be divided into different output domains. The output domain is called Scope in PyWebIO.
@@ -354,7 +353,7 @@ def btn_click(btn_val):
354353

355354
put_markdown(t("""----
356355
For more information about output of PyWebIO, please visit PyWebIO [User Guide](https://pywebio.readthedocs.io/zh_CN/latest/guide.html) and [output module documentation](https://pywebio.readthedocs.io/zh_CN/latest/output.html).
357-
""","""----
356+
""", """----
358357
PyWebIO的输出演示到这里就结束了,更多内容请访问PyWebIO[用户指南](https://pywebio.readthedocs.io/zh_CN/latest/guide.html)和[output模块文档](https://pywebio.readthedocs.io/zh_CN/latest/output.html)。
359358
"""), lstrip=True)
360359

pywebio/output.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,8 @@ def put_grid(content, cell_width='auto', cell_height='auto', cell_widths=None, c
13431343
for y in range(len(content[x])):
13441344
cell = content[x][y]
13451345
if isinstance(cell, span_):
1346-
for i in range(cell.row): lens[x + i] += cell.col
1346+
for i in range(cell.row):
1347+
lens[x + i] += cell.col
13471348

13481349
css = 'grid-row-start: span {row}; grid-column-start: span {col};'.format(row=cell.row, col=cell.col)
13491350
elem = put_html('<div></div>') if cell.content is None else cell.content

pywebio/platform/tornado.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ async def wait_to_stop_loop(server):
435435
server.stop()
436436
logger.debug('Closing tornado ioloop...')
437437
tasks = [t for t in asyncio.all_tasks() if t is not asyncio.current_task() and not t.done()]
438-
for task in tasks: task.cancel()
438+
for task in tasks:
439+
task.cancel()
439440

440441
# 必须需要 await asyncio.sleep ,否则上方 task.cancel() 调用无法调度生效
441442
# This line must be required, otherwise the `task.cancel()` call cannot be scheduled to take effect

pywebio/platform/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ def app():
373373

374374
configs = locals()
375375

376-
377376
class Decorator:
378377
def __init__(self):
379378
self.called = False

test/12.cors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def start_test_server():
6363
flask_server(target, port=8082, host='127.0.0.1', allowed_origins=['http://localhost:5001'], cdn=False)
6464

6565

66-
6766
if __name__ == '__main__':
6867
util.run_test(start_test_server, test,
6968
address='http://localhost:5000/?pywebio_api=http://localhost:8080/')

0 commit comments

Comments
 (0)