ocrd_utils.config module¶
Most behavior of OCR-D is controlled via command-line flags or keyword args. Some behavior is global or too cumbersome to handle via explicit code and better solved by using environment variables.
OcrdEnvConfig is a base class to make this more streamlined, to be subclassed in the ocrd package for the actual values
- class ocrd_utils.config.OcrdEnvVariable(name, description, parser=<class 'str'>, validator=<function OcrdEnvVariable.<lambda>>, default=[False, None])[source]¶
Bases:
object
An environment variable for use in OCR-D.
- Parameters:
name (str) – Name of the environment variable
description (str) – Description of what the variable is used for.
- Keyword Arguments:
parser (callable) – Function to transform the raw (string) value to whatever is needed.
validator (callable) – Function to validate that the raw (string) value is parseable.
default (tuple(bool, any)) – 2-tuple, first element is a bool whether there is a default value defined and second element contains that default value, which can be a callable for deferred evaluation