1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
3

T'íc‘³ã	@sÄdZddlZddlZddlmZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZmZmZddlmZmZddlmZdd	lmZdd
lmZm Z ddl!m"Z"ddl#m$Z$dd
l%m&Z&m'Z'ddl(m)Z)m*Z*ddl+m,Z,ddl-m.Z.m/Z/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6ddl7m8Z8m9Z9erbddl:m;Z;ddl<m=Z=ddl>m?Z?e/j@eAƒZBejCdƒZDejCdejEƒZFGdd„de$eGƒZHGdd„deHƒZIGdd„de,ƒZJGdd „d e2ƒZKGd!d"„d"e$eGƒZLGd#d$„d$e2ƒZMGd%d&„d&e,ƒZNeGeeeGd'œd(d)„ZOd*e	eeGeGePeGejQejRd+œd,d-„ZSGd.d/„d/e2ƒZTdAeGeGeed1œd2d3„ZUGd4d5„d5e2ƒZVGd6d7„d7e,ƒZWGd8d9„d9e&ƒZXd:e&e eeYd;œd<d=„ZZd:eeGefd>œd?d@„Z[dS)BzThe standard domain.éN)Úcopy)Ú
TYPE_CHECKINGÚAnyÚCallableÚDictÚIterableÚIteratorÚListÚOptionalÚTupleÚTypeÚUnionÚcast)Únodes)ÚElementÚNodeÚsystem_message)Ú	DirectiveÚ
directives)Ú
StringList)Úaddnodes)Údesc_signatureÚpending_xref)ÚRemovedInSphinx50Warning)ÚObjectDescription)ÚDomainÚObjType)Ú_Ú__)ÚXRefRole)Údocname_joinÚloggingÚws_re)ÚSphinxDirective)Úclean_astextÚmake_idÚmake_refnode)Ú
OptionSpecÚRoleFunction)ÚSphinx)ÚBuilder)ÚBuildEnvironmentz ((?:/|--|-|\+)?[^\s=]+)(=?\s*.*)z`((~?\w*:)?\w+)`c@sheZdZUdZdZedZeddeegefeeedœdd„Z	eeeddœd	d
„Z
eedœdd
„ZdS)Ú
GenericObjectzM
    A generic x-ref directive registered with Sphinx.add_object_type().
    ÚNr+)ÚsigÚsignodeÚreturncCs@|jr|j|j||ƒ}n$|jƒ|tj||ƒ7}tjd|ƒ}|S)Nú )Ú
