Filepaths

Functions to help locate data to import on disk.

authorityspoke.io.filepaths.make_filepath(filename=None, directory=None, filepath=None, default_folder='holdings')

Create pathlib.Path for a file containing XML or JSON to load as objects.

Parameters:
  • filename (Optional[str]) – just the name of the file, without the directory.

  • directory (Optional[Path]) – just the directory, without the path

  • filepath (Optional[Path]) – a full path that just needs to be checked for validity and returned

  • default_folder (str) – a folder name to use in constructing a missing directory path

Returns:

the path to the desired file

authorityspoke.io.filepaths.get_directory_path(stem)

Find a data directory for importing files.

Parameters:

stem (str) – name of the folder where the desired example data files can be found, e.g. “holdings” or “opinions”.

Return type:

Path

Returns:

path to the directory with the desired example data files.