Skip to content

Commit df111da

Browse files
committed
chore: lintルールを追加 etc.
- chore: コメントを足すなど
1 parent d80dc7e commit df111da

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

script/pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,14 @@ allow-direct-references = true
3030

3131
[tool.hatch.build.targets.wheel]
3232
packages = ["src/atmjsongen"]
33+
34+
[tool.ruff.lint]
35+
select = [
36+
"E", # pycodestyle errors
37+
"W", # pycodestyle warnings
38+
"F", # pyflakes
39+
"I", # isort
40+
"C", # flake8-comprehensions
41+
"B", # flake8-bugbear
42+
"UP", # pyupgrade
43+
]

script/src/atmjsongen/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from typing import Callable
1+
from collections.abc import Callable
22
from pathlib import Path
3+
34
import geopandas
45
import typer
56

@@ -43,9 +44,10 @@ def get_openinghours(tags):
4344
return atm_opening
4445

4546

46-
def main(parquet: Path, geojson_dir: Path = Path.cwd()):
47+
def main(parquet: Path, geojson_dir: Path = Path.cwd()): # noqa: B008
4748
gdf = geopandas.read_parquet(parquet)
48-
gdf["tags"] = gdf["tags"].apply(lambda l: {i[0]: i[1] for i in l})
49+
# タグはlist[tuple]の構造になっているので使いやすいようにdictに変換する
50+
gdf["tags"] = gdf["tags"].apply(lambda lst: {i[0]: i[1] for i in lst})
4951
gdf["brand"] = gdf["tags"].apply(get_sometag("brand"))
5052
gdf["name"] = gdf["tags"].apply(get_sometag("name"))
5153
gdf["atm"] = gdf["tags"].apply(is_atm)

0 commit comments

Comments
 (0)