parse_nodeÚenvÚclearrÚ	desc_namer"Úsub)Úselfr.r/Úname©r9ú4/tmp/pip-build-gk9425m9/sphinx/sphinx/domains/std.pyÚhandle_signature/szGenericObject.handle_signature)r8r.r/r0c
Cst|j|jj|j|ƒ}|dj|ƒ|j|ƒ}||jjjkrV||dkrV|dj|ƒ|jjj|ƒ|j	rØ|j	j
dƒ}|d	kr®|j	d|…jƒ}|j	|dd…jƒ|f}nd}|j	|f}|jdj|||ddfƒt
t|jjdƒƒ}	|	j|j|||ddS)
NÚidsú:éÚsingleÚentriesr-Ústd)Úlocationéÿÿÿÿ)r%r3ÚstateÚdocumentÚobjtypeÚappendÚmake_old_idr<Únote_explicit_targetÚ
indextemplateÚfindÚstripÚ	indexnoderÚStandardDomainÚ
get_domainÚnote_object)
r7r8r.r/Únode_idÚold_node_idÚcolonÚ	indextypeÚ
indexentryrAr9r9r:Úadd_target_and_index9s 
z"GenericObject.add_target_and_index)r8r0cCs|jd|S)z°Generate old styled node_id for generic objects.

        .. note:: Old Styled node_id was used until Sphinx-3.0.
                  This will be removed in Sphinx-5.0.
        ú-)rF)r7r8r9r9r:rHRszGenericObject.make_old_id)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rJÚstrr2rrr;rVrHr9r9r9r:r,(s

r,c@seZdZedƒZdS)ÚEnvVarzenvironment variable; %sN)rXrYrZrrJr9r9r9r:r][sr]c@s8eZdZdZejdeeee	e
e	efdœdd„ZdS)ÚEnvVarXRefRolezQ
    Cross-referencing role for environment variables (adds an index entry).
    r+)rEr3ÚnodeÚis_refr0c	Cs~|s|ggfS|d}d|jdƒ}tjƒ}d||ddfdtdƒ||ddfg|d<tjdd|gd}|j|ƒ|||ggfS)	NÚ	reftargetzindex-%sÚindexr?r-zenvironment variable; %sr@)r<)Znew_serialnorrbrrÚtargetrI)	r7rEr3r_r`ZvarnameZtgtidrMZ
targetnoder9r9r:Úresult_nodesds

zEnvVarXRefRole.result_nodesN)
rXrYrZr[rrErÚboolrr	rrrdr9r9r9r:r^_sr^c@sPeZdZUdZdZdZdZdZdZiZ	e
	eedœdd	„Z
eed
œdd„Zd
S)ÚTargetz@
    Generic target for user-defined cross-reference types.
    r-Fr>rT)r0c
CsLtjd|jdjƒƒ}t|j|jj|j|ƒ}t	j
dd|gd}|j|ƒ|j|ƒ}||jjj
krz||dkrz|dj|ƒ|jjj|ƒ|g}|jr|j|f}d}|jdƒ}|dkrÜ|d|…jƒ}||dd…jƒ}tj|||ddfgd	}	|jd|	ƒ|j}
d|jkr$|jjddƒ\}}
tt|jjd
ƒƒ}|j|
|||d|S)
Nr1rr-)r<r<r?r=r>)r@rA)rBrC)r"r6Ú	argumentsrLr%r3rDrEr8rrcÚset_source_inforHr<rGrIrJrKrrbÚinsertÚsplitrrNrOrP)
r7ÚfullnamerQr_rRÚretrUrTrSÚinoder8rrAr9r9r:Úrun€s0


z
Target.run)r8r0cCs|jd|S)z¨Generate old styled node_id for targets.

        .. note:: Old Styled node_id was used until Sphinx-3.0.
                  This will be removed in Sphinx-5.0.
        rW)r8)r7r8r9r9r:rH¡szTarget.make_old_idN)rXrYrZr[rJÚhas_contentÚrequired_argumentsÚoptional_argumentsÚfinal_argument_whitespaceÚoption_specr'r	rrnr\rHr9r9r9r:rfts
!rfc@sHeZdZdZeeedœdd„Zeeeddœdd„Zeeed	œd
d„ZdS)Ú	Cmdoptionz;
    Description of a command-line option (.. option).
    )r.r/r0c	Csæd}d}xÐ|jdƒD]Â}|jƒ}tj|ƒ}|sDtjtdƒ||dq|jƒ\}}|jdƒrx|jdƒrx|dd…}d|}|rŒ|t	j
ddƒ7}|t	j||ƒ7}|t	j
||ƒ7}|sÀ|}|g|d
<n|d
j|ƒ|d	7}qW|sât
‚|S)z/Transform an option description into RST nodes.rr-z, znMalformed option description %r, should look like "opt", "-opt args", "--opt args", "/opt args" or "+opt args")rBú[ú]Nr>ÚallnamesrC)rjrLÚoption_desc_reÚmatchÚloggerÚwarningrÚgroupsÚendswithrZdesc_addnamer5rGÚ
ValueError)	r7r.r/ÚcountÚ	firstnameZpotential_optionÚmÚoptnameÚargsr9r9r:r;¯s4

zCmdoption.handle_signatureN)r€r.r/r0cCsf|jjjdƒ}xœ|jdgƒD]Œ}dg}|r4|j|ƒ|jdƒsH|jdƒdj|ƒ}t|j|jj||ƒ}|dj|ƒ|j	||ƒ}	|	|jjj
kr|	|dkr|dj|	ƒqW|jjj|ƒtt
|jjdƒƒ}
x0|jdgƒD] }|
j|||jj|dd	ƒqÚW|rtd
ƒ|}ntdƒ}xF|jdgƒD]6}dj||gƒ}
|jd
jd|
|dd	ddfƒq(WdS)Nzstd:programrwÚ	cmdoptionrWú/Úargr<rArz%s command line optionzcommand line optionz; r@Úpairr-)rWr…)r3Úref_contextÚgetrGÚ
startswithÚjoinr%rDrErHr<rIrrNrOÚadd_program_optionÚdocnamerrM)r7r€r.r/Zcurrprogramr‚ÚprefixesÚprefixrQrRÚdomainÚdescrÚoptionÚentryr9r9r:rVÐs2



zCmdoption.add_target_and_index)rr‚r0cCstj|d|ƒS)zªGenerate old styled node_id for cmdoption.

        .. note:: Old Styled node_id was used until Sphinx-3.0.
                  This will be removed in Sphinx-5.0.
        rW)rr%)r7rr‚r9r9r:rHñszCmdoption.make_old_id)	rXrYrZr[r\rr;rVrHr9r9r9r:rtªs!!rtc@s<eZdZUdZdZdZdZdZiZe	e
edœdd„Zd	S)
ÚProgramzI
    Directive to name the program for which options are documented.
    Fr>rT)r0cCs@tjd|jdjƒƒ}|dkr0|jjjddƒn||jjd<gS)NrWrÚNonezstd:program)r"r6rgrLr3rˆÚpop)r7Úprogramr9r9r:rns
zProgram.runN)
rXrYrZr[rorprqrrrsr'r	rrnr9r9r9r:r”ús
r”c@s,eZdZdeeeeeeefdœdd„ZdS)ÚOptionXRefRoler+)r3ÚrefnodeÚhas_explicit_titleÚtitlercr0cCs|jjdƒ|d<||fS)Nzstd:program)rˆr‰)r7r3r™ršr›rcr9r9r:Úprocess_linkszOptionXRefRole.process_linkN)rXrYrZrrer\rrœr9r9r9r:r˜sr˜)Úliner0cCstjd|ƒdg}|S)Nz +: +)Úrerj)rÚpartsr9r9r:Úsplit_term_classifierssr r+)r3Ú	textnodesÚ	index_keyÚsourceÚlinenorQrEr0cCs¸tjd	|žŽ}||_||_|jƒ}|r6|dj|ƒn&t||d|ƒ}|dj|ƒ|j|ƒtt	|j
dƒƒ}	|	j|||dtj
ƒ}
d||d|fg|
d<|j|j|
_|
_|j|
ƒ|S)
Nr-r<ÚtermrA)rBr?Úmainr@)r-r-)rr¥r£rÚastextrGr%rIrrNrOÚ
_note_termrrb)r3r¡r¢r£r¤rQrEr¥ZtermtextrArMr9r9r:Úmake_glossary_terms 

r©c@sBeZdZUdZdZdZdZdZdej	iZ
e
ee
dœdd„Zd	S)
ÚGlossaryz[
    Directive to create a glossary with cross-reference targets for :term:
    roles.
    TrFÚsorted)r0cCsÎtjƒ}|jj|_d|jk|d<g}d}d}d}g}xŠt|j|jjƒD]t\}\}}	|s~|rx|rx|ddjd||	ƒd}qH|oŽ|dj	ƒrP|j
dƒr¤d}qHnd}|rì|sÎ|j|jjjt
dƒ||	d	ƒ|j|||	fgtƒfƒd}nb|r|j|jjjt
d
ƒ||	d	ƒ|r0|ddj|||	fƒn|j|jjjt
dƒ||	d	ƒnj|rXnb|svd}t|ƒt|jƒƒ}
|rœ|ddj||
d…||	ƒn|j|jjjt
dƒ||	d	ƒd}qHWg}xØ|D]Ð\}}
g}g}xl|D]d\}}}	t|ƒ}|jj|d|	ƒ\}}t|j||d||	d|jjd}||_|j|ƒ|j|ƒqâW|j|ƒtjƒ}|
r||jj|
|
jdd|ƒ|j|ƒ|jtjd|žŽƒqÌWtjd|žŽ}|d
jdƒ||7}||gS)Nr«TFr>r-rz.. z,glossary term must be preceded by empty line)r£rz3glossary terms must not be separated by empty linesz4glossary seems to be misformatted, check indentation)rQrEÚclassesÚglossaryrCrCrC)r-)r-)rr­rDrEÚoptionsÚzipÚcontentÚitemsrGÚisspacerŠZreporterr{rrÚlenÚlstripr Zinline_textr©r3Z	rawsourceÚextendrÚ
definitionZnested_parseZdefinition_list_itemZdefinition_list)r7r_r@Z
in_definitionZ
in_commentZ	was_emptyÚmessagesrr£r¤Z
indent_lenr±Útermsr¶Z	termnodesZsystem_messagesrŸr¡Zsysmsgr¥ZdefnodeZdlistr9r9r:rnGsŠ
"
 


zGlossary.runN)rXrYrZr[rorprqrrrÚflagrsr'r	rrnr9r9r9r:rª9s
rªr-)ÚtextÚproductionGroupr0cCs8t|ƒdkr|d7}g}d}xætj|ƒD]Ø}|jƒ|krZ|||jƒ…}|jtj||ƒƒ|jdƒ}d|kr¼|ddkr”|jdƒ\}}|dd…}	qÈ|ddkr²|dd…}|}	qÈ|}|}	n|}||}	t	|dd|	d}
|
tj
||dgd	7}
|j|
ƒ|jƒ}q(W|t|ƒkr4|jtj||d…||d…ƒƒ|S)
Nrr=r>ú~ÚtokenrA)ÚreftypeZ	refdomainraZxref)r¬)r³Útoken_reÚfinditerÚstartrGrZTextÚgrouprjrÚliteralÚend)rºr»ZretnodesÚposrÚtxtr½rr›rcr™r9r9r:Útoken_xrefs«s8

"rÇc@sLeZdZUdZdZdZdZdZiZe	e
edœdd„Ze
e
d	œd
d„ZdS)
ÚProductionListz0
    Directive to list grammar productions.
    Fr>rT)r0cCs”tt|jjdƒƒ}tjƒ}|j|ƒtjdƒ}|j	d|j
dƒjdƒ}d}d}x<|D]2}|dkrvd|krv|jƒ}qV|d7}y|jddƒ\}}	Wnt
k
r¨PYnXtj|ƒ}
|jƒ}||
d<|
drpd	|}t|j|jj||ƒ}|
d
j|ƒ|j|ƒ}
|
|jjjkr.|
|
d
kr.|
d
j|
ƒ|jjj|
|
ƒt|ƒdkrZd||f}n|}|jd|||d
|
jt|	|ƒƒ|j|
ƒqVW|gS)NrAz\\\nr-rÚ
r=r>Z	tokennamezgrammar-token-%sr<z%s:%sr½)rB)rrNr3rOrÚproductionlistrhržÚcompiler6rgrjrLr~Ú
productionr%rDrErGrHr<Znote_implicit_targetr³rPrµrÇ)r7rr_Znl_escape_reÚlinesr»ÚiZruler8ÚtokensÚsubnoderrQrRZobjNamer9r9r:rn×sF




zProductionList.run)r½r0cCstjd|ƒS)z§Generate old styled node_id for tokens.

        .. note:: Old Styled node_id was used until Sphinx-3.0.
                  This will be removed in Sphinx-5.0.
        zgrammar-token-)rr%)r7r½r9r9r:rHszProductionList.make_old_idN)rXrYrZr[rorprqrrrsr'r	rrnr\rHr9r9r9r:rÈÌs
-rÈc@s,eZdZdeeeeeeefdœdd„ZdS)Ú
TokenXRefRoler+)r3r™ršr›rcr0cCsJ|jdƒ}|jrB|ddkrBd|kr6|jdƒ\}}n|dd…}||fS)Nr¼rr=r>)r´ršrj)r7r3r™ršr›rcrr9r9r:rœs
zTokenXRefRole.process_linkN)rXrYrZrrer\rrœr9r9r9r:rÑ
srÑcsêeZdZUdZdZdZeedƒdddeedƒd	d‚deed
ƒdddƒdeed
ƒdƒeedƒdƒeedƒdd„ddœZe	e
efeeee
eedœZe	e
eefeddeƒeƒeejddedejddedddeddedejddœZe	e
eeeffiiddedƒfdded ƒfd!ded"ƒfd#œd…d†d‡d#œd$œZd%d&d'd(d)d*œZejdˆejd‰ej dŠiZ!e	ee"e#e
e$e%ff!d/d,d0œ‡fd1d2„Z&d‹e
e
e
e
d,d3œd4d5„Z'e(e	e#e
e
fe#e
e
ffd6œd7d8„ƒZ)dŒe
e
e
e*d,d9œd:d;„Z+e
e
e
e
d,d<œd=d>„Z,e(e	e
e#e
e
ffd6œd?d@„ƒZ-de
e
e*d,dAœdBdC„Z.e(e	e#e
e
fe#e
e
ffd6œdDdE„ƒZ/e(e	e
e#e
e
e
ffd6œdFdG„ƒZ0e(e	e
e#e
e
ffd6œdHdI„ƒZ1e
d,dJœdKdL„Z2e3e
e	d,dMœdNdO„Z4d/e
ej5d,dPœdQdR„Z6e
e
e
e
d,dSœdTdU„Z7e
dVe
e
e
e
e*e8dWœdXdY„Z9d/e
dVe
e
e:e8e$e8dZœd[d\„Z;d/e
dVe
e
e:e8e$e8dZœd]d^„Z<d/e
dVe
e
e:e8e$e8dZœd_d`„Z=d/e
dVe
e
e:e8e$e8dZœdadb„Z>d/e
dVe
e
e:e8e$e8dZœdcdd„Z?d/e
dVe
e
e:e8e$e8dZœdedf„Z@d/e
dVe
e
e:e8e8dZœdgdh„ZAd/e
dVe
e
e:e8e$e8dZœdidj„ZBd/e
dVe
e:e8e3e#e
e8fdkœdldm„ZCeDe#e
e
e
e
e
eEfd6œdndo„ZFdŽeeGe
dqœdrds„ZHe"eGdtœdudv„ZIe"e$e
dtœdwdx„ZJe"e$e
dtœdydz„ZKd/dVe
e
e8e#eEd{fd|œd}d~„ZLe8e$e
dtœdd€„ZM‡ZNS)rNzs
    Domain for all objects that don't fit into another domain or are added
    via the application interface.
    rAZDefaultz
