class documentation

Read LDIF entry or change records from file object.

Parameters
input_filefile to read the LDIF input from
ignored_attr_typesList of attribute types that will be ignored
process_url_schemesList of URL schemes to process with urllib. An empty list turns off all URL processing and the attribute is ignored completely.
line_sepline separator
encodingEncoding to use for converting values to unicode strings. If decoding failes, the raw bytestring will be used instead. You can also pass None which will skip decoding and always produce bytestrings. Note that this only applies to entry values. dn and entry keys will always be unicode strings.
strictIf set to False, recoverable parse errors will produce log warnings rather than exceptions.
Method __init__ Undocumented
Method parse Iterate LDIF entry records.
Instance Variable byte_counter Undocumented
Instance Variable line_counter Undocumented
Instance Variable records_read Undocumented
Static Method _strip_line_sep Strip trailing line separators from s, but no other whitespaces.
Method _check_changetype Check changetype attribute for issues.
Method _check_dn Check dn attribute for issues.
Method _decode_value Undocumented
Method _error Undocumented
Method _iter_blocks Iter input lines in blocks separated by blank lines.
Method _iter_unfolded_lines Iter input unfoled lines.
Method _parse_attr Parse a single attribute type/value pair.
Method _parse_entry_record Parse a single entry record from a list of lines.
Instance Variable _encoding Undocumented
Instance Variable _ignored_attr_types Undocumented
Instance Variable _input_file Undocumented
Instance Variable _line_sep Undocumented
Instance Variable _process_url_schemes Undocumented
Instance Variable _strict Undocumented
def __init__(self, input_file, ignored_attr_types=(), process_url_schemes=(), line_sep=b'\n', encoding: str | None = 'utf8', strict=True): (source)

Undocumented

def parse(self) -> Iterator[tuple[str | None, dict]]: (source)

Iterate LDIF entry records.

Returns
Iterator[Tuple[string, Dict]](dn, entry)
byte_counter: int = (source)

Undocumented

line_counter: int = (source)

Undocumented

records_read: int = (source)

Undocumented

@staticmethod
def _strip_line_sep(s): (source)

Strip trailing line separators from s, but no other whitespaces.

def _check_changetype(self, dn, changetype, attr_value): (source)

Check changetype attribute for issues.

def _check_dn(self, dn, attr_value): (source)

Check dn attribute for issues.

def _decode_value(self, attr_type, attr_value): (source)

Undocumented

def _error(self, msg): (source)

Undocumented

def _iter_blocks(self): (source)

Iter input lines in blocks separated by blank lines.

def _iter_unfolded_lines(self): (source)

Iter input unfoled lines.

Skip comments.

def _parse_attr(self, line: bytes): (source)

Parse a single attribute type/value pair.

def _parse_entry_record(self, lines: list[bytes]) -> tuple[str | None, dict]: (source)

Parse a single entry record from a list of lines.

_encoding = (source)

Undocumented

_ignored_attr_types = (source)

Undocumented

_input_file = (source)

Undocumented

_line_sep = (source)

Undocumented

_process_url_schemes = (source)

Undocumented

Undocumented