IDD Processor Module DocumentationΒΆ

class eptransition.idd.processor.CurrentReadType[source]

Internal class containing constants for the different states of the actual IDD Processor engine

EncounteredComment_ReadToCR = 0
LookingForFieldMetaDataOrNextField = 11
LookingForFieldMetaDataOrNextObject = 10
LookingForObjectMetaDataOrNextField = 4
ReadAnything = 1
ReadingFieldANValue = 7
ReadingFieldMetaData = 8
ReadingFieldMetaDataOrNextANValue = 9
ReadingGroupDeclaration = 2
ReadingObjectMetaData = 5
ReadingObjectMetaDataContents = 6
ReadingObjectName = 3
class eptransition.idd.processor.IDDProcessor[source]

The core IDD Processor class. Given an IDD via stream or path, this class has workers to robustly process the IDD into a rich IDDStructure instance.

The constructor takes no arguments but sets up instance variables. Relevant “public” members are listed here:

Variables:
  • idd (IDDStructure) – The resulting IDDStructure instance after processing the IDD file/stream
  • file_path (str) – A file path for this IDD, although it may be just a simple descriptor
peek_one_char()[source]

Internal worker function that reads a single character from the internal IDD stream but resets the stream to the former position

Returns:A single character, the one immediately following the cursor, or None if it can’t peek ahead.
process_file()[source]

Internal worker function that reads the IDD stream, whether it was constructed from a file path, stream or string. This state machine worker moves character by character reading tokens and processing them into a meaningful IDD structure.

Returns:An IDD structure describing the IDD contents
Raises:ProcessingException – for any erroneous conditions encountered during processing
process_file_given_file_path(file_path)[source]

This worker allows processing of an IDD file at a specific path on disk.

Parameters:file_path – The path to an IDD file on disk.
Returns:An IDDStructure instance created from processing the IDD file
Raises:ProcessingException – if the specified file does not exist
process_file_via_stream(idd_file_stream)[source]

This worker allows processing of an IDD snippet via stream. Most useful for unit testing, but possibly for other situations.

Parameters:idd_file_stream (file-like-object) – An IDD snippet that responds to typical file-like commands such as read(). A common object would be the StringIO object.
Returns:An IDDStructure instance created from processing the IDD snippet
process_file_via_string(idd_string)[source]

This worker allows processing of an IDD snippet string. Most useful for unit testing, but possibly for other situations.

Parameters:idd_string (str) – An IDD snippet string
Returns:An IDDStructure instance created from processing the IDD string
read_one_char()[source]

Internal worker function that reads a single character from the internal IDD stream, advancing the cursor.

Returns:A single character, the one immediately following the cursor, or None if it can’t read.