pydiffx.errors#

Common errors for parsing and generating diffs.

Exceptions

BaseDiffXError

Base class for all DiffX errors.

DiffXContentError

An error with content for a section.

DiffXOptionValueChoiceError(option, value, ...)

An error with the choice for a value for an option.

DiffXOptionValueError

An error with a value for an option.

DiffXParseError(msg, linenum[, column])

An error when parsing a DiffX file.

DiffXSectionOrderError

An error with the order of a section within the DiffX file.

DiffXUnknownOptionError

An option name is unknown for a given section.

MalformedHunkError(line, line_num[, msg])

Error with the contents of a hunk in a patch.

exception pydiffx.errors.BaseDiffXError#

Bases: Exception

Base class for all DiffX errors.

exception pydiffx.errors.DiffXParseError(msg, linenum, column=None)#

Bases: pydiffx.errors.BaseDiffXError

An error when parsing a DiffX file.

Parse errors contain information on the line (and sometimes the column) causing parsing to fail, along with an error message.

column#

The 0-based column number where the parse error occurred. This may be None for some parse errors.

Type

int

linenum#

The 0-based line number where the parse error occurred.

Type

int

__init__(msg, linenum, column=None)#

Initialize the error.

Parameters
  • msg (unicode) – An error message explaining why the file could not be parsed.

  • linenum (int) – The 0-based line number where the parse error occurred.

  • column (int, optional) – The 0-based column number where the parse error occurred.

exception pydiffx.errors.DiffXSectionOrderError#

Bases: pydiffx.errors.BaseDiffXError

An error with the order of a section within the DiffX file.

exception pydiffx.errors.DiffXContentError#

Bases: pydiffx.errors.BaseDiffXError

An error with content for a section.

exception pydiffx.errors.DiffXUnknownOptionError#

Bases: pydiffx.errors.BaseDiffXError

An option name is unknown for a given section.

exception pydiffx.errors.DiffXOptionValueError#

Bases: pydiffx.errors.BaseDiffXError

An error with a value for an option.

exception pydiffx.errors.DiffXOptionValueChoiceError(option, value, choices)#

Bases: pydiffx.errors.DiffXOptionValueError

An error with the choice for a value for an option.

__init__(option, value, choices)#

Initialize the error.

Parameters
  • option (unicode) – The name of the option.

  • value (object) – The value that was chosen.

  • choices (list of unicode) – The list of values considered valid.

exception pydiffx.errors.MalformedHunkError(line, line_num, msg=None)#

Bases: Exception

Error with the contents of a hunk in a patch.

line#

The contents of the line triggering the error.

Type

bytes

line_num#

The 1-based line number where the error occurred.

Type

int

__init__(line, line_num, msg=None)#

Initialize the error.

Parameters
  • line (bytes) – The contents of the line triggering the error.

  • line_num (int) – The 1-based line number where the error occurred.

  • msg (unicode, optional) – An optional error message to display instead of the default message. This may contain line and line_num format strings (built for %-based formatting).

__eq__(other)#

Return whether this exception equals another.

Parameters

other (object) – The object to compare to.

Returns

True if the objectws are equal. False if they are not.

Return type

bool

__hash__ = None#