pypif.pif module

pypif.pif.dump(pif, fp, **kwargs)

Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.

Parameters:
  • pif – Object or list of objects to serialize.
  • fp – File-like object supporting .write() method to write the serialized object(s) to.
  • kwargs – Any options available to json.dump().
pypif.pif.dumps(pif, **kwargs)

Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded string.

Parameters:
  • pif – Object or list of objects to serialize.
  • kwargs – Any options available to json.dumps().
pypif.pif.load(fp, **kwargs)

Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.

Parameters:
  • fp – File-like object supporting .read() method to deserialize from.
  • kwargs – Any options available to json.load().
Returns:

Single object derived from Pio or a list of such object.

pypif.pif.loado(obj)

Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.

Parameters:obj – Dictionary or list to convert to Physical Information Objects.
Returns:Single object derived from Pio or a list of such object.
pypif.pif.loads(s, **kwargs)

Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.

Parameters:
  • s – String to deserialize.
  • kwargs – Any options available to json.loads().
Returns:

Single object derived from Pio or a list of such object.