glossary termr¥r>)Ú
searchprioz
grammar tokenr½zreference labelÚrefÚkeywordzenvironment variableÚenvvarzprogram optionr’rEÚdoc)r¥r½ÚlabelrÕr„rÖ)r—r„r’rÕr­rÊT)Ú
warn_dangling)ÚinnernodeclassrØ)Ú	lowercaserÙrØ)rÚrØ)rØrÙ)r’rÕr½r¥rÓÚnumrefrÔrÖÚgenindexr-ÚIndexúpy-modindexzModule IndexÚsearchzSearch Page)rÜZmodindexrß)ÚprogoptionsÚobjectsÚlabelsÚ
anonlabelsz term not in glossary: %(target)szundefined label: %(target)szunknown keyword: %(target)szunknown document: %(target)szunknown option: %(target)s)r¥rÛrÔrÖr’ÚfigureNÚtableú
code-blockr+)r3r0csBtƒj|ƒt|jƒ|_x$|jjjjƒD]\}}||j|<q(WdS)N)ÚsuperÚ__init__rÚenumerable_nodesÚappÚregistryr±)r7r3r_Úsettings)Ú	__class__r9r:rèfszStandardDomain.__init__)r8rrQr›r0cCsf||jkr@|j|||fkr@tjtdƒ||jj|j|dƒƒ||f|j|<|rb|||f|j|<dS)aUAdd a hyperlink target for cross reference.

        .. warning::

           This is only for internal use.  Please don't use this from your extension.
           ``document.note_explicit_target()`` or ``note_implicit_target()`` are recommended to
           add a hyperlink target to the document.

           This only adds a hyperlink target to the StandardDomain.  And this does not add a
           node_id to node.  Therefore, it is very fragile to calling this without
           understanding hyperlink target framework in both docutils and Sphinx.

        .. versionadded:: 3.0
        z(duplicate label %s, other instance in %srN)rãrzr{rr3Údoc2pathrâ)r7r8rrQr›r9r9r:Únote_hyperlink_targetns
