/
usr
/
lib64
/
python3.9
/
/usr/lib64/python3.9
mkdir
upload
Name
Size
Mode
Actions
asyncio/
-
0755
rm
collections/
-
0755
rm
concurrent/
-
0755
rm
config-3.9-x86_64-linux-gnu/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
dbm/
-
0755
rm
distutils/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
ensurepip/
-
0755
rm
html/
-
0755
rm
http/
-
0755
rm
importlib/
-
0755
rm
json/
-
0755
rm
lib-dynload/
-
0755
rm
lib2to3/
-
0755
rm
logging/
-
0755
rm
multiprocessing/
-
0755
rm
pydoc_data/
-
0755
rm
site-packages/
-
0755
rm
sqlite3/
-
0755
rm
unittest/
-
0755
rm
urllib/
-
0755
rm
venv/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
xmlrpc/
-
0755
rm
zoneinfo/
-
0755
rm
__pycache__/
-
0755
rm
abc.py
4920
0644
edit
dl
rm
aifc.py
32605
0644
edit
dl
rm
antigravity.py
500
0644
edit
dl
rm
argparse.py
98119
0644
edit
dl
rm
ast.py
56256
0644
edit
dl
rm
asynchat.py
11321
0644
edit
dl
rm
asyncore.py
20102
0644
edit
dl
rm
base64.py
19859
0755
edit
dl
rm
bdb.py
31389
0644
edit
dl
rm
binhex.py
14784
0644
edit
dl
rm
bisect.py
2350
0644
edit
dl
rm
bz2.py
12447
0644
edit
dl
rm
calendar.py
24832
0644
edit
dl
rm
cgi.py
33932
0755
edit
dl
rm
cgitb.py
12096
0644
edit
dl
rm
chunk.py
5435
0644
edit
dl
rm
cmd.py
14860
0644
edit
dl
rm
code.py
10622
0644
edit
dl
rm
codecs.py
36673
0644
edit
dl
rm
codeop.py
6326
0644
edit
dl
rm
colorsys.py
4064
0644
edit
dl
rm
compileall.py
20105
0644
edit
dl
rm
configparser.py
54584
0644
edit
dl
rm
contextlib.py
24624
0644
edit
dl
rm
contextvars.py
129
0644
edit
dl
rm
copy.py
8650
0644
edit
dl
rm
copyreg.py
7274
0644
edit
dl
rm
cProfile.py
6345
0755
edit
dl
rm
crypt.py
3819
0644
edit
dl
rm
csv.py
16144
0644
edit
dl
rm
dataclasses.py
49586
0644
edit
dl
rm
datetime.py
89177
0644
edit
dl
rm
decimal.py
320
0644
edit
dl
rm
difflib.py
83307
0644
edit
dl
rm
dis.py
20570
0644
edit
dl
rm
doctest.py
104568
0644
edit
dl
rm
enum.py
39440
0644
edit
dl
rm
filecmp.py
10024
0644
edit
dl
rm
fileinput.py
14791
0644
edit
dl
rm
fnmatch.py
6004
0644
edit
dl
rm
formatter.py
15143
0644
edit
dl
rm
fractions.py
24323
0644
edit
dl
rm
ftplib.py
35496
0644
edit
dl
rm
functools.py
38881
0644
edit
dl
rm
genericpath.py
5246
0644
edit
dl
rm
getopt.py
7489
0644
edit
dl
rm
getpass.py
5990
0644
edit
dl
rm
gettext.py
27266
0644
edit
dl
rm
glob.py
5823
0644
edit
dl
rm
graphlib.py
9573
0644
edit
dl
rm
gzip.py
21772
0644
edit
dl
rm
hashlib.py
8069
0644
edit
dl
rm
heapq.py
22877
0644
edit
dl
rm
hmac.py
8043
0644
edit
dl
rm
imaplib.py
55256
0644
edit
dl
rm
imghdr.py
3808
0644
edit
dl
rm
imp.py
10536
0644
edit
dl
rm
inspect.py
118235
0644
edit
dl
rm
io.py
3541
0644
edit
dl
rm
ipaddress.py
80924
0644
edit
dl
rm
keyword.py
1047
0644
edit
dl
rm
LICENSE.txt
13937
0644
edit
dl
rm
linecache.py
5461
0644
edit
dl
rm
locale.py
78271
0644
edit
dl
rm
lzma.py
13231
0644
edit
dl
rm
mailbox.py
78794
0644
edit
dl
rm
mailcap.py
9116
0644
edit
dl
rm
mimetypes.py
21564
0644
edit
dl
rm
modulefinder.py
24401
0644
edit
dl
rm
netrc.py
5566
0644
edit
dl
rm
nntplib.py
41023
0644
edit
dl
rm
ntpath.py
26460
0644
edit
dl
rm
nturl2path.py
2887
0644
edit
dl
rm
numbers.py
10338
0644
edit
dl
rm
opcode.py
5660
0644
edit
dl
rm
operator.py
10751
0644
edit
dl
rm
optparse.py
60369
0644
edit
dl
rm
os.py
39065
0644
edit
dl
rm
pathlib.py
51134
0644
edit
dl
rm
pdb.py
63237
0755
edit
dl
rm
pickle.py
64920
0644
edit
dl
rm
pickletools.py
93486
0644
edit
dl
rm
pipes.py
8916
0644
edit
dl
rm
pkgutil.py
24276
0644
edit
dl
rm
platform.py
40601
0755
edit
dl
rm
plistlib.py
28248
0644
edit
dl
rm
poplib.py
15198
0644
edit
dl
rm
posixpath.py
16146
0644
edit
dl
rm
pprint.py
22527
0644
edit
dl
rm
profile.py
22881
0755
edit
dl
rm
pstats.py
29326
0644
edit
dl
rm
pty.py
4807
0644
edit
dl
rm
pyclbr.py
15255
0644
edit
dl
rm
pydoc.py
109599
0755
edit
dl
rm
py_compile.py
8203
0644
edit
dl
rm
queue.py
11496
0644
edit
dl
rm
quopri.py
7266
0755
edit
dl
rm
random.py
31484
0644
edit
dl
rm
re.py
15861
0644
edit
dl
rm
reprlib.py
5267
0644
edit
dl
rm
rlcompleter.py
7648
0644
edit
dl
rm
runpy.py
13084
0644
edit
dl
rm
sched.py
6442
0644
edit
dl
rm
secrets.py
2036
0644
edit
dl
rm
selectors.py
19536
0644
edit
dl
rm
shelve.py
8527
0644
edit
dl
rm
shlex.py
13501
0644
edit
dl
rm
shutil.py
53030
0644
edit
dl
rm
signal.py
2438
0644
edit
dl
rm
site.py
22085
0644
edit
dl
rm
smtpd.py
34821
0755
edit
dl
rm
smtplib.py
45405
0755
edit
dl
rm
sndhdr.py
7099
0644
edit
dl
rm
socket.py
36915
0644
edit
dl
rm
socketserver.py
27296
0644
edit
dl
rm
sre_compile.py
27973
0644
edit
dl
rm
sre_constants.py
7177
0644
edit
dl
rm
sre_parse.py
40779
0644
edit
dl
rm
ssl.py
52622
0644
edit
dl
rm
stat.py
5485
0644
edit
dl
rm
statistics.py
38067
0644
edit
dl
rm
string.py
10566
0644
edit
dl
rm
stringprep.py
12917
0644
edit
dl
rm
struct.py
257
0644
edit
dl
rm
subprocess.py
83564
0644
edit
dl
rm
sunau.py
18158
0644
edit
dl
rm
symbol.py
2281
0644
edit
dl
rm
symtable.py
7905
0644
edit
dl
rm
sysconfig.py
25557
0644
edit
dl
rm
tabnanny.py
11406
0755
edit
dl
rm
tarfile.py
112939
0755
edit
dl
rm
telnetlib.py
23254
0644
edit
dl
rm
tempfile.py
27963
0644
edit
dl
rm
textwrap.py
19407
0644
edit
dl
rm
this.py
1003
0644
edit
dl
rm
threading.py
54176
0644
edit
dl
rm
timeit.py
13480
0755
edit
dl
rm
token.py
2368
0644
edit
dl
rm
tokenize.py
25883
0644
edit
dl
rm
trace.py
29207
0755
edit
dl
rm
traceback.py
24660
0644
edit
dl
rm
tracemalloc.py
18047
0644
edit
dl
rm
tty.py
879
0644
edit
dl
rm
types.py
9785
0644
edit
dl
rm
typing.py
77044
0644
edit
dl
rm
uu.py
7277
0644
edit
dl
rm
uuid.py
27324
0644
edit
dl
rm
warnings.py
19688
0644
edit
dl
rm
wave.py
18004
0644
edit
dl
rm
weakref.py
21560
0644
edit
dl
rm
webbrowser.py
24083
0755
edit
dl
rm
xdrlib.py
5913
0644
edit
dl
rm
zipapp.py
7535
0644
edit
dl
rm
zipfile.py
88899
0644
edit
dl
rm
zipimport.py
30765
0644
edit
dl
rm
_aix_support.py
3389
0644
edit
dl
rm
_bootlocale.py
1801
0644
edit
dl
rm
_bootsubprocess.py
2675
0644
edit
dl
rm
_collections_abc.py
29374
0644
edit
dl
rm
_compat_pickle.py
8749
0644
edit
dl
rm
_compression.py
5340
0644
edit
dl
rm
_markupbase.py
14623
0644
edit
dl
rm
_osx_support.py
21773
0644
edit
dl
rm
_pydecimal.py
228666
0644
edit
dl
rm
_pyio.py
93316
0644
edit
dl
rm
_py_abc.py
6189
0644
edit
dl
rm
_sitebuiltins.py
3115
0644
edit
dl
rm
_strptime.py
25277
0644
edit
dl
rm
_sysconfigdata__linux_x86_64-linux-gnu.py
41236
0644
edit
dl
rm
_threading_local.py
7220
0644
edit
dl
rm
_weakrefset.py
5923
0644
edit
dl
rm
__future__.py
5147
0644
edit
dl
rm
__phello__.foo.py
64
0644
edit
dl
rm
Edit:
/usr/lib64/python3.9/graphlib.py
(9573B)
__all__ = ["TopologicalSorter", "CycleError"] _NODE_OUT = -1 _NODE_DONE = -2 class _NodeInfo: __slots__ = "node", "npredecessors", "successors" def __init__(self, node): # The node this class is augmenting. self.node = node # Number of predecessors, generally >= 0. When this value falls to 0, # and is returned by get_ready(), this is set to _NODE_OUT and when the # node is marked done by a call to done(), set to _NODE_DONE. self.npredecessors = 0 # List of successor nodes. The list can contain duplicated elements as # long as they're all reflected in the successor's npredecessors attribute. self.successors = [] class CycleError(ValueError): """Subclass of ValueError raised by TopologicalSorter.prepare if cycles exist in the working graph. If multiple cycles exist, only one undefined choice among them will be reported and included in the exception. The detected cycle can be accessed via the second element in the *args* attribute of the exception instance and consists in a list of nodes, such that each node is, in the graph, an immediate predecessor of the next node in the list. In the reported list, the first and the last node will be the same, to make it clear that it is cyclic. """ pass class TopologicalSorter: """Provides functionality to topologically sort a graph of hashable nodes""" def __init__(self, graph=None): self._node2info = {} self._ready_nodes = None self._npassedout = 0 self._nfinished = 0 if graph is not None: for node, predecessors in graph.items(): self.add(node, *predecessors) def _get_nodeinfo(self, node): if (result := self._node2info.get(node)) is None: self._node2info[node] = result = _NodeInfo(node) return result def add(self, node, *predecessors): """Add a new node and its predecessors to the graph. Both the *node* and all elements in *predecessors* must be hashable. If called multiple times with the same node argument, the set of dependencies will be the union of all dependencies passed in. It is possible to add a node with no dependencies (*predecessors* is not provided) as well as provide a dependency twice. If a node that has not been provided before is included among *predecessors* it will be automatically added to the graph with no predecessors of its own. Raises ValueError if called after "prepare". """ if self._ready_nodes is not None: raise ValueError("Nodes cannot be added after a call to prepare()") # Create the node -> predecessor edges nodeinfo = self._get_nodeinfo(node) nodeinfo.npredecessors += len(predecessors) # Create the predecessor -> node edges for pred in predecessors: pred_info = self._get_nodeinfo(pred) pred_info.successors.append(node) def prepare(self): """Mark the graph as finished and check for cycles in the graph. If any cycle is detected, "CycleError" will be raised, but "get_ready" can still be used to obtain as many nodes as possible until cycles block more progress. After a call to this function, the graph cannot be modified and therefore no more nodes can be added using "add". """ if self._ready_nodes is not None: raise ValueError("cannot prepare() more than once") self._ready_nodes = [ i.node for i in self._node2info.values() if i.npredecessors == 0 ] # ready_nodes is set before we look for cycles on purpose: # if the user wants to catch the CycleError, that's fine, # they can continue using the instance to grab as many # nodes as possible before cycles block more progress cycle = self._find_cycle() if cycle: raise CycleError(f"nodes are in a cycle", cycle) def get_ready(self): """Return a tuple of all the nodes that are ready. Initially it returns all nodes with no predecessors; once those are marked as processed by calling "done", further calls will return all new nodes that have all their predecessors already processed. Once no more progress can be made, empty tuples are returned. Raises ValueError if called without calling "prepare" previously. """ if self._ready_nodes is None: raise ValueError("prepare() must be called first") # Get the nodes that are ready and mark them result = tuple(self._ready_nodes) n2i = self._node2info for node in result: n2i[node].npredecessors = _NODE_OUT # Clean the list of nodes that are ready and update # the counter of nodes that we have returned. self._ready_nodes.clear() self._npassedout += len(result) return result def is_active(self): """Return ``True`` if more progress can be made and ``False`` otherwise. Progress can be made if cycles do not block the resolution and either there are still nodes ready that haven't yet been returned by "get_ready" or the number of nodes marked "done" is less than the number that have been returned by "get_ready". Raises ValueError if called without calling "prepare" previously. """ if self._ready_nodes is None: raise ValueError("prepare() must be called first") return self._nfinished < self._npassedout or bool(self._ready_nodes) def __bool__(self): return self.is_active() def done(self, *nodes): """Marks a set of nodes returned by "get_ready" as processed. This method unblocks any successor of each node in *nodes* for being returned in the future by a call to "get_ready". Raises :exec:`ValueError` if any node in *nodes* has already been marked as processed by a previous call to this method, if a node was not added to the graph by using "add" or if called without calling "prepare" previously or if node has not yet been returned by "get_ready". """ if self._ready_nodes is None: raise ValueError("prepare() must be called first") n2i = self._node2info for node in nodes: # Check if we know about this node (it was added previously using add() if (nodeinfo := n2i.get(node)) is None: raise ValueError(f"node {node!r} was not added using add()") # If the node has not being returned (marked as ready) previously, inform the user. stat = nodeinfo.npredecessors if stat != _NODE_OUT: if stat >= 0: raise ValueError( f"node {node!r} was not passed out (still not ready)" ) elif stat == _NODE_DONE: raise ValueError(f"node {node!r} was already marked done") else: assert False, f"node {node!r}: unknown status {stat}" # Mark the node as processed nodeinfo.npredecessors = _NODE_DONE # Go to all the successors and reduce the number of predecessors, collecting all the ones # that are ready to be returned in the next get_ready() call. for successor in nodeinfo.successors: successor_info = n2i[successor] successor_info.npredecessors -= 1 if successor_info.npredecessors == 0: self._ready_nodes.append(successor) self._nfinished += 1 def _find_cycle(self): n2i = self._node2info stack = [] itstack = [] seen = set() node2stacki = {} for node in n2i: if node in seen: continue while True: if node in seen: # If we have seen already the node and is in the # current stack we have found a cycle. if node in node2stacki: return stack[node2stacki[node] :] + [node] # else go on to get next successor else: seen.add(node) itstack.append(iter(n2i[node].successors).__next__) node2stacki[node] = len(stack) stack.append(node) # Backtrack to the topmost stack entry with # at least another successor. while stack: try: node = itstack[-1]() break except StopIteration: del node2stacki[stack.pop()] itstack.pop() else: break return None def static_order(self): """Returns an iterable of nodes in a topological order. The particular order that is returned may depend on the specific order in which the items were inserted in the graph. Using this method does not require to call "prepare" or "done". If any cycle is detected, :exc:`CycleError` will be raised. """ self.prepare() while self.is_active(): node_group = self.get_ready() yield from node_group self.done(*node_group)
Save
cmd:
run