Files
intellecton/venv/lib/python3.12/site-packages/markdown/__pycache__/util.cpython-312.pyc
T

156 lines
16 KiB
Plaintext
Raw Normal View History

Ë
KÀjw6ãóH—UdZddlmZddlZddlZddlZddlmZmZddl m
Z
ddl m Z m
Z
mZmZmZmZmZe rddlmZddlmcmZed«Z gd ¢Zd
ed < d Z d
Z edzZ edzezZ ej>edz«Z edzezZ! edzezZ" ej>e"dz«Z# edzezZ$ dZ%ed¬«d„«Z&d(d)d„Z'd*d+d„Z(d,d„Z)d(d-d„Z*d.d„Z+Gd„de,«Z-Gd„d«Z.e r Gd „d!e«Z/Gd"„d#«Z0Gd$„d%e«Z1Gd&„d'e
e«Z2y)/zv
This module contains various contacts, classes and functions which get referenced and used
throughout the code base.
é)Ú annotationsN)ÚwrapsÚ lru_cache)Úcount)Ú
TYPE_CHECKINGÚGenericÚIteratorÚ
NamedTupleÚTypeVarÚ TypedDictÚoverload)ÚMarkdownÚ_T);ÚaddressÚarticleÚasideÚ
blockquoteÚdetailsÚdivÚdlÚfieldsetÚ
figcaptionÚfigureÚfooterÚformÚh1Úh2Úh3Úh4Úh5Úh6ÚheaderÚhgroupÚhrÚmainÚmenuÚnavÚolÚpÚpreÚsectionÚtableÚulÚcanvasÚcolgroupÚddÚbodyÚdtÚgroupÚhtmlÚiframeÚliÚlegendÚmathÚmapÚnoscriptÚoutputÚobjectÚoptionÚprogressÚscriptÚstyleÚsummaryÚtbodyÚtdÚtextareaÚtfootÚthÚtheadÚtrÚvideoÚcenterz list[str]ÚBLOCK_LEVEL_ELEMENTSúúzklzzwxh:z%sz([0-9]+)Úampz
wzxhzdk:%sz
hzzhzkh:%s))uÖ�uß¿)uâ´°u⵿)Úmaxsizecób—tjdk\rddlm}nddl}|j d¬«S)z= Return all entry_points in the `markdown.extensions` group. )éé
r©ÚmetadataNzmarkdown.extensions)r3)ÚsysÚ version_infoÚ importlibrTÚimportlib_metadataÚ entry_pointsrSs úP/home/antigravity/intellecton/venv/lib/python3.12/site-packages/markdown/util.pyÚget_installed_extensionsr[gs-€ô ×ј7Ò"Þ&ã-à × Ñ Ð'<Ð Ó =Ð=óc󇇗ˆˆfd„}|S)zå
Raise a [`DeprecationWarning`][] when wrapped function/method is called.
Usage:
```python
@deprecated("This method will be removed in version X; use Y instead.")
def some_method():
pass
```
có4•‡—t‰«ˆˆˆfd„«}|S)Ncól•—tjd‰j›d‰›�t‰¬«‰|i|¤ŽS)Nú'z' is deprecated. )ÚcategoryÚ
stacklevel)ÚwarningsÚwarnÚ__name__ÚDeprecationWarning)ÚargsÚkwargsÚfuncÚmessagerbs €€€rZÚdeprecated_funcz4deprecated.<locals>.wrapper.<locals>.deprecated_funcs<ø€ä �M‰MØ�D—M‘M�?Ð"3°G°9Ð=Ü+Ø%õ
ñ
˜Ð( Ñ(Ð (r\)r)rirkrjrbs` €€rZÚwrapperzdeprecated.<locals>.wrapper~s!ù€Ü ˆt‹õ )ó
ð )ðÐr\©)rjrbrls`` rZÚ
deprecatedrnrsù€õ ð €Nr\cóÞ—t|t«s|r|€|St|«S|r|j«dk(ry|j«dvry|j«dvry|rt d|z«‚y)aParses a string representing a boolean value. If parsing was successful,
returns `True` or `False`. If `preserve_none=True`, returns `True`, `False`,
or `None`. If parsing was not successful, raises `ValueError`, or, if
`fail_on_errors=False`, returns `None`.NÚnone)ÚtrueÚyesÚyÚonÚ1T)ÚfalseÚnoÚnÚoffÚ0rpFzCannot parse bool value: %r)Ú
isinstanceÚstrÚboolÚlowerÚ
ValueError)ÚvalueÚfail_on_errorsÚ
preserve_nones rZÚparseBoolValuerƒ‹st€ô
�eœSÔ !Ù ˜U˜]؈LÜ�E‹{ÐÙ ˜5Ÿ;™;›=¨FÒ2ØØ �‰‹Ð9Ñ 9ØØ �‰‹ÐBÑ BØÙ ÜÐ6¸Ñ>Ó?Ð?ð
r\cóŠ—d|vr|jdd«}d|vr|jdd«}d|vr|jdd«}|S)zHTML escape a string of code.ú&z&amp;ú<z&lt;ú>z&gt;)Úreplace)Útexts rZÚ code_escaperŠžsL€à
ˆd�{Ø�|‰|˜C Ó)ˆØ
ˆd�{Ø�|‰|˜C Ó(ˆØ
ˆd�{Ø�|‰|˜C Ó(ˆØ €Kr\cór—tj|«}t|«D]}|j}|rŒ|cSy)z+Get current stack depth, performantly.
N)rUÚ _getframerÚf_back)ÚsizeÚframes rZÚ_get_stack_depthr�©s6€ô
�M‰M˜$Ó €Eä�d“ òˆØ— ‘ ˆÚØŠKñr\cóF—tj«t«z
dkS)zBReturn true if current stack depth is within 100 of maximum limit.éd)rUÚgetrecursionlimitr�rmr\rZÚnearing_recursion_limitr”´s€ä × Ñ Ó "Ô%5Ó%7Ñ 7¸#Ñ =Ð=r\có—eZdZdZy)Ú AtomicStringz/A string which should not be further processed.N)reÚ
__module__Ú __qualname__Ú__doc__rmr\rZr–r–½s„Ù9Ør\r–có—eZdZdZddd„Zy)Ú ProcessorzÖ The base class for all processors.
Attributes:
Processor.md: The `Markdown` instance passed in an initialization.
Arguments:
md: The `Markdown` instance this processor is a part of.
Ncó—||_y©N)Úmd)Úselfržs rZÚ__init__zProcessor.__init__Ìs €Øˆ�r\r�)ržzMarkdown | None)rer—r˜r™r rmr\rZr›r›Âs „ñõr\r›có6—eZdZUded<ded<ded<ded<y) ÚTagDatar|Útagúdict[str, str]ÚattrsÚintÚ
left_indexÚ right_indexN©rer—r˜Ú__annotations__rmr\rZr¢r¢Ñs…Ø
‹ØÓØ‹ØÔr\r¢có6—eZdZdZd„Zdd„Zd d„Zd
d„Zd d„Zy) Ú HtmlStashz{
This class is used for stashing HTML objects that we extract
in the beginning and replace with place-holders.
có<—d|_g|_d|_g|_y)z Create an `HtmlStash`. rN)Ú html_counterÚ
rawHtmlBlocksÚ tag_counterÚtag_data©rŸs rZr zHtmlStash.__init__Þs!€àˆÔØ8:ˆÔØˆÔØ')ˆ�
r\cóœ—|jj|«|j|j«}|xjdz
c_|S)a

Saves an HTML segment for later reinsertion. Returns a
placeholder string that needs to be inserted into the
document.
Keyword arguments:
html: An html segment.
Returns:
A placeholder string.
é)r¯ÚappendÚget_placeholderr®)rŸr4Ú placeholders rZÚstorezHtmlStash.storeåsE€ð
×Ñ×!Ñ! $Ô'Ø×*Ñ*¨4×+<Ñ+<Ó=ˆ Ø ×Ò˜QÑÕØÐr\có —d|_g|_y)z Clear the stash. rN)r®r¯r²s rZÚresetzHtmlStash.reset÷s€àˆÔ؈Õr\có—t|zSr�)ÚHTML_PLACEHOLDER©rŸÚkeys rZr¶zHtmlStash.get_placeholderüs
€Ü #Ñ%Ð%r\có¨—|jj||||dœ«tt|j«z}|xjdz
c_|S)z(Store tag data and return a placeholder.)r£r¥r§r¨r´)r±rµÚTAG_PLACEHOLDERr|r°)rŸr£r¥r§r¨r·s rZÚ store_tagzHtmlStash.store_tagÿsQ€à �
‰
×Ñ S°5Ø,6Ø-8ñ:ô ;ô&¬¨D×,<Ñ,<Ó(=Ñ=ˆ Ø ×Ò˜AÑÕØÐr\N)r4zstr | etree.ElementÚreturnr|©rÂÚNone)r¾r¦rÂr|)
r£r|r¥r¤r§r¦r¨r¦rÂr|) rer—r˜r™r r¸rºr¶rÁrmr\rZr¬r¬Øs „ñò
*óó$ ó
&ôr\r¬có"—eZdZUded<ded<y)Ú
_PriorityItemr|ÚnameÚfloatÚpriorityNr©rmr\rZrÆrÆ s …Ø
ƒIØ„Or\rÆcó‚—eZdZdZd„Zdd„Zdd„Zedd„«Zedd„«Zdd„Zdd„Z d „Z
dd
„Z dd „Z ddd „Z
dd
„Zy)ÚRegistryaô
A priority sorted registry.
A `Registry` instance provides two public methods to alter the data of the
registry: `register` and `deregister`. Use `register` to add items and
`deregister` to remove items. See each method for specifics.
When registering an item, a "name" and a "priority" must be provided. All
items are automatically sorted by "priority" from highest to lowest. The
"name" is used to remove ("deregister") and get items.
A `Registry` instance it like a list (which maintains order) when reading
data. You may iterate over the items, get an item and get a count (length)
of all items. You may also check that the registry contains an item.
When getting an item you may use either the index of the item or the
string-based "name". For example:
registry = Registry()
registry.register(SomeItem(), 'itemname', 20)
# Get the item by index
item = registry[0]
# Get the item by name
item = registry['itemname']
When checking that the registry contains an item, you may use either the
string-based "name", or a reference to the actual item. For example:
someitem = SomeItem()
registry.register(someitem, 'itemname', 20)
# Contains the name
assert 'itemname' in registry
# Contains the item instance
assert someitem in registry
The method `get_index_for_name` is also available to obtain the index of
an item using that item's assigned "name".
có.—i|_g|_d|_y)NF)Ú_dataÚ _priorityÚ
_is_sortedr²s rZr zRegistry.__init__9s€Ø$&ˆŒ
Ø.0ˆŒØˆ�r\có’—t|t«r||jj«vS||jj «vSr�)r{r|rÍÚkeysÚvalues)rŸÚitems rZÚ __contains__zRegistry.__contains__>s:€Ü �dœCÔ à˜4Ÿ:™:Ÿ?™?Ó,Ð,Ð ,à�t—z‘z×(Ñ(Ó*Ð*Ð*r\có˜—|j«t|jD��cgc]\}}|j|‘Œc}}«Scc}}wr�)Ú_sortÚiterrÎrÍ)rŸÚkr)s rZÚ__iter__zRegistry.__iter__Es4€Ø �
‰
Œ ܨt¯~©~×>¡t q¨!�T—Z‘Z “]Ó>Ó?Ð?ùÓ>s¥A
có—yr�rmr½s rZÚ __getitem__zRegistry.__getitem__Ió€à r\có—yr�rmr½s rZrÛzRegistry.__getitem__MrÜr\cóR—|j«t|t«rCt«}|j|D]%\}}|j |j |||«Œ'|St|t«r&|j |j|jS|j |Sr�) rÖr{ÚslicerËrÎÚregisterrÍr¦rÇ)rŸr¾ÚdatarØr)s rZrÛzRegistry.__getitem__Qs‹€Ø �
‰
Œ Ü �cœ5Ô !Ü!)£ˆDØŸ™ sÑ+ò
3‘��1Ø—
‘
˜dŸj™j¨™m¨Q°Õ2ð
3àˆKÜ �cœ3Ô Ø—:‘:˜dŸn™n¨SÑ1×6Ñ6Ñ7Ð 7Ø�z‰z˜#‰Ðr\có,—t|j«Sr�)ÚlenrÎr²s rZÚ__len__zRegistry.__len__\s€Ü�4—>‘>Ó"Ð"r\có`—dj|jjt|««S)Nz<{}({})>)ÚformatÚ __class__reÚlistr²s rZÚ__repr__zRegistry.__repr___s#€Ø× Ñ  §¡×!8Ñ!8¼$¸t»*ÓEÐEr\cóô—||vrV|j«|jj|jD�cgc]}|j|k(sŒ|‘Œc}d«St dj |««‚cc}w)z5
Return the index of the given name.
rzNo item named "{}" exists.)rÖrÎÚindexrÇrræ)rŸrÇÚxs rZÚget_index_for_namezRegistry.get_index_for_namebsj€ð �4‰<Ø �J‰JŒLØ—>‘>×'Ñ'Ø ŸN™NÖ=�q¨a¯f©f¸«n’Ò=¸aÑ@óð
ôÐ5×<Ñ<¸TÓBÓCÐCùò>s ¸A5Á
A5có¤—||vr|j|«d|_||j|<|jj t ||««y)aW
Add an item to the registry with the given name and priority.
Arguments:
item: The item being registered.
name: A string used to reference the item.
priority: An integer or float used to sort against all items.
If an item is registered with a "name" which already exists, the
existing item is replaced with the new item. Treat carefully as the
old item is lost with no way to recover it. The new item will be
sorted according to its priority and will **not** retain the position