Pybankreader API¶
pybankreader.exceptions module¶
-
exception
pybankreader.exceptions.
ConfigurationError
[source]¶ Bases:
exceptions.Exception
Exception signifies a programmers error in setting up the reports
-
exception
pybankreader.exceptions.
ValidationError
(field, message)[source]¶ Bases:
exceptions.Exception
Simple exception for field-level validation errors
-
data
= None¶ One line of data, if available, that a record tried to load
-
field
= None¶ The field which raised the exception
-
interval
= (0, 0)¶ Interval in the source data string, that the field tried to parse in the format of a tuple (start, end)
-
message
= None¶ Exception message
-
parent
= None¶ Optional pointer to previous ValidationError exception, as the parser progressed through the data and was trying sucessive records/fields.
-
record
= None¶ The record class name, where the error occured
-
pybankreader.fields module¶
-
class
pybankreader.fields.
CharField
(length, required)[source]¶ Bases:
pybankreader.fields.Field
CharField just uses the Field superclass directly for now, nothing special
-
class
pybankreader.fields.
DecimalField
(*args, **kwargs)[source]¶ Bases:
pybankreader.fields.RegexField
Decimal is just a special-case regex, so the field is implemented this way. Mind that when you’re using decimal, the overall length of the field must count with the decimal dot!
-
class
pybankreader.fields.
Field
(length, required)[source]¶ Bases:
object
Basic field superclass. We have mandatory length and required flags, and we hold the set value (if any). Also, the name of the field as defined in classes using these for reference reasons.
-
field_name
¶ Return the name of the field it has been assigned to
Return string: name of the field
-
length
= None¶
-
required
= None¶
-
value
¶ Just return the value, nothing special here
Returns: object
-
-
class
pybankreader.fields.
IntegerField
(*args, **kwargs)[source]¶ Bases:
pybankreader.fields.RegexField
Integer is just a special-case regex, so the field is implemented this way
-
class
pybankreader.fields.
RegexField
(regex, *args, **kwargs)[source]¶ Bases:
pybankreader.fields.Field
Generic regex field. On top of basic checks, enforces a regex match
-
class
pybankreader.fields.
TimestampField
(format, *args, **kwargs)[source]¶ Bases:
pybankreader.fields.Field
Timestamp field takes on format parameter to be fed into strptime
pybankreader.records module¶
-
class
pybankreader.records.
FieldProxy
(field_obj)[source]¶ Bases:
object
A decriptor class for fields. This essentially creates a proxy to attributes. Beware of weird class-level like behavior of descriptors
-
class
pybankreader.records.
Record
(initial=None)[source]¶ Bases:
object
The base Record class. Any record definition should use this one, since it allows for the smooth definition via class attributes and adds some facade methods to load those records.
Also, it uses the same trick as Field to mainatin it’s relative position inside the Report class
pybankreader.reports module¶
-
class
pybankreader.reports.
CompoundRecord
(*args)[source]¶ Bases:
pybankreader.records.Record
A wrapper for a record field that represents a list of records and possibly of multiple types of records. This is mainly required to control the position of individual record attributes in the given report.