Ë b n¤+÷Ããóœ—dZddlZ ddlmZmZddlmZmZdZ Gd„dej«Z Gd„d e«Z y#e$r ddlmZmZYŒ:wxYw) a Simple case insensitive dictionaries. The :class:`CaseInsensitiveDict` class is a dictionary whose string keys are case insensitive. It works by automatically coercing string keys to :class:`CaseInsensitiveKey` objects. Keys that are not strings are supported as well, just without case insensitivity. At its core this module works by normalizing strings to lowercase before comparing or hashing them. It doesn't support proper case folding nor does it support Unicode normalization, hence the word "simple". éN)ÚIterableÚMapping)Ú basestringÚunicode)ÚCaseInsensitiveDictÚCaseInsensitiveKeycó�‡—eZdZdZd ˆfd„ Zd„Zed d„«Zd ˆfd„ Zd ˆfd„ Z d ˆfd„ Z d d„Z ˆfd „Z ˆfd „Z ˆfd „Zˆfd „ZˆxZS)ra Simple case insensitive dictionary implementation (that remembers insertion order). This class works by overriding methods that deal with dictionary keys to coerce string keys to :class:`CaseInsensitiveKey` objects before calling down to the regular dictionary handling methods. While intended to be complete this class has not been extensively tested yet. c óP•—tt|� «|j|fi|¤Žy)z1Initialize a :class:`CaseInsensitiveDict` object.N)ÚsuperrÚ__init__Úupdate)ÚselfÚotherÚkwÚ __class__s €ú7/usr/lib/python3.12/site-packages/humanfriendly/case.pyr zCaseInsensitiveDict.__init__0s&ø€ô Ô! 4Ñ1Ô3àˆ� ‰ �EÑ ˜RÓ ócó<—t|t«r t|«}|S)a8 Coerce string keys to :class:`CaseInsensitiveKey` objects. :param key: The value to coerce (any type). :returns: If `key` is a string then a :class:`CaseInsensitiveKey` object is returned, otherwise the value of `key` is returned unmodified. )Ú isinstancerr)rÚkeys rÚ coerce_keyzCaseInsensitiveDict.coerce_key7s€ô �cœ:Ô &Ü$ SÓ)ˆC؈ rcó&‡—|ˆfd„|D««S)zYCreate a case insensitive dictionary with keys from `iterable` and values set to `value`.c3ó&•K—|]}|‰f–—Œ y­w©N©)Ú.0ÚkÚvalues €rÚ z/CaseInsensitiveDict.fromkeys..Gsøèø€Ð0¡x !�A�u”:¡xùsƒr)ÚclsÚiterablers `rÚfromkeyszCaseInsensitiveDict.fromkeysDsø€ñÓ0¡xÓ0Ó0Ð0rcóJ•—tt|� |j|«|«S)z"Get the value of an existing item.)r rÚgetr©rrÚdefaultrs €rr$zCaseInsensitiveDict.getIó!ø€äÔ(¨$Ñ3°D·O±OÀCÓ4HÈ'ÓRÐRrcóJ•—tt|� |j|«|«S)z2Remove an item from a case insensitive dictionary.)r rÚpoprr%s €rr)zCaseInsensitiveDict.popMr'rcóJ•—tt|� |j|«|«S)z4Get the value of an existing item or add a new item.)r rÚ setdefaultrr%s €rr+zCaseInsensitiveDict.setdefaultQs"ø€äÔ(¨$Ñ:¸4¿?¹?È3Ó;OÐQXÓYÐYrc ó(—t|t«r|j«D] \}}|||<Œ nGt|t«r|D] \}}|||<Œ n'|�%d}t «j }t ||z«‚|j«D] \}}|||<Œ y)z4Update a case insensitive dictionary with new items.Nz'%s' object is not iterable)rrÚitemsrÚtypeÚ__name__Ú TypeError)rrrrrÚmsgÚ type_names rr zCaseInsensitiveDict.updateUs�€ä �eœWÔ %à#Ÿk™kžm‘ ��UØ!��S’ ñ,ä ˜œxÔ (ã#‘ ��UØ!��S’ ñ$à Ð à/ˆCܘU› ×,Ñ,ˆIܘC )™OÓ,Ð ,àŸ(™(ž*‰JˆC�؈D�ŠIñ%rcóH•—tt|� |j|««S)z>Check if a case insensitive dictionary contains the given key.)r rÚ __contains__r©rrrs €rr4z CaseInsensitiveDict.__contains__hsø€äÔ(¨$Ñ<¸T¿_¹_ÈSÓ=QÓRÐRrcóH•—tt|� |j|««S)z0Delete an item in a case insensitive dictionary.)r rÚ __delitem__rr5s €rr7zCaseInsensitiveDict.__delitem__lóø€äÔ(¨$Ñ;¸D¿O¹OÈCÓr?rDrLrOrrrrrys„ñ òò ó "rr) r?Ú collectionsÚcollections.abcrrÚ ImportErrorÚhumanfriendly.compatrrÚ__all__Ú OrderedDictrrrrrÚrVs^ðñ óð.ç1÷ 5ð 8€ôQY˜+×1Ñ1ôQYôh$"˜õ$"øðò.ç-Ñ-ð.úsˆ;» A Á A