Changeset 166

Show
Ignore:
Timestamp:
03/22/06 12:57:41 (3 years ago)
Author:
abaxter
Message:

reformat code, fix bugs (false instead of False)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pyramid/dictutils.py

    r163 r166  
    33import mergetrees 
    44 
    5 def merge(a,b,dir=None,partialbuild=False): 
     5def merge(a, b, dir=None, partialbuild=False): 
    66 
    7     if isinstance(a,Y.sectionnav) and isinstance(b,Y.sectionnav) and dir is not None: 
    8         # special case. If b is the same as a, it has been inhereited - sectionnav's 
    9         # should not inherit in this fashion however 
    10         # TODO: this fix might cause problems in the future. e.g. if the second level nav were exactly the same as the first level nav? 
     7    if (isinstance(a, Y.sectionnav) and  
     8        isinstance(b, Y.sectionnav) and dir is not None): 
     9        # special case. If b is the same as a, it has been inhereited -  
     10        # sectionnav's should not inherit in this fashion however 
     11        # TODO: this fix might cause problems in the future. e.g. if  
     12        # the second level nav were exactly the same as the first level nav? 
    1113        if a == b: 
    1214            b = [] 
     
    1416            a = b 
    1517        else: 
    16             mergetrees.merge(a,b,dir) 
     18            mergetrees.merge(a, b, dir) 
    1719 
    18     elif isinstance(b,dict) and isinstance(a,dict): 
     20    elif isinstance(b, dict) and isinstance(a, dict): 
    1921        for bkey in b.keys(): 
    2022            if a.has_key(bkey): 
    21                 a[bkey] = merge(a[bkey],b[bkey],dir,partialbuild=partialbuild) 
     23                a[bkey] = merge(a[bkey], b[bkey], dir,  
     24                                partialbuild=partialbuild) 
    2225            else: 
    2326                a[bkey] = b[bkey] 
     
    3336        if parent is not None: 
    3437            self.parent = parent 
    35             merge(self,parent) 
     38            merge(self, parent) 
    3639 
    3740    def popStack(self): 
     
    6669 
    6770 
    68     xd = syck.load(x,Loader=Y.Loader, implicit_typing=false) 
    69     yd = syck.load(y,Loader=Y.Loader, implicit_typing=false) 
     71    xd = syck.load(x, Loader=Y.Loader, implicit_typing=False) 
     72    yd = syck.load(y, Loader=Y.Loader, implicit_typing=False) 
    7073 
    71     z = merge(xd,yd) 
     74    z = merge(xd, yd) 
    7275 
    7376    print z 
     
    7780    d = stackdict() 
    7881    d['a'] = 1 
    79     d['b'] = {'x':1,'y':2 } 
     82    d['b'] = {'x':1, 'y':2 } 
    8083    print d 
    8184 
     
    8588 
    8689    d = stackdict(d) 
    87     d['b'] = {'x':2,'y': {'p':4 } } 
     90    d['b'] = {'x':2, 'y': {'p':4 } } 
    8891    d['c'] = 100 
    8992    print d