@@ -374,8 +374,8 @@ def size(self):
374374 Get dictionary containing the names of child containers in the current
375375 object as keys and the number of children of that type as values.
376376 """
377- return dict (( name , len (getattr (self , name ) ))
378- for name in self ._child_containers )
377+ return { name : len (getattr (self , name ))
378+ for name in self ._child_containers }
379379
380380 def filter (self , targdict = None , data = True , container = False , recursive = True ,
381381 objects = None , ** kwargs ):
@@ -569,7 +569,7 @@ def merge(self, other):
569569 # merge containers with the same name
570570 for container in (self ._container_child_containers +
571571 self ._multi_child_containers ):
572- lookup = dict (( obj .name , obj ) for obj in getattr (self , container ))
572+ lookup = { obj .name : obj for obj in getattr (self , container )}
573573 ids = [id (obj ) for obj in getattr (self , container )]
574574 for obj in getattr (other , container ):
575575 if id (obj ) in ids :
@@ -584,7 +584,7 @@ def merge(self, other):
584584 # for data objects, ignore the name and just add them
585585 for container in self ._data_child_containers :
586586 objs = getattr (self , container )
587- lookup = dict (( obj .name , i ) for i , obj in enumerate (objs ))
587+ lookup = { obj .name : i for i , obj in enumerate (objs )}
588588 ids = [id (obj ) for obj in objs ]
589589 for obj in getattr (other , container ):
590590 if id (obj ) in ids :
@@ -617,7 +617,7 @@ def _repr_pretty_(self, pp, cycle):
617617 for container in self ._child_containers :
618618 objs = getattr (self , container )
619619 if objs :
620- vals .append ('%s %s' % (len (objs ), container ))
620+ vals .append ('{} {}' . format (len (objs ), container ))
621621 pp .text (', ' .join (vals ))
622622
623623 if self ._has_repr_pretty_attrs_ ():
@@ -627,7 +627,7 @@ def _repr_pretty_(self, pp, cycle):
627627 for container in self ._repr_pretty_containers :
628628 pp .breakable ()
629629 objs = getattr (self , container )
630- pp .text ("# %s (N=%s)" % (container , len (objs )))
630+ pp .text ("# {} (N={})" . format (container , len (objs )))
631631 for (i , obj ) in enumerate (objs ):
632632 pp .breakable ()
633633 pp .text ("%s: " % i )
0 commit comments