iprPy.record package

Module contents

loaded

Dictionary of the record styles that were successfully imported. The dictionary keys are the database style names, and the values are the loaded modules.

Type

dict

failed

Dictionary listing the record styles that failed import. Values contain the error messages thrown by the style.

Type

dict

class Record(name=None, content=None)

Bases: object

Class for handling different record styles in the same fashion. The class defines the common methods and attributes, which are then uniquely implemented for each style. The available styles are loaded from the iprPy.records submodule.

property content

The record’s content.

Type

DataModelDict

property contentroot

The root element of the content

Type

str

property directory

The path to the record’s directory

Type

str

property name

The record’s name.

Type

str

property schema

The absolute directory path to the .xsd file associated with the record style.

Type

str

property style

The record style

Type

str

todict(full=True, flat=False)

Converts the structured content to a simpler dictionary.

Parameters
  • full (bool, optional) – Flag used by the calculation records. A True value will include terms for both the calculation’s input and results, while a value of False will only include input terms (Default is True).

  • flat (bool, optional) – Flag affecting the format of the dictionary terms. If True, the dictionary terms are limited to having only str, int, and float values, which is useful for comparisons. If False, the term values can be of any data type, which is convenient for analysis. (Default is False).

Returns

A dictionary representation of the record’s content.

Return type

dict

load_record(style, name=None, content=None)

Loads a Record subclass associated with a given record style

Parameters
  • style (str) – The record style

  • name (str) – The name to give to the specific record

  • content – The record’s data model content

Returns

A Record object for the style

Return type

subclass of iprPy.record.Record