find_top_level¶
- photonforge.find_top_level(*components)¶
Filter a set of components to return only top-level ones.
Top-level components are components that are not dependencies of any other component in the set.
- Parameters:
components – Instances of
Component
.- Returns:
List of top-level components.
Note
The implementation is equivalent to:
def find_top_level(*components): c_set = set(components) d_set = set(dep for c in c_set for dep in c.dependencies()) return list(c_set - d_set)
Example
>>> components = load_layout(filename) >>> top_level = find_top_level(*components.values())