z$StandardDomain.note_hyperlink_target)r0cCs|jjdiƒS)Nrá)ÚdataÚ
setdefault)r7r9r9r:rá†szStandardDomain.objects)rFr8ÚlabelidrBr0cCsR||f|jkr8|j||fd}tjtdƒ||||d|jj|f|j||f<dS)zRNote a generic object for cross reference.

        .. versionadded:: 3.0
        rz4duplicate %s description of %s, other instance in %s)rBN)rárzr{rr3r)r7rFr8ròrBrr9r9r:rPŠs

zStandardDomain.note_object)rFr8rròr0cCs&tjdtdd||f|j||f<dS)Nz*StandardDomain.add_object() is deprecated.é)Ú
stacklevel)ÚwarningsÚwarnrrá)r7rFr8rròr9r9r:Ú
add_object–s
zStandardDomain.add_objectcCs|jjdiƒS)z2.. note:: Will be removed soon. internal use only.r¸)rðrñ)r7r9r9r:Ú_terms›szStandardDomain._terms)r¥ròrBr0cCs*|jd|||ƒ|jj|f|j|jƒ<dS)zeNote a term for cross reference.

        .. note:: Will be removed soon. internal use only.
        r¥N)rPr3rrøÚlower)r7r¥ròrBr9r9r:r¨ szStandardDomain._note_termcCs|jjdiƒS)Nrà)rðrñ)r7r9r9r:rà©szStandardDomain.progoptionscCs|jjdiƒS)Nrâ)rðrñ)r7r9r9r:râ­szStandardDomain.labelscCs|jjdiƒS)Nrã)rðrñ)r7r9r9r:rã±szStandardDomain.anonlabels)rr0cCsúd}x.t|jjƒƒD]\}\}}||kr|j|=qWx.t|jjƒƒD]\}\}}||krD|j|=qDWx.t|jjƒƒD]\}\}}||krt|j|=qtWx0t|jjƒƒD]\}\}}}||kr¤|j|=q¤Wx.t|jjƒƒD]\}\}}||krÖ|j|=qÖWdS)N)Úlistràr±rárørârã)r7rÚkeyÚfnZ_lr9r9r:Ú	clear_docµs zStandardDomain.clear_doc)ÚdocnamesÚ	otherdatar0cCsôx.|djƒD]\}}|d|kr||j|<qWx.|djƒD]\}}|d|kr>||j|<q>Wx.|djƒD]\}}|d|krn||j|<qnWx.|djƒD]\}}|d|krž||j|<qžWx.|djƒD]\}}|d|krÎ||j|<qÎWdS)Nràrrár¸rârã)r±ràrárørârã)r7rþrÿrûrðr9r9r:Úmerge_domaindataÇszStandardDomain.merge_domaindata)r3rrEr0cCsjxb|jjƒD]R\}}|sq|j|}|dkr2q|j|}t|tjƒrld|krl|jj|dƒ}|dd}|jdksd|ks|jj	dƒrŒq||j
