Skip to content

Commit

Permalink
mnt: mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
n-takumasa committed Sep 20, 2024
1 parent b5858fa commit 99b2216
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/fix_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fix_inf(text: str) -> str:
return f"{title}\n{header}\n{new_body}"


def main():
def main() -> None:
for fp in Path("src/janaf/data/").glob("*.txt"):
orig = fp.read_text(encoding="ascii")
text = orig
Expand Down
4 changes: 2 additions & 2 deletions scripts/update_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def dst(index: str) -> Path:
return root / f"src/janaf/data/{index}.txt"


async def fetch(session: aiohttp.ClientSession, url: str, dst: Path):
async def fetch(session: aiohttp.ClientSession, url: str, dst: Path) -> None:
async with session.get(url) as res:
data = await res.text("utf-8")
async with aiofiles.open(dst, "w", encoding="utf-8") as f:
await f.write(data)


async def main():
async def main() -> None:
async with aiofiles.open(path_json, encoding="utf-8") as fp:
indexes = json.load(fp.buffer)["index"]

Expand Down
2 changes: 1 addition & 1 deletion scripts/update_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
dst = root / "src/janaf/janaf.json"


async def main():
async def main() -> None:
async with aiohttp.ClientSession() as session, session.get(url) as res:
text = await res.text("utf-8")
async with aiofiles.open(dst, "w", encoding="utf-8") as f:
Expand Down
4 changes: 3 additions & 1 deletion src/janaf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
from janaf.table import Table

if TYPE_CHECKING:
from typing import Any

import polars as pl


def __getattr__(name):
def __getattr__(name: str) -> Any:
from janaf.index import db

if name == "db":
Expand Down

0 comments on commit 99b2216

Please sign in to comment.