forked from AFPy/python-docs-fr
225 lines
7.8 KiB
Plaintext
225 lines
7.8 KiB
Plaintext
# Copyright (C) 2001-2018, Python Software Foundation
|
|
# For licence information, see README file.
|
|
#
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: Python 3\n"
|
|
"Report-Msgid-Bugs-To: \n"
|
|
"POT-Creation-Date: 2021-09-23 16:16+0200\n"
|
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
|
|
"Language: fr\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#: library/graphlib.rst:2
|
|
msgid ":mod:`graphlib` --- Functionality to operate with graph-like structures"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:8
|
|
msgid "**Source code:** :source:`Lib/graphlib.py`"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:20
|
|
msgid "Provides functionality to topologically sort a graph of hashable nodes."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:22
|
|
msgid ""
|
|
"A topological order is a linear ordering of the vertices in a graph such "
|
|
"that for every directed edge u -> v from vertex u to vertex v, vertex u "
|
|
"comes before vertex v in the ordering. For instance, the vertices of the "
|
|
"graph may represent tasks to be performed, and the edges may represent "
|
|
"constraints that one task must be performed before another; in this example, "
|
|
"a topological ordering is just a valid sequence for the tasks. A complete "
|
|
"topological ordering is possible if and only if the graph has no directed "
|
|
"cycles, that is, if it is a directed acyclic graph."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:31
|
|
msgid ""
|
|
"If the optional *graph* argument is provided it must be a dictionary "
|
|
"representing a directed acyclic graph where the keys are nodes and the "
|
|
"values are iterables of all predecessors of that node in the graph (the "
|
|
"nodes that have edges that point to the value in the key). Additional nodes "
|
|
"can be added to the graph using the :meth:`~TopologicalSorter.add` method."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:37
|
|
msgid ""
|
|
"In the general case, the steps required to perform the sorting of a given "
|
|
"graph are as follows:"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:40
|
|
msgid ""
|
|
"Create an instance of the :class:`TopologicalSorter` with an optional "
|
|
"initial graph."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:42
|
|
msgid "Add additional nodes to the graph."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:43
|
|
msgid "Call :meth:`~TopologicalSorter.prepare` on the graph."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:44
|
|
msgid ""
|
|
"While :meth:`~TopologicalSorter.is_active` is ``True``, iterate over the "
|
|
"nodes returned by :meth:`~TopologicalSorter.get_ready` and process them. "
|
|
"Call :meth:`~TopologicalSorter.done` on each node as it finishes processing."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:49
|
|
msgid ""
|
|
"In case just an immediate sorting of the nodes in the graph is required and "
|
|
"no parallelism is involved, the convenience method :meth:`TopologicalSorter."
|
|
"static_order` can be used directly:"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:60
|
|
msgid ""
|
|
"The class is designed to easily support parallel processing of the nodes as "
|
|
"they become ready. For instance::"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:87
|
|
msgid ""
|
|
"Add a new node and its predecessors to the graph. Both the *node* and all "
|
|
"elements in *predecessors* must be hashable."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:90
|
|
msgid ""
|
|
"If called multiple times with the same node argument, the set of "
|
|
"dependencies will be the union of all dependencies passed in."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:93
|
|
msgid ""
|
|
"It is possible to add a node with no dependencies (*predecessors* is not "
|
|
"provided) or to 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."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:98
|
|
msgid ""
|
|
"Raises :exc:`ValueError` if called after :meth:`~TopologicalSorter.prepare`."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:102
|
|
msgid ""
|
|
"Mark the graph as finished and check for cycles in the graph. If any cycle "
|
|
"is detected, :exc:`CycleError` will be raised, but :meth:`~TopologicalSorter."
|
|
"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 :meth:"
|
|
"`~TopologicalSorter.add`."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:111
|
|
msgid ""
|
|
"Returns ``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 :meth:"
|
|
"`TopologicalSorter.get_ready` or the number of nodes marked :meth:"
|
|
"`TopologicalSorter.done` is less than the number that have been returned by :"
|
|
"meth:`TopologicalSorter.get_ready`."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:118
|
|
msgid ""
|
|
"The :meth:`~TopologicalSorter.__bool__` method of this class defers to this "
|
|
"function, so instead of::"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:124
|
|
msgid "it is possible to simply do::"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:152
|
|
msgid ""
|
|
"Raises :exc:`ValueError` if called without calling :meth:`~TopologicalSorter."
|
|
"prepare` previously."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:134
|
|
msgid ""
|
|
"Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as "
|
|
"processed, unblocking any successor of each node in *nodes* for being "
|
|
"returned in the future by a call to :meth:`TopologicalSorter.get_ready`."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:138
|
|
msgid ""
|
|
"Raises :exc:`ValueError` if any node in *nodes* has already been marked as "
|
|
"processed by a previous call to this method or if a node was not added to "
|
|
"the graph by using :meth:`TopologicalSorter.add`, if called without calling :"
|
|
"meth:`~TopologicalSorter.prepare` or if node has not yet been returned by :"
|
|
"meth:`~TopologicalSorter.get_ready`."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:146
|
|
msgid ""
|
|
"Returns a ``tuple`` with all the nodes that are ready. Initially it returns "
|
|
"all nodes with no predecessors, and once those are marked as processed by "
|
|
"calling :meth:`TopologicalSorter.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."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:157
|
|
msgid ""
|
|
"Returns an iterator object which will iterate over nodes in a topological "
|
|
"order. When using this method, :meth:`~TopologicalSorter.prepare` and :meth:"
|
|
"`~TopologicalSorter.done` should not be called. This method is equivalent "
|
|
"to::"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:169
|
|
msgid ""
|
|
"The particular order that is returned may depend on the specific order in "
|
|
"which the items were inserted in the graph. For example:"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:186
|
|
msgid ""
|
|
"This is due to the fact that \"0\" and \"2\" are in the same level in the "
|
|
"graph (they would have been returned in the same call to :meth:"
|
|
"`~TopologicalSorter.get_ready`) and the order between them is determined by "
|
|
"the order of insertion."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:192
|
|
msgid "If any cycle is detected, :exc:`CycleError` will be raised."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:198
|
|
msgid "Exceptions"
|
|
msgstr "Exceptions"
|
|
|
|
#: library/graphlib.rst:199
|
|
msgid "The :mod:`graphlib` module defines the following exception classes:"
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:203
|
|
msgid ""
|
|
"Subclass of :exc:`ValueError` raised by :meth:`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."
|
|
msgstr ""
|
|
|
|
#: library/graphlib.rst:207
|
|
msgid ""
|
|
"The detected cycle can be accessed via the second element in the :attr:"
|
|
"`~CycleError.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."
|
|
msgstr ""
|