Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > sqlalchemy > util > >
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 6711 bytes | April 17 2025 13:10:58. | |
_collections.py | File | 29219 bytes | April 17 2025 13:10:58. | |
_preloaded.py | File | 5765 bytes | April 17 2025 13:10:58. | |
compat.py | File | 16984 bytes | April 17 2025 13:10:58. | |
deprecations.py | File | 7474 bytes | April 17 2025 13:10:58. | |
langhelpers.py | File | 47707 bytes | April 17 2025 13:10:58. | |
queue.py | File | 6827 bytes | April 17 2025 13:10:58. | |
topological.py | File | 2767 bytes | April 17 2025 13:10:58. |
# util/topological.py # Copyright (C) 2005-2021 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Topological sorting algorithms.""" from .. import util from ..exc import CircularDependencyError __all__ = ["sort", "sort_as_subsets", "find_cycles"] def sort_as_subsets(tuples, allitems, deterministic_order=False): edges = util.defaultdict(set) for parent, child in tuples: edges[child].add(parent) Set = util.OrderedSet if deterministic_order else set todo = Set(allitems) while todo: output = Set() for node in todo: if todo.isdisjoint(edges[node]): output.add(node) if not output: raise CircularDependencyError( "Circular dependency detected.", find_cycles(tuples, allitems), _gen_edges(edges), ) todo.difference_update(output) yield output def sort(tuples, allitems, deterministic_order=False): """sort the given list of items by dependency. 'tuples' is a list of tuples representing a partial ordering. 'deterministic_order' keeps items within a dependency tier in list order. """ for set_ in sort_as_subsets(tuples, allitems, deterministic_order): for s in set_: yield s def find_cycles(tuples, allitems): # adapted from: # http://neopythonic.blogspot.com/2009/01/detecting-cycles-in-directed-graph.html edges = util.defaultdict(set) for parent, child in tuples: edges[parent].add(child) nodes_to_test = set(edges) output = set() # we'd like to find all nodes that are # involved in cycles, so we do the full # pass through the whole thing for each # node in the original list. # we can go just through parent edge nodes. # if a node is only a child and never a parent, # by definition it can't be part of a cycle. same # if it's not in the edges at all. for node in nodes_to_test: stack = [node] todo = nodes_to_test.difference(stack) while stack: top = stack[-1] for node in edges[top]: if node in stack: cyc = stack[stack.index(node) :] todo.difference_update(cyc) output.update(cyc) if node in todo: stack.append(node) todo.remove(node) break else: node = stack.pop() return output def _gen_edges(edges): return set([(right, left) for left in edges for right in edges[left]])
SILENT KILLER Tool