diffHandler module

class diffHandler.DiffAlgo(*args, **kwargs)

Bases: AutoPropertyObject

abstract diff(newText: str, oldText: str) List[str]
abstract _getText(ti: TextInfo) str
_abc_impl = <_abc._abc_data object>
_propertyCache: Set[Callable[[AutoPropertyObject], Any]]
class diffHandler.DiffMatchPatch(*args, **kwargs)

Bases: DiffAlgo

A character-based diffing approach, using the Google Diff Match Patch library in a proxy process (to work around a licence conflict).

_proc = None

A subprocess.Popen object for the nvda_dmp process.

_lock = <unlocked _thread.lock object>

A lock to control access to the nvda_dmp process. Control access to avoid synchronization problems if multiple threads attempt to use nvda_dmp at the same time.

_initialize()

Start the nvda_dmp process if it is not already running. @note: This should be run from within the context of an acquired lock.

_getText(ti: TextInfo) str
classmethod _readData(size: int) bytes

Reads from stdout, raises exception on EOF.

diff(newText: str, oldText: str) List[str]
_terminate()
_abc_impl = <_abc._abc_data object>
_propertyCache: Set[Callable[[AutoPropertyObject], Any]]
class diffHandler.Difflib(*args, **kwargs)

Bases: DiffAlgo

A line-based diffing approach in pure Python, using the Python standard library.

diff(newText: str, oldText: str) List[str]
_getText(ti: TextInfo) str
_abc_impl = <_abc._abc_data object>
_propertyCache: Set[Callable[[AutoPropertyObject], Any]]
diffHandler.prefer_dmp()

This function returns a Diff Match Patch object if allowed by the user. DMP is new and can be explicitly disabled by a user setting. If config does not allow DMP, this function returns a Difflib instance instead.

diffHandler.prefer_difflib()

This function returns a Difflib object if allowed by the user. Difflib can be explicitly disabled by a user setting. If config does not allow Difflib, this function returns a DMP instance instead.