def detect_circle(nodes):
    """ Wrapper for recursive _detect_circle function """
    # Verify nodes and traveled types
    if not isinstance(nodes, dict):
        raise TypeError('"nodes" must be a dictionary')

    dependencies = set(nodes.keys())
    traveled = []

    heads = _detect_circle(nodes, dependencies, traveled)

    return DependencyTree(heads)
def detect_circle ( nodes ) : if not isinstance ( nodes , dict ) : raise TypeError ( '"nodes" must be a dictionary' ) dependencies = set ( nodes . keys ( ) ) traveled = [ ] heads = _detect_circle ( nodes , dependencies , traveled ) return DependencyTree ( heads )
Wrapper for recursive _detect_circle function