Skip to content

Commit e592333

Browse files
committed
添加black配置
1 parent 790c03f commit e592333

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

pyproject.toml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[build-system]
2+
# These are the assumed default build requirements from pip:
3+
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
4+
requires = ["setuptools>=43.0.0", "wheel"]
5+
build-backend = "setuptools.build_meta"
6+
7+
[tool.black]
8+
skip-string-normalization = true
9+
line-length = 100
10+
target-version = ['py39']
11+
exclude = '''
12+
/(
13+
\.git
14+
| \.tox
15+
| \.venv
16+
| \.history
17+
| build
18+
| dist
19+
| docs
20+
| hack
21+
)/
22+
'''
23+
24+
25+
[tool.isort]
26+
profile = "black"
27+
line_length = 100
28+
29+
[tool.pytest.ini_options]
30+
log_cli = true
31+
log_cli_level = "DEBUG"
32+
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
33+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"

server-app/app.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88
# 假设有一个简单的数据列表
99
data_list = [{'id': 1, 'name': 'Item 1'}, {'id': 2, 'name': 'Item 2'}]
1010

11+
1112
@app.route('/api/items', methods=['GET'])
1213
def get_items():
1314
return jsonify(data_list)
1415

16+
1517
@app.route('/api/items', methods=['POST'])
1618
def add_item():
1719
new_item = request.json
1820
data_list.append(new_item)
1921
return jsonify(new_item)
2022

23+
2124
if __name__ == '__main__':
2225
app.run()

0 commit comments

Comments
 (0)