import_pickles

menpo.io.import_pickles(pattern, max_pickles=None, verbose=False)[source]

Multiple pickle file import generator.

Note that this is a generator function.

Menpo unambiguously uses .pkl as it’s choice of extension for pickle files. Menpo also supports automatic importing of gzip compressed pickle files - matching files with extension pkl.gz will be automatically un-gzipped and imported.

Parameters:
  • pattern (str) – The glob path pattern to search for pickles. Every pickle file found to match the glob will be imported one by one.
  • max_pickles (positive int, optional) – If not None, only import the first max_pickles found. Else, import all.
  • verbose (bool, optional) – If True progress of the importing will be dynamically reported.
Returns:

generator (generator yielding object) – Generator yielding whatever Python object is present in the pickle files that match the glob pattern provided.

Raises:

ValueError – If no pickles are found at the provided glob.