pg.patching.from_maybe_serialized

Accessible via pg.patching.from_maybe_serialized.

from_maybe_serialized(source, value_type=None)[source]

Load value from maybe serialized form (e.g. JSON file or JSON string).

Return type:

Any

Parameters:
  • source – Source of value. It can be value (non-string type) itself, or a filepath, or a JSON string from where the value will be loaded.

  • value_type – An optional type to constrain the value.

Returns:

Value from source.