kr¼tjt
dƒ||j|j
|dƒ|d||f|j|<|jd	krîttj|dƒ}t|ƒ}	nd|jd
krt|ƒ}	nN|j|ƒr$|j|ƒ}	|	sRqn.t|jtjƒdƒ}
|
r|
jdƒr|
jdƒ}	nq|||	f|j
|<qWdS)NÚrefidÚnamesrZfootnoteÚrefuriZdesc_z(duplicate label %s, other instance in %s)rBÚsectionZrubricÚcaption)Z	nametypesr±Znameidsr<Ú
isinstancerrcr‰ÚtagnamerŠrârzr{rrîrãrr›r$Úis_enumerable_nodeÚget_numfig_titleÚnextÚfindallrÚtoctree)r7r3rrEr8Úexplicitròr_r›Úsectnamerr9r9r:Úprocess_docÙsB








zStandardDomain.process_doc)r—r8rròr0cCs||f|j||f<dS)N)rà)r7r—r8rròr9r9r:rŒsz!StandardDomain.add_program_optionr*)ÚfromdocnameÚbuilderrròrÚrolenamer®r0cKsº|jdtjƒ}|d
ddi|—Ž}	tj||ƒ}
|
jdƒdk	rZ|
djdƒ|
djd|ƒ||krl||	d<n@tdƒ}||d	<||d
<|j||ƒ|	d<|r¬|	dd|7<|	j|
ƒ|	S)NÚ	nodeclassr-ZinternalTr¬rAzstd-rZ
refdocnameZrefsectnamerú#)r-r-)r–rÚ	referenceÚinliner‰rGrZget_relative_uri)r7rrrròrrr®rZnewnodeÚ	innernodeÚcontnoder9r9r:Úbuild_reference_nodes"

