INNER CODE UNIT · Python

_str_to_bool

georgekhananaev/google-reviews-scraper-pro · modules/cli.py:30

def _str_to_bool(value: str) -> bool:
    """Parse boolean string for argparse (type=bool is broken)."""
    if value.lower() in ("true", "1", "yes", "on"):
        return True
    if value.lower() in ("false", "0", "no", "off"):
        return False
    raise argparse.ArgumentTypeError(f"Boolean value expected, got '{value}'")


def _add_common_args(parser: argparse.ArgumentParser) -> None:
    """Add common arguments shared across subcommands."""
    parser.add_argument(
        "--config", type=str, default=None,
        help="path to custom configuration file",
    )
    parser.add_argument(
        "--db-path", type=str, default=None,
        help="path to SQLite database file (default: reviews.db)",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…