compat.py 111 KB

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