Overview

Path PyPoE/poe/file/specification/__init__.py
Version 1.0.0a0
Revision $Id: bab0874388e86a946efc474d7aa1c72d551325e6 $
Author Omega_K2
PyPoE.poe.file.specification.load(path=None, version=<VERSION.STABLE: 1>, reload=False, validate=None)[source]

Loads a specification from a python module that can be used for the dat files. The file must implement the classes from PyPoE.poe.file.specification.fields and expose the specification with a variable “specification” for this to work properly.

Since this function is using python imports specifications are automatically cached once loaded. If using a cached version is not desired set the reload parameter to True.

Warning

Please note that many usages of the reload function will cause a memory leak since python does not remove old modules from it’s cache.

Parameters:
  • path (str) – If specified, read the specified python module as specification
  • version (constants.VERSION) – Version of the game to load the specification for; only works if path is not specified.
  • reload (bool) – Whether to reload the specified specification.
  • validate (bool or None) – Whether additional validation will be run on the Specification. By default (None), this will only occur when custom specifications are loaded and not when default specifications are loaded.
Returns:

returns the ConfigObj of the read file.

Return type:

ConfigObj

Raises:
  • ValueError – if version passed is not valid
  • SpecificationError – if validation is enabled and any issues occur