Metadata-Version: 1.1
Name: noattr
Version: 0.0.8
Summary: To avoid NoneType AttributeError exception on chained attributes
Home-page: https://github.com/elapouya/noattr
Author: Eric Lapouyade
Author-email: elapouya@gmail.com
License: LGPL 2.1
Description: 
        ======
        NoAttr
        ======
        
        When you access an object with chained attributes ::
        
            info = obj.a.b.c.d or 'Unknown'
            
        Usually, it will failed when one intermediate attribute return ‘None‘ ::
            
            if obj.a returns None
            obj.a.b.c.d will fail with that exception :
            AttributeError: 'NoneType' object has no attribute 'b'
            
        To avoid that, instead of returning a ‘None‘ value, one should return ‘NoAttr‘, by this way, 
        even next chained attribute will return ‘NoAttr‘ ::
        
            if obj.a returns NoAttr
            obj.a.b.c.d will not fail and will return NoAttr
            
        ‘NoAttr‘ can be seen as False, 0, '', [] or {} depending on the context, so ::
        
            if obj.a returns NoAttr
            
            obj.a.b.c.d or 'Unknown' will return 'Unknown'
            
            for i in obj.a.b.c.d:
                print i
            prints nothing     
           
            obj.a.b.c.d + 1 returns 1
            
            obj.a.b.c.d.anyfunc() returns NoAttr
            
            but for ljust(), rjust(), rfind(), find(), rindex(), index(), count()
            NoAttr is seen as '' :
            
            obj.a.b.c.d.ljust(3) returns '   '
        
        News
        ====
        0.0.8 (2018-08-24)
        ------------------
        __iter__() now returns an empty iter
        
        0.0.7 (2018-08-21)
        ------------------
        Update code for python3 compatibility
        
        0.0.6 (2016-03-11)
        ------------------
        remove __or__ and __rshift__ definition for python_textops
        
        0.0.5 (2015-10-13)
        ------------------
        add as_list property
        
        0.0.4 (2015-08-19)
        ------------------
        add __setattr__ to avoid any modification
        
        0.0.3 (2015-07-27)
        ------------------
        First official version
        
        
Keywords: attribute,AttrDict
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
