INNER CODE UNIT · Python
collect_pixelation_overrides
KennethJAllen/proper-pixel-art · proper_pixel_art/cli.py:139
def collect_pixelation_overrides(args: argparse.Namespace) -> dict:
"""Collect the explicit pixelation flag values from parsed args.
Values are ``None`` when the flag wasn't provided, so they fall back to
the config / built-in defaults downstream.
"""
return {field: getattr(args, field) for field in PIXELATION_FIELDS}
def resolve_input_path(
parser: argparse.ArgumentParser, args: argparse.Namespace
) -> argparse.Namespace:
"""Resolve the positional input path against the ``-i``/``--input`` flag,
erroring out when neither is given."""
if args.input_path is None and args.input_path_flag is None:
parser.error("You must provide an input path (positional or with -i).")
args.input_path = (
args.input_path if args.input_path is not None else args.input_path_flag