Skip to content

Commit

Permalink
bootstrap: Note pydocstyle updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Dec 10, 2023
1 parent b07f101 commit 3ee77db
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/unihan_db/bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Fetch, extract, transform, and load UNIHAN into database."""
import logging
import sys
import typing as t
Expand Down Expand Up @@ -30,8 +31,7 @@ def setup_logger(
logger: t.Optional[logging.Logger] = None,
level: t.Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO",
) -> None:
"""
Setup logging for CLI use.
"""Configure logging for CLI use.
Parameters
----------
Expand Down Expand Up @@ -148,6 +148,7 @@ def is_bootstrapped(metadata: sqlalchemy.MetaData) -> bool:
def bootstrap_data(
options: t.Union[UntypedUnihanData, None] = None,
) -> t.Optional["UntypedNormalizedData"]:
"""Fetch, download, and export UNIHAN data in dictionary format."""
if options is None:
options = {}
_options = options
Expand All @@ -163,6 +164,7 @@ def bootstrap_unihan(
session: t.Union[Session, ScopedSession[t.Any]],
options: t.Optional[UntypedUnihanData] = None,
) -> None:
"""Bootstrap UNIHAN to database."""
_options = options if options is not None else {}

"""Download, extract and import unihan to database."""
Expand Down Expand Up @@ -197,8 +199,7 @@ def bootstrap_unihan(


def to_dict(obj: t.Any, found: t.Optional[t.Set[t.Any]] = None) -> t.Dict[str, object]:
"""
Return dictionary of an SQLAlchemy Query result.
"""Return dictionary of an SQLAlchemy Query result.
Supports recursive relationships.
Expand Down Expand Up @@ -242,8 +243,7 @@ def _get_key_value(c: str) -> t.Any:


def add_to_dict(b: t.Any) -> t.Any:
"""
Add :func:`.to_dict` method to SQLAlchemy Base object.
"""Add :func:`.to_dict` method to SQLAlchemy Base object.
Parameters
----------
Expand All @@ -257,8 +257,7 @@ def add_to_dict(b: t.Any) -> t.Any:
def get_session(
engine_url: str = "sqlite:///{user_data_dir}/unihan_db.db",
) -> "ScopedSession[t.Any]":
"""
Return new SQLAlchemy session object from engine string.
"""Return new SQLAlchemy session object from engine string.
*engine_url* accepts a string template variable for ``{user_data_dir}``,
which is replaced to the XDG data directory for the user running the script
Expand Down

0 comments on commit 3ee77db

Please sign in to comment.