z#StandardDomain.build_reference_node)r3rrÚtyprcr_rr0c	Csz|dkr|j}nV|dkr |j}nF|dkr0|j}n6|dkr@|j}n&|dkrP|j}n|dkr`|j}n|j}||||||||ƒS)NrÓrÛrÔrÖr’r¥)Ú_resolve_ref_xrefÚ_resolve_numref_xrefÚ_resolve_keyword_xrefÚ_resolve_doc_xrefÚ_resolve_option_xrefÚ_resolve_term_xrefÚ_resolve_obj_xref)	r7r3rrrrcr_rÚresolverr9r9r:Úresolve_xrefszStandardDomain.resolve_xrefcCsT|dr$|jj|dƒ\}}	|jƒ}
n|jj|dƒ\}}	}
|s@dS|j||||	|
dƒS)NÚrefexplicitr-rÓ)r-r-)r-r-r-)rãr‰r§râr)r7r3rrrrcr_rrròrr9r9r:r2s
z StandardDomain._resolve_ref_xrefc Csþ||jkr |jj|dƒ\}}	}
n|jj|dƒ\}}	d}
|s>dS|j|ƒjj|	ƒ}|j|ƒ}|dkrfdS|dkr|jjdkrtj	t
dƒ|d|Sy"|j|||||ƒ}
|
dkr°|SWn(tk
rÚtj	t
dƒ|	|d|SXy¤|drò|j
ƒ}n|jjj|dƒ}|
dkr.d|kr.tj	t
d	ƒ||d|Sd
jtt|
ƒƒ}d|ksRd|krv|
rh|j|
|d}n|j|d
}n||}Wn`tk
r¸}ztj	t
dƒ|||d|Sd}~Xn*tk
ràtj	t
dƒ||d|SX|j||||	|dtj|dS)Nr-rFz(numfig is disabled. :numref: is ignored.)rBzBFailed to create a cross reference. Any number is not assigned: %sr$z{name}zthe link has no caption: %sÚ.Únumber)r8r&)r&zinvalid numfig_format: %s (%r)zinvalid numfig_format: %srÛ)rr›)r-r-r-)r-r-)râr‰rãZget_doctreer<Úget_enumerable_node_typeÚconfigZnumfigrzr{rÚ
get_fignumberr~r§Z
numfig_formatr‹Úmapr\ÚformatÚKeyErrorÚ	TypeErrorrrZnumber_reference)r7r3rrrrcr_rrròZfignameÚtarget_nodeÚfigtypeZ	fignumberr›ZfignumZnewtitleÚexcr9r9r:rDsX





z#StandardDomain._resolve_numref_xrefcCs,|jj|dƒ\}}	}
|sdSt||||	|ƒS)Nr-)r-r-r-)râr‰r&)r7r3rrrrcr_rrròrr9r9r:rƒs
z$StandardDomain._resolve_keyword_xrefcCsn|jd|ƒ}t||dƒ}	|	|jkr(dS|dr:|jƒ}
nt|j|	ƒ}
tj|
|
dgd}t|||	d|ƒSdS)NÚrefdocrar$rÖ)r¬)	r‰r Úall_docsr§r$Útitlesrrr&)r7r3rrrrcr_rr1rrrr9r9r:rs

z StandardDomain._resolve_doc_xrefc
Cs”|jdƒ}|jƒ}|jj||fdƒ\}	}
|	s„g}xRtj|ƒr~tj|dƒ\}}|j|ƒdj|ƒ}|jj||fdƒ\}	}
|	r2Pq2WdSt|||	|
|ƒS)Nzstd:programr-r>rW)r-r-)r-r-)	r‰rLràr"rßrjrGr‹r&)
r7r3rrrrcr_rÚprognamerròÚcommandsÚ
subcommandr9r9r:ržs


z#StandardDomain._resolve_option_xrefcCsV|j|||||||ƒ}|r|S|jƒ|jkrN|j|jƒ\}	}
t|||	|
|ƒSdSdS)N)r!rùrør&)r7r3rrrrcr_rÚresultrròr9r9r:r ´s
z!StandardDomain._resolve_term_xrefcCs^|j|ƒpg}x6|D]&}	|	|f|jkr|j|	|f\}
}PqWd\}
}|
sNdSt|||
||ƒS)Nr-)r-r-)Zobjtypes_for_rolerár&)r7r3rrrrcr_rZobjtypesrFrròr9r9r:r!Ãs
z StandardDomain._resolve_obj_xref)r3rrrcr_rr0c	Csºg}|jƒ}xDdD]<}	|j||||	|	dkr.|n|||ƒ}
|
r|jd|	|
fƒqWxb|jD]X}||f}|dkrv||f}||jkrZ|j|\}
}|jd|j|ƒt|||
||ƒfƒqZW|S)NrÓr’zstd:r¥)rÓr’)rùr#rGÚobject_typesráZrole_for_objtyper&)r7r3rrrcr_rÚresultsZltargetÚroleÚresrFrûrròr9r9r:Úresolve_any_xrefÒs$

zStandardDomain.resolve_any_xrefccsNx.|jjD]"}|t|jj|ƒd|dd	fVq
Wxb|jjƒD]T\\}}}|rvdj||gƒ}||d|d|ddfVq<||d|d|ddfVq<Wx@|jjƒD]2\\}}}||||d|d|j|j	dfVq Wx.|j
jƒD] \}\}}	}
||
d||	d
fVqâWt|j
ƒ}x8|jjƒD]*\}\}}	||kr||d||	dfVqWdS)NrÖr-r>r%r„rrÒr×rCrCrC)
r3r2r$r3ràr±r‹rár8ÚattrsrâÚsetrã)r7rÖÚprogr’ÚinforkÚtyper8rròZsectionnameZnon_anon_labelsr9r9r:Úget_objectsés "

zStandardDomain.get_objectsF)rAÚprimaryr0cCs|jS)N)Úlname)r7rArCr9r9r:Ú
get_type_nameþszStandardDomain.get_type_name)r_r0cCs|j|jkS)N)ríré)r7r_r9r9r:rsz!StandardDomain.is_enumerable_nodecCs`|j|ƒr\tt|ƒ}|jj|jdƒ\}}|r4||ƒSx&|D]}t|tjtj	fƒr:t
|ƒSq:WdS)z?Get the title of enumerable nodes to refer them using its titleN)NN)rrrrér‰rírrrr›r$)r7r_ÚelemrZtitle_getterrÐr9r9r:r	s


