miranda.archive package#

Archive module.

miranda.archive.group_by_deciphered_date(files: generator | list[str | Path]) dict[str, list[Path]][source]#

Find a common date and groups files based on year and month.

Parameters:

files (GeneratorType or list of str or pathlib.Path)

Returns:

dict[str, list[pathlib.Path]]

miranda.archive.group_by_length(files: generator | list[str | Path], size: int = 10, sort: bool = False) list[list[Path]][source]#

Group files by an arbitrary number of file entries.

Parameters:
  • files (GeneratorType or list of str or pathlib.Path)

  • size (int)

  • sort (bool)

Returns:

list[list[pathlib.Path]]

miranda.archive.group_by_size(files: generator | list[str | Path], size: int = 10737418240) list[list[Path]][source]#

Group files up until a desired size and save it as a grouping within a list.

Parameters:
  • files (GeneratorType or list of str or pathlib.Path)

  • size (int)

Returns:

list[list[pathlib.Path]]

miranda.archive.group_by_subdirectories(files: generator | list[str | Path], within: str | Path = None) dict[str, list[Path]][source]#

Group files based on the parent folder that they are located within.

Parameters:
  • files (GeneratorType or list of str or pathlib.Path)

  • within (str or pathlib.Path)

Returns:

dict[str, list[pathlib.Path]]

miranda.archive.select_by_date_modified(source: str | Path, year: int | None, month: int | None, day: int | None, *, suffixes: str = 'nc', date: datetime) list[Path][source]#

Select files by the date on which they were last modified.

Parameters:
  • source (str or Path)

  • year (int)

  • month (int)

  • day (int)

  • suffixes (str)

  • date (datetime.date)

Returns:

list of Path

Submodules#

miranda.archive._groupings module#

miranda.archive._groupings.group_by_deciphered_date(files: generator | list[str | Path]) dict[str, list[Path]][source]#

Find a common date and groups files based on year and month.

Parameters:

files (GeneratorType or list of str or pathlib.Path)

Returns:

dict[str, list[pathlib.Path]]

miranda.archive._groupings.group_by_length(files: generator | list[str | Path], size: int = 10, sort: bool = False) list[list[Path]][source]#

Group files by an arbitrary number of file entries.

Parameters:
  • files (GeneratorType or list of str or pathlib.Path)

  • size (int)

  • sort (bool)

Returns:

list[list[pathlib.Path]]

miranda.archive._groupings.group_by_size(files: generator | list[str | Path], size: int = 10737418240) list[list[Path]][source]#

Group files up until a desired size and save it as a grouping within a list.

Parameters:
  • files (GeneratorType or list of str or pathlib.Path)

  • size (int)

Returns:

list[list[pathlib.Path]]

miranda.archive._groupings.group_by_subdirectories(files: generator | list[str | Path], within: str | Path = None) dict[str, list[Path]][source]#

Group files based on the parent folder that they are located within.

Parameters:
  • files (GeneratorType or list of str or pathlib.Path)

  • within (str or pathlib.Path)

Returns:

dict[str, list[pathlib.Path]]

miranda.archive._selection module#

miranda.archive._selection.select_by_date_modified(source: str | Path, year: int | None, month: int | None, day: int | None, *, suffixes: str = 'nc', date: datetime) list[Path][source]#

Select files by the date on which they were last modified.

Parameters:
  • source (str or Path)

  • year (int)

  • month (int)

  • day (int)

  • suffixes (str)

  • date (datetime.date)

Returns:

list of Path