Changeset 2735:48c02492211b in livinglogic.python.xist

Show
Ignore:
Timestamp:
06/29/07 19:37:17 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add an inattr selector that return True, if the node is an attribute or
is itself inside an attribute.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/xfind.py

    r2733 r2735  
    214214    def __repr__(self): 
    215215        return "%s(%r, %r)" % (self.__class__.__name__, self.attrname, self.attrvalue) 
     216 
     217 
     218class inattr(Selector): 
     219    def match(self, path): 
     220        return any(isinstance_(node, xsc.Attr) for node in path) 
     221 
     222    def __repr__(self): 
     223        return "inattr" 
     224 
     225 
     226inattr = inattr() 
    216227 
    217228