compat.py 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from __future__ import division
  4. import base64
  5. import binascii
  6. import collections
  7. import ctypes
  8. import datetime
  9. import email
  10. import getpass
  11. import io
  12. import itertools
  13. import optparse
  14. import os
  15. import platform
  16. import re
  17. import shlex
  18. import shutil
  19. import socket
  20. import struct
  21. import subprocess
  22. import sys
  23. import types
  24. import xml.etree.ElementTree
  25. # naming convention
  26. # 'compat_' + Python3_name.replace('.', '_')
  27. # other aliases exist for convenience and/or legacy
  28. # deal with critical unicode/str things first
  29. try:
  30. # Python 2
  31. compat_str, compat_basestring, compat_chr = (
  32. unicode, basestring, unichr
  33. )
  34. except NameError:
  35. compat_str, compat_basestring, compat_chr = (
  36. str, (str, bytes), chr
  37. )
  38. # casefold
  39. try:
  40. compat_str.casefold
  41. compat_casefold = lambda s: s.casefold()
  42. except AttributeError:
  43. from .casefold import casefold as compat_casefold
  44. try:
  45. import collections.abc as compat_collections_abc
  46. except ImportError:
  47. import collections as compat_collections_abc
  48. try:
  49. import urllib.request as compat_urllib_request
  50. except ImportError: # Python 2
  51. import urllib2 as compat_urllib_request
  52. # Also fix up lack of method arg in old Pythons
  53. try:
  54. type(compat_urllib_request.Request('http://127.0.0.1', method='GET'))
  55. except TypeError:
  56. def _add_init_method_arg(cls):
  57. init = cls.__init__
  58. def wrapped_init(self, *args, **kwargs):
  59. method = kwargs.pop('method', 'GET')
  60. init(self, *args, **kwargs)
  61. if any(callable(x.__dict__.get('get_method')) for x in (self.__class__, self) if x != cls):
  62. # allow instance or its subclass to override get_method()
  63. return
  64. if self.has_data() and method == 'GET':
  65. method = 'POST'
  66. self.get_method = types.MethodType(lambda _: method, self)
  67. cls.__init__ = wrapped_init
  68. _add_init_method_arg(compat_urllib_request.Request)
  69. del _add_init_method_arg
  70. try:
  71. import urllib.error as compat_urllib_error
  72. except ImportError: # Python 2
  73. import urllib2 as compat_urllib_error
  74. try:
  75. import urllib.parse as compat_urllib_parse
  76. except ImportError: # Python 2
  77. import urllib as compat_urllib_parse
  78. import urlparse as _urlparse
  79. for a in dir(_urlparse):
  80. if not hasattr(compat_urllib_parse, a):
  81. setattr(compat_urllib_parse, a, getattr(_urlparse, a))
  82. del _urlparse
  83. # unfavoured aliases
  84. compat_urlparse = compat_urllib_parse
  85. compat_urllib_parse_urlparse = compat_urllib_parse.urlparse
  86. try:
  87. import urllib.response as compat_urllib_response
  88. except ImportError: # Python 2
  89. import urllib as compat_urllib_response
  90. try:
  91. compat_urllib_response.addinfourl.status
  92. except AttributeError:
  93. # .getcode() is deprecated in Py 3.
  94. compat_urllib_response.addinfourl.status = property(lambda self: self.getcode())
  95. try:
  96. import http.cookiejar as compat_cookiejar
  97. except ImportError: # Python 2
  98. import cookielib as compat_cookiejar
  99. compat_http_cookiejar = compat_cookiejar
  100. if sys.version_info[0] == 2:
  101. class compat_cookiejar_Cookie(compat_cookiejar.Cookie):
  102. def __init__(self, version, name, value, *args, **kwargs):
  103. if isinstance(name, compat_str):
  104. name = name.encode()
  105. if isinstance(value, compat_str):
  106. value = value.encode()
  107. compat_cookiejar.Cookie.__init__(self, version, name, value, *args, **kwargs)
  108. else:
  109. compat_cookiejar_Cookie = compat_cookiejar.Cookie
  110. compat_http_cookiejar_Cookie = compat_cookiejar_Cookie
  111. try:
  112. import http.cookies as compat_cookies
  113. except ImportError: # Python 2
  114. import Cookie as compat_cookies
  115. compat_http_cookies = compat_cookies
  116. if sys.version_info[0] == 2 or sys.version_info < (3, 3):
  117. class compat_cookies_SimpleCookie(compat_cookies.SimpleCookie):
  118. def load(self, rawdata):
  119. must_have_value = 0
  120. if not isinstance(rawdata, dict):
  121. if sys.version_info[:2] != (2, 7) or sys.platform.startswith('java'):
  122. # attribute must have value for parsing
  123. rawdata, must_have_value = re.subn(
  124. r'(?i)(;\s*)(secure|httponly)(\s*(?:;|$))', r'\1\2=\2\3', rawdata)
  125. if sys.version_info[0] == 2:
  126. if isinstance(rawdata, compat_str):
  127. rawdata = str(rawdata)
  128. super(compat_cookies_SimpleCookie, self).load(rawdata)
  129. if must_have_value > 0:
  130. for morsel in self.values():
  131. for attr in ('secure', 'httponly'):
  132. if morsel.get(attr):
  133. morsel[attr] = True
  134. else:
  135. compat_cookies_SimpleCookie = compat_cookies.SimpleCookie
  136. compat_http_cookies_SimpleCookie = compat_cookies_SimpleCookie
  137. try:
  138. import html.entities as compat_html_entities
  139. except ImportError: # Python 2
  140. import htmlentitydefs as compat_html_entities
  141. try: # Python >= 3.3
  142. compat_html_entities_html5 = compat_html_entities.html5
  143. except AttributeError:
  144. # Copied from CPython 3.5.1 html/entities.py
  145. compat_html_entities_html5 = {
  146. 'Aacute': '\xc1',
  147. 'aacute': '\xe1',
  148. 'Aacute;': '\xc1',
  149. 'aacute;': '\xe1',
  150. 'Abreve;': '\u0102',
  151. 'abreve;': '\u0103',
  152. 'ac;': '\u223e',
  153. 'acd;': '\u223f',
  154. 'acE;': '\u223e\u0333',
  155. 'Acirc': '\xc2',
  156. 'acirc': '\xe2',
  157. 'Acirc;': '\xc2',
  158. 'acirc;': '\xe2',
  159. 'acute': '\xb4',
  160. 'acute;': '\xb4',
  161. 'Acy;': '\u0410',
  162. 'acy;': '\u0430',
  163. 'AElig': '\xc6',
  164. 'aelig': '\xe6',
  165. 'AElig;': '\xc6',
  166. 'aelig;': '\xe6',
  167. 'af;': '\u2061',
  168. 'Afr;': '\U0001d504',
  169. 'afr;': '\U0001d51e',
  170. 'Agrave': '\xc0',
  171. 'agrave': '\xe0',
  172. 'Agrave;': '\xc0',
  173. 'agrave;': '\xe0',
  174. 'alefsym;': '\u2135',
  175. 'aleph;': '\u2135',
  176. 'Alpha;': '\u0391',
  177. 'alpha;': '\u03b1',
  178. 'Amacr;': '\u0100',
  179. 'amacr;': '\u0101',
  180. 'amalg;': '\u2a3f',
  181. 'AMP': '&',
  182. 'amp': '&',
  183. 'AMP;': '&',
  184. 'amp;': '&',
  185. 'And;': '\u2a53',
  186. 'and;': '\u2227',
  187. 'andand;': '\u2a55',
  188. 'andd;': '\u2a5c',
  189. 'andslope;': '\u2a58',
  190. 'andv;': '\u2a5a',
  191. 'ang;': '\u2220',
  192. 'ange;': '\u29a4',
  193. 'angle;': '\u2220',
  194. 'angmsd;': '\u2221',
  195. 'angmsdaa;': '\u29a8',
  196. 'angmsdab;': '\u29a9',
  197. 'angmsdac;': '\u29aa',
  198. 'angmsdad;': '\u29ab',
  199. 'angmsdae;': '\u29ac',
  200. 'angmsdaf;': '\u29ad',
  201. 'angmsdag;': '\u29ae',
  202. 'angmsdah;': '\u29af',
  203. 'angrt;': '\u221f',
  204. 'angrtvb;': '\u22be',
  205. 'angrtvbd;': '\u299d',
  206. 'angsph;': '\u2222',
  207. 'angst;': '\xc5',
  208. 'angzarr;': '\u237c',
  209. 'Aogon;': '\u0104',
  210. 'aogon;': '\u0105',
  211. 'Aopf;': '\U0001d538',
  212. 'aopf;': '\U0001d552',
  213. 'ap;': '\u2248',
  214. 'apacir;': '\u2a6f',
  215. 'apE;': '\u2a70',
  216. 'ape;': '\u224a',
  217. 'apid;': '\u224b',
  218. 'apos;': "'",
  219. 'ApplyFunction;': '\u2061',
  220. 'approx;': '\u2248',
  221. 'approxeq;': '\u224a',
  222. 'Aring': '\xc5',
  223. 'aring': '\xe5',
  224. 'Aring;': '\xc5',
  225. 'aring;': '\xe5',
  226. 'Ascr;': '\U0001d49c',
  227. 'ascr;': '\U0001d4b6',
  228. 'Assign;': '\u2254',
  229. 'ast;': '*',
  230. 'asymp;': '\u2248',
  231. 'asympeq;': '\u224d',
  232. 'Atilde': '\xc3',
  233. 'atilde': '\xe3',
  234. 'Atilde;': '\xc3',
  235. 'atilde;': '\xe3',
  236. 'Auml': '\xc4',
  237. 'auml': '\xe4',
  238. 'Auml;': '\xc4',
  239. 'auml;': '\xe4',
  240. 'awconint;': '\u2233',
  241. 'awint;': '\u2a11',
  242. 'backcong;': '\u224c',
  243. 'backepsilon;': '\u03f6',
  244. 'backprime;': '\u2035',
  245. 'backsim;': '\u223d',
  246. 'backsimeq;': '\u22cd',
  247. 'Backslash;': '\u2216',
  248. 'Barv;': '\u2ae7',
  249. 'barvee;': '\u22bd',
  250. 'Barwed;': '\u2306',
  251. 'barwed;': '\u2305',
  252. 'barwedge;': '\u2305',
  253. 'bbrk;': '\u23b5',
  254. 'bbrktbrk;': '\u23b6',
  255. 'bcong;': '\u224c',
  256. 'Bcy;': '\u0411',
  257. 'bcy;': '\u0431',
  258. 'bdquo;': '\u201e',
  259. 'becaus;': '\u2235',
  260. 'Because;': '\u2235',
  261. 'because;': '\u2235',
  262. 'bemptyv;': '\u29b0',
  263. 'bepsi;': '\u03f6',
  264. 'bernou;': '\u212c',
  265. 'Bernoullis;': '\u212c',
  266. 'Beta;': '\u0392',
  267. 'beta;': '\u03b2',
  268. 'beth;': '\u2136',
  269. 'between;': '\u226c',
  270. 'Bfr;': '\U0001d505',
  271. 'bfr;': '\U0001d51f',
  272. 'bigcap;': '\u22c2',
  273. 'bigcirc;': '\u25ef',
  274. 'bigcup;': '\u22c3',
  275. 'bigodot;': '\u2a00',
  276. 'bigoplus;': '\u2a01',
  277. 'bigotimes;': '\u2a02',
  278. 'bigsqcup;': '\u2a06',
  279. 'bigstar;': '\u2605',
  280. 'bigtriangledown;': '\u25bd',
  281. 'bigtriangleup;': '\u25b3',
  282. 'biguplus;': '\u2a04',
  283. 'bigvee;': '\u22c1',
  284. 'bigwedge;': '\u22c0',
  285. 'bkarow;': '\u290d',
  286. 'blacklozenge;': '\u29eb',
  287. 'blacksquare;': '\u25aa',
  288. 'blacktriangle;': '\u25b4',
  289. 'blacktriangledown;': '\u25be',
  290. 'blacktriangleleft;': '\u25c2',
  291. 'blacktriangleright;': '\u25b8',
  292. 'blank;': '\u2423',
  293. 'blk12;': '\u2592',
  294. 'blk14;': '\u2591',
  295. 'blk34;': '\u2593',
  296. 'block;': '\u2588',
  297. 'bne;': '=\u20e5',
  298. 'bnequiv;': '\u2261\u20e5',
  299. 'bNot;': '\u2aed',
  300. 'bnot;': '\u2310',
  301. 'Bopf;': '\U0001d539',
  302. 'bopf;': '\U0001d553',
  303. 'bot;': '\u22a5',
  304. 'bottom;': '\u22a5',
  305. 'bowtie;': '\u22c8',
  306. 'boxbox;': '\u29c9',
  307. 'boxDL;': '\u2557',
  308. 'boxDl;': '\u2556',
  309. 'boxdL;': '\u2555',
  310. 'boxdl;': '\u2510',
  311. 'boxDR;': '\u2554',
  312. 'boxDr;': '\u2553',
  313. 'boxdR;': '\u2552',
  314. 'boxdr;': '\u250c',
  315. 'boxH;': '\u2550',
  316. 'boxh;': '\u2500',
  317. 'boxHD;': '\u2566',
  318. 'boxHd;': '\u2564',
  319. 'boxhD;': '\u2565',
  320. 'boxhd;': '\u252c',
  321. 'boxHU;': '\u2569',
  322. 'boxHu;': '\u2567',
  323. 'boxhU;': '\u2568',
  324. 'boxhu;': '\u2534',
  325. 'boxminus;': '\u229f',
  326. 'boxplus;': '\u229e',
  327. 'boxtimes;': '\u22a0',
  328. 'boxUL;': '\u255d',
  329. 'boxUl;': '\u255c',
  330. 'boxuL;': '\u255b',
  331. 'boxul;': '\u2518',
  332. 'boxUR;': '\u255a',
  333. 'boxUr;': '\u2559',
  334. 'boxuR;': '\u2558',
  335. 'boxur;': '\u2514',
  336. 'boxV;': '\u2551',
  337. 'boxv;': '\u2502',
  338. 'boxVH;': '\u256c',
  339. 'boxVh;': '\u256b',
  340. 'boxvH;': '\u256a',
  341. 'boxvh;': '\u253c',
  342. 'boxVL;': '\u2563',
  343. 'boxVl;': '\u2562',
  344. 'boxvL;': '\u2561',
  345. 'boxvl;': '\u2524',
  346. 'boxVR;': '\u2560',
  347. 'boxVr;': '\u255f',
  348. 'boxvR;': '\u255e',
  349. 'boxvr;': '\u251c',
  350. 'bprime;': '\u2035',
  351. 'Breve;': '\u02d8',
  352. 'breve;': '\u02d8',
  353. 'brvbar': '\xa6',
  354. 'brvbar;': '\xa6',
  355. 'Bscr;': '\u212c',
  356. 'bscr;': '\U0001d4b7',
  357. 'bsemi;': '\u204f',
  358. 'bsim;': '\u223d',
  359. 'bsime;': '\u22cd',
  360. 'bsol;': '\\',
  361. 'bsolb;': '\u29c5',
  362. 'bsolhsub;': '\u27c8',
  363. 'bull;': '\u2022',
  364. 'bullet;': '\u2022',
  365. 'bump;': '\u224e',
  366. 'bumpE;': '\u2aae',
  367. 'bumpe;': '\u224f',
  368. 'Bumpeq;': '\u224e',
  369. 'bumpeq;': '\u224f',
  370. 'Cacute;': '\u0106',
  371. 'cacute;': '\u0107',
  372. 'Cap;': '\u22d2',
  373. 'cap;': '\u2229',
  374. 'capand;': '\u2a44',
  375. 'capbrcup;': '\u2a49',
  376. 'capcap;': '\u2a4b',
  377. 'capcup;': '\u2a47',
  378. 'capdot;': '\u2a40',
  379. 'CapitalDifferentialD;': '\u2145',
  380. 'caps;': '\u2229\ufe00',
  381. 'caret;': '\u2041',
  382. 'caron;': '\u02c7',
  383. 'Cayleys;': '\u212d',
  384. 'ccaps;': '\u2a4d',
  385. 'Ccaron;': '\u010c',
  386. 'ccaron;': '\u010d',
  387. 'Ccedil': '\xc7',
  388. 'ccedil': '\xe7',
  389. 'Ccedil;': '\xc7',
  390. 'ccedil;': '\xe7',
  391. 'Ccirc;': '\u0108',
  392. 'ccirc;': '\u0109',
  393. 'Cconint;': '\u2230',
  394. 'ccups;': '\u2a4c',
  395. 'ccupssm;': '\u2a50',
  396. 'Cdot;': '\u010a',
  397. 'cdot;': '\u010b',
  398. 'cedil': '\xb8',
  399. 'cedil;': '\xb8',
  400. 'Cedilla;': '\xb8',
  401. 'cemptyv;': '\u29b2',
  402. 'cent': '\xa2',
  403. 'cent;': '\xa2',
  404. 'CenterDot;': '\xb7',
  405. 'centerdot;': '\xb7',
  406. 'Cfr;': '\u212d',
  407. 'cfr;': '\U0001d520',
  408. 'CHcy;': '\u0427',
  409. 'chcy;': '\u0447',
  410. 'check;': '\u2713',
  411. 'checkmark;': '\u2713',
  412. 'Chi;': '\u03a7',
  413. 'chi;': '\u03c7',
  414. 'cir;': '\u25cb',
  415. 'circ;': '\u02c6',
  416. 'circeq;': '\u2257',
  417. 'circlearrowleft;': '\u21ba',
  418. 'circlearrowright;': '\u21bb',
  419. 'circledast;': '\u229b',
  420. 'circledcirc;': '\u229a',
  421. 'circleddash;': '\u229d',
  422. 'CircleDot;': '\u2299',
  423. 'circledR;': '\xae',
  424. 'circledS;': '\u24c8',
  425. 'CircleMinus;': '\u2296',
  426. 'CirclePlus;': '\u2295',
  427. 'CircleTimes;': '\u2297',
  428. 'cirE;': '\u29c3',
  429. 'cire;': '\u2257',
  430. 'cirfnint;': '\u2a10',
  431. 'cirmid;': '\u2aef',
  432. 'cirscir;': '\u29c2',
  433. 'ClockwiseContourIntegral;': '\u2232',
  434. 'CloseCurlyDoubleQuote;': '\u201d',
  435. 'CloseCurlyQuote;': '\u2019',
  436. 'clubs;': '\u2663',
  437. 'clubsuit;': '\u2663',
  438. 'Colon;': '\u2237',
  439. 'colon;': ':',
  440. 'Colone;': '\u2a74',
  441. 'colone;': '\u2254',
  442. 'coloneq;': '\u2254',
  443. 'comma;': ',',
  444. 'commat;': '@',
  445. 'comp;': '\u2201',
  446. 'compfn;': '\u2218',
  447. 'complement;': '\u2201',
  448. 'complexes;': '\u2102',
  449. 'cong;': '\u2245',
  450. 'congdot;': '\u2a6d',
  451. 'Congruent;': '\u2261',
  452. 'Conint;': '\u222f',
  453. 'conint;': '\u222e',
  454. 'ContourIntegral;': '\u222e',
  455. 'Copf;': '\u2102',
  456. 'copf;': '\U0001d554',
  457. 'coprod;': '\u2210',
  458. 'Coproduct;': '\u2210',
  459. 'COPY': '\xa9',
  460. 'copy': '\xa9',
  461. 'COPY;': '\xa9',
  462. 'copy;': '\xa9',
  463. 'copysr;': '\u2117',
  464. 'CounterClockwiseContourIntegral;': '\u2233',
  465. 'crarr;': '\u21b5',
  466. 'Cross;': '\u2a2f',
  467. 'cross;': '\u2717',
  468. 'Cscr;': '\U0001d49e',
  469. 'cscr;': '\U0001d4b8',
  470. 'csub;': '\u2acf',
  471. 'csube;': '\u2ad1',
  472. 'csup;': '\u2ad0',
  473. 'csupe;': '\u2ad2',
  474. 'ctdot;': '\u22ef',
  475. 'cudarrl;': '\u2938',
  476. 'cudarrr;': '\u2935',
  477. 'cuepr;': '\u22de',
  478. 'cuesc;': '\u22df',
  479. 'cularr;': '\u21b6',
  480. 'cularrp;': '\u293d',
  481. 'Cup;': '\u22d3',
  482. 'cup;': '\u222a',
  483. 'cupbrcap;': '\u2a48',
  484. 'CupCap;': '\u224d',
  485. 'cupcap;': '\u2a46',
  486. 'cupcup;': '\u2a4a',
  487. 'cupdot;': '\u228d',
  488. 'cupor;': '\u2a45',
  489. 'cups;': '\u222a\ufe00',
  490. 'curarr;': '\u21b7',
  491. 'curarrm;': '\u293c',
  492. 'curlyeqprec;': '\u22de',
  493. 'curlyeqsucc;': '\u22df',
  494. 'curlyvee;': '\u22ce',
  495. 'curlywedge;': '\u22cf',
  496. 'curren': '\xa4',
  497. 'curren;': '\xa4',
  498. 'curvearrowleft;': '\u21b6',
  499. 'curvearrowright;': '\u21b7',
  500. 'cuvee;': '\u22ce',
  501. 'cuwed;': '\u22cf',
  502. 'cwconint;': '\u2232',
  503. 'cwint;': '\u2231',
  504. 'cylcty;': '\u232d',
  505. 'Dagger;': '\u2021',
  506. 'dagger;': '\u2020',
  507. 'daleth;': '\u2138',
  508. 'Darr;': '\u21a1',
  509. 'dArr;': '\u21d3',
  510. 'darr;': '\u2193',
  511. 'dash;': '\u2010',
  512. 'Dashv;': '\u2ae4',
  513. 'dashv;': '\u22a3',
  514. 'dbkarow;': '\u290f',
  515. 'dblac;': '\u02dd',
  516. 'Dcaron;': '\u010e',
  517. 'dcaron;': '\u010f',
  518. 'Dcy;': '\u0414',
  519. 'dcy;': '\u0434',
  520. 'DD;': '\u2145',
  521. 'dd;': '\u2146',
  522. 'ddagger;': '\u2021',
  523. 'ddarr;': '\u21ca',
  524. 'DDotrahd;': '\u2911',
  525. 'ddotseq;': '\u2a77',
  526. 'deg': '\xb0',
  527. 'deg;': '\xb0',
  528. 'Del;': '\u2207',
  529. 'Delta;': '\u0394',
  530. 'delta;': '\u03b4',
  531. 'demptyv;': '\u29b1',
  532. 'dfisht;': '\u297f',
  533. 'Dfr;': '\U0001d507',
  534. 'dfr;': '\U0001d521',
  535. 'dHar;': '\u2965',
  536. 'dharl;': '\u21c3',
  537. 'dharr;': '\u21c2',
  538. 'DiacriticalAcute;': '\xb4',
  539. 'DiacriticalDot;': '\u02d9',
  540. 'DiacriticalDoubleAcute;': '\u02dd',
  541. 'DiacriticalGrave;': '`',
  542. 'DiacriticalTilde;': '\u02dc',
  543. 'diam;': '\u22c4',
  544. 'Diamond;': '\u22c4',
  545. 'diamond;': '\u22c4',
  546. 'diamondsuit;': '\u2666',
  547. 'diams;': '\u2666',
  548. 'die;': '\xa8',
  549. 'DifferentialD;': '\u2146',
  550. 'digamma;': '\u03dd',
  551. 'disin;': '\u22f2',
  552. 'div;': '\xf7',
  553. 'divide': '\xf7',
  554. 'divide;': '\xf7',
  555. 'divideontimes;': '\u22c7',
  556. 'divonx;': '\u22c7',
  557. 'DJcy;': '\u0402',
  558. 'djcy;': '\u0452',
  559. 'dlcorn;': '\u231e',
  560. 'dlcrop;': '\u230d',
  561. 'dollar;': '$',
  562. 'Dopf;': '\U0001d53b',
  563. 'dopf;': '\U0001d555',
  564. 'Dot;': '\xa8',
  565. 'dot;': '\u02d9',
  566. 'DotDot;': '\u20dc',
  567. 'doteq;': '\u2250',
  568. 'doteqdot;': '\u2251',
  569. 'DotEqual;': '\u2250',
  570. 'dotminus;': '\u2238',
  571. 'dotplus;': '\u2214',
  572. 'dotsquare;': '\u22a1',
  573. 'doublebarwedge;': '\u2306',
  574. 'DoubleContourIntegral;': '\u222f',
  575. 'DoubleDot;': '\xa8',
  576. 'DoubleDownArrow;': '\u21d3',
  577. 'DoubleLeftArrow;': '\u21d0',
  578. 'DoubleLeftRightArrow;': '\u21d4',
  579. 'DoubleLeftTee;': '\u2ae4',
  580. 'DoubleLongLeftArrow;': '\u27f8',
  581. 'DoubleLongLeftRightArrow;': '\u27fa',
  582. 'DoubleLongRightArrow;': '\u27f9',
  583. 'DoubleRightArrow;': '\u21d2',
  584. 'DoubleRightTee;': '\u22a8',
  585. 'DoubleUpArrow;': '\u21d1',
  586. 'DoubleUpDownArrow;': '\u21d5',
  587. 'DoubleVerticalBar;': '\u2225',
  588. 'DownArrow;': '\u2193',
  589. 'Downarrow;': '\u21d3',
  590. 'downarrow;': '\u2193',
  591. 'DownArrowBar;': '\u2913',
  592. 'DownArrowUpArrow;': '\u21f5',
  593. 'DownBreve;': '\u0311',
  594. 'downdownarrows;': '\u21ca',
  595. 'downharpoonleft;': '\u21c3',
  596. 'downharpoonright;': '\u21c2',
  597. 'DownLeftRightVector;': '\u2950',
  598. 'DownLeftTeeVector;': '\u295e',
  599. 'DownLeftVector;': '\u21bd',
  600. 'DownLeftVectorBar;': '\u2956',
  601. 'DownRightTeeVector;': '\u295f',
  602. 'DownRightVector;': '\u21c1',
  603. 'DownRightVectorBar;': '\u2957',
  604. 'DownTee;': '\u22a4',
  605. 'DownTeeArrow;': '\u21a7',
  606. 'drbkarow;': '\u2910',
  607. 'drcorn;': '\u231f',
  608. 'drcrop;': '\u230c',
  609. 'Dscr;': '\U0001d49f',
  610. 'dscr;': '\U0001d4b9',
  611. 'DScy;': '\u0405',
  612. 'dscy;': '\u0455',
  613. 'dsol;': '\u29f6',
  614. 'Dstrok;': '\u0110',
  615. 'dstrok;': '\u0111',
  616. 'dtdot;': '\u22f1',
  617. 'dtri;': '\u25bf',
  618. 'dtrif;': '\u25be',
  619. 'duarr;': '\u21f5',
  620. 'duhar;': '\u296f',
  621. 'dwangle;': '\u29a6',
  622. 'DZcy;': '\u040f',
  623. 'dzcy;': '\u045f',
  624. 'dzigrarr;': '\u27ff',
  625. 'Eacute': '\xc9',
  626. 'eacute': '\xe9',
  627. 'Eacute;': '\xc9',
  628. 'eacute;': '\xe9',
  629. 'easter;': '\u2a6e',
  630. 'Ecaron;': '\u011a',
  631. 'ecaron;': '\u011b',
  632. 'ecir;': '\u2256',
  633. 'Ecirc': '\xca',
  634. 'ecirc': '\xea',
  635. 'Ecirc;': '\xca',
  636. 'ecirc;': '\xea',
  637. 'ecolon;': '\u2255',
  638. 'Ecy;': '\u042d',
  639. 'ecy;': '\u044d',
  640. 'eDDot;': '\u2a77',
  641. 'Edot;': '\u0116',
  642. 'eDot;': '\u2251',
  643. 'edot;': '\u0117',
  644. 'ee;': '\u2147',
  645. 'efDot;': '\u2252',
  646. 'Efr;': '\U0001d508',
  647. 'efr;': '\U0001d522',
  648. 'eg;': '\u2a9a',
  649. 'Egrave': '\xc8',
  650. 'egrave': '\xe8',
  651. 'Egrave;': '\xc8',
  652. 'egrave;': '\xe8',
  653. 'egs;': '\u2a96',
  654. 'egsdot;': '\u2a98',
  655. 'el;': '\u2a99',
  656. 'Element;': '\u2208',
  657. 'elinters;': '\u23e7',
  658. 'ell;': '\u2113',
  659. 'els;': '\u2a95',
  660. 'elsdot;': '\u2a97',
  661. 'Emacr;': '\u0112',
  662. 'emacr;': '\u0113',
  663. 'empty;': '\u2205',
  664. 'emptyset;': '\u2205',
  665. 'EmptySmallSquare;': '\u25fb',
  666. 'emptyv;': '\u2205',
  667. 'EmptyVerySmallSquare;': '\u25ab',
  668. 'emsp13;': '\u2004',
  669. 'emsp14;': '\u2005',
  670. 'emsp;': '\u2003',
  671. 'ENG;': '\u014a',
  672. 'eng;': '\u014b',
  673. 'ensp;': '\u2002',
  674. 'Eogon;': '\u0118',
  675. 'eogon;': '\u0119',
  676. 'Eopf;': '\U0001d53c',
  677. 'eopf;': '\U0001d556',
  678. 'epar;': '\u22d5',
  679. 'eparsl;': '\u29e3',
  680. 'eplus;': '\u2a71',
  681. 'epsi;': '\u03b5',
  682. 'Epsilon;': '\u0395',
  683. 'epsilon;': '\u03b5',
  684. 'epsiv;': '\u03f5',
  685. 'eqcirc;': '\u2256',
  686. 'eqcolon;': '\u2255',
  687. 'eqsim;': '\u2242',
  688. 'eqslantgtr;': '\u2a96',
  689. 'eqslantless;': '\u2a95',
  690. 'Equal;': '\u2a75',
  691. 'equals;': '=',
  692. 'EqualTilde;': '\u2242',
  693. 'equest;': '\u225f',
  694. 'Equilibrium;': '\u21cc',
  695. 'equiv;': '\u2261',
  696. 'equivDD;': '\u2a78',
  697. 'eqvparsl;': '\u29e5',
  698. 'erarr;': '\u2971',
  699. 'erDot;': '\u2253',
  700. 'Escr;': '\u2130',
  701. 'escr;': '\u212f',
  702. 'esdot;': '\u2250',
  703. 'Esim;': '\u2a73',
  704. 'esim;': '\u2242',
  705. 'Eta;': '\u0397',
  706. 'eta;': '\u03b7',
  707. 'ETH': '\xd0',
  708. 'eth': '\xf0',
  709. 'ETH;': '\xd0',
  710. 'eth;': '\xf0',
  711. 'Euml': '\xcb',
  712. 'euml': '\xeb',
  713. 'Euml;': '\xcb',
  714. 'euml;': '\xeb',
  715. 'euro;': '\u20ac',
  716. 'excl;': '!',
  717. 'exist;': '\u2203',
  718. 'Exists;': '\u2203',
  719. 'expectation;': '\u2130',
  720. 'ExponentialE;': '\u2147',
  721. 'exponentiale;': '\u2147',
  722. 'fallingdotseq;': '\u2252',
  723. 'Fcy;': '\u0424',
  724. 'fcy;': '\u0444',
  725. 'female;': '\u2640',
  726. 'ffilig;': '\ufb03',
  727. 'fflig;': '\ufb00',
  728. 'ffllig;': '\ufb04',
  729. 'Ffr;': '\U0001d509',
  730. 'ffr;': '\U0001d523',
  731. 'filig;': '\ufb01',
  732. 'FilledSmallSquare;': '\u25fc',
  733. 'FilledVerySmallSquare;': '\u25aa',
  734. 'fjlig;': 'fj',
  735. 'flat;': '\u266d',
  736. 'fllig;': '\ufb02',
  737. 'fltns;': '\u25b1',
  738. 'fnof;': '\u0192',
  739. 'Fopf;': '\U0001d53d',
  740. 'fopf;': '\U0001d557',
  741. 'ForAll;': '\u2200',
  742. 'forall;': '\u2200',
  743. 'fork;': '\u22d4',
  744. 'forkv;': '\u2ad9',
  745. 'Fouriertrf;': '\u2131',
  746. 'fpartint;': '\u2a0d',
  747. 'frac12': '\xbd',
  748. 'frac12;': '\xbd',
  749. 'frac13;': '\u2153',
  750. 'frac14': '\xbc',
  751. 'frac14;': '\xbc',
  752. 'frac15;': '\u2155',
  753. 'frac16;': '\u2159',
  754. 'frac18;': '\u215b',
  755. 'frac23;': '\u2154',
  756. 'frac25;': '\u2156',
  757. 'frac34': '\xbe',
  758. 'frac34;': '\xbe',
  759. 'frac35;': '\u2157',
  760. 'frac38;': '\u215c',
  761. 'frac45;': '\u2158',
  762. 'frac56;': '\u215a',
  763. 'frac58;': '\u215d',
  764. 'frac78;': '\u215e',
  765. 'frasl;': '\u2044',
  766. 'frown;': '\u2322',
  767. 'Fscr;': '\u2131',
  768. 'fscr;': '\U0001d4bb',
  769. 'gacute;': '\u01f5',
  770. 'Gamma;': '\u0393',
  771. 'gamma;': '\u03b3',
  772. 'Gammad;': '\u03dc',
  773. 'gammad;': '\u03dd',
  774. 'gap;': '\u2a86',
  775. 'Gbreve;': '\u011e',
  776. 'gbreve;': '\u011f',
  777. 'Gcedil;': '\u0122',
  778. 'Gcirc;': '\u011c',
  779. 'gcirc;': '\u011d',
  780. 'Gcy;': '\u0413',
  781. 'gcy;': '\u0433',
  782. 'Gdot;': '\u0120',
  783. 'gdot;': '\u0121',
  784. 'gE;': '\u2267',
  785. 'ge;': '\u2265',
  786. 'gEl;': '\u2a8c',
  787. 'gel;': '\u22db',
  788. 'geq;': '\u2265',
  789. 'geqq;': '\u2267',
  790. 'geqslant;': '\u2a7e',
  791. 'ges;': '\u2a7e',
  792. 'gescc;': '\u2aa9',
  793. 'gesdot;': '\u2a80',
  794. 'gesdoto;': '\u2a82',
  795. 'gesdotol;': '\u2a84',
  796. 'gesl;': '\u22db\ufe00',
  797. 'gesles;': '\u2a94',
  798. 'Gfr;': '\U0001d50a',
  799. 'gfr;': '\U0001d524',
  800. 'Gg;': '\u22d9',
  801. 'gg;': '\u226b',
  802. 'ggg;': '\u22d9',
  803. 'gimel;': '\u2137',
  804. 'GJcy;': '\u0403',
  805. 'gjcy;': '\u0453',
  806. 'gl;': '\u2277',
  807. 'gla;': '\u2aa5',
  808. 'glE;': '\u2a92',
  809. 'glj;': '\u2aa4',
  810. 'gnap;': '\u2a8a',
  811. 'gnapprox;': '\u2a8a',
  812. 'gnE;': '\u2269',
  813. 'gne;': '\u2a88',
  814. 'gneq;': '\u2a88',
  815. 'gneqq;': '\u2269',
  816. 'gnsim;': '\u22e7',
  817. 'Gopf;': '\U0001d53e',
  818. 'gopf;': '\U0001d558',
  819. 'grave;': '`',
  820. 'GreaterEqual;': '\u2265',
  821. 'GreaterEqualLess;': '\u22db',
  822. 'GreaterFullEqual;': '\u2267',
  823. 'GreaterGreater;': '\u2aa2',
  824. 'GreaterLess;': '\u2277',
  825. 'GreaterSlantEqual;': '\u2a7e',
  826. 'GreaterTilde;': '\u2273',
  827. 'Gscr;': '\U0001d4a2',
  828. 'gscr;': '\u210a',
  829. 'gsim;': '\u2273',
  830. 'gsime;': '\u2a8e',
  831. 'gsiml;': '\u2a90',
  832. 'GT': '>',
  833. 'gt': '>',
  834. 'GT;': '>',
  835. 'Gt;': '\u226b',
  836. 'gt;': '>',
  837. 'gtcc;': '\u2aa7',
  838. 'gtcir;': '\u2a7a',
  839. 'gtdot;': '\u22d7',
  840. 'gtlPar;': '\u2995',
  841. 'gtquest;': '\u2a7c',
  842. 'gtrapprox;': '\u2a86',
  843. 'gtrarr;': '\u2978',
  844. 'gtrdot;': '\u22d7',
  845. 'gtreqless;': '\u22db',
  846. 'gtreqqless;': '\u2a8c',
  847. 'gtrless;': '\u2277',
  848. 'gtrsim;': '\u2273',
  849. 'gvertneqq;': '\u2269\ufe00',
  850. 'gvnE;': '\u2269\ufe00',
  851. 'Hacek;': '\u02c7',
  852. 'hairsp;': '\u200a',
  853. 'half;': '\xbd',
  854. 'hamilt;': '\u210b',
  855. 'HARDcy;': '\u042a',
  856. 'hardcy;': '\u044a',
  857. 'hArr;': '\u21d4',
  858. 'harr;': '\u2194',
  859. 'harrcir;': '\u2948',
  860. 'harrw;': '\u21ad',
  861. 'Hat;': '^',
  862. 'hbar;': '\u210f',
  863. 'Hcirc;': '\u0124',
  864. 'hcirc;': '\u0125',
  865. 'hearts;': '\u2665',
  866. 'heartsuit;': '\u2665',
  867. 'hellip;': '\u2026',
  868. 'hercon;': '\u22b9',
  869. 'Hfr;': '\u210c',
  870. 'hfr;': '\U0001d525',
  871. 'HilbertSpace;': '\u210b',
  872. 'hksearow;': '\u2925',
  873. 'hkswarow;': '\u2926',
  874. 'hoarr;': '\u21ff',
  875. 'homtht;': '\u223b',
  876. 'hookleftarrow;': '\u21a9',
  877. 'hookrightarrow;': '\u21aa',
  878. 'Hopf;': '\u210d',
  879. 'hopf;': '\U0001d559',
  880. 'horbar;': '\u2015',
  881. 'HorizontalLine;': '\u2500',
  882. 'Hscr;': '\u210b',
  883. 'hscr;': '\U0001d4bd',
  884. 'hslash;': '\u210f',
  885. 'Hstrok;': '\u0126',
  886. 'hstrok;': '\u0127',
  887. 'HumpDownHump;': '\u224e',
  888. 'HumpEqual;': '\u224f',
  889. 'hybull;': '\u2043',
  890. 'hyphen;': '\u2010',
  891. 'Iacute': '\xcd',
  892. 'iacute': '\xed',
  893. 'Iacute;': '\xcd',
  894. 'iacute;': '\xed',
  895. 'ic;': '\u2063',
  896. 'Icirc': '\xce',
  897. 'icirc': '\xee',
  898. 'Icirc;': '\xce',
  899. 'icirc;': '\xee',
  900. 'Icy;': '\u0418',
  901. 'icy;': '\u0438',
  902. 'Idot;': '\u0130',
  903. 'IEcy;': '\u0415',
  904. 'iecy;': '\u0435',
  905. 'iexcl': '\xa1',
  906. 'iexcl;': '\xa1',
  907. 'iff;': '\u21d4',
  908. 'Ifr;': '\u2111',
  909. 'ifr;': '\U0001d526',
  910. 'Igrave': '\xcc',
  911. 'igrave': '\xec',
  912. 'Igrave;': '\xcc',
  913. 'igrave;': '\xec',
  914. 'ii;': '\u2148',
  915. 'iiiint;': '\u2a0c',
  916. 'iiint;': '\u222d',
  917. 'iinfin;': '\u29dc',
  918. 'iiota;': '\u2129',
  919. 'IJlig;': '\u0132',
  920. 'ijlig;': '\u0133',
  921. 'Im;': '\u2111',
  922. 'Imacr;': '\u012a',
  923. 'imacr;': '\u012b',
  924. 'image;': '\u2111',
  925. 'ImaginaryI;': '\u2148',
  926. 'imagline;': '\u2110',
  927. 'imagpart;': '\u2111',
  928. 'imath;': '\u0131',
  929. 'imof;': '\u22b7',
  930. 'imped;': '\u01b5',
  931. 'Implies;': '\u21d2',
  932. 'in;': '\u2208',
  933. 'incare;': '\u2105',
  934. 'infin;': '\u221e',
  935. 'infintie;': '\u29dd',
  936. 'inodot;': '\u0131',
  937. 'Int;': '\u222c',
  938. 'int;': '\u222b',
  939. 'intcal;': '\u22ba',
  940. 'integers;': '\u2124',
  941. 'Integral;': '\u222b',
  942. 'intercal;': '\u22ba',
  943. 'Intersection;': '\u22c2',
  944. 'intlarhk;': '\u2a17',
  945. 'intprod;': '\u2a3c',
  946. 'InvisibleComma;': '\u2063',
  947. 'InvisibleTimes;': '\u2062',
  948. 'IOcy;': '\u0401',
  949. 'iocy;': '\u0451',
  950. 'Iogon;': '\u012e',
  951. 'iogon;': '\u012f',
  952. 'Iopf;': '\U0001d540',
  953. 'iopf;': '\U0001d55a',
  954. 'Iota;': '\u0399',
  955. 'iota;': '\u03b9',
  956. 'iprod;': '\u2a3c',
  957. 'iquest': '\xbf',
  958. 'iquest;': '\xbf',
  959. 'Iscr;': '\u2110',
  960. 'iscr;': '\U0001d4be',
  961. 'isin;': '\u2208',
  962. 'isindot;': '\u22f5',
  963. 'isinE;': '\u22f9',
  964. 'isins;': '\u22f4',
  965. 'isinsv;': '\u22f3',
  966. 'isinv;': '\u2208',
  967. 'it;': '\u2062',
  968. 'Itilde;': '\u0128',
  969. 'itilde;': '\u0129',
  970. 'Iukcy;': '\u0406',
  971. 'iukcy;': '\u0456',
  972. 'Iuml': '\xcf',
  973. 'iuml': '\xef',
  974. 'Iuml;': '\xcf',
  975. 'iuml;': '\xef',
  976. 'Jcirc;': '\u0134',
  977. 'jcirc;': '\u0135',
  978. 'Jcy;': '\u0419',
  979. 'jcy;': '\u0439',
  980. 'Jfr;': '\U0001d50d',
  981. 'jfr;': '\U0001d527',
  982. 'jmath;': '\u0237',
  983. 'Jopf;': '\U0001d541',
  984. 'jopf;': '\U0001d55b',
  985. 'Jscr;': '\U0001d4a5',
  986. 'jscr;': '\U0001d4bf',
  987. 'Jsercy;': '\u0408',
  988. 'jsercy;': '\u0458',
  989. 'Jukcy;': '\u0404',
  990. 'jukcy;': '\u0454',
  991. 'Kappa;': '\u039a',
  992. 'kappa;': '\u03ba',
  993. 'kappav;': '\u03f0',
  994. 'Kcedil;': '\u0136',
  995. 'kcedil;': '\u0137',
  996. 'Kcy;': '\u041a',
  997. 'kcy;': '\u043a',
  998. 'Kfr;': '\U0001d50e',
  999. 'kfr;': '\U0001d528',
  1000. 'kgreen;': '\u0138',
  1001. 'KHcy;': '\u0425',
  1002. 'khcy;': '\u0445',
  1003. 'KJcy;': '\u040c',
  1004. 'kjcy;': '\u045c',
  1005. 'Kopf;': '\U0001d542',
  1006. 'kopf;': '\U0001d55c',
  1007. 'Kscr;': '\U0001d4a6',
  1008. 'kscr;': '\U0001d4c0',
  1009. 'lAarr;': '\u21da',
  1010. 'Lacute;': '\u0139',
  1011. 'lacute;': '\u013a',
  1012. 'laemptyv;': '\u29b4',
  1013. 'lagran;': '\u2112',
  1014. 'Lambda;': '\u039b',
  1015. 'lambda;': '\u03bb',
  1016. 'Lang;': '\u27ea',
  1017. 'lang;': '\u27e8',
  1018. 'langd;': '\u2991',
  1019. 'langle;': '\u27e8',
  1020. 'lap;': '\u2a85',
  1021. 'Laplacetrf;': '\u2112',
  1022. 'laquo': '\xab',
  1023. 'laquo;': '\xab',
  1024. 'Larr;': '\u219e',
  1025. 'lArr;': '\u21d0',
  1026. 'larr;': '\u2190',
  1027. 'larrb;': '\u21e4',
  1028. 'larrbfs;': '\u291f',
  1029. 'larrfs;': '\u291d',
  1030. 'larrhk;': '\u21a9',
  1031. 'larrlp;': '\u21ab',
  1032. 'larrpl;': '\u2939',
  1033. 'larrsim;': '\u2973',
  1034. 'larrtl;': '\u21a2',
  1035. 'lat;': '\u2aab',
  1036. 'lAtail;': '\u291b',
  1037. 'latail;': '\u2919',
  1038. 'late;': '\u2aad',
  1039. 'lates;': '\u2aad\ufe00',
  1040. 'lBarr;': '\u290e',
  1041. 'lbarr;': '\u290c',
  1042. 'lbbrk;': '\u2772',
  1043. 'lbrace;': '{',
  1044. 'lbrack;': '[',
  1045. 'lbrke;': '\u298b',
  1046. 'lbrksld;': '\u298f',
  1047. 'lbrkslu;': '\u298d',
  1048. 'Lcaron;': '\u013d',
  1049. 'lcaron;': '\u013e',
  1050. 'Lcedil;': '\u013b',
  1051. 'lcedil;': '\u013c',
  1052. 'lceil;': '\u2308',
  1053. 'lcub;': '{',
  1054. 'Lcy;': '\u041b',
  1055. 'lcy;': '\u043b',
  1056. 'ldca;': '\u2936',
  1057. 'ldquo;': '\u201c',
  1058. 'ldquor;': '\u201e',
  1059. 'ldrdhar;': '\u2967',
  1060. 'ldrushar;': '\u294b',
  1061. 'ldsh;': '\u21b2',
  1062. 'lE;': '\u2266',
  1063. 'le;': '\u2264',
  1064. 'LeftAngleBracket;': '\u27e8',
  1065. 'LeftArrow;': '\u2190',
  1066. 'Leftarrow;': '\u21d0',
  1067. 'leftarrow;': '\u2190',
  1068. 'LeftArrowBar;': '\u21e4',
  1069. 'LeftArrowRightArrow;': '\u21c6',
  1070. 'leftarrowtail;': '\u21a2',
  1071. 'LeftCeiling;': '\u2308',
  1072. 'LeftDoubleBracket;': '\u27e6',
  1073. 'LeftDownTeeVector;': '\u2961',
  1074. 'LeftDownVector;': '\u21c3',
  1075. 'LeftDownVectorBar;': '\u2959',
  1076. 'LeftFloor;': '\u230a',
  1077. 'leftharpoondown;': '\u21bd',
  1078. 'leftharpoonup;': '\u21bc',
  1079. 'leftleftarrows;': '\u21c7',
  1080. 'LeftRightArrow;': '\u2194',
  1081. 'Leftrightarrow;': '\u21d4',
  1082. 'leftrightarrow;': '\u2194',
  1083. 'leftrightarrows;': '\u21c6',
  1084. 'leftrightharpoons;': '\u21cb',
  1085. 'leftrightsquigarrow;': '\u21ad',
  1086. 'LeftRightVector;': '\u294e',
  1087. 'LeftTee;': '\u22a3',
  1088. 'LeftTeeArrow;': '\u21a4',
  1089. 'LeftTeeVector;': '\u295a',
  1090. 'leftthreetimes;': '\u22cb',
  1091. 'LeftTriangle;': '\u22b2',
  1092. 'LeftTriangleBar;': '\u29cf',
  1093. 'LeftTriangleEqual;': '\u22b4',
  1094. 'LeftUpDownVector;': '\u2951',
  1095. 'LeftUpTeeVector;': '\u2960',
  1096. 'LeftUpVector;': '\u21bf',
  1097. 'LeftUpVectorBar;': '\u2958',
  1098. 'LeftVector;': '\u21bc',
  1099. 'LeftVectorBar;': '\u2952',
  1100. 'lEg;': '\u2a8b',
  1101. 'leg;': '\u22da',
  1102. 'leq;': '\u2264',
  1103. 'leqq;': '\u2266',
  1104. 'leqslant;': '\u2a7d',
  1105. 'les;': '\u2a7d',
  1106. 'lescc;': '\u2aa8',
  1107. 'lesdot;': '\u2a7f',
  1108. 'lesdoto;': '\u2a81',
  1109. 'lesdotor;': '\u2a83',
  1110. 'lesg;': '\u22da\ufe00',
  1111. 'lesges;': '\u2a93',
  1112. 'lessapprox;': '\u2a85',
  1113. 'lessdot;': '\u22d6',
  1114. 'lesseqgtr;': '\u22da',
  1115. 'lesseqqgtr;': '\u2a8b',
  1116. 'LessEqualGreater;': '\u22da',
  1117. 'LessFullEqual;': '\u2266',
  1118. 'LessGreater;': '\u2276',
  1119. 'lessgtr;': '\u2276',
  1120. 'LessLess;': '\u2aa1',
  1121. 'lesssim;': '\u2272',
  1122. 'LessSlantEqual;': '\u2a7d',
  1123. 'LessTilde;': '\u2272',
  1124. 'lfisht;': '\u297c',
  1125. 'lfloor;': '\u230a',
  1126. 'Lfr;': '\U0001d50f',
  1127. 'lfr;': '\U0001d529',
  1128. 'lg;': '\u2276',
  1129. 'lgE;': '\u2a91',
  1130. 'lHar;': '\u2962',
  1131. 'lhard;': '\u21bd',
  1132. 'lharu;': '\u21bc',
  1133. 'lharul;': '\u296a',
  1134. 'lhblk;': '\u2584',
  1135. 'LJcy;': '\u0409',
  1136. 'ljcy;': '\u0459',
  1137. 'Ll;': '\u22d8',
  1138. 'll;': '\u226a',
  1139. 'llarr;': '\u21c7',
  1140. 'llcorner;': '\u231e',
  1141. 'Lleftarrow;': '\u21da',
  1142. 'llhard;': '\u296b',
  1143. 'lltri;': '\u25fa',
  1144. 'Lmidot;': '\u013f',
  1145. 'lmidot;': '\u0140',
  1146. 'lmoust;': '\u23b0',
  1147. 'lmoustache;': '\u23b0',
  1148. 'lnap;': '\u2a89',
  1149. 'lnapprox;': '\u2a89',
  1150. 'lnE;': '\u2268',
  1151. 'lne;': '\u2a87',
  1152. 'lneq;': '\u2a87',
  1153. 'lneqq;': '\u2268',
  1154. 'lnsim;': '\u22e6',
  1155. 'loang;': '\u27ec',
  1156. 'loarr;': '\u21fd',
  1157. 'lobrk;': '\u27e6',
  1158. 'LongLeftArrow;': '\u27f5',
  1159. 'Longleftarrow;': '\u27f8',
  1160. 'longleftarrow;': '\u27f5',
  1161. 'LongLeftRightArrow;': '\u27f7',
  1162. 'Longleftrightarrow;': '\u27fa',
  1163. 'longleftrightarrow;': '\u27f7',
  1164. 'longmapsto;': '\u27fc',
  1165. 'LongRightArrow;': '\u27f6',
  1166. 'Longrightarrow;': '\u27f9',
  1167. 'longrightarrow;': '\u27f6',
  1168. 'looparrowleft;': '\u21ab',
  1169. 'looparrowright;': '\u21ac',
  1170. 'lopar;': '\u2985',
  1171. 'Lopf;': '\U0001d543',
  1172. 'lopf;': '\U0001d55d',
  1173. 'loplus;': '\u2a2d',
  1174. 'lotimes;': '\u2a34',
  1175. 'lowast;': '\u2217',
  1176. 'lowbar;': '_',
  1177. 'LowerLeftArrow;': '\u2199',
  1178. 'LowerRightArrow;': '\u2198',
  1179. 'loz;': '\u25ca',
  1180. 'lozenge;': '\u25ca',
  1181. 'lozf;': '\u29eb',
  1182. 'lpar;': '(',
  1183. 'lparlt;': '\u2993',
  1184. 'lrarr;': '\u21c6',
  1185. 'lrcorner;': '\u231f',
  1186. 'lrhar;': '\u21cb',
  1187. 'lrhard;': '\u296d',
  1188. 'lrm;': '\u200e',
  1189. 'lrtri;': '\u22bf',
  1190. 'lsaquo;': '\u2039',
  1191. 'Lscr;': '\u2112',
  1192. 'lscr;': '\U0001d4c1',
  1193. 'Lsh;': '\u21b0',
  1194. 'lsh;': '\u21b0',
  1195. 'lsim;': '\u2272',
  1196. 'lsime;': '\u2a8d',
  1197. 'lsimg;': '\u2a8f',
  1198. 'lsqb;': '[',
  1199. 'lsquo;': '\u2018',
  1200. 'lsquor;': '\u201a',
  1201. 'Lstrok;': '\u0141',
  1202. 'lstrok;': '\u0142',
  1203. 'LT': '<',
  1204. 'lt': '<',
  1205. 'LT;': '<',
  1206. 'Lt;': '\u226a',
  1207. 'lt;': '<',
  1208. 'ltcc;': '\u2aa6',
  1209. 'ltcir;': '\u2a79',
  1210. 'ltdot;': '\u22d6',
  1211. 'lthree;': '\u22cb',
  1212. 'ltimes;': '\u22c9',
  1213. 'ltlarr;': '\u2976',
  1214. 'ltquest;': '\u2a7b',
  1215. 'ltri;': '\u25c3',
  1216. 'ltrie;': '\u22b4',
  1217. 'ltrif;': '\u25c2',
  1218. 'ltrPar;': '\u2996',
  1219. 'lurdshar;': '\u294a',
  1220. 'luruhar;': '\u2966',
  1221. 'lvertneqq;': '\u2268\ufe00',
  1222. 'lvnE;': '\u2268\ufe00',
  1223. 'macr': '\xaf',
  1224. 'macr;': '\xaf',
  1225. 'male;': '\u2642',
  1226. 'malt;': '\u2720',
  1227. 'maltese;': '\u2720',
  1228. 'Map;': '\u2905',
  1229. 'map;': '\u21a6',
  1230. 'mapsto;': '\u21a6',
  1231. 'mapstodown;': '\u21a7',
  1232. 'mapstoleft;': '\u21a4',
  1233. 'mapstoup;': '\u21a5',
  1234. 'marker;': '\u25ae',
  1235. 'mcomma;': '\u2a29',
  1236. 'Mcy;': '\u041c',
  1237. 'mcy;': '\u043c',
  1238. 'mdash;': '\u2014',
  1239. 'mDDot;': '\u223a',
  1240. 'measuredangle;': '\u2221',
  1241. 'MediumSpace;': '\u205f',
  1242. 'Mellintrf;': '\u2133',
  1243. 'Mfr;': '\U0001d510',
  1244. 'mfr;': '\U0001d52a',
  1245. 'mho;': '\u2127',
  1246. 'micro': '\xb5',
  1247. 'micro;': '\xb5',
  1248. 'mid;': '\u2223',
  1249. 'midast;': '*',
  1250. 'midcir;': '\u2af0',
  1251. 'middot': '\xb7',
  1252. 'middot;': '\xb7',
  1253. 'minus;': '\u2212',
  1254. 'minusb;': '\u229f',
  1255. 'minusd;': '\u2238',
  1256. 'minusdu;': '\u2a2a',
  1257. 'MinusPlus;': '\u2213',
  1258. 'mlcp;': '\u2adb',
  1259. 'mldr;': '\u2026',
  1260. 'mnplus;': '\u2213',
  1261. 'models;': '\u22a7',
  1262. 'Mopf;': '\U0001d544',
  1263. 'mopf;': '\U0001d55e',
  1264. 'mp;': '\u2213',
  1265. 'Mscr;': '\u2133',
  1266. 'mscr;': '\U0001d4c2',
  1267. 'mstpos;': '\u223e',
  1268. 'Mu;': '\u039c',
  1269. 'mu;': '\u03bc',
  1270. 'multimap;': '\u22b8',
  1271. 'mumap;': '\u22b8',
  1272. 'nabla;': '\u2207',
  1273. 'Nacute;': '\u0143',
  1274. 'nacute;': '\u0144',
  1275. 'nang;': '\u2220\u20d2',
  1276. 'nap;': '\u2249',
  1277. 'napE;': '\u2a70\u0338',
  1278. 'napid;': '\u224b\u0338',
  1279. 'napos;': '\u0149',
  1280. 'napprox;': '\u2249',
  1281. 'natur;': '\u266e',
  1282. 'natural;': '\u266e',
  1283. 'naturals;': '\u2115',
  1284. 'nbsp': '\xa0',
  1285. 'nbsp;': '\xa0',
  1286. 'nbump;': '\u224e\u0338',
  1287. 'nbumpe;': '\u224f\u0338',
  1288. 'ncap;': '\u2a43',
  1289. 'Ncaron;': '\u0147',
  1290. 'ncaron;': '\u0148',
  1291. 'Ncedil;': '\u0145',
  1292. 'ncedil;': '\u0146',
  1293. 'ncong;': '\u2247',
  1294. 'ncongdot;': '\u2a6d\u0338',
  1295. 'ncup;': '\u2a42',
  1296. 'Ncy;': '\u041d',
  1297. 'ncy;': '\u043d',
  1298. 'ndash;': '\u2013',
  1299. 'ne;': '\u2260',
  1300. 'nearhk;': '\u2924',
  1301. 'neArr;': '\u21d7',
  1302. 'nearr;': '\u2197',
  1303. 'nearrow;': '\u2197',
  1304. 'nedot;': '\u2250\u0338',
  1305. 'NegativeMediumSpace;': '\u200b',
  1306. 'NegativeThickSpace;': '\u200b',
  1307. 'NegativeThinSpace;': '\u200b',
  1308. 'NegativeVeryThinSpace;': '\u200b',
  1309. 'nequiv;': '\u2262',
  1310. 'nesear;': '\u2928',
  1311. 'nesim;': '\u2242\u0338',
  1312. 'NestedGreaterGreater;': '\u226b',
  1313. 'NestedLessLess;': '\u226a',
  1314. 'NewLine;': '\n',
  1315. 'nexist;': '\u2204',
  1316. 'nexists;': '\u2204',
  1317. 'Nfr;': '\U0001d511',
  1318. 'nfr;': '\U0001d52b',
  1319. 'ngE;': '\u2267\u0338',
  1320. 'nge;': '\u2271',
  1321. 'ngeq;': '\u2271',
  1322. 'ngeqq;': '\u2267\u0338',
  1323. 'ngeqslant;': '\u2a7e\u0338',
  1324. 'nges;': '\u2a7e\u0338',
  1325. 'nGg;': '\u22d9\u0338',
  1326. 'ngsim;': '\u2275',
  1327. 'nGt;': '\u226b\u20d2',
  1328. 'ngt;': '\u226f',
  1329. 'ngtr;': '\u226f',
  1330. 'nGtv;': '\u226b\u0338',
  1331. 'nhArr;': '\u21ce',
  1332. 'nharr;': '\u21ae',
  1333. 'nhpar;': '\u2af2',
  1334. 'ni;': '\u220b',
  1335. 'nis;': '\u22fc',
  1336. 'nisd;': '\u22fa',
  1337. 'niv;': '\u220b',
  1338. 'NJcy;': '\u040a',
  1339. 'njcy;': '\u045a',
  1340. 'nlArr;': '\u21cd',
  1341. 'nlarr;': '\u219a',
  1342. 'nldr;': '\u2025',
  1343. 'nlE;': '\u2266\u0338',
  1344. 'nle;': '\u2270',
  1345. 'nLeftarrow;': '\u21cd',
  1346. 'nleftarrow;': '\u219a',
  1347. 'nLeftrightarrow;': '\u21ce',
  1348. 'nleftrightarrow;': '\u21ae',
  1349. 'nleq;': '\u2270',
  1350. 'nleqq;': '\u2266\u0338',
  1351. 'nleqslant;': '\u2a7d\u0338',
  1352. 'nles;': '\u2a7d\u0338',
  1353. 'nless;': '\u226e',
  1354. 'nLl;': '\u22d8\u0338',
  1355. 'nlsim;': '\u2274',
  1356. 'nLt;': '\u226a\u20d2',
  1357. 'nlt;': '\u226e',
  1358. 'nltri;': '\u22ea',
  1359. 'nltrie;': '\u22ec',
  1360. 'nLtv;': '\u226a\u0338',
  1361. 'nmid;': '\u2224',
  1362. 'NoBreak;': '\u2060',
  1363. 'NonBreakingSpace;': '\xa0',
  1364. 'Nopf;': '\u2115',
  1365. 'nopf;': '\U0001d55f',
  1366. 'not': '\xac',
  1367. 'Not;': '\u2aec',
  1368. 'not;': '\xac',
  1369. 'NotCongruent;': '\u2262',
  1370. 'NotCupCap;': '\u226d',
  1371. 'NotDoubleVerticalBar;': '\u2226',
  1372. 'NotElement;': '\u2209',
  1373. 'NotEqual;': '\u2260',
  1374. 'NotEqualTilde;': '\u2242\u0338',
  1375. 'NotExists;': '\u2204',
  1376. 'NotGreater;': '\u226f',
  1377. 'NotGreaterEqual;': '\u2271',
  1378. 'NotGreaterFullEqual;': '\u2267\u0338',
  1379. 'NotGreaterGreater;': '\u226b\u0338',
  1380. 'NotGreaterLess;': '\u2279',
  1381. 'NotGreaterSlantEqual;': '\u2a7e\u0338',
  1382. 'NotGreaterTilde;': '\u2275',
  1383. 'NotHumpDownHump;': '\u224e\u0338',
  1384. 'NotHumpEqual;': '\u224f\u0338',
  1385. 'notin;': '\u2209',
  1386. 'notindot;': '\u22f5\u0338',
  1387. 'notinE;': '\u22f9\u0338',
  1388. 'notinva;': '\u2209',
  1389. 'notinvb;': '\u22f7',
  1390. 'notinvc;': '\u22f6',
  1391. 'NotLeftTriangle;': '\u22ea',
  1392. 'NotLeftTriangleBar;': '\u29cf\u0338',
  1393. 'NotLeftTriangleEqual;': '\u22ec',
  1394. 'NotLess;': '\u226e',
  1395. 'NotLessEqual;': '\u2270',
  1396. 'NotLessGreater;': '\u2278',
  1397. 'NotLessLess;': '\u226a\u0338',
  1398. 'NotLessSlantEqual;': '\u2a7d\u0338',
  1399. 'NotLessTilde;': '\u2274',
  1400. 'NotNestedGreaterGreater;': '\u2aa2\u0338',
  1401. 'NotNestedLessLess;': '\u2aa1\u0338',
  1402. 'notni;': '\u220c',
  1403. 'notniva;': '\u220c',
  1404. 'notnivb;': '\u22fe',
  1405. 'notnivc;': '\u22fd',
  1406. 'NotPrecedes;': '\u2280',
  1407. 'NotPrecedesEqual;': '\u2aaf\u0338',
  1408. 'NotPrecedesSlantEqual;': '\u22e0',
  1409. 'NotReverseElement;': '\u220c',
  1410. 'NotRightTriangle;': '\u22eb',
  1411. 'NotRightTriangleBar;': '\u29d0\u0338',
  1412. 'NotRightTriangleEqual;': '\u22ed',
  1413. 'NotSquareSubset;': '\u228f\u0338',
  1414. 'NotSquareSubsetEqual;': '\u22e2',
  1415. 'NotSquareSuperset;': '\u2290\u0338',
  1416. 'NotSquareSupersetEqual;': '\u22e3',
  1417. 'NotSubset;': '\u2282\u20d2',
  1418. 'NotSubsetEqual;': '\u2288',
  1419. 'NotSucceeds;': '\u2281',
  1420. 'NotSucceedsEqual;': '\u2ab0\u0338',
  1421. 'NotSucceedsSlantEqual;': '\u22e1',
  1422. 'NotSucceedsTilde;': '\u227f\u0338',
  1423. 'NotSuperset;': '\u2283\u20d2',
  1424. 'NotSupersetEqual;': '\u2289',
  1425. 'NotTilde;': '\u2241',
  1426. 'NotTildeEqual;': '\u2244',
  1427. 'NotTildeFullEqual;': '\u2247',
  1428. 'NotTildeTilde;': '\u2249',
  1429. 'NotVerticalBar;': '\u2224',
  1430. 'npar;': '\u2226',
  1431. 'nparallel;': '\u2226',
  1432. 'nparsl;': '\u2afd\u20e5',
  1433. 'npart;': '\u2202\u0338',
  1434. 'npolint;': '\u2a14',
  1435. 'npr;': '\u2280',
  1436. 'nprcue;': '\u22e0',
  1437. 'npre;': '\u2aaf\u0338',
  1438. 'nprec;': '\u2280',
  1439. 'npreceq;': '\u2aaf\u0338',
  1440. 'nrArr;': '\u21cf',
  1441. 'nrarr;': '\u219b',
  1442. 'nrarrc;': '\u2933\u0338',
  1443. 'nrarrw;': '\u219d\u0338',
  1444. 'nRightarrow;': '\u21cf',
  1445. 'nrightarrow;': '\u219b',
  1446. 'nrtri;': '\u22eb',
  1447. 'nrtrie;': '\u22ed',
  1448. 'nsc;': '\u2281',
  1449. 'nsccue;': '\u22e1',
  1450. 'nsce;': '\u2ab0\u0338',
  1451. 'Nscr;': '\U0001d4a9',
  1452. 'nscr;': '\U0001d4c3',
  1453. 'nshortmid;': '\u2224',
  1454. 'nshortparallel;': '\u2226',
  1455. 'nsim;': '\u2241',
  1456. 'nsime;': '\u2244',
  1457. 'nsimeq;': '\u2244',
  1458. 'nsmid;': '\u2224',
  1459. 'nspar;': '\u2226',
  1460. 'nsqsube;': '\u22e2',
  1461. 'nsqsupe;': '\u22e3',
  1462. 'nsub;': '\u2284',
  1463. 'nsubE;': '\u2ac5\u0338',
  1464. 'nsube;': '\u2288',
  1465. 'nsubset;': '\u2282\u20d2',
  1466. 'nsubseteq;': '\u2288',
  1467. 'nsubseteqq;': '\u2ac5\u0338',
  1468. 'nsucc;': '\u2281',
  1469. 'nsucceq;': '\u2ab0\u0338',
  1470. 'nsup;': '\u2285',
  1471. 'nsupE;': '\u2ac6\u0338',
  1472. 'nsupe;': '\u2289',
  1473. 'nsupset;': '\u2283\u20d2',
  1474. 'nsupseteq;': '\u2289',
  1475. 'nsupseteqq;': '\u2ac6\u0338',
  1476. 'ntgl;': '\u2279',
  1477. 'Ntilde': '\xd1',
  1478. 'ntilde': '\xf1',
  1479. 'Ntilde;': '\xd1',
  1480. 'ntilde;': '\xf1',
  1481. 'ntlg;': '\u2278',
  1482. 'ntriangleleft;': '\u22ea',
  1483. 'ntrianglelefteq;': '\u22ec',
  1484. 'ntriangleright;': '\u22eb',
  1485. 'ntrianglerighteq;': '\u22ed',
  1486. 'Nu;': '\u039d',
  1487. 'nu;': '\u03bd',
  1488. 'num;': '#',
  1489. 'numero;': '\u2116',
  1490. 'numsp;': '\u2007',
  1491. 'nvap;': '\u224d\u20d2',
  1492. 'nVDash;': '\u22af',
  1493. 'nVdash;': '\u22ae',
  1494. 'nvDash;': '\u22ad',
  1495. 'nvdash;': '\u22ac',
  1496. 'nvge;': '\u2265\u20d2',
  1497. 'nvgt;': '>\u20d2',
  1498. 'nvHarr;': '\u2904',
  1499. 'nvinfin;': '\u29de',
  1500. 'nvlArr;': '\u2902',
  1501. 'nvle;': '\u2264\u20d2',
  1502. 'nvlt;': '<\u20d2',
  1503. 'nvltrie;': '\u22b4\u20d2',
  1504. 'nvrArr;': '\u2903',
  1505. 'nvrtrie;': '\u22b5\u20d2',
  1506. 'nvsim;': '\u223c\u20d2',
  1507. 'nwarhk;': '\u2923',
  1508. 'nwArr;': '\u21d6',
  1509. 'nwarr;': '\u2196',
  1510. 'nwarrow;': '\u2196',
  1511. 'nwnear;': '\u2927',
  1512. 'Oacute': '\xd3',
  1513. 'oacute': '\xf3',
  1514. 'Oacute;': '\xd3',
  1515. 'oacute;': '\xf3',
  1516. 'oast;': '\u229b',
  1517. 'ocir;': '\u229a',
  1518. 'Ocirc': '\xd4',
  1519. 'ocirc': '\xf4',
  1520. 'Ocirc;': '\xd4',
  1521. 'ocirc;': '\xf4',
  1522. 'Ocy;': '\u041e',
  1523. 'ocy;': '\u043e',
  1524. 'odash;': '\u229d',
  1525. 'Odblac;': '\u0150',
  1526. 'odblac;': '\u0151',
  1527. 'odiv;': '\u2a38',
  1528. 'odot;': '\u2299',
  1529. 'odsold;': '\u29bc',
  1530. 'OElig;': '\u0152',
  1531. 'oelig;': '\u0153',
  1532. 'ofcir;': '\u29bf',
  1533. 'Ofr;': '\U0001d512',
  1534. 'ofr;': '\U0001d52c',
  1535. 'ogon;': '\u02db',
  1536. 'Ograve': '\xd2',
  1537. 'ograve': '\xf2',
  1538. 'Ograve;': '\xd2',
  1539. 'ograve;': '\xf2',
  1540. 'ogt;': '\u29c1',
  1541. 'ohbar;': '\u29b5',
  1542. 'ohm;': '\u03a9',
  1543. 'oint;': '\u222e',
  1544. 'olarr;': '\u21ba',
  1545. 'olcir;': '\u29be',
  1546. 'olcross;': '\u29bb',
  1547. 'oline;': '\u203e',
  1548. 'olt;': '\u29c0',
  1549. 'Omacr;': '\u014c',
  1550. 'omacr;': '\u014d',
  1551. 'Omega;': '\u03a9',
  1552. 'omega;': '\u03c9',
  1553. 'Omicron;': '\u039f',
  1554. 'omicron;': '\u03bf',
  1555. 'omid;': '\u29b6',
  1556. 'ominus;': '\u2296',
  1557. 'Oopf;': '\U0001d546',
  1558. 'oopf;': '\U0001d560',
  1559. 'opar;': '\u29b7',
  1560. 'OpenCurlyDoubleQuote;': '\u201c',
  1561. 'OpenCurlyQuote;': '\u2018',
  1562. 'operp;': '\u29b9',
  1563. 'oplus;': '\u2295',
  1564. 'Or;': '\u2a54',
  1565. 'or;': '\u2228',
  1566. 'orarr;': '\u21bb',
  1567. 'ord;': '\u2a5d',
  1568. 'order;': '\u2134',
  1569. 'orderof;': '\u2134',
  1570. 'ordf': '\xaa',
  1571. 'ordf;': '\xaa',
  1572. 'ordm': '\xba',
  1573. 'ordm;': '\xba',
  1574. 'origof;': '\u22b6',
  1575. 'oror;': '\u2a56',
  1576. 'orslope;': '\u2a57',
  1577. 'orv;': '\u2a5b',
  1578. 'oS;': '\u24c8',
  1579. 'Oscr;': '\U0001d4aa',
  1580. 'oscr;': '\u2134',
  1581. 'Oslash': '\xd8',
  1582. 'oslash': '\xf8',
  1583. 'Oslash;': '\xd8',
  1584. 'oslash;': '\xf8',
  1585. 'osol;': '\u2298',
  1586. 'Otilde': '\xd5',
  1587. 'otilde': '\xf5',
  1588. 'Otilde;': '\xd5',
  1589. 'otilde;': '\xf5',
  1590. 'Otimes;': '\u2a37',
  1591. 'otimes;': '\u2297',
  1592. 'otimesas;': '\u2a36',
  1593. 'Ouml': '\xd6',
  1594. 'ouml': '\xf6',
  1595. 'Ouml;': '\xd6',
  1596. 'ouml;': '\xf6',
  1597. 'ovbar;': '\u233d',
  1598. 'OverBar;': '\u203e',
  1599. 'OverBrace;': '\u23de',
  1600. 'OverBracket;': '\u23b4',
  1601. 'OverParenthesis;': '\u23dc',
  1602. 'par;': '\u2225',
  1603. 'para': '\xb6',
  1604. 'para;': '\xb6',
  1605. 'parallel;': '\u2225',
  1606. 'parsim;': '\u2af3',
  1607. 'parsl;': '\u2afd',
  1608. 'part;': '\u2202',
  1609. 'PartialD;': '\u2202',
  1610. 'Pcy;': '\u041f',
  1611. 'pcy;': '\u043f',
  1612. 'percnt;': '%',
  1613. 'period;': '.',
  1614. 'permil;': '\u2030',
  1615. 'perp;': '\u22a5',
  1616. 'pertenk;': '\u2031',
  1617. 'Pfr;': '\U0001d513',
  1618. 'pfr;': '\U0001d52d',
  1619. 'Phi;': '\u03a6',
  1620. 'phi;': '\u03c6',
  1621. 'phiv;': '\u03d5',
  1622. 'phmmat;': '\u2133',
  1623. 'phone;': '\u260e',
  1624. 'Pi;': '\u03a0',
  1625. 'pi;': '\u03c0',
  1626. 'pitchfork;': '\u22d4',
  1627. 'piv;': '\u03d6',
  1628. 'planck;': '\u210f',
  1629. 'planckh;': '\u210e',
  1630. 'plankv;': '\u210f',
  1631. 'plus;': '+',
  1632. 'plusacir;': '\u2a23',
  1633. 'plusb;': '\u229e',
  1634. 'pluscir;': '\u2a22',
  1635. 'plusdo;': '\u2214',
  1636. 'plusdu;': '\u2a25',
  1637. 'pluse;': '\u2a72',
  1638. 'PlusMinus;': '\xb1',
  1639. 'plusmn': '\xb1',
  1640. 'plusmn;': '\xb1',
  1641. 'plussim;': '\u2a26',
  1642. 'plustwo;': '\u2a27',
  1643. 'pm;': '\xb1',
  1644. 'Poincareplane;': '\u210c',
  1645. 'pointint;': '\u2a15',
  1646. 'Popf;': '\u2119',
  1647. 'popf;': '\U0001d561',
  1648. 'pound': '\xa3',
  1649. 'pound;': '\xa3',
  1650. 'Pr;': '\u2abb',
  1651. 'pr;': '\u227a',
  1652. 'prap;': '\u2ab7',
  1653. 'prcue;': '\u227c',
  1654. 'prE;': '\u2ab3',
  1655. 'pre;': '\u2aaf',
  1656. 'prec;': '\u227a',
  1657. 'precapprox;': '\u2ab7',
  1658. 'preccurlyeq;': '\u227c',
  1659. 'Precedes;': '\u227a',
  1660. 'PrecedesEqual;': '\u2aaf',
  1661. 'PrecedesSlantEqual;': '\u227c',
  1662. 'PrecedesTilde;': '\u227e',
  1663. 'preceq;': '\u2aaf',
  1664. 'precnapprox;': '\u2ab9',
  1665. 'precneqq;': '\u2ab5',
  1666. 'precnsim;': '\u22e8',
  1667. 'precsim;': '\u227e',
  1668. 'Prime;': '\u2033',
  1669. 'prime;': '\u2032',
  1670. 'primes;': '\u2119',
  1671. 'prnap;': '\u2ab9',
  1672. 'prnE;': '\u2ab5',
  1673. 'prnsim;': '\u22e8',
  1674. 'prod;': '\u220f',
  1675. 'Product;': '\u220f',
  1676. 'profalar;': '\u232e',
  1677. 'profline;': '\u2312',
  1678. 'profsurf;': '\u2313',
  1679. 'prop;': '\u221d',
  1680. 'Proportion;': '\u2237',
  1681. 'Proportional;': '\u221d',
  1682. 'propto;': '\u221d',
  1683. 'prsim;': '\u227e',
  1684. 'prurel;': '\u22b0',
  1685. 'Pscr;': '\U0001d4ab',
  1686. 'pscr;': '\U0001d4c5',
  1687. 'Psi;': '\u03a8',
  1688. 'psi;': '\u03c8',
  1689. 'puncsp;': '\u2008',
  1690. 'Qfr;': '\U0001d514',
  1691. 'qfr;': '\U0001d52e',
  1692. 'qint;': '\u2a0c',
  1693. 'Qopf;': '\u211a',
  1694. 'qopf;': '\U0001d562',
  1695. 'qprime;': '\u2057',
  1696. 'Qscr;': '\U0001d4ac',
  1697. 'qscr;': '\U0001d4c6',
  1698. 'quaternions;': '\u210d',
  1699. 'quatint;': '\u2a16',
  1700. 'quest;': '?',
  1701. 'questeq;': '\u225f',
  1702. 'QUOT': '"',
  1703. 'quot': '"',
  1704. 'QUOT;': '"',
  1705. 'quot;': '"',
  1706. 'rAarr;': '\u21db',
  1707. 'race;': '\u223d\u0331',
  1708. 'Racute;': '\u0154',
  1709. 'racute;': '\u0155',
  1710. 'radic;': '\u221a',
  1711. 'raemptyv;': '\u29b3',
  1712. 'Rang;': '\u27eb',
  1713. 'rang;': '\u27e9',
  1714. 'rangd;': '\u2992',
  1715. 'range;': '\u29a5',
  1716. 'rangle;': '\u27e9',
  1717. 'raquo': '\xbb',
  1718. 'raquo;': '\xbb',
  1719. 'Rarr;': '\u21a0',
  1720. 'rArr;': '\u21d2',
  1721. 'rarr;': '\u2192',
  1722. 'rarrap;': '\u2975',
  1723. 'rarrb;': '\u21e5',
  1724. 'rarrbfs;': '\u2920',
  1725. 'rarrc;': '\u2933',
  1726. 'rarrfs;': '\u291e',
  1727. 'rarrhk;': '\u21aa',
  1728. 'rarrlp;': '\u21ac',
  1729. 'rarrpl;': '\u2945',
  1730. 'rarrsim;': '\u2974',
  1731. 'Rarrtl;': '\u2916',
  1732. 'rarrtl;': '\u21a3',
  1733. 'rarrw;': '\u219d',
  1734. 'rAtail;': '\u291c',
  1735. 'ratail;': '\u291a',
  1736. 'ratio;': '\u2236',
  1737. 'rationals;': '\u211a',
  1738. 'RBarr;': '\u2910',
  1739. 'rBarr;': '\u290f',
  1740. 'rbarr;': '\u290d',
  1741. 'rbbrk;': '\u2773',
  1742. 'rbrace;': '}',
  1743. 'rbrack;': ']',
  1744. 'rbrke;': '\u298c',
  1745. 'rbrksld;': '\u298e',
  1746. 'rbrkslu;': '\u2990',
  1747. 'Rcaron;': '\u0158',
  1748. 'rcaron;': '\u0159',
  1749. 'Rcedil;': '\u0156',
  1750. 'rcedil;': '\u0157',
  1751. 'rceil;': '\u2309',
  1752. 'rcub;': '}',
  1753. 'Rcy;': '\u0420',
  1754. 'rcy;': '\u0440',
  1755. 'rdca;': '\u2937',
  1756. 'rdldhar;': '\u2969',
  1757. 'rdquo;': '\u201d',
  1758. 'rdquor;': '\u201d',
  1759. 'rdsh;': '\u21b3',
  1760. 'Re;': '\u211c',
  1761. 'real;': '\u211c',
  1762. 'realine;': '\u211b',
  1763. 'realpart;': '\u211c',
  1764. 'reals;': '\u211d',
  1765. 'rect;': '\u25ad',
  1766. 'REG': '\xae',
  1767. 'reg': '\xae',
  1768. 'REG;': '\xae',
  1769. 'reg;': '\xae',
  1770. 'ReverseElement;': '\u220b',
  1771. 'ReverseEquilibrium;': '\u21cb',
  1772. 'ReverseUpEquilibrium;': '\u296f',
  1773. 'rfisht;': '\u297d',
  1774. 'rfloor;': '\u230b',
  1775. 'Rfr;': '\u211c',
  1776. 'rfr;': '\U0001d52f',
  1777. 'rHar;': '\u2964',
  1778. 'rhard;': '\u21c1',
  1779. 'rharu;': '\u21c0',
  1780. 'rharul;': '\u296c',
  1781. 'Rho;': '\u03a1',
  1782. 'rho;': '\u03c1',
  1783. 'rhov;': '\u03f1',
  1784. 'RightAngleBracket;': '\u27e9',
  1785. 'RightArrow;': '\u2192',
  1786. 'Rightarrow;': '\u21d2',
  1787. 'rightarrow;': '\u2192',
  1788. 'RightArrowBar;': '\u21e5',
  1789. 'RightArrowLeftArrow;': '\u21c4',
  1790. 'rightarrowtail;': '\u21a3',
  1791. 'RightCeiling;': '\u2309',
  1792. 'RightDoubleBracket;': '\u27e7',
  1793. 'RightDownTeeVector;': '\u295d',
  1794. 'RightDownVector;': '\u21c2',
  1795. 'RightDownVectorBar;': '\u2955',
  1796. 'RightFloor;': '\u230b',
  1797. 'rightharpoondown;': '\u21c1',
  1798. 'rightharpoonup;': '\u21c0',
  1799. 'rightleftarrows;': '\u21c4',
  1800. 'rightleftharpoons;': '\u21cc',
  1801. 'rightrightarrows;': '\u21c9',
  1802. 'rightsquigarrow;': '\u219d',
  1803. 'RightTee;': '\u22a2',
  1804. 'RightTeeArrow;': '\u21a6',
  1805. 'RightTeeVector;': '\u295b',
  1806. 'rightthreetimes;': '\u22cc',
  1807. 'RightTriangle;': '\u22b3',
  1808. 'RightTriangleBar;': '\u29d0',
  1809. 'RightTriangleEqual;': '\u22b5',
  1810. 'RightUpDownVector;': '\u294f',
  1811. 'RightUpTeeVector;': '\u295c',
  1812. 'RightUpVector;': '\u21be',
  1813. 'RightUpVectorBar;': '\u2954',
  1814. 'RightVector;': '\u21c0',
  1815. 'RightVectorBar;': '\u2953',
  1816. 'ring;': '\u02da',
  1817. 'risingdotseq;': '\u2253',
  1818. 'rlarr;': '\u21c4',
  1819. 'rlhar;': '\u21cc',
  1820. 'rlm;': '\u200f',
  1821. 'rmoust;': '\u23b1',
  1822. 'rmoustache;': '\u23b1',
  1823. 'rnmid;': '\u2aee',
  1824. 'roang;': '\u27ed',
  1825. 'roarr;': '\u21fe',
  1826. 'robrk;': '\u27e7',
  1827. 'ropar;': '\u2986',
  1828. 'Ropf;': '\u211d',
  1829. 'ropf;': '\U0001d563',
  1830. 'roplus;': '\u2a2e',
  1831. 'rotimes;': '\u2a35',
  1832. 'RoundImplies;': '\u2970',
  1833. 'rpar;': ')',
  1834. 'rpargt;': '\u2994',
  1835. 'rppolint;': '\u2a12',
  1836. 'rrarr;': '\u21c9',
  1837. 'Rrightarrow;': '\u21db',
  1838. 'rsaquo;': '\u203a',
  1839. 'Rscr;': '\u211b',
  1840. 'rscr;': '\U0001d4c7',
  1841. 'Rsh;': '\u21b1',
  1842. 'rsh;': '\u21b1',
  1843. 'rsqb;': ']',
  1844. 'rsquo;': '\u2019',
  1845. 'rsquor;': '\u2019',
  1846. 'rthree;': '\u22cc',
  1847. 'rtimes;': '\u22ca',
  1848. 'rtri;': '\u25b9',
  1849. 'rtrie;': '\u22b5',
  1850. 'rtrif;': '\u25b8',
  1851. 'rtriltri;': '\u29ce',
  1852. 'RuleDelayed;': '\u29f4',
  1853. 'ruluhar;': '\u2968',
  1854. 'rx;': '\u211e',
  1855. 'Sacute;': '\u015a',
  1856. 'sacute;': '\u015b',
  1857. 'sbquo;': '\u201a',
  1858. 'Sc;': '\u2abc',
  1859. 'sc;': '\u227b',
  1860. 'scap;': '\u2ab8',
  1861. 'Scaron;': '\u0160',
  1862. 'scaron;': '\u0161',
  1863. 'sccue;': '\u227d',
  1864. 'scE;': '\u2ab4',
  1865. 'sce;': '\u2ab0',
  1866. 'Scedil;': '\u015e',
  1867. 'scedil;': '\u015f',
  1868. 'Scirc;': '\u015c',
  1869. 'scirc;': '\u015d',
  1870. 'scnap;': '\u2aba',
  1871. 'scnE;': '\u2ab6',
  1872. 'scnsim;': '\u22e9',
  1873. 'scpolint;': '\u2a13',
  1874. 'scsim;': '\u227f',
  1875. 'Scy;': '\u0421',
  1876. 'scy;': '\u0441',
  1877. 'sdot;': '\u22c5',
  1878. 'sdotb;': '\u22a1',
  1879. 'sdote;': '\u2a66',
  1880. 'searhk;': '\u2925',
  1881. 'seArr;': '\u21d8',
  1882. 'searr;': '\u2198',
  1883. 'searrow;': '\u2198',
  1884. 'sect': '\xa7',
  1885. 'sect;': '\xa7',
  1886. 'semi;': ';',
  1887. 'seswar;': '\u2929',
  1888. 'setminus;': '\u2216',
  1889. 'setmn;': '\u2216',
  1890. 'sext;': '\u2736',
  1891. 'Sfr;': '\U0001d516',
  1892. 'sfr;': '\U0001d530',
  1893. 'sfrown;': '\u2322',
  1894. 'sharp;': '\u266f',
  1895. 'SHCHcy;': '\u0429',
  1896. 'shchcy;': '\u0449',
  1897. 'SHcy;': '\u0428',
  1898. 'shcy;': '\u0448',
  1899. 'ShortDownArrow;': '\u2193',
  1900. 'ShortLeftArrow;': '\u2190',
  1901. 'shortmid;': '\u2223',
  1902. 'shortparallel;': '\u2225',
  1903. 'ShortRightArrow;': '\u2192',
  1904. 'ShortUpArrow;': '\u2191',
  1905. 'shy': '\xad',
  1906. 'shy;': '\xad',
  1907. 'Sigma;': '\u03a3',
  1908. 'sigma;': '\u03c3',
  1909. 'sigmaf;': '\u03c2',
  1910. 'sigmav;': '\u03c2',
  1911. 'sim;': '\u223c',
  1912. 'simdot;': '\u2a6a',
  1913. 'sime;': '\u2243',
  1914. 'simeq;': '\u2243',
  1915. 'simg;': '\u2a9e',
  1916. 'simgE;': '\u2aa0',
  1917. 'siml;': '\u2a9d',
  1918. 'simlE;': '\u2a9f',
  1919. 'simne;': '\u2246',
  1920. 'simplus;': '\u2a24',
  1921. 'simrarr;': '\u2972',
  1922. 'slarr;': '\u2190',
  1923. 'SmallCircle;': '\u2218',
  1924. 'smallsetminus;': '\u2216',
  1925. 'smashp;': '\u2a33',
  1926. 'smeparsl;': '\u29e4',
  1927. 'smid;': '\u2223',
  1928. 'smile;': '\u2323',
  1929. 'smt;': '\u2aaa',
  1930. 'smte;': '\u2aac',
  1931. 'smtes;': '\u2aac\ufe00',
  1932. 'SOFTcy;': '\u042c',
  1933. 'softcy;': '\u044c',
  1934. 'sol;': '/',
  1935. 'solb;': '\u29c4',
  1936. 'solbar;': '\u233f',
  1937. 'Sopf;': '\U0001d54a',
  1938. 'sopf;': '\U0001d564',
  1939. 'spades;': '\u2660',
  1940. 'spadesuit;': '\u2660',
  1941. 'spar;': '\u2225',
  1942. 'sqcap;': '\u2293',
  1943. 'sqcaps;': '\u2293\ufe00',
  1944. 'sqcup;': '\u2294',
  1945. 'sqcups;': '\u2294\ufe00',
  1946. 'Sqrt;': '\u221a',
  1947. 'sqsub;': '\u228f',
  1948. 'sqsube;': '\u2291',
  1949. 'sqsubset;': '\u228f',
  1950. 'sqsubseteq;': '\u2291',
  1951. 'sqsup;': '\u2290',
  1952. 'sqsupe;': '\u2292',
  1953. 'sqsupset;': '\u2290',
  1954. 'sqsupseteq;': '\u2292',
  1955. 'squ;': '\u25a1',
  1956. 'Square;': '\u25a1',
  1957. 'square;': '\u25a1',
  1958. 'SquareIntersection;': '\u2293',
  1959. 'SquareSubset;': '\u228f',
  1960. 'SquareSubsetEqual;': '\u2291',
  1961. 'SquareSuperset;': '\u2290',
  1962. 'SquareSupersetEqual;': '\u2292',
  1963. 'SquareUnion;': '\u2294',
  1964. 'squarf;': '\u25aa',
  1965. 'squf;': '\u25aa',
  1966. 'srarr;': '\u2192',
  1967. 'Sscr;': '\U0001d4ae',
  1968. 'sscr;': '\U0001d4c8',
  1969. 'ssetmn;': '\u2216',
  1970. 'ssmile;': '\u2323',
  1971. 'sstarf;': '\u22c6',
  1972. 'Star;': '\u22c6',
  1973. 'star;': '\u2606',
  1974. 'starf;': '\u2605',
  1975. 'straightepsilon;': '\u03f5',
  1976. 'straightphi;': '\u03d5',
  1977. 'strns;': '\xaf',
  1978. 'Sub;': '\u22d0',
  1979. 'sub;': '\u2282',
  1980. 'subdot;': '\u2abd',
  1981. 'subE;': '\u2ac5',
  1982. 'sube;': '\u2286',
  1983. 'subedot;': '\u2ac3',
  1984. 'submult;': '\u2ac1',
  1985. 'subnE;': '\u2acb',
  1986. 'subne;': '\u228a',
  1987. 'subplus;': '\u2abf',
  1988. 'subrarr;': '\u2979',
  1989. 'Subset;': '\u22d0',
  1990. 'subset;': '\u2282',
  1991. 'subseteq;': '\u2286',
  1992. 'subseteqq;': '\u2ac5',
  1993. 'SubsetEqual;': '\u2286',
  1994. 'subsetneq;': '\u228a',
  1995. 'subsetneqq;': '\u2acb',
  1996. 'subsim;': '\u2ac7',
  1997. 'subsub;': '\u2ad5',
  1998. 'subsup;': '\u2ad3',
  1999. 'succ;': '\u227b',
  2000. 'succapprox;': '\u2ab8',
  2001. 'succcurlyeq;': '\u227d',
  2002. 'Succeeds;': '\u227b',
  2003. 'SucceedsEqual;': '\u2ab0',
  2004. 'SucceedsSlantEqual;': '\u227d',
  2005. 'SucceedsTilde;': '\u227f',
  2006. 'succeq;': '\u2ab0',
  2007. 'succnapprox;': '\u2aba',
  2008. 'succneqq;': '\u2ab6',
  2009. 'succnsim;': '\u22e9',
  2010. 'succsim;': '\u227f',
  2011. 'SuchThat;': '\u220b',
  2012. 'Sum;': '\u2211',
  2013. 'sum;': '\u2211',
  2014. 'sung;': '\u266a',
  2015. 'sup1': '\xb9',
  2016. 'sup1;': '\xb9',
  2017. 'sup2': '\xb2',
  2018. 'sup2;': '\xb2',
  2019. 'sup3': '\xb3',
  2020. 'sup3;': '\xb3',
  2021. 'Sup;': '\u22d1',
  2022. 'sup;': '\u2283',
  2023. 'supdot;': '\u2abe',
  2024. 'supdsub;': '\u2ad8',
  2025. 'supE;': '\u2ac6',
  2026. 'supe;': '\u2287',
  2027. 'supedot;': '\u2ac4',
  2028. 'Superset;': '\u2283',
  2029. 'SupersetEqual;': '\u2287',
  2030. 'suphsol;': '\u27c9',
  2031. 'suphsub;': '\u2ad7',
  2032. 'suplarr;': '\u297b',
  2033. 'supmult;': '\u2ac2',
  2034. 'supnE;': '\u2acc',
  2035. 'supne;': '\u228b',
  2036. 'supplus;': '\u2ac0',
  2037. 'Supset;': '\u22d1',
  2038. 'supset;': '\u2283',
  2039. 'supseteq;': '\u2287',
  2040. 'supseteqq;': '\u2ac6',
  2041. 'supsetneq;': '\u228b',
  2042. 'supsetneqq;': '\u2acc',
  2043. 'supsim;': '\u2ac8',
  2044. 'supsub;': '\u2ad4',
  2045. 'supsup;': '\u2ad6',
  2046. 'swarhk;': '\u2926',
  2047. 'swArr;': '\u21d9',
  2048. 'swarr;': '\u2199',
  2049. 'swarrow;': '\u2199',
  2050. 'swnwar;': '\u292a',
  2051. 'szlig': '\xdf',
  2052. 'szlig;': '\xdf',
  2053. 'Tab;': '\t',
  2054. 'target;': '\u2316',
  2055. 'Tau;': '\u03a4',
  2056. 'tau;': '\u03c4',
  2057. 'tbrk;': '\u23b4',
  2058. 'Tcaron;': '\u0164',
  2059. 'tcaron;': '\u0165',
  2060. 'Tcedil;': '\u0162',
  2061. 'tcedil;': '\u0163',
  2062. 'Tcy;': '\u0422',
  2063. 'tcy;': '\u0442',
  2064. 'tdot;': '\u20db',
  2065. 'telrec;': '\u2315',
  2066. 'Tfr;': '\U0001d517',
  2067. 'tfr;': '\U0001d531',
  2068. 'there4;': '\u2234',
  2069. 'Therefore;': '\u2234',
  2070. 'therefore;': '\u2234',
  2071. 'Theta;': '\u0398',
  2072. 'theta;': '\u03b8',
  2073. 'thetasym;': '\u03d1',
  2074. 'thetav;': '\u03d1',
  2075. 'thickapprox;': '\u2248',
  2076. 'thicksim;': '\u223c',
  2077. 'ThickSpace;': '\u205f\u200a',
  2078. 'thinsp;': '\u2009',
  2079. 'ThinSpace;': '\u2009',
  2080. 'thkap;': '\u2248',
  2081. 'thksim;': '\u223c',
  2082. 'THORN': '\xde',
  2083. 'thorn': '\xfe',
  2084. 'THORN;': '\xde',
  2085. 'thorn;': '\xfe',
  2086. 'Tilde;': '\u223c',
  2087. 'tilde;': '\u02dc',
  2088. 'TildeEqual;': '\u2243',
  2089. 'TildeFullEqual;': '\u2245',
  2090. 'TildeTilde;': '\u2248',
  2091. 'times': '\xd7',
  2092. 'times;': '\xd7',
  2093. 'timesb;': '\u22a0',
  2094. 'timesbar;': '\u2a31',
  2095. 'timesd;': '\u2a30',
  2096. 'tint;': '\u222d',
  2097. 'toea;': '\u2928',
  2098. 'top;': '\u22a4',
  2099. 'topbot;': '\u2336',
  2100. 'topcir;': '\u2af1',
  2101. 'Topf;': '\U0001d54b',
  2102. 'topf;': '\U0001d565',
  2103. 'topfork;': '\u2ada',
  2104. 'tosa;': '\u2929',
  2105. 'tprime;': '\u2034',
  2106. 'TRADE;': '\u2122',
  2107. 'trade;': '\u2122',
  2108. 'triangle;': '\u25b5',
  2109. 'triangledown;': '\u25bf',
  2110. 'triangleleft;': '\u25c3',
  2111. 'trianglelefteq;': '\u22b4',
  2112. 'triangleq;': '\u225c',
  2113. 'triangleright;': '\u25b9',
  2114. 'trianglerighteq;': '\u22b5',
  2115. 'tridot;': '\u25ec',
  2116. 'trie;': '\u225c',
  2117. 'triminus;': '\u2a3a',
  2118. 'TripleDot;': '\u20db',
  2119. 'triplus;': '\u2a39',
  2120. 'trisb;': '\u29cd',
  2121. 'tritime;': '\u2a3b',
  2122. 'trpezium;': '\u23e2',
  2123. 'Tscr;': '\U0001d4af',
  2124. 'tscr;': '\U0001d4c9',
  2125. 'TScy;': '\u0426',
  2126. 'tscy;': '\u0446',
  2127. 'TSHcy;': '\u040b',
  2128. 'tshcy;': '\u045b',
  2129. 'Tstrok;': '\u0166',
  2130. 'tstrok;': '\u0167',
  2131. 'twixt;': '\u226c',
  2132. 'twoheadleftarrow;': '\u219e',
  2133. 'twoheadrightarrow;': '\u21a0',
  2134. 'Uacute': '\xda',
  2135. 'uacute': '\xfa',
  2136. 'Uacute;': '\xda',
  2137. 'uacute;': '\xfa',
  2138. 'Uarr;': '\u219f',
  2139. 'uArr;': '\u21d1',
  2140. 'uarr;': '\u2191',
  2141. 'Uarrocir;': '\u2949',
  2142. 'Ubrcy;': '\u040e',
  2143. 'ubrcy;': '\u045e',
  2144. 'Ubreve;': '\u016c',
  2145. 'ubreve;': '\u016d',
  2146. 'Ucirc': '\xdb',
  2147. 'ucirc': '\xfb',
  2148. 'Ucirc;': '\xdb',
  2149. 'ucirc;': '\xfb',
  2150. 'Ucy;': '\u0423',
  2151. 'ucy;': '\u0443',
  2152. 'udarr;': '\u21c5',
  2153. 'Udblac;': '\u0170',
  2154. 'udblac;': '\u0171',
  2155. 'udhar;': '\u296e',
  2156. 'ufisht;': '\u297e',
  2157. 'Ufr;': '\U0001d518',
  2158. 'ufr;': '\U0001d532',
  2159. 'Ugrave': '\xd9',
  2160. 'ugrave': '\xf9',
  2161. 'Ugrave;': '\xd9',
  2162. 'ugrave;': '\xf9',
  2163. 'uHar;': '\u2963',
  2164. 'uharl;': '\u21bf',
  2165. 'uharr;': '\u21be',
  2166. 'uhblk;': '\u2580',
  2167. 'ulcorn;': '\u231c',
  2168. 'ulcorner;': '\u231c',
  2169. 'ulcrop;': '\u230f',
  2170. 'ultri;': '\u25f8',
  2171. 'Umacr;': '\u016a',
  2172. 'umacr;': '\u016b',
  2173. 'uml': '\xa8',
  2174. 'uml;': '\xa8',
  2175. 'UnderBar;': '_',
  2176. 'UnderBrace;': '\u23df',
  2177. 'UnderBracket;': '\u23b5',
  2178. 'UnderParenthesis;': '\u23dd',
  2179. 'Union;': '\u22c3',
  2180. 'UnionPlus;': '\u228e',
  2181. 'Uogon;': '\u0172',
  2182. 'uogon;': '\u0173',
  2183. 'Uopf;': '\U0001d54c',
  2184. 'uopf;': '\U0001d566',
  2185. 'UpArrow;': '\u2191',
  2186. 'Uparrow;': '\u21d1',
  2187. 'uparrow;': '\u2191',
  2188. 'UpArrowBar;': '\u2912',
  2189. 'UpArrowDownArrow;': '\u21c5',
  2190. 'UpDownArrow;': '\u2195',
  2191. 'Updownarrow;': '\u21d5',
  2192. 'updownarrow;': '\u2195',
  2193. 'UpEquilibrium;': '\u296e',
  2194. 'upharpoonleft;': '\u21bf',
  2195. 'upharpoonright;': '\u21be',
  2196. 'uplus;': '\u228e',
  2197. 'UpperLeftArrow;': '\u2196',
  2198. 'UpperRightArrow;': '\u2197',
  2199. 'Upsi;': '\u03d2',
  2200. 'upsi;': '\u03c5',
  2201. 'upsih;': '\u03d2',
  2202. 'Upsilon;': '\u03a5',
  2203. 'upsilon;': '\u03c5',
  2204. 'UpTee;': '\u22a5',
  2205. 'UpTeeArrow;': '\u21a5',
  2206. 'upuparrows;': '\u21c8',
  2207. 'urcorn;': '\u231d',
  2208. 'urcorner;': '\u231d',
  2209. 'urcrop;': '\u230e',
  2210. 'Uring;': '\u016e',
  2211. 'uring;': '\u016f',
  2212. 'urtri;': '\u25f9',
  2213. 'Uscr;': '\U0001d4b0',
  2214. 'uscr;': '\U0001d4ca',
  2215. 'utdot;': '\u22f0',
  2216. 'Utilde;': '\u0168',
  2217. 'utilde;': '\u0169',
  2218. 'utri;': '\u25b5',
  2219. 'utrif;': '\u25b4',
  2220. 'uuarr;': '\u21c8',
  2221. 'Uuml': '\xdc',
  2222. 'uuml': '\xfc',
  2223. 'Uuml;': '\xdc',
  2224. 'uuml;': '\xfc',
  2225. 'uwangle;': '\u29a7',
  2226. 'vangrt;': '\u299c',
  2227. 'varepsilon;': '\u03f5',
  2228. 'varkappa;': '\u03f0',
  2229. 'varnothing;': '\u2205',
  2230. 'varphi;': '\u03d5',
  2231. 'varpi;': '\u03d6',
  2232. 'varpropto;': '\u221d',
  2233. 'vArr;': '\u21d5',
  2234. 'varr;': '\u2195',
  2235. 'varrho;': '\u03f1',
  2236. 'varsigma;': '\u03c2',
  2237. 'varsubsetneq;': '\u228a\ufe00',
  2238. 'varsubsetneqq;': '\u2acb\ufe00',
  2239. 'varsupsetneq;': '\u228b\ufe00',
  2240. 'varsupsetneqq;': '\u2acc\ufe00',
  2241. 'vartheta;': '\u03d1',
  2242. 'vartriangleleft;': '\u22b2',
  2243. 'vartriangleright;': '\u22b3',
  2244. 'Vbar;': '\u2aeb',
  2245. 'vBar;': '\u2ae8',
  2246. 'vBarv;': '\u2ae9',
  2247. 'Vcy;': '\u0412',
  2248. 'vcy;': '\u0432',
  2249. 'VDash;': '\u22ab',
  2250. 'Vdash;': '\u22a9',
  2251. 'vDash;': '\u22a8',
  2252. 'vdash;': '\u22a2',
  2253. 'Vdashl;': '\u2ae6',
  2254. 'Vee;': '\u22c1',
  2255. 'vee;': '\u2228',
  2256. 'veebar;': '\u22bb',
  2257. 'veeeq;': '\u225a',
  2258. 'vellip;': '\u22ee',
  2259. 'Verbar;': '\u2016',
  2260. 'verbar;': '|',
  2261. 'Vert;': '\u2016',
  2262. 'vert;': '|',
  2263. 'VerticalBar;': '\u2223',
  2264. 'VerticalLine;': '|',
  2265. 'VerticalSeparator;': '\u2758',
  2266. 'VerticalTilde;': '\u2240',
  2267. 'VeryThinSpace;': '\u200a',
  2268. 'Vfr;': '\U0001d519',
  2269. 'vfr;': '\U0001d533',
  2270. 'vltri;': '\u22b2',
  2271. 'vnsub;': '\u2282\u20d2',
  2272. 'vnsup;': '\u2283\u20d2',
  2273. 'Vopf;': '\U0001d54d',
  2274. 'vopf;': '\U0001d567',
  2275. 'vprop;': '\u221d',
  2276. 'vrtri;': '\u22b3',
  2277. 'Vscr;': '\U0001d4b1',
  2278. 'vscr;': '\U0001d4cb',
  2279. 'vsubnE;': '\u2acb\ufe00',
  2280. 'vsubne;': '\u228a\ufe00',
  2281. 'vsupnE;': '\u2acc\ufe00',
  2282. 'vsupne;': '\u228b\ufe00',
  2283. 'Vvdash;': '\u22aa',
  2284. 'vzigzag;': '\u299a',
  2285. 'Wcirc;': '\u0174',
  2286. 'wcirc;': '\u0175',
  2287. 'wedbar;': '\u2a5f',
  2288. 'Wedge;': '\u22c0',
  2289. 'wedge;': '\u2227',
  2290. 'wedgeq;': '\u2259',
  2291. 'weierp;': '\u2118',
  2292. 'Wfr;': '\U0001d51a',
  2293. 'wfr;': '\U0001d534',
  2294. 'Wopf;': '\U0001d54e',
  2295. 'wopf;': '\U0001d568',
  2296. 'wp;': '\u2118',
  2297. 'wr;': '\u2240',
  2298. 'wreath;': '\u2240',
  2299. 'Wscr;': '\U0001d4b2',
  2300. 'wscr;': '\U0001d4cc',
  2301. 'xcap;': '\u22c2',
  2302. 'xcirc;': '\u25ef',
  2303. 'xcup;': '\u22c3',
  2304. 'xdtri;': '\u25bd',
  2305. 'Xfr;': '\U0001d51b',
  2306. 'xfr;': '\U0001d535',
  2307. 'xhArr;': '\u27fa',
  2308. 'xharr;': '\u27f7',
  2309. 'Xi;': '\u039e',
  2310. 'xi;': '\u03be',
  2311. 'xlArr;': '\u27f8',
  2312. 'xlarr;': '\u27f5',
  2313. 'xmap;': '\u27fc',
  2314. 'xnis;': '\u22fb',
  2315. 'xodot;': '\u2a00',
  2316. 'Xopf;': '\U0001d54f',
  2317. 'xopf;': '\U0001d569',
  2318. 'xoplus;': '\u2a01',
  2319. 'xotime;': '\u2a02',
  2320. 'xrArr;': '\u27f9',
  2321. 'xrarr;': '\u27f6',
  2322. 'Xscr;': '\U0001d4b3',
  2323. 'xscr;': '\U0001d4cd',
  2324. 'xsqcup;': '\u2a06',
  2325. 'xuplus;': '\u2a04',
  2326. 'xutri;': '\u25b3',
  2327. 'xvee;': '\u22c1',
  2328. 'xwedge;': '\u22c0',
  2329. 'Yacute': '\xdd',
  2330. 'yacute': '\xfd',
  2331. 'Yacute;': '\xdd',
  2332. 'yacute;': '\xfd',
  2333. 'YAcy;': '\u042f',
  2334. 'yacy;': '\u044f',
  2335. 'Ycirc;': '\u0176',
  2336. 'ycirc;': '\u0177',
  2337. 'Ycy;': '\u042b',
  2338. 'ycy;': '\u044b',
  2339. 'yen': '\xa5',
  2340. 'yen;': '\xa5',
  2341. 'Yfr;': '\U0001d51c',
  2342. 'yfr;': '\U0001d536',
  2343. 'YIcy;': '\u0407',
  2344. 'yicy;': '\u0457',
  2345. 'Yopf;': '\U0001d550',
  2346. 'yopf;': '\U0001d56a',
  2347. 'Yscr;': '\U0001d4b4',
  2348. 'yscr;': '\U0001d4ce',
  2349. 'YUcy;': '\u042e',
  2350. 'yucy;': '\u044e',
  2351. 'yuml': '\xff',
  2352. 'Yuml;': '\u0178',
  2353. 'yuml;': '\xff',
  2354. 'Zacute;': '\u0179',
  2355. 'zacute;': '\u017a',
  2356. 'Zcaron;': '\u017d',
  2357. 'zcaron;': '\u017e',
  2358. 'Zcy;': '\u0417',
  2359. 'zcy;': '\u0437',
  2360. 'Zdot;': '\u017b',
  2361. 'zdot;': '\u017c',
  2362. 'zeetrf;': '\u2128',
  2363. 'ZeroWidthSpace;': '\u200b',
  2364. 'Zeta;': '\u0396',
  2365. 'zeta;': '\u03b6',
  2366. 'Zfr;': '\u2128',
  2367. 'zfr;': '\U0001d537',
  2368. 'ZHcy;': '\u0416',
  2369. 'zhcy;': '\u0436',
  2370. 'zigrarr;': '\u21dd',
  2371. 'Zopf;': '\u2124',
  2372. 'zopf;': '\U0001d56b',
  2373. 'Zscr;': '\U0001d4b5',
  2374. 'zscr;': '\U0001d4cf',
  2375. 'zwj;': '\u200d',
  2376. 'zwnj;': '\u200c',
  2377. }
  2378. try:
  2379. import http.client as compat_http_client
  2380. except ImportError: # Python 2
  2381. import httplib as compat_http_client
  2382. try:
  2383. compat_http_client.HTTPResponse.getcode
  2384. except AttributeError:
  2385. # Py < 3.1
  2386. compat_http_client.HTTPResponse.getcode = lambda self: self.status
  2387. try:
  2388. from urllib.error import HTTPError as compat_HTTPError
  2389. except ImportError: # Python 2
  2390. from urllib2 import HTTPError as compat_HTTPError
  2391. compat_urllib_HTTPError = compat_HTTPError
  2392. try:
  2393. from urllib.request import urlretrieve as compat_urlretrieve
  2394. except ImportError: # Python 2
  2395. from urllib import urlretrieve as compat_urlretrieve
  2396. compat_urllib_request_urlretrieve = compat_urlretrieve
  2397. try:
  2398. from HTMLParser import (
  2399. HTMLParser as compat_HTMLParser,
  2400. HTMLParseError as compat_HTMLParseError)
  2401. except ImportError: # Python 3
  2402. from html.parser import HTMLParser as compat_HTMLParser
  2403. try:
  2404. from html.parser import HTMLParseError as compat_HTMLParseError
  2405. except ImportError: # Python >3.4
  2406. # HTMLParseError was deprecated in Python 3.3 and removed in
  2407. # Python 3.5. Introducing dummy exception for Python >3.5 for compatible
  2408. # and uniform cross-version exception handling
  2409. class compat_HTMLParseError(Exception):
  2410. pass
  2411. compat_html_parser_HTMLParser = compat_HTMLParser
  2412. compat_html_parser_HTMLParseError = compat_HTMLParseError
  2413. try:
  2414. _DEVNULL = subprocess.DEVNULL
  2415. compat_subprocess_get_DEVNULL = lambda: _DEVNULL
  2416. except AttributeError:
  2417. compat_subprocess_get_DEVNULL = lambda: open(os.path.devnull, 'w')
  2418. try:
  2419. import http.server as compat_http_server
  2420. except ImportError:
  2421. import BaseHTTPServer as compat_http_server
  2422. try:
  2423. from urllib.parse import unquote_to_bytes as compat_urllib_parse_unquote_to_bytes
  2424. from urllib.parse import unquote as compat_urllib_parse_unquote
  2425. from urllib.parse import unquote_plus as compat_urllib_parse_unquote_plus
  2426. from urllib.parse import urlencode as compat_urllib_parse_urlencode
  2427. from urllib.parse import parse_qs as compat_parse_qs
  2428. except ImportError: # Python 2
  2429. _asciire = (compat_urllib_parse._asciire if hasattr(compat_urllib_parse, '_asciire')
  2430. else re.compile(r'([\x00-\x7f]+)'))
  2431. # HACK: The following are the correct unquote_to_bytes, unquote and unquote_plus
  2432. # implementations from cpython 3.4.3's stdlib. Python 2's version
  2433. # is apparently broken (see https://github.com/ytdl-org/youtube-dl/pull/6244)
  2434. def compat_urllib_parse_unquote_to_bytes(string):
  2435. """unquote_to_bytes('abc%20def') -> b'abc def'."""
  2436. # Note: strings are encoded as UTF-8. This is only an issue if it contains
  2437. # unescaped non-ASCII characters, which URIs should not.
  2438. if not string:
  2439. # Is it a string-like object?
  2440. string.split
  2441. return b''
  2442. if isinstance(string, compat_str):
  2443. string = string.encode('utf-8')
  2444. bits = string.split(b'%')
  2445. if len(bits) == 1:
  2446. return string
  2447. res = [bits[0]]
  2448. append = res.append
  2449. for item in bits[1:]:
  2450. try:
  2451. append(compat_urllib_parse._hextochr[item[:2]])
  2452. append(item[2:])
  2453. except KeyError:
  2454. append(b'%')
  2455. append(item)
  2456. return b''.join(res)
  2457. def compat_urllib_parse_unquote(string, encoding='utf-8', errors='replace'):
  2458. """Replace %xx escapes by their single-character equivalent. The optional
  2459. encoding and errors parameters specify how to decode percent-encoded
  2460. sequences into Unicode characters, as accepted by the bytes.decode()
  2461. method.
  2462. By default, percent-encoded sequences are decoded with UTF-8, and invalid
  2463. sequences are replaced by a placeholder character.
  2464. unquote('abc%20def') -> 'abc def'.
  2465. """
  2466. if '%' not in string:
  2467. string.split
  2468. return string
  2469. if encoding is None:
  2470. encoding = 'utf-8'
  2471. if errors is None:
  2472. errors = 'replace'
  2473. bits = _asciire.split(string)
  2474. res = [bits[0]]
  2475. append = res.append
  2476. for i in range(1, len(bits), 2):
  2477. append(compat_urllib_parse_unquote_to_bytes(bits[i]).decode(encoding, errors))
  2478. append(bits[i + 1])
  2479. return ''.join(res)
  2480. def compat_urllib_parse_unquote_plus(string, encoding='utf-8', errors='replace'):
  2481. """Like unquote(), but also replace plus signs by spaces, as required for
  2482. unquoting HTML form values.
  2483. unquote_plus('%7e/abc+def') -> '~/abc def'
  2484. """
  2485. string = string.replace('+', ' ')
  2486. return compat_urllib_parse_unquote(string, encoding, errors)
  2487. # Python 2 will choke in urlencode on mixture of byte and unicode strings.
  2488. # Possible solutions are to either port it from python 3 with all
  2489. # the friends or manually ensure input query contains only byte strings.
  2490. # We will stick with latter thus recursively encoding the whole query.
  2491. def compat_urllib_parse_urlencode(query, doseq=0, encoding='utf-8'):
  2492. def encode_elem(e):
  2493. if isinstance(e, dict):
  2494. e = encode_dict(e)
  2495. elif isinstance(e, (list, tuple,)):
  2496. list_e = encode_list(e)
  2497. e = tuple(list_e) if isinstance(e, tuple) else list_e
  2498. elif isinstance(e, compat_str):
  2499. e = e.encode(encoding)
  2500. return e
  2501. def encode_dict(d):
  2502. return dict((encode_elem(k), encode_elem(v)) for k, v in d.items())
  2503. def encode_list(l):
  2504. return [encode_elem(e) for e in l]
  2505. return compat_urllib_parse._urlencode(encode_elem(query), doseq=doseq)
  2506. # HACK: The following is the correct parse_qs implementation from cpython 3's stdlib.
  2507. # Python 2's version is apparently totally broken
  2508. def _parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
  2509. encoding='utf-8', errors='replace'):
  2510. qs, _coerce_result = qs, compat_str
  2511. pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
  2512. r = []
  2513. for name_value in pairs:
  2514. if not name_value and not strict_parsing:
  2515. continue
  2516. nv = name_value.split('=', 1)
  2517. if len(nv) != 2:
  2518. if strict_parsing:
  2519. raise ValueError('bad query field: %r' % (name_value,))
  2520. # Handle case of a control-name with no equal sign
  2521. if keep_blank_values:
  2522. nv.append('')
  2523. else:
  2524. continue
  2525. if len(nv[1]) or keep_blank_values:
  2526. name = nv[0].replace('+', ' ')
  2527. name = compat_urllib_parse_unquote(
  2528. name, encoding=encoding, errors=errors)
  2529. name = _coerce_result(name)
  2530. value = nv[1].replace('+', ' ')
  2531. value = compat_urllib_parse_unquote(
  2532. value, encoding=encoding, errors=errors)
  2533. value = _coerce_result(value)
  2534. r.append((name, value))
  2535. return r
  2536. def compat_parse_qs(qs, keep_blank_values=False, strict_parsing=False,
  2537. encoding='utf-8', errors='replace'):
  2538. parsed_result = {}
  2539. pairs = _parse_qsl(qs, keep_blank_values, strict_parsing,
  2540. encoding=encoding, errors=errors)
  2541. for name, value in pairs:
  2542. if name in parsed_result:
  2543. parsed_result[name].append(value)
  2544. else:
  2545. parsed_result[name] = [value]
  2546. return parsed_result
  2547. setattr(compat_urllib_parse, '_urlencode',
  2548. getattr(compat_urllib_parse, 'urlencode'))
  2549. for name, fix in (
  2550. ('unquote_to_bytes', compat_urllib_parse_unquote_to_bytes),
  2551. ('parse_unquote', compat_urllib_parse_unquote),
  2552. ('unquote_plus', compat_urllib_parse_unquote_plus),
  2553. ('urlencode', compat_urllib_parse_urlencode),
  2554. ('parse_qs', compat_parse_qs)):
  2555. setattr(compat_urllib_parse, name, fix)
  2556. compat_urllib_parse_parse_qs = compat_parse_qs
  2557. try:
  2558. from urllib.request import DataHandler as compat_urllib_request_DataHandler
  2559. except ImportError: # Python < 3.4
  2560. # Ported from CPython 98774:1733b3bd46db, Lib/urllib/request.py
  2561. class compat_urllib_request_DataHandler(compat_urllib_request.BaseHandler):
  2562. def data_open(self, req):
  2563. # data URLs as specified in RFC 2397.
  2564. #
  2565. # ignores POSTed data
  2566. #
  2567. # syntax:
  2568. # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
  2569. # mediatype := [ type "/" subtype ] *( ";" parameter )
  2570. # data := *urlchar
  2571. # parameter := attribute "=" value
  2572. url = req.get_full_url()
  2573. scheme, data = url.split(':', 1)
  2574. mediatype, data = data.split(',', 1)
  2575. # even base64 encoded data URLs might be quoted so unquote in any case:
  2576. data = compat_urllib_parse_unquote_to_bytes(data)
  2577. if mediatype.endswith(';base64'):
  2578. data = binascii.a2b_base64(data)
  2579. mediatype = mediatype[:-7]
  2580. if not mediatype:
  2581. mediatype = 'text/plain;charset=US-ASCII'
  2582. headers = email.message_from_string(
  2583. 'Content-type: %s\nContent-length: %d\n' % (mediatype, len(data)))
  2584. return compat_urllib_response.addinfourl(io.BytesIO(data), headers, url)
  2585. try:
  2586. from xml.etree.ElementTree import ParseError as compat_xml_parse_error
  2587. except ImportError: # Python 2.6
  2588. from xml.parsers.expat import ExpatError as compat_xml_parse_error
  2589. compat_xml_etree_ElementTree_ParseError = compat_xml_parse_error
  2590. etree = xml.etree.ElementTree
  2591. class _TreeBuilder(etree.TreeBuilder):
  2592. def doctype(self, name, pubid, system):
  2593. pass
  2594. try:
  2595. # xml.etree.ElementTree.Element is a method in Python <=2.6 and
  2596. # the following will crash with:
  2597. # TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
  2598. isinstance(None, etree.Element)
  2599. from xml.etree.ElementTree import Element as compat_etree_Element
  2600. except TypeError: # Python <=2.6
  2601. from xml.etree.ElementTree import _ElementInterface as compat_etree_Element
  2602. compat_xml_etree_ElementTree_Element = compat_etree_Element
  2603. if sys.version_info[0] >= 3:
  2604. def compat_etree_fromstring(text):
  2605. return etree.XML(text, parser=etree.XMLParser(target=_TreeBuilder()))
  2606. else:
  2607. # python 2.x tries to encode unicode strings with ascii (see the
  2608. # XMLParser._fixtext method)
  2609. try:
  2610. _etree_iter = etree.Element.iter
  2611. except AttributeError: # Python <=2.6
  2612. def _etree_iter(root):
  2613. for el in root.findall('*'):
  2614. yield el
  2615. for sub in _etree_iter(el):
  2616. yield sub
  2617. # on 2.6 XML doesn't have a parser argument, function copied from CPython
  2618. # 2.7 source
  2619. def _XML(text, parser=None):
  2620. if not parser:
  2621. parser = etree.XMLParser(target=_TreeBuilder())
  2622. parser.feed(text)
  2623. return parser.close()
  2624. def _element_factory(*args, **kwargs):
  2625. el = etree.Element(*args, **kwargs)
  2626. for k, v in el.items():
  2627. if isinstance(v, bytes):
  2628. el.set(k, v.decode('utf-8'))
  2629. return el
  2630. def compat_etree_fromstring(text):
  2631. doc = _XML(text, parser=etree.XMLParser(target=_TreeBuilder(element_factory=_element_factory)))
  2632. for el in _etree_iter(doc):
  2633. if el.text is not None and isinstance(el.text, bytes):
  2634. el.text = el.text.decode('utf-8')
  2635. return doc
  2636. if hasattr(etree, 'register_namespace'):
  2637. compat_etree_register_namespace = etree.register_namespace
  2638. else:
  2639. def compat_etree_register_namespace(prefix, uri):
  2640. """Register a namespace prefix.
  2641. The registry is global, and any existing mapping for either the
  2642. given prefix or the namespace URI will be removed.
  2643. *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
  2644. attributes in this namespace will be serialized with prefix if possible.
  2645. ValueError is raised if prefix is reserved or is invalid.
  2646. """
  2647. if re.match(r"ns\d+$", prefix):
  2648. raise ValueError("Prefix format reserved for internal use")
  2649. for k, v in list(etree._namespace_map.items()):
  2650. if k == uri or v == prefix:
  2651. del etree._namespace_map[k]
  2652. etree._namespace_map[uri] = prefix
  2653. compat_xml_etree_register_namespace = compat_etree_register_namespace
  2654. if sys.version_info < (2, 7):
  2655. # Here comes the crazy part: In 2.6, if the xpath is a unicode,
  2656. # .//node does not match if a node is a direct child of . !
  2657. def compat_xpath(xpath):
  2658. if isinstance(xpath, compat_str):
  2659. xpath = xpath.encode('ascii')
  2660. return xpath
  2661. else:
  2662. compat_xpath = lambda xpath: xpath
  2663. compat_os_name = os._name if os.name == 'java' else os.name
  2664. if compat_os_name == 'nt':
  2665. def compat_shlex_quote(s):
  2666. return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
  2667. else:
  2668. try:
  2669. from shlex import quote as compat_shlex_quote
  2670. except ImportError: # Python < 3.3
  2671. def compat_shlex_quote(s):
  2672. if re.match(r'^[-_\w./]+$', s):
  2673. return s
  2674. else:
  2675. return "'" + s.replace("'", "'\"'\"'") + "'"
  2676. try:
  2677. args = shlex.split('中文')
  2678. assert (isinstance(args, list)
  2679. and isinstance(args[0], compat_str)
  2680. and args[0] == '中文')
  2681. compat_shlex_split = shlex.split
  2682. except (AssertionError, UnicodeEncodeError):
  2683. # Working around shlex issue with unicode strings on some python 2
  2684. # versions (see http://bugs.python.org/issue1548891)
  2685. def compat_shlex_split(s, comments=False, posix=True):
  2686. if isinstance(s, compat_str):
  2687. s = s.encode('utf-8')
  2688. return list(map(lambda s: s.decode('utf-8'), shlex.split(s, comments, posix)))
  2689. def compat_ord(c):
  2690. if type(c) is int:
  2691. return c
  2692. else:
  2693. return ord(c)
  2694. if sys.version_info >= (3, 0):
  2695. compat_getenv = os.getenv
  2696. compat_expanduser = os.path.expanduser
  2697. def compat_setenv(key, value, env=os.environ):
  2698. env[key] = value
  2699. else:
  2700. # Environment variables should be decoded with filesystem encoding.
  2701. # Otherwise it will fail if any non-ASCII characters present (see #3854 #3217 #2918)
  2702. def compat_getenv(key, default=None):
  2703. from .utils import get_filesystem_encoding
  2704. env = os.getenv(key, default)
  2705. if env:
  2706. env = env.decode(get_filesystem_encoding())
  2707. return env
  2708. def compat_setenv(key, value, env=os.environ):
  2709. def encode(v):
  2710. from .utils import get_filesystem_encoding
  2711. return v.encode(get_filesystem_encoding()) if isinstance(v, compat_str) else v
  2712. env[encode(key)] = encode(value)
  2713. # HACK: The default implementations of os.path.expanduser from cpython do not decode
  2714. # environment variables with filesystem encoding. We will work around this by
  2715. # providing adjusted implementations.
  2716. # The following are os.path.expanduser implementations from cpython 2.7.8 stdlib
  2717. # for different platforms with correct environment variables decoding.
  2718. if compat_os_name == 'posix':
  2719. def compat_expanduser(path):
  2720. """Expand ~ and ~user constructions. If user or $HOME is unknown,
  2721. do nothing."""
  2722. if not path.startswith('~'):
  2723. return path
  2724. i = path.find('/', 1)
  2725. if i < 0:
  2726. i = len(path)
  2727. if i == 1:
  2728. if 'HOME' not in os.environ:
  2729. import pwd
  2730. userhome = pwd.getpwuid(os.getuid()).pw_dir
  2731. else:
  2732. userhome = compat_getenv('HOME')
  2733. else:
  2734. import pwd
  2735. try:
  2736. pwent = pwd.getpwnam(path[1:i])
  2737. except KeyError:
  2738. return path
  2739. userhome = pwent.pw_dir
  2740. userhome = userhome.rstrip('/')
  2741. return (userhome + path[i:]) or '/'
  2742. elif compat_os_name in ('nt', 'ce'):
  2743. def compat_expanduser(path):
  2744. """Expand ~ and ~user constructs.
  2745. If user or $HOME is unknown, do nothing."""
  2746. if path[:1] != '~':
  2747. return path
  2748. i, n = 1, len(path)
  2749. while i < n and path[i] not in '/\\':
  2750. i = i + 1
  2751. if 'HOME' in os.environ:
  2752. userhome = compat_getenv('HOME')
  2753. elif 'USERPROFILE' in os.environ:
  2754. userhome = compat_getenv('USERPROFILE')
  2755. elif 'HOMEPATH' not in os.environ:
  2756. return path
  2757. else:
  2758. try:
  2759. drive = compat_getenv('HOMEDRIVE')
  2760. except KeyError:
  2761. drive = ''
  2762. userhome = os.path.join(drive, compat_getenv('HOMEPATH'))
  2763. if i != 1: # ~user
  2764. userhome = os.path.join(os.path.dirname(userhome), path[1:i])
  2765. return userhome + path[i:]
  2766. else:
  2767. compat_expanduser = os.path.expanduser
  2768. compat_os_path_expanduser = compat_expanduser
  2769. if compat_os_name == 'nt' and sys.version_info < (3, 8):
  2770. # os.path.realpath on Windows does not follow symbolic links
  2771. # prior to Python 3.8 (see https://bugs.python.org/issue9949)
  2772. def compat_realpath(path):
  2773. while os.path.islink(path):
  2774. path = os.path.abspath(os.readlink(path))
  2775. return path
  2776. else:
  2777. compat_realpath = os.path.realpath
  2778. compat_os_path_realpath = compat_realpath
  2779. if sys.version_info < (3, 0):
  2780. def compat_print(s):
  2781. from .utils import preferredencoding
  2782. print(s.encode(preferredencoding(), 'xmlcharrefreplace'))
  2783. else:
  2784. def compat_print(s):
  2785. assert isinstance(s, compat_str)
  2786. print(s)
  2787. if sys.version_info < (3, 0) and sys.platform == 'win32':
  2788. def compat_getpass(prompt, *args, **kwargs):
  2789. if isinstance(prompt, compat_str):
  2790. from .utils import preferredencoding
  2791. prompt = prompt.encode(preferredencoding())
  2792. return getpass.getpass(prompt, *args, **kwargs)
  2793. else:
  2794. compat_getpass = getpass.getpass
  2795. compat_getpass_getpass = compat_getpass
  2796. try:
  2797. compat_input = raw_input
  2798. except NameError: # Python 3
  2799. compat_input = input
  2800. # Python < 2.6.5 require kwargs to be bytes
  2801. try:
  2802. def _testfunc(x):
  2803. pass
  2804. _testfunc(**{'x': 0})
  2805. except TypeError:
  2806. def compat_kwargs(kwargs):
  2807. return dict((bytes(k), v) for k, v in kwargs.items())
  2808. else:
  2809. compat_kwargs = lambda kwargs: kwargs
  2810. try:
  2811. compat_numeric_types = (int, float, long, complex)
  2812. except NameError: # Python 3
  2813. compat_numeric_types = (int, float, complex)
  2814. try:
  2815. compat_integer_types = (int, long)
  2816. except NameError: # Python 3
  2817. compat_integer_types = (int, )
  2818. if sys.version_info < (2, 7):
  2819. def compat_socket_create_connection(address, timeout, source_address=None):
  2820. host, port = address
  2821. err = None
  2822. for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
  2823. af, socktype, proto, canonname, sa = res
  2824. sock = None
  2825. try:
  2826. sock = socket.socket(af, socktype, proto)
  2827. sock.settimeout(timeout)
  2828. if source_address:
  2829. sock.bind(source_address)
  2830. sock.connect(sa)
  2831. return sock
  2832. except socket.error as _:
  2833. err = _
  2834. if sock is not None:
  2835. sock.close()
  2836. if err is not None:
  2837. raise err
  2838. else:
  2839. raise socket.error('getaddrinfo returns an empty list')
  2840. else:
  2841. compat_socket_create_connection = socket.create_connection
  2842. try:
  2843. from contextlib import suppress as compat_contextlib_suppress
  2844. except ImportError:
  2845. class compat_contextlib_suppress(object):
  2846. _exceptions = None
  2847. def __init__(self, *exceptions):
  2848. super(compat_contextlib_suppress, self).__init__()
  2849. # TODO: [Base]ExceptionGroup (3.12+)
  2850. self._exceptions = exceptions
  2851. def __enter__(self):
  2852. return self
  2853. def __exit__(self, exc_type, exc_val, exc_tb):
  2854. return exc_val is not None and isinstance(exc_val, self._exceptions or tuple())
  2855. # subprocess.Popen context manager
  2856. # avoids leaking handles if .communicate() is not called
  2857. try:
  2858. _Popen = subprocess.Popen
  2859. # check for required context manager attributes
  2860. _Popen.__enter__ and _Popen.__exit__
  2861. compat_subprocess_Popen = _Popen
  2862. except AttributeError:
  2863. # not a context manager - make one
  2864. from contextlib import contextmanager
  2865. @contextmanager
  2866. def compat_subprocess_Popen(*args, **kwargs):
  2867. popen = None
  2868. try:
  2869. popen = _Popen(*args, **kwargs)
  2870. yield popen
  2871. finally:
  2872. if popen:
  2873. for f in (popen.stdin, popen.stdout, popen.stderr):
  2874. if f:
  2875. # repeated .close() is OK, but just in case
  2876. with compat_contextlib_suppress(EnvironmentError):
  2877. f.close()
  2878. popen.wait()
  2879. # Fix https://github.com/ytdl-org/youtube-dl/issues/4223
  2880. # See http://bugs.python.org/issue9161 for what is broken
  2881. def workaround_optparse_bug9161():
  2882. op = optparse.OptionParser()
  2883. og = optparse.OptionGroup(op, 'foo')
  2884. try:
  2885. og.add_option('-t')
  2886. except TypeError:
  2887. real_add_option = optparse.OptionGroup.add_option
  2888. def _compat_add_option(self, *args, **kwargs):
  2889. enc = lambda v: (
  2890. v.encode('ascii', 'replace') if isinstance(v, compat_str)
  2891. else v)
  2892. bargs = [enc(a) for a in args]
  2893. bkwargs = dict(
  2894. (k, enc(v)) for k, v in kwargs.items())
  2895. return real_add_option(self, *bargs, **bkwargs)
  2896. optparse.OptionGroup.add_option = _compat_add_option
  2897. if hasattr(shutil, 'get_terminal_size'): # Python >= 3.3
  2898. compat_get_terminal_size = shutil.get_terminal_size
  2899. else:
  2900. _terminal_size = collections.namedtuple('terminal_size', ['columns', 'lines'])
  2901. def compat_get_terminal_size(fallback=(80, 24)):
  2902. from .utils import process_communicate_or_kill
  2903. columns = compat_getenv('COLUMNS')
  2904. if columns:
  2905. columns = int(columns)
  2906. else:
  2907. columns = None
  2908. lines = compat_getenv('LINES')
  2909. if lines:
  2910. lines = int(lines)
  2911. else:
  2912. lines = None
  2913. if columns is None or lines is None or columns <= 0 or lines <= 0:
  2914. try:
  2915. sp = subprocess.Popen(
  2916. ['stty', 'size'],
  2917. stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  2918. out, err = process_communicate_or_kill(sp)
  2919. _lines, _columns = map(int, out.split())
  2920. except Exception:
  2921. _columns, _lines = _terminal_size(*fallback)
  2922. if columns is None or columns <= 0:
  2923. columns = _columns
  2924. if lines is None or lines <= 0:
  2925. lines = _lines
  2926. return _terminal_size(columns, lines)
  2927. try:
  2928. itertools.count(start=0, step=1)
  2929. compat_itertools_count = itertools.count
  2930. except TypeError: # Python 2.6
  2931. def compat_itertools_count(start=0, step=1):
  2932. while True:
  2933. yield start
  2934. start += step
  2935. if sys.version_info >= (3, 0):
  2936. from tokenize import tokenize as compat_tokenize_tokenize
  2937. else:
  2938. from tokenize import generate_tokens as compat_tokenize_tokenize
  2939. try:
  2940. struct.pack('!I', 0)
  2941. except TypeError:
  2942. # In Python 2.6 and 2.7.x < 2.7.7, struct requires a bytes argument
  2943. # See https://bugs.python.org/issue19099
  2944. def compat_struct_pack(spec, *args):
  2945. if isinstance(spec, compat_str):
  2946. spec = spec.encode('ascii')
  2947. return struct.pack(spec, *args)
  2948. def compat_struct_unpack(spec, *args):
  2949. if isinstance(spec, compat_str):
  2950. spec = spec.encode('ascii')
  2951. return struct.unpack(spec, *args)
  2952. class compat_Struct(struct.Struct):
  2953. def __init__(self, fmt):
  2954. if isinstance(fmt, compat_str):
  2955. fmt = fmt.encode('ascii')
  2956. super(compat_Struct, self).__init__(fmt)
  2957. else:
  2958. compat_struct_pack = struct.pack
  2959. compat_struct_unpack = struct.unpack
  2960. if platform.python_implementation() == 'IronPython' and sys.version_info < (2, 7, 8):
  2961. class compat_Struct(struct.Struct):
  2962. def unpack(self, string):
  2963. if not isinstance(string, buffer): # noqa: F821
  2964. string = buffer(string) # noqa: F821
  2965. return super(compat_Struct, self).unpack(string)
  2966. else:
  2967. compat_Struct = struct.Struct
  2968. # compat_map/filter() returning an iterator, supposedly the
  2969. # same versioning as for zip below
  2970. try:
  2971. from future_builtins import map as compat_map
  2972. except ImportError:
  2973. try:
  2974. from itertools import imap as compat_map
  2975. except ImportError:
  2976. compat_map = map
  2977. try:
  2978. from future_builtins import filter as compat_filter
  2979. except ImportError:
  2980. try:
  2981. from itertools import ifilter as compat_filter
  2982. except ImportError:
  2983. compat_filter = filter
  2984. try:
  2985. from future_builtins import zip as compat_zip
  2986. except ImportError: # not 2.6+ or is 3.x
  2987. try:
  2988. from itertools import izip as compat_zip # < 2.5 or 3.x
  2989. except ImportError:
  2990. compat_zip = zip
  2991. # method renamed between Py2/3
  2992. try:
  2993. from itertools import zip_longest as compat_itertools_zip_longest
  2994. except ImportError:
  2995. from itertools import izip_longest as compat_itertools_zip_longest
  2996. # new class in collections
  2997. try:
  2998. from collections import ChainMap as compat_collections_chain_map
  2999. # Py3.3's ChainMap is deficient
  3000. if sys.version_info < (3, 4):
  3001. raise ImportError
  3002. except ImportError:
  3003. # Py <= 3.3
  3004. class compat_collections_chain_map(compat_collections_abc.MutableMapping):
  3005. maps = [{}]
  3006. def __init__(self, *maps):
  3007. self.maps = list(maps) or [{}]
  3008. def __getitem__(self, k):
  3009. for m in self.maps:
  3010. if k in m:
  3011. return m[k]
  3012. raise KeyError(k)
  3013. def __setitem__(self, k, v):
  3014. self.maps[0].__setitem__(k, v)
  3015. return
  3016. def __contains__(self, k):
  3017. return any((k in m) for m in self.maps)
  3018. def __delitem(self, k):
  3019. if k in self.maps[0]:
  3020. del self.maps[0][k]
  3021. return
  3022. raise KeyError(k)
  3023. def __delitem__(self, k):
  3024. self.__delitem(k)
  3025. def __iter__(self):
  3026. return itertools.chain(*reversed(self.maps))
  3027. def __len__(self):
  3028. return len(iter(self))
  3029. # to match Py3, don't del directly
  3030. def pop(self, k, *args):
  3031. if self.__contains__(k):
  3032. off = self.__getitem__(k)
  3033. self.__delitem(k)
  3034. return off
  3035. elif len(args) > 0:
  3036. return args[0]
  3037. raise KeyError(k)
  3038. def new_child(self, m=None, **kwargs):
  3039. m = m or {}
  3040. m.update(kwargs)
  3041. return compat_collections_chain_map(m, *self.maps)
  3042. @property
  3043. def parents(self):
  3044. return compat_collections_chain_map(*(self.maps[1:]))
  3045. # Pythons disagree on the type of a pattern (RegexObject, _sre.SRE_Pattern, Pattern, ...?)
  3046. compat_re_Pattern = type(re.compile(''))
  3047. # and on the type of a match
  3048. compat_re_Match = type(re.match('a', 'a'))
  3049. if sys.version_info < (3, 3):
  3050. def compat_b64decode(s, *args, **kwargs):
  3051. if isinstance(s, compat_str):
  3052. s = s.encode('ascii')
  3053. return base64.b64decode(s, *args, **kwargs)
  3054. else:
  3055. compat_b64decode = base64.b64decode
  3056. compat_base64_b64decode = compat_b64decode
  3057. if platform.python_implementation() == 'PyPy' and sys.pypy_version_info < (5, 4, 0):
  3058. # PyPy2 prior to version 5.4.0 expects byte strings as Windows function
  3059. # names, see the original PyPy issue [1] and the youtube-dl one [2].
  3060. # 1. https://bitbucket.org/pypy/pypy/issues/2360/windows-ctypescdll-typeerror-function-name
  3061. # 2. https://github.com/ytdl-org/youtube-dl/pull/4392
  3062. def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
  3063. real = ctypes.WINFUNCTYPE(*args, **kwargs)
  3064. def resf(tpl, *args, **kwargs):
  3065. funcname, dll = tpl
  3066. return real((str(funcname), dll), *args, **kwargs)
  3067. return resf
  3068. else:
  3069. def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
  3070. return ctypes.WINFUNCTYPE(*args, **kwargs)
  3071. if sys.version_info < (3, 0):
  3072. # open(file, mode='r', buffering=- 1, encoding=None, errors=None, newline=None, closefd=True) not: opener=None
  3073. def compat_open(file_, *args, **kwargs):
  3074. if len(args) > 6 or 'opener' in kwargs:
  3075. raise ValueError('open: unsupported argument "opener"')
  3076. return io.open(file_, *args, **kwargs)
  3077. else:
  3078. compat_open = open
  3079. # compat_register_utf8
  3080. def compat_register_utf8():
  3081. if sys.platform == 'win32':
  3082. # https://github.com/ytdl-org/youtube-dl/issues/820
  3083. from codecs import register, lookup
  3084. register(
  3085. lambda name: lookup('utf-8') if name == 'cp65001' else None)
  3086. # compat_datetime_timedelta_total_seconds
  3087. try:
  3088. compat_datetime_timedelta_total_seconds = datetime.timedelta.total_seconds
  3089. except AttributeError:
  3090. # Py 2.6
  3091. def compat_datetime_timedelta_total_seconds(td):
  3092. return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
  3093. # optional decompression packages
  3094. # PyPi brotli package implements 'br' Content-Encoding
  3095. try:
  3096. import brotli as compat_brotli
  3097. except ImportError:
  3098. compat_brotli = None
  3099. # PyPi ncompress package implements 'compress' Content-Encoding
  3100. try:
  3101. import ncompress as compat_ncompress
  3102. except ImportError:
  3103. compat_ncompress = None
  3104. legacy = [
  3105. 'compat_HTMLParseError',
  3106. 'compat_HTMLParser',
  3107. 'compat_HTTPError',
  3108. 'compat_b64decode',
  3109. 'compat_cookiejar',
  3110. 'compat_cookiejar_Cookie',
  3111. 'compat_cookies',
  3112. 'compat_cookies_SimpleCookie',
  3113. 'compat_etree_Element',
  3114. 'compat_etree_register_namespace',
  3115. 'compat_expanduser',
  3116. 'compat_getpass',
  3117. 'compat_parse_qs',
  3118. 'compat_realpath',
  3119. 'compat_urllib_parse_parse_qs',
  3120. 'compat_urllib_parse_unquote',
  3121. 'compat_urllib_parse_unquote_plus',
  3122. 'compat_urllib_parse_unquote_to_bytes',
  3123. 'compat_urllib_parse_urlencode',
  3124. 'compat_urllib_parse_urlparse',
  3125. 'compat_urlparse',
  3126. 'compat_urlretrieve',
  3127. 'compat_xml_parse_error',
  3128. ]
  3129. __all__ = [
  3130. 'compat_html_parser_HTMLParseError',
  3131. 'compat_html_parser_HTMLParser',
  3132. 'compat_Struct',
  3133. 'compat_base64_b64decode',
  3134. 'compat_basestring',
  3135. 'compat_brotli',
  3136. 'compat_casefold',
  3137. 'compat_chr',
  3138. 'compat_collections_abc',
  3139. 'compat_collections_chain_map',
  3140. 'compat_datetime_timedelta_total_seconds',
  3141. 'compat_http_cookiejar',
  3142. 'compat_http_cookiejar_Cookie',
  3143. 'compat_http_cookies',
  3144. 'compat_http_cookies_SimpleCookie',
  3145. 'compat_contextlib_suppress',
  3146. 'compat_ctypes_WINFUNCTYPE',
  3147. 'compat_etree_fromstring',
  3148. 'compat_filter',
  3149. 'compat_get_terminal_size',
  3150. 'compat_getenv',
  3151. 'compat_getpass_getpass',
  3152. 'compat_html_entities',
  3153. 'compat_html_entities_html5',
  3154. 'compat_http_client',
  3155. 'compat_http_server',
  3156. 'compat_input',
  3157. 'compat_integer_types',
  3158. 'compat_itertools_count',
  3159. 'compat_itertools_zip_longest',
  3160. 'compat_kwargs',
  3161. 'compat_map',
  3162. 'compat_ncompress',
  3163. 'compat_numeric_types',
  3164. 'compat_open',
  3165. 'compat_ord',
  3166. 'compat_os_name',
  3167. 'compat_os_path_expanduser',
  3168. 'compat_os_path_realpath',
  3169. 'compat_print',
  3170. 'compat_re_Match',
  3171. 'compat_re_Pattern',
  3172. 'compat_register_utf8',
  3173. 'compat_setenv',
  3174. 'compat_shlex_quote',
  3175. 'compat_shlex_split',
  3176. 'compat_socket_create_connection',
  3177. 'compat_str',
  3178. 'compat_struct_pack',
  3179. 'compat_struct_unpack',
  3180. 'compat_subprocess_get_DEVNULL',
  3181. 'compat_subprocess_Popen',
  3182. 'compat_tokenize_tokenize',
  3183. 'compat_urllib_error',
  3184. 'compat_urllib_parse',
  3185. 'compat_urllib_request',
  3186. 'compat_urllib_request_DataHandler',
  3187. 'compat_urllib_response',
  3188. 'compat_urllib_request_urlretrieve',
  3189. 'compat_urllib_HTTPError',
  3190. 'compat_xml_etree_ElementTree_Element',
  3191. 'compat_xml_etree_ElementTree_ParseError',
  3192. 'compat_xml_etree_register_namespace',
  3193. 'compat_xpath',
  3194. 'compat_zip',
  3195. 'workaround_optparse_bug9161',
  3196. ]