|
| 1 | +# SOME DESCRIPTIVE TITLE. |
| 2 | +# Copyright (C) 2001-2021, Python Software Foundation |
| 3 | +# This file is distributed under the same license as the Python package. |
| 4 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 | +# |
| 6 | +# Translators: |
| 7 | +# ww song <[email protected]>, 2020 |
| 8 | +# Freesand Leo <[email protected]>, 2021 |
| 9 | +# |
| 10 | +#, fuzzy |
| 11 | +msgid "" |
| 12 | +msgstr "" |
| 13 | +"Project-Id-Version: Python 3.9\n" |
| 14 | +"Report-Msgid-Bugs-To: \n" |
| 15 | +"POT-Creation-Date: 2021-06-30 06:46+0000\n" |
| 16 | +"PO-Revision-Date: 2020-06-01 03:18+0000\n" |
| 17 | +" Last-Translator: Freesand Leo <[email protected]>, 2021\n" |
| 18 | +"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n" |
| 19 | +"MIME-Version: 1.0\n" |
| 20 | +"Content-Type: text/plain; charset=UTF-8\n" |
| 21 | +"Content-Transfer-Encoding: 8bit\n" |
| 22 | +"Language: zh_CN\n" |
| 23 | +"Plural-Forms: nplurals=1; plural=0;\n" |
| 24 | + |
| 25 | +#: ../../library/graphlib.rst:2 |
| 26 | +msgid "" |
| 27 | +":mod:`graphlib` --- Functionality to operate with graph-like structures" |
| 28 | +msgstr ":mod:`graphlib` --- 操作类似图的结构的功能" |
| 29 | + |
| 30 | +#: ../../library/graphlib.rst:8 |
| 31 | +msgid "**Source code:** :source:`Lib/graphlib.py`" |
| 32 | +msgstr "**源代码:** :source:`Lib/graphlib.py`" |
| 33 | + |
| 34 | +#: ../../library/graphlib.rst:20 |
| 35 | +msgid "" |
| 36 | +"Provides functionality to topologically sort a graph of hashable nodes." |
| 37 | +msgstr "提供以拓扑方式对可哈希节点的图进行排序的功能。" |
| 38 | + |
| 39 | +#: ../../library/graphlib.rst:22 |
| 40 | +msgid "" |
| 41 | +"A topological order is a linear ordering of the vertices in a graph such " |
| 42 | +"that for every directed edge u -> v from vertex u to vertex v, vertex u " |
| 43 | +"comes before vertex v in the ordering. For instance, the vertices of the " |
| 44 | +"graph may represent tasks to be performed, and the edges may represent " |
| 45 | +"constraints that one task must be performed before another; in this example," |
| 46 | +" a topological ordering is just a valid sequence for the tasks. A complete " |
| 47 | +"topological ordering is possible if and only if the graph has no directed " |
| 48 | +"cycles, that is, if it is a directed acyclic graph." |
| 49 | +msgstr "" |
| 50 | +"拓扑排序是指图中顶点的线性排序,使得对于每条从顶点 u 到顶点 v 的有向边 u -> v,顶点 u 都排在顶点 v 之前。 " |
| 51 | +"例如,图的顶点可以代表要执行的任务,而边代表某一个任务必须在另一个任务之前执行的约束条件;在这个例子中,拓扑排序只是任务的有效序列。 完全拓扑排序 " |
| 52 | +"当且仅当图不包含有向环,也就是说为有向无环图时,完全拓扑排序才是可能的。" |
| 53 | + |
| 54 | +#: ../../library/graphlib.rst:31 |
| 55 | +msgid "" |
| 56 | +"If the optional *graph* argument is provided it must be a dictionary " |
| 57 | +"representing a directed acyclic graph where the keys are nodes and the " |
| 58 | +"values are iterables of all predecessors of that node in the graph (the " |
| 59 | +"nodes that have edges that point to the value in the key). Additional nodes " |
| 60 | +"can be added to the graph using the :meth:`~TopologicalSorter.add` method." |
| 61 | +msgstr "" |
| 62 | +"如果提供了可选的 *graph* " |
| 63 | +"参数则它必须为一个表示有向无环图的字典,其中的键为节点而值为包含图中该节点的所有上级节点(即具有指向键中的值的边的节点)的可迭代对象。 " |
| 64 | +"额外的节点可以使用 :meth:`~TopologicalSorter.add` 方法添加到图中。" |
| 65 | + |
| 66 | +#: ../../library/graphlib.rst:37 |
| 67 | +msgid "" |
| 68 | +"In the general case, the steps required to perform the sorting of a given " |
| 69 | +"graph are as follows:" |
| 70 | +msgstr "在通常情况下,对给定的图执行排序所需的步骤如下:" |
| 71 | + |
| 72 | +#: ../../library/graphlib.rst:40 |
| 73 | +msgid "" |
| 74 | +"Create an instance of the :class:`TopologicalSorter` with an optional " |
| 75 | +"initial graph." |
| 76 | +msgstr "通过可选的初始图创建一个 :class:`TopologicalSorter` 的实例。" |
| 77 | + |
| 78 | +#: ../../library/graphlib.rst:42 |
| 79 | +msgid "Add additional nodes to the graph." |
| 80 | +msgstr "添加额外的节点到图中。" |
| 81 | + |
| 82 | +#: ../../library/graphlib.rst:43 |
| 83 | +msgid "Call :meth:`~TopologicalSorter.prepare` on the graph." |
| 84 | +msgstr "在图上调用 :meth:`~TopologicalSorter.prepare`。" |
| 85 | + |
| 86 | +#: ../../library/graphlib.rst:44 |
| 87 | +msgid "" |
| 88 | +"While :meth:`~TopologicalSorter.is_active` is ``True``, iterate over the " |
| 89 | +"nodes returned by :meth:`~TopologicalSorter.get_ready` and process them. " |
| 90 | +"Call :meth:`~TopologicalSorter.done` on each node as it finishes processing." |
| 91 | +msgstr "" |
| 92 | +"当 :meth:`~TopologicalSorter.is_active` 为 ``True`` 时,迭代 " |
| 93 | +":meth:`~TopologicalSorter.get_ready` 所返回的节点并加以处理。 完成处理后在每个节点上调用 " |
| 94 | +":meth:`~TopologicalSorter.done`。" |
| 95 | + |
| 96 | +#: ../../library/graphlib.rst:49 |
| 97 | +msgid "" |
| 98 | +"In case just an immediate sorting of the nodes in the graph is required and " |
| 99 | +"no parallelism is involved, the convenience method " |
| 100 | +":meth:`TopologicalSorter.static_order` can be used directly:" |
| 101 | +msgstr "" |
| 102 | +"在只需要对图中的节点进行立即排序并且不涉及并行性的情况下,可以直接使用便捷方法 " |
| 103 | +":meth:`TopologicalSorter.static_order`:" |
| 104 | + |
| 105 | +#: ../../library/graphlib.rst:60 |
| 106 | +msgid "" |
| 107 | +"The class is designed to easily support parallel processing of the nodes as " |
| 108 | +"they become ready. For instance::" |
| 109 | +msgstr "这个类被设计用来在节点就绪时方便地支持对其并行处理。 例如::" |
| 110 | + |
| 111 | +#: ../../library/graphlib.rst:87 |
| 112 | +msgid "" |
| 113 | +"Add a new node and its predecessors to the graph. Both the *node* and all " |
| 114 | +"elements in *predecessors* must be hashable." |
| 115 | +msgstr "将一个新节点及其上级节点添加到图中。 *node* 以及 *predecessors* 中的所有元素都必须为可哈希对象。" |
| 116 | + |
| 117 | +#: ../../library/graphlib.rst:90 |
| 118 | +msgid "" |
| 119 | +"If called multiple times with the same node argument, the set of " |
| 120 | +"dependencies will be the union of all dependencies passed in." |
| 121 | +msgstr "如果附带相同的节点参数多次调用,则依赖项的集合将为所有被传入依赖项的并集。" |
| 122 | + |
| 123 | +#: ../../library/graphlib.rst:93 |
| 124 | +msgid "" |
| 125 | +"It is possible to add a node with no dependencies (*predecessors* is not " |
| 126 | +"provided) or to provide a dependency twice. If a node that has not been " |
| 127 | +"provided before is included among *predecessors* it will be automatically " |
| 128 | +"added to the graph with no predecessors of its own." |
| 129 | +msgstr "" |
| 130 | +"可以添加不带依赖项的节点 (即不提供 *predecessors*) 或者重复提供依赖项。 如果有先前未提供的节点包含在 *predecessors* " |
| 131 | +"中则它将被自动添加到图中并且不带自己的上级节点。" |
| 132 | + |
| 133 | +#: ../../library/graphlib.rst:98 |
| 134 | +msgid "" |
| 135 | +"Raises :exc:`ValueError` if called after :meth:`~TopologicalSorter.prepare`." |
| 136 | +msgstr "如果在 :meth:`~TopologicalSorter.prepare` 之后被调用则会引发 :exc:`ValueError`。" |
| 137 | + |
| 138 | +#: ../../library/graphlib.rst:102 |
| 139 | +msgid "" |
| 140 | +"Mark the graph as finished and check for cycles in the graph. If any cycle " |
| 141 | +"is detected, :exc:`CycleError` will be raised, but " |
| 142 | +":meth:`~TopologicalSorter.get_ready` can still be used to obtain as many " |
| 143 | +"nodes as possible until cycles block more progress. After a call to this " |
| 144 | +"function, the graph cannot be modified, and therefore no more nodes can be " |
| 145 | +"added using :meth:`~TopologicalSorter.add`." |
| 146 | +msgstr "" |
| 147 | +"将图标记为已完成并检查图中是否存在环。 如何检测到任何环,则将引发 :exc:`CycleError`,但 " |
| 148 | +":meth:`~TopologicalSorter.get_ready` 仍可被用来获取尽可能多的节点直到环阻塞了操作过程。 " |
| 149 | +"在调用此函数后,图将无法再修改,因此不能再使用 :meth:`~TopologicalSorter.add` 添加更多的节点。" |
| 150 | + |
| 151 | +#: ../../library/graphlib.rst:111 |
| 152 | +msgid "" |
| 153 | +"Returns ``True`` if more progress can be made and ``False`` otherwise. " |
| 154 | +"Progress can be made if cycles do not block the resolution and either there " |
| 155 | +"are still nodes ready that haven't yet been returned by " |
| 156 | +":meth:`TopologicalSorter.get_ready` or the number of nodes marked " |
| 157 | +":meth:`TopologicalSorter.done` is less than the number that have been " |
| 158 | +"returned by :meth:`TopologicalSorter.get_ready`." |
| 159 | +msgstr "" |
| 160 | +"如果可以取得更多进展则返回 ``True``,否则返回 ``False``。 如果环没有阻塞操作,并且还存在尚未被 " |
| 161 | +":meth:`TopologicalSorter.get_ready` 返回的已就绪节点或者已标记为 " |
| 162 | +":meth:`TopologicalSorter.done` 的节点数量少于已被 :meth:`TopologicalSorter.get_ready`" |
| 163 | +" 所返回的节点数量则还可以取得进展。" |
| 164 | + |
| 165 | +#: ../../library/graphlib.rst:118 |
| 166 | +msgid "" |
| 167 | +"The :meth:`~TopologicalSorter.__bool__` method of this class defers to this " |
| 168 | +"function, so instead of::" |
| 169 | +msgstr "该类的 :meth:`~TopologicalSorter.__bool__` 方法要使用此函数,因此除了::" |
| 170 | + |
| 171 | +#: ../../library/graphlib.rst:124 |
| 172 | +msgid "it is possible to simply do::" |
| 173 | +msgstr "可能会简单地执行::" |
| 174 | + |
| 175 | +#: ../../library/graphlib.rst:129 ../../library/graphlib.rst:152 |
| 176 | +msgid "" |
| 177 | +"Raises :exc:`ValueError` if called without calling " |
| 178 | +":meth:`~TopologicalSorter.prepare` previously." |
| 179 | +msgstr "" |
| 180 | +"如果之前未调用 :meth:`~TopologicalSorter.prepare` 就调用此函数则会引发 :exc:`ValueError`。" |
| 181 | + |
| 182 | +#: ../../library/graphlib.rst:134 |
| 183 | +msgid "" |
| 184 | +"Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as " |
| 185 | +"processed, unblocking any successor of each node in *nodes* for being " |
| 186 | +"returned in the future by a call to :meth:`TopologicalSorter.get_ready`." |
| 187 | +msgstr "" |
| 188 | +"将 :meth:`TopologicalSorter.get_ready` 所返回的节点集合标记为已处理,解除对 *nodes* " |
| 189 | +"中每个节点的后续节点的阻塞以便在将来通过对 :meth:`TopologicalSorter.get_ready` 的调用来返回它们。" |
| 190 | + |
| 191 | +#: ../../library/graphlib.rst:138 |
| 192 | +msgid "" |
| 193 | +"Raises :exc:`ValueError` if any node in *nodes* has already been marked as " |
| 194 | +"processed by a previous call to this method or if a node was not added to " |
| 195 | +"the graph by using :meth:`TopologicalSorter.add`, if called without calling " |
| 196 | +":meth:`~TopologicalSorter.prepare` or if node has not yet been returned by " |
| 197 | +":meth:`~TopologicalSorter.get_ready`." |
| 198 | +msgstr "" |
| 199 | +"如果 *nodes* 中的任何节点已经被之前对该方法的调用标记为已处理或者如果未通过使用 :meth:`TopologicalSorter.add` " |
| 200 | +"将一个节点添加到图中,如果未调用 :meth:`~TopologicalSorter.prepare` 即调用此方法或者如果节点尚未被 " |
| 201 | +":meth:`~TopologicalSorter.get_ready` 所返回则将引发 :exc:`ValueError`。" |
| 202 | + |
| 203 | +#: ../../library/graphlib.rst:146 |
| 204 | +msgid "" |
| 205 | +"Returns a ``tuple`` with all the nodes that are ready. Initially it returns " |
| 206 | +"all nodes with no predecessors, and once those are marked as processed by " |
| 207 | +"calling :meth:`TopologicalSorter.done`, further calls will return all new " |
| 208 | +"nodes that have all their predecessors already processed. Once no more " |
| 209 | +"progress can be made, empty tuples are returned." |
| 210 | +msgstr "" |
| 211 | +"返回由所有已就绪节点组成的 ``tuple``。 初始状态下它将返回所有不带上级节点的节点,并且一旦通过调用 " |
| 212 | +":meth:`TopologicalSorter.done` 将它们标记为已处理,之后的调用将返回所有上级节点已被处理的新节点。 " |
| 213 | +"一旦无法再取得进展,则会返回空元组。" |
| 214 | + |
| 215 | +#: ../../library/graphlib.rst:157 |
| 216 | +msgid "" |
| 217 | +"Returns an iterator object which will iterate over nodes in a topological " |
| 218 | +"order. When using this method, :meth:`~TopologicalSorter.prepare` and " |
| 219 | +":meth:`~TopologicalSorter.done` should not be called. This method is " |
| 220 | +"equivalent to::" |
| 221 | +msgstr "" |
| 222 | +"返回一个迭代器,它将按照拓扑顺序来迭代所有节点。 当使用此方法时,:meth:`~TopologicalSorter.prepare` 和 " |
| 223 | +":meth:`~TopologicalSorter.done` 不应被调用。 此方法等价于::" |
| 224 | + |
| 225 | +#: ../../library/graphlib.rst:169 |
| 226 | +msgid "" |
| 227 | +"The particular order that is returned may depend on the specific order in " |
| 228 | +"which the items were inserted in the graph. For example:" |
| 229 | +msgstr "所返回的特定顺序可能取决于条目被插入图中的顺序。 例如:" |
| 230 | + |
| 231 | +#: ../../library/graphlib.rst:186 |
| 232 | +msgid "" |
| 233 | +"This is due to the fact that \"0\" and \"2\" are in the same level in the " |
| 234 | +"graph (they would have been returned in the same call to " |
| 235 | +":meth:`~TopologicalSorter.get_ready`) and the order between them is " |
| 236 | +"determined by the order of insertion." |
| 237 | +msgstr "" |
| 238 | +"这是由于实际上 \"0\" 和 \"2\" 在图中的级别相同(它们将在对 :meth:`~TopologicalSorter.get_ready` " |
| 239 | +"的同一次调用中被返回) 并且它们之间的顺序是由插入顺序决定的。" |
| 240 | + |
| 241 | +#: ../../library/graphlib.rst:192 |
| 242 | +msgid "If any cycle is detected, :exc:`CycleError` will be raised." |
| 243 | +msgstr "如果检测到任何环,则将引发 :exc:`CycleError`。" |
| 244 | + |
| 245 | +#: ../../library/graphlib.rst:198 |
| 246 | +msgid "Exceptions" |
| 247 | +msgstr "异常" |
| 248 | + |
| 249 | +#: ../../library/graphlib.rst:199 |
| 250 | +msgid "The :mod:`graphlib` module defines the following exception classes:" |
| 251 | +msgstr ":mod:`graphlib` 模块定义了以下异常类:" |
| 252 | + |
| 253 | +#: ../../library/graphlib.rst:203 |
| 254 | +msgid "" |
| 255 | +"Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if" |
| 256 | +" cycles exist in the working graph. If multiple cycles exist, only one " |
| 257 | +"undefined choice among them will be reported and included in the exception." |
| 258 | +msgstr "" |
| 259 | +":exc:`ValueError` 的子类,当特定的图中存在环时将由 :meth:`TopologicalSorter.prepare` 引发。 " |
| 260 | +"如果存在多个环,则将只报告其中一个未定义的选项并将其包括在异常中。" |
| 261 | + |
| 262 | +#: ../../library/graphlib.rst:207 |
| 263 | +msgid "" |
| 264 | +"The detected cycle can be accessed via the second element in the " |
| 265 | +":attr:`~CycleError.args` attribute of the exception instance and consists in" |
| 266 | +" a list of nodes, such that each node is, in the graph, an immediate " |
| 267 | +"predecessor of the next node in the list. In the reported list, the first " |
| 268 | +"and the last node will be the same, to make it clear that it is cyclic." |
| 269 | +msgstr "" |
| 270 | +"检测到的环可以通过异常实例的 :attr:`~CycleError.args` " |
| 271 | +"属性的第二个元素来访问,它由一个节点列表组成,其中的每个节点在图中都是列表中下一个节点的直接上级节点。 " |
| 272 | +"在报告的列表中,开头和末尾的节点将是同一对象,以表明它是一个环。" |
0 commit comments