zStandardDomain.get_numfig_titlecCsbtttdœdd„}t|tjƒr"dSt|tjƒrFd|krF||tjƒrFdS|jj	|j
dƒ\}}|SdS)	zGet type of enumerable nodes.)r_Úclsr0cst‡fdd„|DƒƒS)Nc3s|]}t|ˆƒVqdS)N)r)Ú.0Úchild)rGr9r:ú	<genexpr>szMStandardDomain.get_enumerable_node_type.<locals>.has_child.<locals>.<genexpr>)Úany)r_rGr9)rGr:Ú	has_childsz:StandardDomain.get_enumerable_node_type.<locals>.has_childrÚ
literal_blockz
code-blockN)NN)rrrerrrÚ	containerrMrér‰rí)r7r_rLr/rr9r9r:r'sz'StandardDomain.get_enumerable_node_type.)r3rr/rr.r0c	Cs¸|dkrh|jdkrtƒS||jkr(t‚q´d|dd}||j|krV|j|jdƒS|j|j|ƒSnLy|dd}|j|||Sttfk
r²}zt|‚WYdd}~XnXdS)NrZlatexrr<rr-)r8ÚtupleZtoc_secnumbersr~r‰Ztoc_fignumbersr,Ú
IndexError)	r7r3rr/rr.Z
anchornameZ	figure_idr0r9r9r:r)#s

