colawater.lib.scan#

Functions and constants for working with scan files.

Examples

from colawater import scan

important_list = [do_something(f) for f in scan.CITY_DIR.iterdir() if scan.exists(f)]

Module Contents#

Functions#

exists(→ bool)

Returns whether this scan file exists.

Attributes#

CITY_DIR

Known static location of city scan directory.

CW2020_DIR

Known static location of CleanWater 2020 scan directory.

colawater.lib.scan.CITY_DIR: pathlib.Path#

Known static location of city scan directory.

colawater.lib.scan.CW2020_DIR: pathlib.Path#

Known static location of CleanWater 2020 scan directory.

colawater.lib.scan.exists(filename: str) bool#

Returns whether this scan file exists.

Applies some heuristics to detect if the string is a valid scan file name and only checks the filesystem if those heuristics pass. Uses an unbounded LRU cache to store arguments and results to avoid erroneous filesystem accesses.

Parameters:

filename (str) – The name of a file.

Returns:

Whether a scan with filename exists.

Return type:

bool