@@ -120,17 +120,15 @@ def __getitem__(self, id):
120
120
return self ._get_set_or_delete (id , 'get' )
121
121
122
122
def __setitem__ (self , id , item ):
123
- """Set an element by its ID
124
- """
123
+ """Set an element by its ID."""
125
124
return self ._get_set_or_delete (id , 'set' , item )
126
125
127
126
def __delitem__ (self , id ):
128
- """Delete items by ID in the tree of children
129
- """
127
+ """Delete items by ID in the tree of children."""
130
128
return self ._get_set_or_delete (id , 'delete' )
131
129
132
130
def traverse (self ):
133
- """Yield each item in the tree"""
131
+ """Yield each item in the tree. """
134
132
children = getattr (self , 'children' , None )
135
133
136
134
# children is just a component
@@ -149,17 +147,15 @@ def traverse(self):
149
147
yield t
150
148
151
149
def __iter__ (self ):
152
- """Yield IDs in the tree of children
153
- """
150
+ """Yield IDs in the tree of children."""
154
151
for t in self .traverse ():
155
152
if (isinstance (t , Component ) and
156
153
getattr (t , 'id' , None ) is not None ):
157
154
158
155
yield t .id
159
156
160
157
def __len__ (self ):
161
- """Return the number of items in the tree
162
- """
158
+ """Return the number of items in the tree."""
163
159
# TODO - Should we return the number of items that have IDs
164
160
# or just the number of items?
165
161
# The number of items is more intuitive but returning the number
0 commit comments