zStandardDomain.get_fignumbercCsf|jdƒdkr^|jdƒ}tj|jdƒƒ}|r8|jd|ƒ|jƒ}|rXdjdj|ƒ|gƒSdSndSdS)Nr¾r’zstd:programrarr%rW)r‰r"rjrir–r‹)r7r_r4Úcommandr’r9r9r:Úget_full_qualified_name:s
z&StandardDomain.get_full_qualified_namerCrCrCrC)rÜr-)rÞr-)rßr-)räN)råN)ræN)r-)N)N)F)OrXrYrZr[r8r×rrr8rr\r”rtr]rªrÈrrrr˜r^rÑrrrZrolesr
r(Zinitial_dataZdangling_warningsrärårNrérrr
rrèrïÚpropertyrárrPr÷rør¨ràrârãrýr	rrErrŒrrrr#rrrrrr r!r<rÚintrBrerErr	r'r)rRÚ
__classcell__r9r9)rír:rNsÊ
"&&	(
 	(" )=

"rNr))rêrr_r0cCsd|r|jdks|ddkrdS|d}||jkr:tdƒ}ntdƒ}tj|||d|dddSdS)	NrAr¾rÓrazundefined label: %szDFailed to create a cross reference. A title or caption not found: %s)rBrAÚsubtypeT)r8rãrrzr{)rêrr_rcÚmsgr9r9r:Úwarn_missing_referenceIs

rX)rêr0cCs$|jtƒ|jdtƒdddddœS)Nzwarn-missing-referenceÚbuiltinróT)ÚversionZenv_versionZparallel_read_safeZparallel_write_safe)Z
add_domainrNÚconnectrX)rêr9r9r:ÚsetupXs
r\)r-)\r[ržrõrÚtypingrrrrrrr	r
rrr
rZdocutilsrZdocutils.nodesrrrZdocutils.parsers.rstrrZdocutils.statemachinerZsphinxrZsphinx.addnodesrrZsphinx.deprecationrZsphinx.directivesrZsphinx.domainsrrZ
sphinx.localerrZsphinx.rolesrZsphinx.utilr r!r"Zsphinx.util.docutilsr#Zsphinx.util.nodesr$r%r&Zsphinx.util.typingr'r(Zsphinx.applicationr)Zsphinx.buildersr*Zsphinx.environmentr+Ú	getLoggerrXrzrËrxÚUr¿r\r,r]r^rfrtr”r˜r rTrEr¥r©rªrÇrÈrÑrNrerXr\r9r9r9r:Ú<module>sb8

36P

r!A4