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

156 lines
16 KiB
Plaintext
Raw Normal View History

Ë
jw6ãóHUdZddlmZddlZddlZddlZddlmZmZddl 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)dZ'd*d+dZ(d,dZ)d(d-dZ*d.dZ+Gdde,«Z-Gdd«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Ú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óbtjdk\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-ô ×ј × Ñ Ð'<Ð Ó cóˆˆfd}|S)
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ó4t«ˆˆˆfd«}|S)Ncóltjdjdt¬«|i|¤ŽS)'z' is deprecated. )ÚcategoryÚ
stacklevel)ÚwarningsÚwarnÚ__name__ÚDeprecationWarning)ÚargsÚkwargsÚfuncÚmessagerbs €€€rZÚdeprecated_funcz4deprecated.<locals>.wrapper.<locals>.deprecated_funcs<ø€ä M‰MØD—MM?Ð"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ÚonÚ1T)ÚfalseÚnoÚ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ÒØ Ð9Ñ 9ØØ ÐBÑ BØÙ ÜÐÑ
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órtj|«}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óFtj«t«z
dkS)zBReturn true if current stack depth is within 100 of maximum limit.éd)rUÚgetrecursionlimitrrmr\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\rZrr½sÙr\rcóeZdZdZdddZy)Ú 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)zMarkdown | None)rer—r˜r™r rmr\rZrrÂs ñõr\r›có6eZdZUded<ded<ded<ded<y) ÚTagDatar|Útagúdict[str, str]ÚattrsÚintÚ
left_indexÚ right_indexN©rer—r˜Ú__annotations__rmr\rZÑsØ
ØÓØØÔr\có6eZdZdZdZddZd dZd
dZd dZy) Ú 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©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.
é)ÚappendÚget_placeholderr®)r4Ú placeholders rZÚstorezHtmlStash.storeåsEð
×Ñ×! ×*¨4×+<Ñ+<Ó=ˆ Ø ×Ò˜QÑÕØÐr\có d|_g|_y)z Clear the stash. rN)s rZÚresetzHtmlStash.reset÷sàˆÔ؈Õr\cót|zSr)ÚHTML_PLACEHOLDER©Úkeys rZzHtmlStash.get_placeholderüs
Ü %r\có¨|jj||||dœ«tt|j«z}|xjdz
c_|S)z(Store tag data and return a placeholder.)r´)ÚTAG_PLACEHOLDERr|)s rZÚ store_tagzHtmlStash.store_tagÿsQà
×Ñ S°5Ø,6Ø-8ñ¨D×,<Ñ,<Ó(=Ñ=ˆ Ø ×Ò˜AÑÕØÐr\N)r4zstr | etree.ElementÚreturnr|©ÚNone)r|)
r|r|) rer—r˜r™r r¸rmr\rZØs ñò
ó$ ó
r\có"eZdZUded<ded<y)Ú
_PriorityItemr|ÚnameÚfloatÚpriorityNr©rmr\rZ s Ø
ƒIØ„Or\có‚eZdZdZdZddZddZedd«Zedd«ZddZddZ 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|ÚkeysÚvalues)Úitems rZÚ __contains__zRegistry.__contains__>s:Ü dœCÔ à˜4Ÿ:™:Ÿ?™?Ó t—zz×*r\có˜|j«t|jDcgc]\}}|j|Œc}}«Scc}}wr)Ú_sortÚiterrÎ)Úkr)s rZÚ__iter__zRegistry.__iter__Es4Ø
Œ ܨt¯~©~×>¡t q¨!T—ZZ “]Ó?ùÓ>s¥A
cóyrrms rZÚ __getitem__zRegistry.__getitem__Ióà r\cóyrrms rZzRegistry.__getitem__Mr\cóR|j«t|t«rCt«}|j|D]%\}}|j |j |||«Œ'|St|t«r&|j |j|jS|j |Sr) rÖr{ÚslicerËÚregisterrÍ)ÚdatarØr)s rZzRegistry.__getitem__QsØ
Œ Ü cœ5Ô !Ü!)£ˆDØŸ sÑ
3
˜dŸj™j¨™m¨Q°Õ
ˆKÜ cœ3Ô Ø—:‘:˜dŸn™n¨SÑ z‰z˜#‰Ðr\có,t|j«Sr)ÚlenrÎ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»*ÓEr\cóô||vrV|j«|jj|jDcgc]}|j|k(sŒ|Œc}d«St dj |««cc}w)z5
Return the index of the given name.
rzNo item named "{}" exists.)ÚindexrÇr)Úxs rZÚget_index_for_namezRegistry.get_index_for_namebsjð 4‰<Ø J‰JŒLØ—>>× ŸN™NÖ=q¨a¯f©f¸«n’Ò=¸aÑð
ôÐ5×<¸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