Skip to content

Commit

Permalink
Use """triple double quotes""" around docstrings. https://www.python.…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbampton authored and chriddyp committed Nov 29, 2017
1 parent 454c597 commit d012158
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions dash/development/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,26 @@ def _get_set_or_delete(self, id, operation, new_item=None):
# - __len__

def __getitem__(self, id):
'''Recursively find the element with the given ID through the tree
"""Recursively find the element with the given ID through the tree
of children.
'''
"""

# A component's children can be undefined, a string, another component,
# or a list of components.
return self._get_set_or_delete(id, 'get')

def __setitem__(self, id, item):
'''Set an element by its ID
'''
"""Set an element by its ID
"""
return self._get_set_or_delete(id, 'set', item)

def __delitem__(self, id):
'''Delete items by ID in the tree of children
'''
"""Delete items by ID in the tree of children
"""
return self._get_set_or_delete(id, 'delete')

def traverse(self):
'''Yield each item in the tree'''
"""Yield each item in the tree"""
children = getattr(self, 'children', None)

# children is just a component
Expand All @@ -149,17 +149,17 @@ def traverse(self):
yield t

def __iter__(self):
'''Yield IDs in the tree of children
'''
"""Yield IDs in the tree of children
"""
for t in self.traverse():
if (isinstance(t, Component) and
getattr(t, 'id', None) is not None):

yield t.id

def __len__(self):
'''Return the number of items in the tree
'''
"""Return the number of items in the tree
"""
# TODO - Should we return the number of items that have IDs
# or just the number of items?
# The number of items is more intuitive but returning the number
Expand Down

0 comments on commit d012158

Please sign in to comment.