示例#1
0
    def __init__(self, keysrc=[]):
        expkey = []
        if isinstance(keysrc, str):  # Handle single string
            keysrc = [keysrc]
        assert isinstance(keysrc, list)

        # List of tuples
        if keysrc and isinstance(keysrc[0], tuple):
            expkey = keysrc

        # List of strings
        elif keysrc and isinstance(keysrc[0], str):
            for key in keysrc:
                lhs_rhs = key.split('=', 1)
                if len(lhs_rhs) == 1:
                    expkey.append((lhs_rhs[0].strip(), None))
                else:
                    expkey.append((lhs_rhs[0].strip(), lhs_rhs[1].strip()))

        # Create the dict
        Bindings.__init__(self, expkey)
        for neg in self._neglected:
            if neg in self:
                del self[neg]
示例#2
0
    def __init__(self, keysrc=[]):
        expkey = []
        if isinstance(keysrc, str): # Handle single string
            keysrc = [ keysrc ]
        assert isinstance(keysrc, list)
        
        # List of tuples
        if keysrc and isinstance(keysrc[0], tuple):
            expkey = keysrc

        # List of strings
        elif keysrc and isinstance(keysrc[0], str):
            for key in keysrc:
                lhs_rhs = key.split('=',1)
                if len(lhs_rhs)==1:
                    expkey.append( (lhs_rhs[0].strip(), None) )
                else:
                    expkey.append( (lhs_rhs[0].strip(), lhs_rhs[1].strip()) )

        # Create the dict
        Bindings.__init__(self, expkey)
        for neg in self._neglected:
            if neg in self:
                del self[neg]
示例#3
0
 def __init__( self ):
     Bindings.__init__( self )
     self.references = {}