class documentation

A class that generates unique output paths in a directory.

This class provides a get_output_path method that generates unique filenames in the specified output directory.

If an input path is provided, its filename is maintained, unless a name conflict in output_dir would occur, in which case an index of the form "-%d" % count is appended to the filename.

If no input filename is provided, an output filename of the form <output_dir>/<count><default_ext> is generated, where count is the number of files in output_dir.

If no output_dir is provided, then unique filenames with no base directory are generated.

If a rel_dir is provided, then this path will be stripped from each input path to generate the identifier of each file (rather than just its basename). This argument allows for populating nested subdirectories in output_dir that match the shape of the input paths.

If alt_dir is provided, you can use get_alt_path to retrieve the equivalent path rooted in this directory rather than output_dir.

Parameters
output_dira directory in which to generate output paths
rel_diran optional relative directory to strip from each path. The path is converted to an absolute path (if necessary) via fiftyone.core.storage.normalize_path
alt_diran optional alternate directory in which to generate paths when get_alt_path is called
chunk_sizeif provided, output paths will be nested in subdirectories of output_dir with at most this many files per subdirectory. Has no effect if a rel_dir is provided
default_extthe file extension to use when generating default output paths
ignore_extswhether to omit file extensions when checking for duplicate filenames
ignore_existingwhether to ignore existing files in output_dir for output filename generation purposes
idempotentwhether to return the same output path when the same input path is provided multiple times (True) or to generate new output paths (False)
Method __init__ Undocumented
Method get_alt_path Returns the alternate path for the given output path generated by get_output_path.
Method get_output_path Returns a unique output path.
Method seen_input_path Checks whether we've already seen the given input path.
Instance Variable alt_dir Undocumented
Instance Variable chunk_size Undocumented
Instance Variable default_ext Undocumented
Instance Variable idempotent Undocumented
Instance Variable ignore_existing Undocumented
Instance Variable ignore_exts Undocumented
Instance Variable output_dir Undocumented
Instance Variable rel_dir Undocumented
Method _setup Undocumented
Instance Variable _chunk_count Undocumented
Instance Variable _chunk_num Undocumented
Instance Variable _chunk_root Undocumented
Instance Variable _default_filename_patt Undocumented
Instance Variable _filename_counts Undocumented
Instance Variable _filepath_map Undocumented
Instance Variable _idx Undocumented
def __init__(self, output_dir=None, rel_dir=None, alt_dir=None, chunk_size=None, default_ext=None, ignore_exts=False, ignore_existing=False, idempotent=True): (source)

Undocumented

def get_alt_path(self, output_path, alt_dir=None): (source)

Returns the alternate path for the given output path generated by get_output_path.

Parameters
output_pathan output path
alt_dir:Nonea directory in which to return the alternate path. If not provided, alt_dir is used
Returns
the corresponding alternate path
def get_output_path(self, input_path=None, output_ext=None): (source)

Returns a unique output path.

Parameters
input_path:Nonean input path
output_ext:Nonean optional output extension to use
Returns
the output path
def seen_input_path(self, input_path): (source)

Checks whether we've already seen the given input path.

Parameters
input_pathan input path
Returns
True/False

Undocumented

chunk_size: None = (source)

Undocumented

default_ext: None = (source)

Undocumented

idempotent: True = (source)

Undocumented

ignore_existing: False = (source)

Undocumented

ignore_exts: False = (source)

Undocumented

output_dir: None = (source)

Undocumented

Undocumented

def _setup(self): (source)

Undocumented

_chunk_count: int = (source)

Undocumented

_chunk_num: int = (source)

Undocumented

_chunk_root = (source)

Undocumented

_default_filename_patt = (source)

Undocumented

_filename_counts = (source)

Undocumented

_filepath_map: dict = (source)

Undocumented

Undocumented