Small PyPI package which provides python code cleaning from comments, docstrings, annotations
Project description
py-code-cleaner
Small PyPI package which provides python code cleaning from comments, docstrings, annotations
pip install py_code_cleaner
from py_code_cleaner import clean_py, clean_py_deep, clean_py_main
# def clean_py_main(
# src: PathLike,
# dst: Optional[PathLike] = None,
# keep_nonpy: Optional[Iterable[str]] = ('.pyx',),
# filter_empty_lines: bool = True,
# filter_docstrings: bool = True,
# filter_annotations: bool = True,
# quiet: bool = False,
# dry_run: bool = False
# )
CLI
cleane-py -h
usage: clean-py [-h] [--destination DESTINATION] [--keep-nonpy KEEP_NONPY [KEEP_NONPY ...]] [--keep-empty-lines] [--keep-docstrings] [--keep-annotations] [--quiet] [--dry-run] source
Cleanses *.py files from comments, empty lines, annotations and docstrings
positional arguments:
source python file path or path to directory with files
optional arguments:
-h, --help show this help message and exit
--destination DESTINATION, -d DESTINATION
destination file or directory; empty means to print to stdout (default: None)
--keep-nonpy KEEP_NONPY [KEEP_NONPY ...], -k KEEP_NONPY [KEEP_NONPY ...]
additional file extensions to transfer between src and dst directories (to not ignore) (default: )
--keep-empty-lines, -e
Whether to not remove empty lines (default: False)
--keep-docstrings, -s
Whether to not remove docstrings (default: False)
--keep-annotations, -a
Whether to not remove annotations (default: False)
--quiet, -q Do not print processing info (default: False)
--dry-run, -n Whether to run without performing file processing operations (default: False)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_code_cleaner-1.0.0.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for py_code_cleaner-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af8e5f177b302f63cd87e760a141a8570c8345f7fae0074431889eedb212752e |
|
MD5 | 9cc4c742d410c1116e98aef62ffdda0e |
|
BLAKE2b-256 | c041a921da1b75cb640520ad474c7536b947825f6b6fd60350edda6bfa014d8c |