Implementation of rfc822 serializer and deserializer.
Warning
THIS MODULE DOES NOT HAVE STABLE PUBLIC API
A ITextSource subclass indicating that text came from a file.
Variables: | filename – name of the file something comes from |
---|
Simple class for tracking where something came from
Variables: |
|
---|
Create an Origin instance pointing at the call site of this method.
Create a Origin with source relative to the specified base directory.
Parameters: | base_dir – A base directory name |
---|---|
Returns: | A new Origin with source replaced by the result of calling relative_to(base_dir) on the current source iff the current source has that method, self otherwise. |
This method is useful for obtaining user friendly Origin objects that have short, understandable filenames.
A FileTextSource subclass indicating the file was a python file.
It implements no differences but in some context it might be helpful to differentiate on the type of the source field in the origin of a job definition record.
Variables: | filename – name of the python filename that something comes from |
---|
Class for tracking RFC822 records.
This is a simple container for the dictionary of data. The data is represented by two copies, one original and one after value normalization. Value normalization strips out excess whitespace and processes the magic leading dot syntax that is essential for empty newlines.
Comparison is performed on the normalized data only, raw data is stored for reference but does not differentiate records.
Each instance also holds the origin of the data (location of the file/stream where it was parsed from).
The normalized version of the data set (dictionary)
This property exposes the normalized version of the data encapsulated in this record. Normalization is performed with normalize_rfc822_value(). Only values are normalized, keys are left intact.
SyntaxError subclass for RFC822 parsing functions
A ITextSource subclass indicating that the source of text is unknown.
This instances of this class are constructed by gen_rfc822_records() when no explicit source is provided and the stream has no name. The serve as non-None values to prevent constructing PythonFileTextSource with origin computed from Origin.get_caller_origin()
Load a sequence of rfc822-like records from a text stream.
Parameters: |
|
---|
Each record consists of any number of key-value pairs. Subsequent records are separated by one blank line. A record key may have a multi-line value if the line starts with whitespace character.
Returns a list of subsequent values as instances RFC822Record class. If the optional data_cls argument is collections.OrderedDict then the values retain their original ordering.
Load a sequence of rfc822-like records from a text stream.
Parameters: |
|
---|
Each record consists of any number of key-value pairs. Subsequent records are separated by one blank line. A record key may have a multi-line value if the line starts with whitespace character.
Returns a list of subsequent values as instances RFC822Record class. If the optional data_cls argument is collections.OrderedDict then the values retain their original ordering.