Metadata-Version: 1.1
Name: objdiff
Version: 0.1
Summary: Returns a list of commands/delta to go from one tree of objects to another
Home-page: http://blitz.works/objdiff
Author: Da_Blitz
Author-email: code@pocketnix.org
License: MIT BSD
Download-URL: http://blitz.works/objdiff/archive/default.zip
Description: Objdiff
        =======
        Take 2 sets of containers and provide a (deep) delta between them
        
        
        Why?
        -----
        At the time this module was started, no modules existed that had this 
        functionality. After poking the difflib module there was code that could be 
        reused to achive part of what i wanted. functionality above and beyond this was 
        trivial to implement (diffing unsorted items)
        
        There are a number of libraries out there that provide diffing functionality 
        however a quick review of these has indicated they are mainly for display 
        output and do not provide an easy way for a program to diff 2 things and then 
        react based ont he results (ie they require you to split lots of strings to get 
        at the information you need)
        
        How?
        ----
        Objdiff uses difflib built into python for lists and tuples (basically sorted 
        things) and implements its own comparison code for dictonaries. User types are 
        detected via the collections.abc.Mapping type and instance comparison and are 
        treated as dictonaries (ie unsorted item => value mappings)
        
        What does this look like?
        -------------------------
        >>> import objdiff
        >>> a = {'a': 1, 'b':[1,2,3], 'c':None}
        >>> b = {'a': 1, 'b':[1,4], 'c':'hello'}
        >>> objdiff.obj_diff(a, b)
        <generator object obj_diff at 0xb6a3da80>
        
        We return an iterator and make use of yield from so you can process large trees 
        of objects efficiently and incremental
        
        >>> list(objdiff.obj_diff(a, b))
        [('!', ['c'], (None, 'hello')), ('!', ['b'], ([1, 2, 3], [1, 4]))]
        
        Expanding out the generator we get back a bunch of tuples containing the 
        command value, key path and before and after value
        
        >>> c = {'a':{1: None, 2: 2, 3: 3}, 'b': None}
        >>> d = {'a':{1: 1, 2: 2}, 'b': {'1':{}, '2':{'2':2}}}
        >>> list(objdiff.obj_diff(c, d))
        [('-', ['a', 3], (3, Deleted)), ('!', ['a', 1], (None, 1)), ('!', ['b'], (None, {'1': {}, '2': {'2': 2}}))]
        
        Note in the above how you get a full list of keys to the destined object after 
        the command value
        
Keywords: objects diff tree difflib patch diffrence
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Software Development :: Libraries
