bw_processing.filesystem ======================== .. py:module:: bw_processing.filesystem Attributes ---------- .. autoapisummary:: bw_processing.filesystem.MULTI_RE bw_processing.filesystem.SUBSTITUTION_RE bw_processing.filesystem.re_slugify Functions --------- .. autoapisummary:: bw_processing.filesystem.clean_datapackage_name bw_processing.filesystem.md5 bw_processing.filesystem.safe_filename Module Contents --------------- .. py:function:: clean_datapackage_name(name: str) -> str Clean string ``name`` of characters not allowed in data package names. Replaces with underscores, and drops multiple underscores. .. py:function:: md5(filepath: Union[str, pathlib.Path], blocksize: int = 65536) -> str Generate MD5 hash for file at `filepath` .. py:function:: safe_filename(string: Union[str, bytes], add_hash: bool = True, full: bool = False) -> str Convert arbitrary strings to make them safe for filenames. Substitutes strange characters, and uses unicode normalization. if `add_hash`, appends hash of `string` to avoid name collisions. From http://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename-in-python .. py:data:: MULTI_RE .. py:data:: SUBSTITUTION_RE .. py:data:: re_slugify