neuralib.util.utils.uglob

neuralib.util.utils.uglob(directory, pattern, is_dir=False)[source]

Use glob pattern to find the unique file in the directory.

Parameters:
  • directory (str | Path | PathLike[str]) – Directory

  • pattern (str) – Glob pattern

  • is_dir (bool) – Is the pattern point to a directory?

Returns:

The unique path

Raises:
  • FileNotFoundError – the unique path is not existed.

  • NotADirectoryErrordirectory is not a directory

  • RuntimeError – more than one path are found.

Return type:

Path