--- a/src/pyams_utils/container.py Sat Jul 21 00:15:37 2018 +0200
+++ b/src/pyams_utils/container.py Sat Jul 21 00:16:17 2018 +0200
@@ -94,12 +94,10 @@
for name, adapter in registry.getAdapters((context,), ISublocations):
if not name: # don't reuse default adapter!!
continue
- for location in adapter.sublocations():
- yield location
+ yield from adapter.sublocations()
# then yield container items
if IContainer.providedBy(context):
- for key in context:
- yield context[key]
+ yield from context.values()
def find_objects_matching(root, condition, ignore_root=False):
@@ -124,8 +122,7 @@
for location in locations.sublocations():
if condition(location):
yield location
- for sublocation in find_objects_matching(location, condition, ignore_root=True):
- yield sublocation
+ yield from find_objects_matching(location, condition, ignore_root=True)
def find_objects_providing(root, interface):
@@ -137,5 +134,4 @@
:param Interface interface: interface; an interface that sub-objects should provide
:return: an iterator for all root's sub-objects that provide the given interface
"""
- for match in find_objects_matching(root, interface.providedBy):
- yield match
+ yield from find_objects_matching(root, interface.providedBy)