ZTWHHH commited on
Commit
ef6741f
·
verified ·
1 Parent(s): 9e895f4

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. omnilmm/lib/python3.10/asyncio/__pycache__/__init__.cpython-310.pyc +0 -0
  3. omnilmm/lib/python3.10/asyncio/__pycache__/__main__.cpython-310.pyc +0 -0
  4. omnilmm/lib/python3.10/asyncio/__pycache__/base_events.cpython-310.pyc +0 -0
  5. omnilmm/lib/python3.10/asyncio/__pycache__/base_futures.cpython-310.pyc +0 -0
  6. omnilmm/lib/python3.10/asyncio/__pycache__/base_subprocess.cpython-310.pyc +0 -0
  7. omnilmm/lib/python3.10/asyncio/__pycache__/base_tasks.cpython-310.pyc +0 -0
  8. omnilmm/lib/python3.10/asyncio/__pycache__/constants.cpython-310.pyc +0 -0
  9. omnilmm/lib/python3.10/asyncio/__pycache__/coroutines.cpython-310.pyc +0 -0
  10. omnilmm/lib/python3.10/asyncio/__pycache__/events.cpython-310.pyc +0 -0
  11. omnilmm/lib/python3.10/asyncio/__pycache__/exceptions.cpython-310.pyc +0 -0
  12. omnilmm/lib/python3.10/asyncio/__pycache__/format_helpers.cpython-310.pyc +0 -0
  13. omnilmm/lib/python3.10/asyncio/__pycache__/futures.cpython-310.pyc +0 -0
  14. omnilmm/lib/python3.10/asyncio/__pycache__/locks.cpython-310.pyc +0 -0
  15. omnilmm/lib/python3.10/asyncio/__pycache__/log.cpython-310.pyc +0 -0
  16. omnilmm/lib/python3.10/asyncio/__pycache__/mixins.cpython-310.pyc +0 -0
  17. omnilmm/lib/python3.10/asyncio/__pycache__/proactor_events.cpython-310.pyc +0 -0
  18. omnilmm/lib/python3.10/asyncio/__pycache__/protocols.cpython-310.pyc +0 -0
  19. omnilmm/lib/python3.10/asyncio/__pycache__/queues.cpython-310.pyc +0 -0
  20. omnilmm/lib/python3.10/asyncio/__pycache__/runners.cpython-310.pyc +0 -0
  21. omnilmm/lib/python3.10/asyncio/__pycache__/selector_events.cpython-310.pyc +0 -0
  22. omnilmm/lib/python3.10/asyncio/__pycache__/sslproto.cpython-310.pyc +0 -0
  23. omnilmm/lib/python3.10/asyncio/__pycache__/staggered.cpython-310.pyc +0 -0
  24. omnilmm/lib/python3.10/asyncio/__pycache__/streams.cpython-310.pyc +0 -0
  25. omnilmm/lib/python3.10/asyncio/__pycache__/subprocess.cpython-310.pyc +0 -0
  26. omnilmm/lib/python3.10/asyncio/__pycache__/tasks.cpython-310.pyc +0 -0
  27. omnilmm/lib/python3.10/asyncio/__pycache__/threads.cpython-310.pyc +0 -0
  28. omnilmm/lib/python3.10/asyncio/__pycache__/transports.cpython-310.pyc +0 -0
  29. omnilmm/lib/python3.10/asyncio/__pycache__/trsock.cpython-310.pyc +0 -0
  30. omnilmm/lib/python3.10/asyncio/__pycache__/unix_events.cpython-310.pyc +0 -0
  31. omnilmm/lib/python3.10/asyncio/__pycache__/windows_events.cpython-310.pyc +0 -0
  32. omnilmm/lib/python3.10/asyncio/__pycache__/windows_utils.cpython-310.pyc +0 -0
  33. omnilmm/lib/python3.10/asyncio/base_subprocess.py +285 -0
  34. omnilmm/lib/python3.10/asyncio/proactor_events.py +875 -0
  35. omnilmm/lib/python3.10/asyncio/queues.py +245 -0
  36. omnilmm/lib/python3.10/asyncio/staggered.py +149 -0
  37. omnilmm/lib/python3.10/asyncio/streams.py +726 -0
  38. omnilmm/lib/python3.10/html/__init__.py +132 -0
  39. omnilmm/lib/python3.10/html/__pycache__/__init__.cpython-310.pyc +0 -0
  40. omnilmm/lib/python3.10/html/__pycache__/parser.cpython-310.pyc +0 -0
  41. omnilmm/lib/python3.10/html/entities.py +2510 -0
  42. omnilmm/lib/python3.10/html/parser.py +462 -0
  43. omnilmm/lib/python3.10/lib-dynload/_contextvars.cpython-310-x86_64-linux-gnu.so +0 -0
  44. omnilmm/lib/python3.10/lib-dynload/_sha256.cpython-310-x86_64-linux-gnu.so +0 -0
  45. omnilmm/lib/python3.10/lib-dynload/termios.cpython-310-x86_64-linux-gnu.so +0 -0
  46. omnilmm/lib/python3.10/pydoc_data/__init__.py +0 -0
  47. omnilmm/lib/python3.10/pydoc_data/__pycache__/__init__.cpython-310.pyc +0 -0
  48. omnilmm/lib/python3.10/pydoc_data/__pycache__/topics.cpython-310.pyc +3 -0
  49. omnilmm/lib/python3.10/pydoc_data/_pydoc.css +6 -0
  50. omnilmm/lib/python3.10/pydoc_data/topics.py +0 -0
.gitattributes CHANGED
@@ -1023,3 +1023,4 @@ omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/backend_bases.cpytho
1023
  omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/patches.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1024
  omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/widgets.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1025
  omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/figure.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
 
 
1023
  omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/patches.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1024
  omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/widgets.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1025
  omnilmm/lib/python3.10/site-packages/matplotlib/__pycache__/figure.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1026
+ omnilmm/lib/python3.10/pydoc_data/__pycache__/topics.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
omnilmm/lib/python3.10/asyncio/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (739 Bytes). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/__main__.cpython-310.pyc ADDED
Binary file (3.46 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/base_events.cpython-310.pyc ADDED
Binary file (52.1 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/base_futures.cpython-310.pyc ADDED
Binary file (2.17 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/base_subprocess.cpython-310.pyc ADDED
Binary file (9.38 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/base_tasks.cpython-310.pyc ADDED
Binary file (2.24 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/constants.cpython-310.pyc ADDED
Binary file (840 Bytes). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/coroutines.cpython-310.pyc ADDED
Binary file (6.62 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/events.cpython-310.pyc ADDED
Binary file (28.6 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/exceptions.cpython-310.pyc ADDED
Binary file (2.72 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/format_helpers.cpython-310.pyc ADDED
Binary file (2.59 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/futures.cpython-310.pyc ADDED
Binary file (12.1 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/locks.cpython-310.pyc ADDED
Binary file (14.4 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/log.cpython-310.pyc ADDED
Binary file (483 Bytes). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/mixins.cpython-310.pyc ADDED
Binary file (1.07 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/proactor_events.cpython-310.pyc ADDED
Binary file (24.7 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/protocols.cpython-310.pyc ADDED
Binary file (8.29 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/queues.cpython-310.pyc ADDED
Binary file (8.3 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/runners.cpython-310.pyc ADDED
Binary file (2.09 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/selector_events.cpython-310.pyc ADDED
Binary file (29.8 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/sslproto.cpython-310.pyc ADDED
Binary file (22.2 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/staggered.cpython-310.pyc ADDED
Binary file (4.44 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/streams.cpython-310.pyc ADDED
Binary file (20.4 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/subprocess.cpython-310.pyc ADDED
Binary file (7.32 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/tasks.cpython-310.pyc ADDED
Binary file (24.2 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/threads.cpython-310.pyc ADDED
Binary file (1.24 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/transports.cpython-310.pyc ADDED
Binary file (12.6 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/trsock.cpython-310.pyc ADDED
Binary file (7.84 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/unix_events.cpython-310.pyc ADDED
Binary file (41.9 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/windows_events.cpython-310.pyc ADDED
Binary file (24.4 kB). View file
 
omnilmm/lib/python3.10/asyncio/__pycache__/windows_utils.cpython-310.pyc ADDED
Binary file (4.75 kB). View file
 
omnilmm/lib/python3.10/asyncio/base_subprocess.py ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import collections
2
+ import subprocess
3
+ import warnings
4
+
5
+ from . import protocols
6
+ from . import transports
7
+ from .log import logger
8
+
9
+
10
+ class BaseSubprocessTransport(transports.SubprocessTransport):
11
+
12
+ def __init__(self, loop, protocol, args, shell,
13
+ stdin, stdout, stderr, bufsize,
14
+ waiter=None, extra=None, **kwargs):
15
+ super().__init__(extra)
16
+ self._closed = False
17
+ self._protocol = protocol
18
+ self._loop = loop
19
+ self._proc = None
20
+ self._pid = None
21
+ self._returncode = None
22
+ self._exit_waiters = []
23
+ self._pending_calls = collections.deque()
24
+ self._pipes = {}
25
+ self._finished = False
26
+
27
+ if stdin == subprocess.PIPE:
28
+ self._pipes[0] = None
29
+ if stdout == subprocess.PIPE:
30
+ self._pipes[1] = None
31
+ if stderr == subprocess.PIPE:
32
+ self._pipes[2] = None
33
+
34
+ # Create the child process: set the _proc attribute
35
+ try:
36
+ self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
37
+ stderr=stderr, bufsize=bufsize, **kwargs)
38
+ except:
39
+ self.close()
40
+ raise
41
+
42
+ self._pid = self._proc.pid
43
+ self._extra['subprocess'] = self._proc
44
+
45
+ if self._loop.get_debug():
46
+ if isinstance(args, (bytes, str)):
47
+ program = args
48
+ else:
49
+ program = args[0]
50
+ logger.debug('process %r created: pid %s',
51
+ program, self._pid)
52
+
53
+ self._loop.create_task(self._connect_pipes(waiter))
54
+
55
+ def __repr__(self):
56
+ info = [self.__class__.__name__]
57
+ if self._closed:
58
+ info.append('closed')
59
+ if self._pid is not None:
60
+ info.append(f'pid={self._pid}')
61
+ if self._returncode is not None:
62
+ info.append(f'returncode={self._returncode}')
63
+ elif self._pid is not None:
64
+ info.append('running')
65
+ else:
66
+ info.append('not started')
67
+
68
+ stdin = self._pipes.get(0)
69
+ if stdin is not None:
70
+ info.append(f'stdin={stdin.pipe}')
71
+
72
+ stdout = self._pipes.get(1)
73
+ stderr = self._pipes.get(2)
74
+ if stdout is not None and stderr is stdout:
75
+ info.append(f'stdout=stderr={stdout.pipe}')
76
+ else:
77
+ if stdout is not None:
78
+ info.append(f'stdout={stdout.pipe}')
79
+ if stderr is not None:
80
+ info.append(f'stderr={stderr.pipe}')
81
+
82
+ return '<{}>'.format(' '.join(info))
83
+
84
+ def _start(self, args, shell, stdin, stdout, stderr, bufsize, **kwargs):
85
+ raise NotImplementedError
86
+
87
+ def set_protocol(self, protocol):
88
+ self._protocol = protocol
89
+
90
+ def get_protocol(self):
91
+ return self._protocol
92
+
93
+ def is_closing(self):
94
+ return self._closed
95
+
96
+ def close(self):
97
+ if self._closed:
98
+ return
99
+ self._closed = True
100
+
101
+ for proto in self._pipes.values():
102
+ if proto is None:
103
+ continue
104
+ proto.pipe.close()
105
+
106
+ if (self._proc is not None and
107
+ # has the child process finished?
108
+ self._returncode is None and
109
+ # the child process has finished, but the
110
+ # transport hasn't been notified yet?
111
+ self._proc.poll() is None):
112
+
113
+ if self._loop.get_debug():
114
+ logger.warning('Close running child process: kill %r', self)
115
+
116
+ try:
117
+ self._proc.kill()
118
+ except ProcessLookupError:
119
+ pass
120
+
121
+ # Don't clear the _proc reference yet: _post_init() may still run
122
+
123
+ def __del__(self, _warn=warnings.warn):
124
+ if not self._closed:
125
+ _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
126
+ self.close()
127
+
128
+ def get_pid(self):
129
+ return self._pid
130
+
131
+ def get_returncode(self):
132
+ return self._returncode
133
+
134
+ def get_pipe_transport(self, fd):
135
+ if fd in self._pipes:
136
+ return self._pipes[fd].pipe
137
+ else:
138
+ return None
139
+
140
+ def _check_proc(self):
141
+ if self._proc is None:
142
+ raise ProcessLookupError()
143
+
144
+ def send_signal(self, signal):
145
+ self._check_proc()
146
+ self._proc.send_signal(signal)
147
+
148
+ def terminate(self):
149
+ self._check_proc()
150
+ self._proc.terminate()
151
+
152
+ def kill(self):
153
+ self._check_proc()
154
+ self._proc.kill()
155
+
156
+ async def _connect_pipes(self, waiter):
157
+ try:
158
+ proc = self._proc
159
+ loop = self._loop
160
+
161
+ if proc.stdin is not None:
162
+ _, pipe = await loop.connect_write_pipe(
163
+ lambda: WriteSubprocessPipeProto(self, 0),
164
+ proc.stdin)
165
+ self._pipes[0] = pipe
166
+
167
+ if proc.stdout is not None:
168
+ _, pipe = await loop.connect_read_pipe(
169
+ lambda: ReadSubprocessPipeProto(self, 1),
170
+ proc.stdout)
171
+ self._pipes[1] = pipe
172
+
173
+ if proc.stderr is not None:
174
+ _, pipe = await loop.connect_read_pipe(
175
+ lambda: ReadSubprocessPipeProto(self, 2),
176
+ proc.stderr)
177
+ self._pipes[2] = pipe
178
+
179
+ assert self._pending_calls is not None
180
+
181
+ loop.call_soon(self._protocol.connection_made, self)
182
+ for callback, data in self._pending_calls:
183
+ loop.call_soon(callback, *data)
184
+ self._pending_calls = None
185
+ except (SystemExit, KeyboardInterrupt):
186
+ raise
187
+ except BaseException as exc:
188
+ if waiter is not None and not waiter.cancelled():
189
+ waiter.set_exception(exc)
190
+ else:
191
+ if waiter is not None and not waiter.cancelled():
192
+ waiter.set_result(None)
193
+
194
+ def _call(self, cb, *data):
195
+ if self._pending_calls is not None:
196
+ self._pending_calls.append((cb, data))
197
+ else:
198
+ self._loop.call_soon(cb, *data)
199
+
200
+ def _pipe_connection_lost(self, fd, exc):
201
+ self._call(self._protocol.pipe_connection_lost, fd, exc)
202
+ self._try_finish()
203
+
204
+ def _pipe_data_received(self, fd, data):
205
+ self._call(self._protocol.pipe_data_received, fd, data)
206
+
207
+ def _process_exited(self, returncode):
208
+ assert returncode is not None, returncode
209
+ assert self._returncode is None, self._returncode
210
+ if self._loop.get_debug():
211
+ logger.info('%r exited with return code %r', self, returncode)
212
+ self._returncode = returncode
213
+ if self._proc.returncode is None:
214
+ # asyncio uses a child watcher: copy the status into the Popen
215
+ # object. On Python 3.6, it is required to avoid a ResourceWarning.
216
+ self._proc.returncode = returncode
217
+ self._call(self._protocol.process_exited)
218
+ self._try_finish()
219
+
220
+ # wake up futures waiting for wait()
221
+ for waiter in self._exit_waiters:
222
+ if not waiter.cancelled():
223
+ waiter.set_result(returncode)
224
+ self._exit_waiters = None
225
+
226
+ async def _wait(self):
227
+ """Wait until the process exit and return the process return code.
228
+
229
+ This method is a coroutine."""
230
+ if self._returncode is not None:
231
+ return self._returncode
232
+
233
+ waiter = self._loop.create_future()
234
+ self._exit_waiters.append(waiter)
235
+ return await waiter
236
+
237
+ def _try_finish(self):
238
+ assert not self._finished
239
+ if self._returncode is None:
240
+ return
241
+ if all(p is not None and p.disconnected
242
+ for p in self._pipes.values()):
243
+ self._finished = True
244
+ self._call(self._call_connection_lost, None)
245
+
246
+ def _call_connection_lost(self, exc):
247
+ try:
248
+ self._protocol.connection_lost(exc)
249
+ finally:
250
+ self._loop = None
251
+ self._proc = None
252
+ self._protocol = None
253
+
254
+
255
+ class WriteSubprocessPipeProto(protocols.BaseProtocol):
256
+
257
+ def __init__(self, proc, fd):
258
+ self.proc = proc
259
+ self.fd = fd
260
+ self.pipe = None
261
+ self.disconnected = False
262
+
263
+ def connection_made(self, transport):
264
+ self.pipe = transport
265
+
266
+ def __repr__(self):
267
+ return f'<{self.__class__.__name__} fd={self.fd} pipe={self.pipe!r}>'
268
+
269
+ def connection_lost(self, exc):
270
+ self.disconnected = True
271
+ self.proc._pipe_connection_lost(self.fd, exc)
272
+ self.proc = None
273
+
274
+ def pause_writing(self):
275
+ self.proc._protocol.pause_writing()
276
+
277
+ def resume_writing(self):
278
+ self.proc._protocol.resume_writing()
279
+
280
+
281
+ class ReadSubprocessPipeProto(WriteSubprocessPipeProto,
282
+ protocols.Protocol):
283
+
284
+ def data_received(self, data):
285
+ self.proc._pipe_data_received(self.fd, data)
omnilmm/lib/python3.10/asyncio/proactor_events.py ADDED
@@ -0,0 +1,875 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Event loop using a proactor and related classes.
2
+
3
+ A proactor is a "notify-on-completion" multiplexer. Currently a
4
+ proactor is only implemented on Windows with IOCP.
5
+ """
6
+
7
+ __all__ = 'BaseProactorEventLoop',
8
+
9
+ import io
10
+ import os
11
+ import socket
12
+ import warnings
13
+ import signal
14
+ import threading
15
+ import collections
16
+
17
+ from . import base_events
18
+ from . import constants
19
+ from . import futures
20
+ from . import exceptions
21
+ from . import protocols
22
+ from . import sslproto
23
+ from . import transports
24
+ from . import trsock
25
+ from .log import logger
26
+
27
+
28
+ def _set_socket_extra(transport, sock):
29
+ transport._extra['socket'] = trsock.TransportSocket(sock)
30
+
31
+ try:
32
+ transport._extra['sockname'] = sock.getsockname()
33
+ except socket.error:
34
+ if transport._loop.get_debug():
35
+ logger.warning(
36
+ "getsockname() failed on %r", sock, exc_info=True)
37
+
38
+ if 'peername' not in transport._extra:
39
+ try:
40
+ transport._extra['peername'] = sock.getpeername()
41
+ except socket.error:
42
+ # UDP sockets may not have a peer name
43
+ transport._extra['peername'] = None
44
+
45
+
46
+ class _ProactorBasePipeTransport(transports._FlowControlMixin,
47
+ transports.BaseTransport):
48
+ """Base class for pipe and socket transports."""
49
+
50
+ def __init__(self, loop, sock, protocol, waiter=None,
51
+ extra=None, server=None):
52
+ super().__init__(extra, loop)
53
+ self._set_extra(sock)
54
+ self._sock = sock
55
+ self.set_protocol(protocol)
56
+ self._server = server
57
+ self._buffer = None # None or bytearray.
58
+ self._read_fut = None
59
+ self._write_fut = None
60
+ self._pending_write = 0
61
+ self._conn_lost = 0
62
+ self._closing = False # Set when close() called.
63
+ self._called_connection_lost = False
64
+ self._eof_written = False
65
+ if self._server is not None:
66
+ self._server._attach()
67
+ self._loop.call_soon(self._protocol.connection_made, self)
68
+ if waiter is not None:
69
+ # only wake up the waiter when connection_made() has been called
70
+ self._loop.call_soon(futures._set_result_unless_cancelled,
71
+ waiter, None)
72
+
73
+ def __repr__(self):
74
+ info = [self.__class__.__name__]
75
+ if self._sock is None:
76
+ info.append('closed')
77
+ elif self._closing:
78
+ info.append('closing')
79
+ if self._sock is not None:
80
+ info.append(f'fd={self._sock.fileno()}')
81
+ if self._read_fut is not None:
82
+ info.append(f'read={self._read_fut!r}')
83
+ if self._write_fut is not None:
84
+ info.append(f'write={self._write_fut!r}')
85
+ if self._buffer:
86
+ info.append(f'write_bufsize={len(self._buffer)}')
87
+ if self._eof_written:
88
+ info.append('EOF written')
89
+ return '<{}>'.format(' '.join(info))
90
+
91
+ def _set_extra(self, sock):
92
+ self._extra['pipe'] = sock
93
+
94
+ def set_protocol(self, protocol):
95
+ self._protocol = protocol
96
+
97
+ def get_protocol(self):
98
+ return self._protocol
99
+
100
+ def is_closing(self):
101
+ return self._closing
102
+
103
+ def close(self):
104
+ if self._closing:
105
+ return
106
+ self._closing = True
107
+ self._conn_lost += 1
108
+ if not self._buffer and self._write_fut is None:
109
+ self._loop.call_soon(self._call_connection_lost, None)
110
+ if self._read_fut is not None:
111
+ self._read_fut.cancel()
112
+ self._read_fut = None
113
+
114
+ def __del__(self, _warn=warnings.warn):
115
+ if self._sock is not None:
116
+ _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
117
+ self._sock.close()
118
+
119
+ def _fatal_error(self, exc, message='Fatal error on pipe transport'):
120
+ try:
121
+ if isinstance(exc, OSError):
122
+ if self._loop.get_debug():
123
+ logger.debug("%r: %s", self, message, exc_info=True)
124
+ else:
125
+ self._loop.call_exception_handler({
126
+ 'message': message,
127
+ 'exception': exc,
128
+ 'transport': self,
129
+ 'protocol': self._protocol,
130
+ })
131
+ finally:
132
+ self._force_close(exc)
133
+
134
+ def _force_close(self, exc):
135
+ if self._empty_waiter is not None and not self._empty_waiter.done():
136
+ if exc is None:
137
+ self._empty_waiter.set_result(None)
138
+ else:
139
+ self._empty_waiter.set_exception(exc)
140
+ if self._closing and self._called_connection_lost:
141
+ return
142
+ self._closing = True
143
+ self._conn_lost += 1
144
+ if self._write_fut:
145
+ self._write_fut.cancel()
146
+ self._write_fut = None
147
+ if self._read_fut:
148
+ self._read_fut.cancel()
149
+ self._read_fut = None
150
+ self._pending_write = 0
151
+ self._buffer = None
152
+ self._loop.call_soon(self._call_connection_lost, exc)
153
+
154
+ def _call_connection_lost(self, exc):
155
+ if self._called_connection_lost:
156
+ return
157
+ try:
158
+ self._protocol.connection_lost(exc)
159
+ finally:
160
+ # XXX If there is a pending overlapped read on the other
161
+ # end then it may fail with ERROR_NETNAME_DELETED if we
162
+ # just close our end. First calling shutdown() seems to
163
+ # cure it, but maybe using DisconnectEx() would be better.
164
+ if hasattr(self._sock, 'shutdown') and self._sock.fileno() != -1:
165
+ self._sock.shutdown(socket.SHUT_RDWR)
166
+ self._sock.close()
167
+ self._sock = None
168
+ server = self._server
169
+ if server is not None:
170
+ server._detach()
171
+ self._server = None
172
+ self._called_connection_lost = True
173
+
174
+ def get_write_buffer_size(self):
175
+ size = self._pending_write
176
+ if self._buffer is not None:
177
+ size += len(self._buffer)
178
+ return size
179
+
180
+
181
+ class _ProactorReadPipeTransport(_ProactorBasePipeTransport,
182
+ transports.ReadTransport):
183
+ """Transport for read pipes."""
184
+
185
+ def __init__(self, loop, sock, protocol, waiter=None,
186
+ extra=None, server=None, buffer_size=65536):
187
+ self._pending_data_length = -1
188
+ self._paused = True
189
+ super().__init__(loop, sock, protocol, waiter, extra, server)
190
+
191
+ self._data = bytearray(buffer_size)
192
+ self._loop.call_soon(self._loop_reading)
193
+ self._paused = False
194
+
195
+ def is_reading(self):
196
+ return not self._paused and not self._closing
197
+
198
+ def pause_reading(self):
199
+ if self._closing or self._paused:
200
+ return
201
+ self._paused = True
202
+
203
+ # bpo-33694: Don't cancel self._read_fut because cancelling an
204
+ # overlapped WSASend() loss silently data with the current proactor
205
+ # implementation.
206
+ #
207
+ # If CancelIoEx() fails with ERROR_NOT_FOUND, it means that WSASend()
208
+ # completed (even if HasOverlappedIoCompleted() returns 0), but
209
+ # Overlapped.cancel() currently silently ignores the ERROR_NOT_FOUND
210
+ # error. Once the overlapped is ignored, the IOCP loop will ignores the
211
+ # completion I/O event and so not read the result of the overlapped
212
+ # WSARecv().
213
+
214
+ if self._loop.get_debug():
215
+ logger.debug("%r pauses reading", self)
216
+
217
+ def resume_reading(self):
218
+ if self._closing or not self._paused:
219
+ return
220
+
221
+ self._paused = False
222
+ if self._read_fut is None:
223
+ self._loop.call_soon(self._loop_reading, None)
224
+
225
+ length = self._pending_data_length
226
+ self._pending_data_length = -1
227
+ if length > -1:
228
+ # Call the protocol methode after calling _loop_reading(),
229
+ # since the protocol can decide to pause reading again.
230
+ self._loop.call_soon(self._data_received, self._data[:length], length)
231
+
232
+ if self._loop.get_debug():
233
+ logger.debug("%r resumes reading", self)
234
+
235
+ def _eof_received(self):
236
+ if self._loop.get_debug():
237
+ logger.debug("%r received EOF", self)
238
+
239
+ try:
240
+ keep_open = self._protocol.eof_received()
241
+ except (SystemExit, KeyboardInterrupt):
242
+ raise
243
+ except BaseException as exc:
244
+ self._fatal_error(
245
+ exc, 'Fatal error: protocol.eof_received() call failed.')
246
+ return
247
+
248
+ if not keep_open:
249
+ self.close()
250
+
251
+ def _data_received(self, data, length):
252
+ if self._paused:
253
+ # Don't call any protocol method while reading is paused.
254
+ # The protocol will be called on resume_reading().
255
+ assert self._pending_data_length == -1
256
+ self._pending_data_length = length
257
+ return
258
+
259
+ if length == 0:
260
+ self._eof_received()
261
+ return
262
+
263
+ if isinstance(self._protocol, protocols.BufferedProtocol):
264
+ try:
265
+ protocols._feed_data_to_buffered_proto(self._protocol, data)
266
+ except (SystemExit, KeyboardInterrupt):
267
+ raise
268
+ except BaseException as exc:
269
+ self._fatal_error(exc,
270
+ 'Fatal error: protocol.buffer_updated() '
271
+ 'call failed.')
272
+ return
273
+ else:
274
+ self._protocol.data_received(data)
275
+
276
+ def _loop_reading(self, fut=None):
277
+ length = -1
278
+ data = None
279
+ try:
280
+ if fut is not None:
281
+ assert self._read_fut is fut or (self._read_fut is None and
282
+ self._closing)
283
+ self._read_fut = None
284
+ if fut.done():
285
+ # deliver data later in "finally" clause
286
+ length = fut.result()
287
+ if length == 0:
288
+ # we got end-of-file so no need to reschedule a new read
289
+ return
290
+
291
+ data = self._data[:length]
292
+ else:
293
+ # the future will be replaced by next proactor.recv call
294
+ fut.cancel()
295
+
296
+ if self._closing:
297
+ # since close() has been called we ignore any read data
298
+ return
299
+
300
+ # bpo-33694: buffer_updated() has currently no fast path because of
301
+ # a data loss issue caused by overlapped WSASend() cancellation.
302
+
303
+ if not self._paused:
304
+ # reschedule a new read
305
+ self._read_fut = self._loop._proactor.recv_into(self._sock, self._data)
306
+ except ConnectionAbortedError as exc:
307
+ if not self._closing:
308
+ self._fatal_error(exc, 'Fatal read error on pipe transport')
309
+ elif self._loop.get_debug():
310
+ logger.debug("Read error on pipe transport while closing",
311
+ exc_info=True)
312
+ except ConnectionResetError as exc:
313
+ self._force_close(exc)
314
+ except OSError as exc:
315
+ self._fatal_error(exc, 'Fatal read error on pipe transport')
316
+ except exceptions.CancelledError:
317
+ if not self._closing:
318
+ raise
319
+ else:
320
+ if not self._paused:
321
+ self._read_fut.add_done_callback(self._loop_reading)
322
+ finally:
323
+ if length > -1:
324
+ self._data_received(data, length)
325
+
326
+
327
+ class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport,
328
+ transports.WriteTransport):
329
+ """Transport for write pipes."""
330
+
331
+ _start_tls_compatible = True
332
+
333
+ def __init__(self, *args, **kw):
334
+ super().__init__(*args, **kw)
335
+ self._empty_waiter = None
336
+
337
+ def write(self, data):
338
+ if not isinstance(data, (bytes, bytearray, memoryview)):
339
+ raise TypeError(
340
+ f"data argument must be a bytes-like object, "
341
+ f"not {type(data).__name__}")
342
+ if self._eof_written:
343
+ raise RuntimeError('write_eof() already called')
344
+ if self._empty_waiter is not None:
345
+ raise RuntimeError('unable to write; sendfile is in progress')
346
+
347
+ if not data:
348
+ return
349
+
350
+ if self._conn_lost:
351
+ if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES:
352
+ logger.warning('socket.send() raised exception.')
353
+ self._conn_lost += 1
354
+ return
355
+
356
+ # Observable states:
357
+ # 1. IDLE: _write_fut and _buffer both None
358
+ # 2. WRITING: _write_fut set; _buffer None
359
+ # 3. BACKED UP: _write_fut set; _buffer a bytearray
360
+ # We always copy the data, so the caller can't modify it
361
+ # while we're still waiting for the I/O to happen.
362
+ if self._write_fut is None: # IDLE -> WRITING
363
+ assert self._buffer is None
364
+ # Pass a copy, except if it's already immutable.
365
+ self._loop_writing(data=bytes(data))
366
+ elif not self._buffer: # WRITING -> BACKED UP
367
+ # Make a mutable copy which we can extend.
368
+ self._buffer = bytearray(data)
369
+ self._maybe_pause_protocol()
370
+ else: # BACKED UP
371
+ # Append to buffer (also copies).
372
+ self._buffer.extend(data)
373
+ self._maybe_pause_protocol()
374
+
375
+ def _loop_writing(self, f=None, data=None):
376
+ try:
377
+ if f is not None and self._write_fut is None and self._closing:
378
+ # XXX most likely self._force_close() has been called, and
379
+ # it has set self._write_fut to None.
380
+ return
381
+ assert f is self._write_fut
382
+ self._write_fut = None
383
+ self._pending_write = 0
384
+ if f:
385
+ f.result()
386
+ if data is None:
387
+ data = self._buffer
388
+ self._buffer = None
389
+ if not data:
390
+ if self._closing:
391
+ self._loop.call_soon(self._call_connection_lost, None)
392
+ if self._eof_written:
393
+ self._sock.shutdown(socket.SHUT_WR)
394
+ # Now that we've reduced the buffer size, tell the
395
+ # protocol to resume writing if it was paused. Note that
396
+ # we do this last since the callback is called immediately
397
+ # and it may add more data to the buffer (even causing the
398
+ # protocol to be paused again).
399
+ self._maybe_resume_protocol()
400
+ else:
401
+ self._write_fut = self._loop._proactor.send(self._sock, data)
402
+ if not self._write_fut.done():
403
+ assert self._pending_write == 0
404
+ self._pending_write = len(data)
405
+ self._write_fut.add_done_callback(self._loop_writing)
406
+ self._maybe_pause_protocol()
407
+ else:
408
+ self._write_fut.add_done_callback(self._loop_writing)
409
+ if self._empty_waiter is not None and self._write_fut is None:
410
+ self._empty_waiter.set_result(None)
411
+ except ConnectionResetError as exc:
412
+ self._force_close(exc)
413
+ except OSError as exc:
414
+ self._fatal_error(exc, 'Fatal write error on pipe transport')
415
+
416
+ def can_write_eof(self):
417
+ return True
418
+
419
+ def write_eof(self):
420
+ self.close()
421
+
422
+ def abort(self):
423
+ self._force_close(None)
424
+
425
+ def _make_empty_waiter(self):
426
+ if self._empty_waiter is not None:
427
+ raise RuntimeError("Empty waiter is already set")
428
+ self._empty_waiter = self._loop.create_future()
429
+ if self._write_fut is None:
430
+ self._empty_waiter.set_result(None)
431
+ return self._empty_waiter
432
+
433
+ def _reset_empty_waiter(self):
434
+ self._empty_waiter = None
435
+
436
+
437
+ class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport):
438
+ def __init__(self, *args, **kw):
439
+ super().__init__(*args, **kw)
440
+ self._read_fut = self._loop._proactor.recv(self._sock, 16)
441
+ self._read_fut.add_done_callback(self._pipe_closed)
442
+
443
+ def _pipe_closed(self, fut):
444
+ if fut.cancelled():
445
+ # the transport has been closed
446
+ return
447
+ assert fut.result() == b''
448
+ if self._closing:
449
+ assert self._read_fut is None
450
+ return
451
+ assert fut is self._read_fut, (fut, self._read_fut)
452
+ self._read_fut = None
453
+ if self._write_fut is not None:
454
+ self._force_close(BrokenPipeError())
455
+ else:
456
+ self.close()
457
+
458
+
459
+ class _ProactorDatagramTransport(_ProactorBasePipeTransport,
460
+ transports.DatagramTransport):
461
+ max_size = 256 * 1024
462
+ def __init__(self, loop, sock, protocol, address=None,
463
+ waiter=None, extra=None):
464
+ self._address = address
465
+ self._empty_waiter = None
466
+ # We don't need to call _protocol.connection_made() since our base
467
+ # constructor does it for us.
468
+ super().__init__(loop, sock, protocol, waiter=waiter, extra=extra)
469
+
470
+ # The base constructor sets _buffer = None, so we set it here
471
+ self._buffer = collections.deque()
472
+ self._loop.call_soon(self._loop_reading)
473
+
474
+ def _set_extra(self, sock):
475
+ _set_socket_extra(self, sock)
476
+
477
+ def get_write_buffer_size(self):
478
+ return sum(len(data) for data, _ in self._buffer)
479
+
480
+ def abort(self):
481
+ self._force_close(None)
482
+
483
+ def sendto(self, data, addr=None):
484
+ if not isinstance(data, (bytes, bytearray, memoryview)):
485
+ raise TypeError('data argument must be bytes-like object (%r)',
486
+ type(data))
487
+
488
+ if not data:
489
+ return
490
+
491
+ if self._address is not None and addr not in (None, self._address):
492
+ raise ValueError(
493
+ f'Invalid address: must be None or {self._address}')
494
+
495
+ if self._conn_lost and self._address:
496
+ if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES:
497
+ logger.warning('socket.sendto() raised exception.')
498
+ self._conn_lost += 1
499
+ return
500
+
501
+ # Ensure that what we buffer is immutable.
502
+ self._buffer.append((bytes(data), addr))
503
+
504
+ if self._write_fut is None:
505
+ # No current write operations are active, kick one off
506
+ self._loop_writing()
507
+ # else: A write operation is already kicked off
508
+
509
+ self._maybe_pause_protocol()
510
+
511
+ def _loop_writing(self, fut=None):
512
+ try:
513
+ if self._conn_lost:
514
+ return
515
+
516
+ assert fut is self._write_fut
517
+ self._write_fut = None
518
+ if fut:
519
+ # We are in a _loop_writing() done callback, get the result
520
+ fut.result()
521
+
522
+ if not self._buffer or (self._conn_lost and self._address):
523
+ # The connection has been closed
524
+ if self._closing:
525
+ self._loop.call_soon(self._call_connection_lost, None)
526
+ return
527
+
528
+ data, addr = self._buffer.popleft()
529
+ if self._address is not None:
530
+ self._write_fut = self._loop._proactor.send(self._sock,
531
+ data)
532
+ else:
533
+ self._write_fut = self._loop._proactor.sendto(self._sock,
534
+ data,
535
+ addr=addr)
536
+ except OSError as exc:
537
+ self._protocol.error_received(exc)
538
+ except Exception as exc:
539
+ self._fatal_error(exc, 'Fatal write error on datagram transport')
540
+ else:
541
+ self._write_fut.add_done_callback(self._loop_writing)
542
+ self._maybe_resume_protocol()
543
+
544
+ def _loop_reading(self, fut=None):
545
+ data = None
546
+ try:
547
+ if self._conn_lost:
548
+ return
549
+
550
+ assert self._read_fut is fut or (self._read_fut is None and
551
+ self._closing)
552
+
553
+ self._read_fut = None
554
+ if fut is not None:
555
+ res = fut.result()
556
+
557
+ if self._closing:
558
+ # since close() has been called we ignore any read data
559
+ data = None
560
+ return
561
+
562
+ if self._address is not None:
563
+ data, addr = res, self._address
564
+ else:
565
+ data, addr = res
566
+
567
+ if self._conn_lost:
568
+ return
569
+ if self._address is not None:
570
+ self._read_fut = self._loop._proactor.recv(self._sock,
571
+ self.max_size)
572
+ else:
573
+ self._read_fut = self._loop._proactor.recvfrom(self._sock,
574
+ self.max_size)
575
+ except OSError as exc:
576
+ self._protocol.error_received(exc)
577
+ except exceptions.CancelledError:
578
+ if not self._closing:
579
+ raise
580
+ else:
581
+ if self._read_fut is not None:
582
+ self._read_fut.add_done_callback(self._loop_reading)
583
+ finally:
584
+ if data:
585
+ self._protocol.datagram_received(data, addr)
586
+
587
+
588
+ class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport,
589
+ _ProactorBaseWritePipeTransport,
590
+ transports.Transport):
591
+ """Transport for duplex pipes."""
592
+
593
+ def can_write_eof(self):
594
+ return False
595
+
596
+ def write_eof(self):
597
+ raise NotImplementedError
598
+
599
+
600
+ class _ProactorSocketTransport(_ProactorReadPipeTransport,
601
+ _ProactorBaseWritePipeTransport,
602
+ transports.Transport):
603
+ """Transport for connected sockets."""
604
+
605
+ _sendfile_compatible = constants._SendfileMode.TRY_NATIVE
606
+
607
+ def __init__(self, loop, sock, protocol, waiter=None,
608
+ extra=None, server=None):
609
+ super().__init__(loop, sock, protocol, waiter, extra, server)
610
+ base_events._set_nodelay(sock)
611
+
612
+ def _set_extra(self, sock):
613
+ _set_socket_extra(self, sock)
614
+
615
+ def can_write_eof(self):
616
+ return True
617
+
618
+ def write_eof(self):
619
+ if self._closing or self._eof_written:
620
+ return
621
+ self._eof_written = True
622
+ if self._write_fut is None:
623
+ self._sock.shutdown(socket.SHUT_WR)
624
+
625
+
626
+ class BaseProactorEventLoop(base_events.BaseEventLoop):
627
+
628
+ def __init__(self, proactor):
629
+ super().__init__()
630
+ logger.debug('Using proactor: %s', proactor.__class__.__name__)
631
+ self._proactor = proactor
632
+ self._selector = proactor # convenient alias
633
+ self._self_reading_future = None
634
+ self._accept_futures = {} # socket file descriptor => Future
635
+ proactor.set_loop(self)
636
+ self._make_self_pipe()
637
+ if threading.current_thread() is threading.main_thread():
638
+ # wakeup fd can only be installed to a file descriptor from the main thread
639
+ signal.set_wakeup_fd(self._csock.fileno())
640
+
641
+ def _make_socket_transport(self, sock, protocol, waiter=None,
642
+ extra=None, server=None):
643
+ return _ProactorSocketTransport(self, sock, protocol, waiter,
644
+ extra, server)
645
+
646
+ def _make_ssl_transport(
647
+ self, rawsock, protocol, sslcontext, waiter=None,
648
+ *, server_side=False, server_hostname=None,
649
+ extra=None, server=None,
650
+ ssl_handshake_timeout=None):
651
+ ssl_protocol = sslproto.SSLProtocol(
652
+ self, protocol, sslcontext, waiter,
653
+ server_side, server_hostname,
654
+ ssl_handshake_timeout=ssl_handshake_timeout)
655
+ _ProactorSocketTransport(self, rawsock, ssl_protocol,
656
+ extra=extra, server=server)
657
+ return ssl_protocol._app_transport
658
+
659
+ def _make_datagram_transport(self, sock, protocol,
660
+ address=None, waiter=None, extra=None):
661
+ return _ProactorDatagramTransport(self, sock, protocol, address,
662
+ waiter, extra)
663
+
664
+ def _make_duplex_pipe_transport(self, sock, protocol, waiter=None,
665
+ extra=None):
666
+ return _ProactorDuplexPipeTransport(self,
667
+ sock, protocol, waiter, extra)
668
+
669
+ def _make_read_pipe_transport(self, sock, protocol, waiter=None,
670
+ extra=None):
671
+ return _ProactorReadPipeTransport(self, sock, protocol, waiter, extra)
672
+
673
+ def _make_write_pipe_transport(self, sock, protocol, waiter=None,
674
+ extra=None):
675
+ # We want connection_lost() to be called when other end closes
676
+ return _ProactorWritePipeTransport(self,
677
+ sock, protocol, waiter, extra)
678
+
679
+ def close(self):
680
+ if self.is_running():
681
+ raise RuntimeError("Cannot close a running event loop")
682
+ if self.is_closed():
683
+ return
684
+
685
+ if threading.current_thread() is threading.main_thread():
686
+ signal.set_wakeup_fd(-1)
687
+ # Call these methods before closing the event loop (before calling
688
+ # BaseEventLoop.close), because they can schedule callbacks with
689
+ # call_soon(), which is forbidden when the event loop is closed.
690
+ self._stop_accept_futures()
691
+ self._close_self_pipe()
692
+ self._proactor.close()
693
+ self._proactor = None
694
+ self._selector = None
695
+
696
+ # Close the event loop
697
+ super().close()
698
+
699
+ async def sock_recv(self, sock, n):
700
+ return await self._proactor.recv(sock, n)
701
+
702
+ async def sock_recv_into(self, sock, buf):
703
+ return await self._proactor.recv_into(sock, buf)
704
+
705
+ async def sock_sendall(self, sock, data):
706
+ return await self._proactor.send(sock, data)
707
+
708
+ async def sock_connect(self, sock, address):
709
+ return await self._proactor.connect(sock, address)
710
+
711
+ async def sock_accept(self, sock):
712
+ return await self._proactor.accept(sock)
713
+
714
+ async def _sock_sendfile_native(self, sock, file, offset, count):
715
+ try:
716
+ fileno = file.fileno()
717
+ except (AttributeError, io.UnsupportedOperation) as err:
718
+ raise exceptions.SendfileNotAvailableError("not a regular file")
719
+ try:
720
+ fsize = os.fstat(fileno).st_size
721
+ except OSError:
722
+ raise exceptions.SendfileNotAvailableError("not a regular file")
723
+ blocksize = count if count else fsize
724
+ if not blocksize:
725
+ return 0 # empty file
726
+
727
+ blocksize = min(blocksize, 0xffff_ffff)
728
+ end_pos = min(offset + count, fsize) if count else fsize
729
+ offset = min(offset, fsize)
730
+ total_sent = 0
731
+ try:
732
+ while True:
733
+ blocksize = min(end_pos - offset, blocksize)
734
+ if blocksize <= 0:
735
+ return total_sent
736
+ await self._proactor.sendfile(sock, file, offset, blocksize)
737
+ offset += blocksize
738
+ total_sent += blocksize
739
+ finally:
740
+ if total_sent > 0:
741
+ file.seek(offset)
742
+
743
+ async def _sendfile_native(self, transp, file, offset, count):
744
+ resume_reading = transp.is_reading()
745
+ transp.pause_reading()
746
+ await transp._make_empty_waiter()
747
+ try:
748
+ return await self.sock_sendfile(transp._sock, file, offset, count,
749
+ fallback=False)
750
+ finally:
751
+ transp._reset_empty_waiter()
752
+ if resume_reading:
753
+ transp.resume_reading()
754
+
755
+ def _close_self_pipe(self):
756
+ if self._self_reading_future is not None:
757
+ self._self_reading_future.cancel()
758
+ self._self_reading_future = None
759
+ self._ssock.close()
760
+ self._ssock = None
761
+ self._csock.close()
762
+ self._csock = None
763
+ self._internal_fds -= 1
764
+
765
+ def _make_self_pipe(self):
766
+ # A self-socket, really. :-)
767
+ self._ssock, self._csock = socket.socketpair()
768
+ self._ssock.setblocking(False)
769
+ self._csock.setblocking(False)
770
+ self._internal_fds += 1
771
+
772
+ def _loop_self_reading(self, f=None):
773
+ try:
774
+ if f is not None:
775
+ f.result() # may raise
776
+ if self._self_reading_future is not f:
777
+ # When we scheduled this Future, we assigned it to
778
+ # _self_reading_future. If it's not there now, something has
779
+ # tried to cancel the loop while this callback was still in the
780
+ # queue (see windows_events.ProactorEventLoop.run_forever). In
781
+ # that case stop here instead of continuing to schedule a new
782
+ # iteration.
783
+ return
784
+ f = self._proactor.recv(self._ssock, 4096)
785
+ except exceptions.CancelledError:
786
+ # _close_self_pipe() has been called, stop waiting for data
787
+ return
788
+ except (SystemExit, KeyboardInterrupt):
789
+ raise
790
+ except BaseException as exc:
791
+ self.call_exception_handler({
792
+ 'message': 'Error on reading from the event loop self pipe',
793
+ 'exception': exc,
794
+ 'loop': self,
795
+ })
796
+ else:
797
+ self._self_reading_future = f
798
+ f.add_done_callback(self._loop_self_reading)
799
+
800
+ def _write_to_self(self):
801
+ # This may be called from a different thread, possibly after
802
+ # _close_self_pipe() has been called or even while it is
803
+ # running. Guard for self._csock being None or closed. When
804
+ # a socket is closed, send() raises OSError (with errno set to
805
+ # EBADF, but let's not rely on the exact error code).
806
+ csock = self._csock
807
+ if csock is None:
808
+ return
809
+
810
+ try:
811
+ csock.send(b'\0')
812
+ except OSError:
813
+ if self._debug:
814
+ logger.debug("Fail to write a null byte into the "
815
+ "self-pipe socket",
816
+ exc_info=True)
817
+
818
+ def _start_serving(self, protocol_factory, sock,
819
+ sslcontext=None, server=None, backlog=100,
820
+ ssl_handshake_timeout=None):
821
+
822
+ def loop(f=None):
823
+ try:
824
+ if f is not None:
825
+ conn, addr = f.result()
826
+ if self._debug:
827
+ logger.debug("%r got a new connection from %r: %r",
828
+ server, addr, conn)
829
+ protocol = protocol_factory()
830
+ if sslcontext is not None:
831
+ self._make_ssl_transport(
832
+ conn, protocol, sslcontext, server_side=True,
833
+ extra={'peername': addr}, server=server,
834
+ ssl_handshake_timeout=ssl_handshake_timeout)
835
+ else:
836
+ self._make_socket_transport(
837
+ conn, protocol,
838
+ extra={'peername': addr}, server=server)
839
+ if self.is_closed():
840
+ return
841
+ f = self._proactor.accept(sock)
842
+ except OSError as exc:
843
+ if sock.fileno() != -1:
844
+ self.call_exception_handler({
845
+ 'message': 'Accept failed on a socket',
846
+ 'exception': exc,
847
+ 'socket': trsock.TransportSocket(sock),
848
+ })
849
+ sock.close()
850
+ elif self._debug:
851
+ logger.debug("Accept failed on socket %r",
852
+ sock, exc_info=True)
853
+ except exceptions.CancelledError:
854
+ sock.close()
855
+ else:
856
+ self._accept_futures[sock.fileno()] = f
857
+ f.add_done_callback(loop)
858
+
859
+ self.call_soon(loop)
860
+
861
+ def _process_events(self, event_list):
862
+ # Events are processed in the IocpProactor._poll() method
863
+ pass
864
+
865
+ def _stop_accept_futures(self):
866
+ for future in self._accept_futures.values():
867
+ future.cancel()
868
+ self._accept_futures.clear()
869
+
870
+ def _stop_serving(self, sock):
871
+ future = self._accept_futures.pop(sock.fileno(), None)
872
+ if future:
873
+ future.cancel()
874
+ self._proactor._stop_serving(sock)
875
+ sock.close()
omnilmm/lib/python3.10/asyncio/queues.py ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __all__ = ('Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty')
2
+
3
+ import collections
4
+ import heapq
5
+ from types import GenericAlias
6
+
7
+ from . import locks
8
+ from . import mixins
9
+
10
+
11
+ class QueueEmpty(Exception):
12
+ """Raised when Queue.get_nowait() is called on an empty Queue."""
13
+ pass
14
+
15
+
16
+ class QueueFull(Exception):
17
+ """Raised when the Queue.put_nowait() method is called on a full Queue."""
18
+ pass
19
+
20
+
21
+ class Queue(mixins._LoopBoundMixin):
22
+ """A queue, useful for coordinating producer and consumer coroutines.
23
+
24
+ If maxsize is less than or equal to zero, the queue size is infinite. If it
25
+ is an integer greater than 0, then "await put()" will block when the
26
+ queue reaches maxsize, until an item is removed by get().
27
+
28
+ Unlike the standard library Queue, you can reliably know this Queue's size
29
+ with qsize(), since your single-threaded asyncio application won't be
30
+ interrupted between calling qsize() and doing an operation on the Queue.
31
+ """
32
+
33
+ def __init__(self, maxsize=0, *, loop=mixins._marker):
34
+ super().__init__(loop=loop)
35
+ self._maxsize = maxsize
36
+
37
+ # Futures.
38
+ self._getters = collections.deque()
39
+ # Futures.
40
+ self._putters = collections.deque()
41
+ self._unfinished_tasks = 0
42
+ self._finished = locks.Event()
43
+ self._finished.set()
44
+ self._init(maxsize)
45
+
46
+ # These three are overridable in subclasses.
47
+
48
+ def _init(self, maxsize):
49
+ self._queue = collections.deque()
50
+
51
+ def _get(self):
52
+ return self._queue.popleft()
53
+
54
+ def _put(self, item):
55
+ self._queue.append(item)
56
+
57
+ # End of the overridable methods.
58
+
59
+ def _wakeup_next(self, waiters):
60
+ # Wake up the next waiter (if any) that isn't cancelled.
61
+ while waiters:
62
+ waiter = waiters.popleft()
63
+ if not waiter.done():
64
+ waiter.set_result(None)
65
+ break
66
+
67
+ def __repr__(self):
68
+ return f'<{type(self).__name__} at {id(self):#x} {self._format()}>'
69
+
70
+ def __str__(self):
71
+ return f'<{type(self).__name__} {self._format()}>'
72
+
73
+ __class_getitem__ = classmethod(GenericAlias)
74
+
75
+ def _format(self):
76
+ result = f'maxsize={self._maxsize!r}'
77
+ if getattr(self, '_queue', None):
78
+ result += f' _queue={list(self._queue)!r}'
79
+ if self._getters:
80
+ result += f' _getters[{len(self._getters)}]'
81
+ if self._putters:
82
+ result += f' _putters[{len(self._putters)}]'
83
+ if self._unfinished_tasks:
84
+ result += f' tasks={self._unfinished_tasks}'
85
+ return result
86
+
87
+ def qsize(self):
88
+ """Number of items in the queue."""
89
+ return len(self._queue)
90
+
91
+ @property
92
+ def maxsize(self):
93
+ """Number of items allowed in the queue."""
94
+ return self._maxsize
95
+
96
+ def empty(self):
97
+ """Return True if the queue is empty, False otherwise."""
98
+ return not self._queue
99
+
100
+ def full(self):
101
+ """Return True if there are maxsize items in the queue.
102
+
103
+ Note: if the Queue was initialized with maxsize=0 (the default),
104
+ then full() is never True.
105
+ """
106
+ if self._maxsize <= 0:
107
+ return False
108
+ else:
109
+ return self.qsize() >= self._maxsize
110
+
111
+ async def put(self, item):
112
+ """Put an item into the queue.
113
+
114
+ Put an item into the queue. If the queue is full, wait until a free
115
+ slot is available before adding item.
116
+ """
117
+ while self.full():
118
+ putter = self._get_loop().create_future()
119
+ self._putters.append(putter)
120
+ try:
121
+ await putter
122
+ except:
123
+ putter.cancel() # Just in case putter is not done yet.
124
+ try:
125
+ # Clean self._putters from canceled putters.
126
+ self._putters.remove(putter)
127
+ except ValueError:
128
+ # The putter could be removed from self._putters by a
129
+ # previous get_nowait call.
130
+ pass
131
+ if not self.full() and not putter.cancelled():
132
+ # We were woken up by get_nowait(), but can't take
133
+ # the call. Wake up the next in line.
134
+ self._wakeup_next(self._putters)
135
+ raise
136
+ return self.put_nowait(item)
137
+
138
+ def put_nowait(self, item):
139
+ """Put an item into the queue without blocking.
140
+
141
+ If no free slot is immediately available, raise QueueFull.
142
+ """
143
+ if self.full():
144
+ raise QueueFull
145
+ self._put(item)
146
+ self._unfinished_tasks += 1
147
+ self._finished.clear()
148
+ self._wakeup_next(self._getters)
149
+
150
+ async def get(self):
151
+ """Remove and return an item from the queue.
152
+
153
+ If queue is empty, wait until an item is available.
154
+ """
155
+ while self.empty():
156
+ getter = self._get_loop().create_future()
157
+ self._getters.append(getter)
158
+ try:
159
+ await getter
160
+ except:
161
+ getter.cancel() # Just in case getter is not done yet.
162
+ try:
163
+ # Clean self._getters from canceled getters.
164
+ self._getters.remove(getter)
165
+ except ValueError:
166
+ # The getter could be removed from self._getters by a
167
+ # previous put_nowait call.
168
+ pass
169
+ if not self.empty() and not getter.cancelled():
170
+ # We were woken up by put_nowait(), but can't take
171
+ # the call. Wake up the next in line.
172
+ self._wakeup_next(self._getters)
173
+ raise
174
+ return self.get_nowait()
175
+
176
+ def get_nowait(self):
177
+ """Remove and return an item from the queue.
178
+
179
+ Return an item if one is immediately available, else raise QueueEmpty.
180
+ """
181
+ if self.empty():
182
+ raise QueueEmpty
183
+ item = self._get()
184
+ self._wakeup_next(self._putters)
185
+ return item
186
+
187
+ def task_done(self):
188
+ """Indicate that a formerly enqueued task is complete.
189
+
190
+ Used by queue consumers. For each get() used to fetch a task,
191
+ a subsequent call to task_done() tells the queue that the processing
192
+ on the task is complete.
193
+
194
+ If a join() is currently blocking, it will resume when all items have
195
+ been processed (meaning that a task_done() call was received for every
196
+ item that had been put() into the queue).
197
+
198
+ Raises ValueError if called more times than there were items placed in
199
+ the queue.
200
+ """
201
+ if self._unfinished_tasks <= 0:
202
+ raise ValueError('task_done() called too many times')
203
+ self._unfinished_tasks -= 1
204
+ if self._unfinished_tasks == 0:
205
+ self._finished.set()
206
+
207
+ async def join(self):
208
+ """Block until all items in the queue have been gotten and processed.
209
+
210
+ The count of unfinished tasks goes up whenever an item is added to the
211
+ queue. The count goes down whenever a consumer calls task_done() to
212
+ indicate that the item was retrieved and all work on it is complete.
213
+ When the count of unfinished tasks drops to zero, join() unblocks.
214
+ """
215
+ if self._unfinished_tasks > 0:
216
+ await self._finished.wait()
217
+
218
+
219
+ class PriorityQueue(Queue):
220
+ """A subclass of Queue; retrieves entries in priority order (lowest first).
221
+
222
+ Entries are typically tuples of the form: (priority number, data).
223
+ """
224
+
225
+ def _init(self, maxsize):
226
+ self._queue = []
227
+
228
+ def _put(self, item, heappush=heapq.heappush):
229
+ heappush(self._queue, item)
230
+
231
+ def _get(self, heappop=heapq.heappop):
232
+ return heappop(self._queue)
233
+
234
+
235
+ class LifoQueue(Queue):
236
+ """A subclass of Queue that retrieves most recently added entries first."""
237
+
238
+ def _init(self, maxsize):
239
+ self._queue = []
240
+
241
+ def _put(self, item):
242
+ self._queue.append(item)
243
+
244
+ def _get(self):
245
+ return self._queue.pop()
omnilmm/lib/python3.10/asyncio/staggered.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Support for running coroutines in parallel with staggered start times."""
2
+
3
+ __all__ = 'staggered_race',
4
+
5
+ import contextlib
6
+ import typing
7
+
8
+ from . import events
9
+ from . import exceptions as exceptions_mod
10
+ from . import locks
11
+ from . import tasks
12
+
13
+
14
+ async def staggered_race(
15
+ coro_fns: typing.Iterable[typing.Callable[[], typing.Awaitable]],
16
+ delay: typing.Optional[float],
17
+ *,
18
+ loop: events.AbstractEventLoop = None,
19
+ ) -> typing.Tuple[
20
+ typing.Any,
21
+ typing.Optional[int],
22
+ typing.List[typing.Optional[Exception]]
23
+ ]:
24
+ """Run coroutines with staggered start times and take the first to finish.
25
+
26
+ This method takes an iterable of coroutine functions. The first one is
27
+ started immediately. From then on, whenever the immediately preceding one
28
+ fails (raises an exception), or when *delay* seconds has passed, the next
29
+ coroutine is started. This continues until one of the coroutines complete
30
+ successfully, in which case all others are cancelled, or until all
31
+ coroutines fail.
32
+
33
+ The coroutines provided should be well-behaved in the following way:
34
+
35
+ * They should only ``return`` if completed successfully.
36
+
37
+ * They should always raise an exception if they did not complete
38
+ successfully. In particular, if they handle cancellation, they should
39
+ probably reraise, like this::
40
+
41
+ try:
42
+ # do work
43
+ except asyncio.CancelledError:
44
+ # undo partially completed work
45
+ raise
46
+
47
+ Args:
48
+ coro_fns: an iterable of coroutine functions, i.e. callables that
49
+ return a coroutine object when called. Use ``functools.partial`` or
50
+ lambdas to pass arguments.
51
+
52
+ delay: amount of time, in seconds, between starting coroutines. If
53
+ ``None``, the coroutines will run sequentially.
54
+
55
+ loop: the event loop to use.
56
+
57
+ Returns:
58
+ tuple *(winner_result, winner_index, exceptions)* where
59
+
60
+ - *winner_result*: the result of the winning coroutine, or ``None``
61
+ if no coroutines won.
62
+
63
+ - *winner_index*: the index of the winning coroutine in
64
+ ``coro_fns``, or ``None`` if no coroutines won. If the winning
65
+ coroutine may return None on success, *winner_index* can be used
66
+ to definitively determine whether any coroutine won.
67
+
68
+ - *exceptions*: list of exceptions returned by the coroutines.
69
+ ``len(exceptions)`` is equal to the number of coroutines actually
70
+ started, and the order is the same as in ``coro_fns``. The winning
71
+ coroutine's entry is ``None``.
72
+
73
+ """
74
+ # TODO: when we have aiter() and anext(), allow async iterables in coro_fns.
75
+ loop = loop or events.get_running_loop()
76
+ enum_coro_fns = enumerate(coro_fns)
77
+ winner_result = None
78
+ winner_index = None
79
+ exceptions = []
80
+ running_tasks = []
81
+
82
+ async def run_one_coro(
83
+ previous_failed: typing.Optional[locks.Event]) -> None:
84
+ # Wait for the previous task to finish, or for delay seconds
85
+ if previous_failed is not None:
86
+ with contextlib.suppress(exceptions_mod.TimeoutError):
87
+ # Use asyncio.wait_for() instead of asyncio.wait() here, so
88
+ # that if we get cancelled at this point, Event.wait() is also
89
+ # cancelled, otherwise there will be a "Task destroyed but it is
90
+ # pending" later.
91
+ await tasks.wait_for(previous_failed.wait(), delay)
92
+ # Get the next coroutine to run
93
+ try:
94
+ this_index, coro_fn = next(enum_coro_fns)
95
+ except StopIteration:
96
+ return
97
+ # Start task that will run the next coroutine
98
+ this_failed = locks.Event()
99
+ next_task = loop.create_task(run_one_coro(this_failed))
100
+ running_tasks.append(next_task)
101
+ assert len(running_tasks) == this_index + 2
102
+ # Prepare place to put this coroutine's exceptions if not won
103
+ exceptions.append(None)
104
+ assert len(exceptions) == this_index + 1
105
+
106
+ try:
107
+ result = await coro_fn()
108
+ except (SystemExit, KeyboardInterrupt):
109
+ raise
110
+ except BaseException as e:
111
+ exceptions[this_index] = e
112
+ this_failed.set() # Kickstart the next coroutine
113
+ else:
114
+ # Store winner's results
115
+ nonlocal winner_index, winner_result
116
+ assert winner_index is None
117
+ winner_index = this_index
118
+ winner_result = result
119
+ # Cancel all other tasks. We take care to not cancel the current
120
+ # task as well. If we do so, then since there is no `await` after
121
+ # here and CancelledError are usually thrown at one, we will
122
+ # encounter a curious corner case where the current task will end
123
+ # up as done() == True, cancelled() == False, exception() ==
124
+ # asyncio.CancelledError. This behavior is specified in
125
+ # https://bugs.python.org/issue30048
126
+ for i, t in enumerate(running_tasks):
127
+ if i != this_index:
128
+ t.cancel()
129
+
130
+ first_task = loop.create_task(run_one_coro(None))
131
+ running_tasks.append(first_task)
132
+ try:
133
+ # Wait for a growing list of tasks to all finish: poor man's version of
134
+ # curio's TaskGroup or trio's nursery
135
+ done_count = 0
136
+ while done_count != len(running_tasks):
137
+ done, _ = await tasks.wait(running_tasks)
138
+ done_count = len(done)
139
+ # If run_one_coro raises an unhandled exception, it's probably a
140
+ # programming error, and I want to see it.
141
+ if __debug__:
142
+ for d in done:
143
+ if d.done() and not d.cancelled() and d.exception():
144
+ raise d.exception()
145
+ return winner_result, winner_index, exceptions
146
+ finally:
147
+ # Make sure no tasks are left running if we leave this function
148
+ for t in running_tasks:
149
+ t.cancel()
omnilmm/lib/python3.10/asyncio/streams.py ADDED
@@ -0,0 +1,726 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __all__ = (
2
+ 'StreamReader', 'StreamWriter', 'StreamReaderProtocol',
3
+ 'open_connection', 'start_server')
4
+
5
+ import collections
6
+ import socket
7
+ import sys
8
+ import warnings
9
+ import weakref
10
+
11
+ if hasattr(socket, 'AF_UNIX'):
12
+ __all__ += ('open_unix_connection', 'start_unix_server')
13
+
14
+ from . import coroutines
15
+ from . import events
16
+ from . import exceptions
17
+ from . import format_helpers
18
+ from . import protocols
19
+ from .log import logger
20
+ from .tasks import sleep
21
+
22
+
23
+ _DEFAULT_LIMIT = 2 ** 16 # 64 KiB
24
+
25
+
26
+ async def open_connection(host=None, port=None, *,
27
+ limit=_DEFAULT_LIMIT, **kwds):
28
+ """A wrapper for create_connection() returning a (reader, writer) pair.
29
+
30
+ The reader returned is a StreamReader instance; the writer is a
31
+ StreamWriter instance.
32
+
33
+ The arguments are all the usual arguments to create_connection()
34
+ except protocol_factory; most common are positional host and port,
35
+ with various optional keyword arguments following.
36
+
37
+ Additional optional keyword arguments are loop (to set the event loop
38
+ instance to use) and limit (to set the buffer limit passed to the
39
+ StreamReader).
40
+
41
+ (If you want to customize the StreamReader and/or
42
+ StreamReaderProtocol classes, just copy the code -- there's
43
+ really nothing special here except some convenience.)
44
+ """
45
+ loop = events.get_running_loop()
46
+ reader = StreamReader(limit=limit, loop=loop)
47
+ protocol = StreamReaderProtocol(reader, loop=loop)
48
+ transport, _ = await loop.create_connection(
49
+ lambda: protocol, host, port, **kwds)
50
+ writer = StreamWriter(transport, protocol, reader, loop)
51
+ return reader, writer
52
+
53
+
54
+ async def start_server(client_connected_cb, host=None, port=None, *,
55
+ limit=_DEFAULT_LIMIT, **kwds):
56
+ """Start a socket server, call back for each client connected.
57
+
58
+ The first parameter, `client_connected_cb`, takes two parameters:
59
+ client_reader, client_writer. client_reader is a StreamReader
60
+ object, while client_writer is a StreamWriter object. This
61
+ parameter can either be a plain callback function or a coroutine;
62
+ if it is a coroutine, it will be automatically converted into a
63
+ Task.
64
+
65
+ The rest of the arguments are all the usual arguments to
66
+ loop.create_server() except protocol_factory; most common are
67
+ positional host and port, with various optional keyword arguments
68
+ following. The return value is the same as loop.create_server().
69
+
70
+ Additional optional keyword arguments are loop (to set the event loop
71
+ instance to use) and limit (to set the buffer limit passed to the
72
+ StreamReader).
73
+
74
+ The return value is the same as loop.create_server(), i.e. a
75
+ Server object which can be used to stop the service.
76
+ """
77
+ loop = events.get_running_loop()
78
+
79
+ def factory():
80
+ reader = StreamReader(limit=limit, loop=loop)
81
+ protocol = StreamReaderProtocol(reader, client_connected_cb,
82
+ loop=loop)
83
+ return protocol
84
+
85
+ return await loop.create_server(factory, host, port, **kwds)
86
+
87
+
88
+ if hasattr(socket, 'AF_UNIX'):
89
+ # UNIX Domain Sockets are supported on this platform
90
+
91
+ async def open_unix_connection(path=None, *,
92
+ limit=_DEFAULT_LIMIT, **kwds):
93
+ """Similar to `open_connection` but works with UNIX Domain Sockets."""
94
+ loop = events.get_running_loop()
95
+
96
+ reader = StreamReader(limit=limit, loop=loop)
97
+ protocol = StreamReaderProtocol(reader, loop=loop)
98
+ transport, _ = await loop.create_unix_connection(
99
+ lambda: protocol, path, **kwds)
100
+ writer = StreamWriter(transport, protocol, reader, loop)
101
+ return reader, writer
102
+
103
+ async def start_unix_server(client_connected_cb, path=None, *,
104
+ limit=_DEFAULT_LIMIT, **kwds):
105
+ """Similar to `start_server` but works with UNIX Domain Sockets."""
106
+ loop = events.get_running_loop()
107
+
108
+ def factory():
109
+ reader = StreamReader(limit=limit, loop=loop)
110
+ protocol = StreamReaderProtocol(reader, client_connected_cb,
111
+ loop=loop)
112
+ return protocol
113
+
114
+ return await loop.create_unix_server(factory, path, **kwds)
115
+
116
+
117
+ class FlowControlMixin(protocols.Protocol):
118
+ """Reusable flow control logic for StreamWriter.drain().
119
+
120
+ This implements the protocol methods pause_writing(),
121
+ resume_writing() and connection_lost(). If the subclass overrides
122
+ these it must call the super methods.
123
+
124
+ StreamWriter.drain() must wait for _drain_helper() coroutine.
125
+ """
126
+
127
+ def __init__(self, loop=None):
128
+ if loop is None:
129
+ self._loop = events._get_event_loop(stacklevel=4)
130
+ else:
131
+ self._loop = loop
132
+ self._paused = False
133
+ self._drain_waiters = collections.deque()
134
+ self._connection_lost = False
135
+
136
+ def pause_writing(self):
137
+ assert not self._paused
138
+ self._paused = True
139
+ if self._loop.get_debug():
140
+ logger.debug("%r pauses writing", self)
141
+
142
+ def resume_writing(self):
143
+ assert self._paused
144
+ self._paused = False
145
+ if self._loop.get_debug():
146
+ logger.debug("%r resumes writing", self)
147
+
148
+ for waiter in self._drain_waiters:
149
+ if not waiter.done():
150
+ waiter.set_result(None)
151
+
152
+ def connection_lost(self, exc):
153
+ self._connection_lost = True
154
+ # Wake up the writer(s) if currently paused.
155
+ if not self._paused:
156
+ return
157
+
158
+ for waiter in self._drain_waiters:
159
+ if not waiter.done():
160
+ if exc is None:
161
+ waiter.set_result(None)
162
+ else:
163
+ waiter.set_exception(exc)
164
+
165
+ async def _drain_helper(self):
166
+ if self._connection_lost:
167
+ raise ConnectionResetError('Connection lost')
168
+ if not self._paused:
169
+ return
170
+ waiter = self._loop.create_future()
171
+ self._drain_waiters.append(waiter)
172
+ try:
173
+ await waiter
174
+ finally:
175
+ self._drain_waiters.remove(waiter)
176
+
177
+ def _get_close_waiter(self, stream):
178
+ raise NotImplementedError
179
+
180
+
181
+ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
182
+ """Helper class to adapt between Protocol and StreamReader.
183
+
184
+ (This is a helper class instead of making StreamReader itself a
185
+ Protocol subclass, because the StreamReader has other potential
186
+ uses, and to prevent the user of the StreamReader to accidentally
187
+ call inappropriate methods of the protocol.)
188
+ """
189
+
190
+ _source_traceback = None
191
+
192
+ def __init__(self, stream_reader, client_connected_cb=None, loop=None):
193
+ super().__init__(loop=loop)
194
+ if stream_reader is not None:
195
+ self._stream_reader_wr = weakref.ref(stream_reader)
196
+ self._source_traceback = stream_reader._source_traceback
197
+ else:
198
+ self._stream_reader_wr = None
199
+ if client_connected_cb is not None:
200
+ # This is a stream created by the `create_server()` function.
201
+ # Keep a strong reference to the reader until a connection
202
+ # is established.
203
+ self._strong_reader = stream_reader
204
+ self._reject_connection = False
205
+ self._stream_writer = None
206
+ self._task = None
207
+ self._transport = None
208
+ self._client_connected_cb = client_connected_cb
209
+ self._over_ssl = False
210
+ self._closed = self._loop.create_future()
211
+
212
+ @property
213
+ def _stream_reader(self):
214
+ if self._stream_reader_wr is None:
215
+ return None
216
+ return self._stream_reader_wr()
217
+
218
+ def connection_made(self, transport):
219
+ if self._reject_connection:
220
+ context = {
221
+ 'message': ('An open stream was garbage collected prior to '
222
+ 'establishing network connection; '
223
+ 'call "stream.close()" explicitly.')
224
+ }
225
+ if self._source_traceback:
226
+ context['source_traceback'] = self._source_traceback
227
+ self._loop.call_exception_handler(context)
228
+ transport.abort()
229
+ return
230
+ self._transport = transport
231
+ reader = self._stream_reader
232
+ if reader is not None:
233
+ reader.set_transport(transport)
234
+ self._over_ssl = transport.get_extra_info('sslcontext') is not None
235
+ if self._client_connected_cb is not None:
236
+ self._stream_writer = StreamWriter(transport, self,
237
+ reader,
238
+ self._loop)
239
+ res = self._client_connected_cb(reader,
240
+ self._stream_writer)
241
+ if coroutines.iscoroutine(res):
242
+ self._task = self._loop.create_task(res)
243
+ self._strong_reader = None
244
+
245
+ def connection_lost(self, exc):
246
+ reader = self._stream_reader
247
+ if reader is not None:
248
+ if exc is None:
249
+ reader.feed_eof()
250
+ else:
251
+ reader.set_exception(exc)
252
+ if not self._closed.done():
253
+ if exc is None:
254
+ self._closed.set_result(None)
255
+ else:
256
+ self._closed.set_exception(exc)
257
+ super().connection_lost(exc)
258
+ self._stream_reader_wr = None
259
+ self._stream_writer = None
260
+ self._task = None
261
+ self._transport = None
262
+
263
+ def data_received(self, data):
264
+ reader = self._stream_reader
265
+ if reader is not None:
266
+ reader.feed_data(data)
267
+
268
+ def eof_received(self):
269
+ reader = self._stream_reader
270
+ if reader is not None:
271
+ reader.feed_eof()
272
+ if self._over_ssl:
273
+ # Prevent a warning in SSLProtocol.eof_received:
274
+ # "returning true from eof_received()
275
+ # has no effect when using ssl"
276
+ return False
277
+ return True
278
+
279
+ def _get_close_waiter(self, stream):
280
+ return self._closed
281
+
282
+ def __del__(self):
283
+ # Prevent reports about unhandled exceptions.
284
+ # Better than self._closed._log_traceback = False hack
285
+ try:
286
+ closed = self._closed
287
+ except AttributeError:
288
+ pass # failed constructor
289
+ else:
290
+ if closed.done() and not closed.cancelled():
291
+ closed.exception()
292
+
293
+
294
+ class StreamWriter:
295
+ """Wraps a Transport.
296
+
297
+ This exposes write(), writelines(), [can_]write_eof(),
298
+ get_extra_info() and close(). It adds drain() which returns an
299
+ optional Future on which you can wait for flow control. It also
300
+ adds a transport property which references the Transport
301
+ directly.
302
+ """
303
+
304
+ def __init__(self, transport, protocol, reader, loop):
305
+ self._transport = transport
306
+ self._protocol = protocol
307
+ # drain() expects that the reader has an exception() method
308
+ assert reader is None or isinstance(reader, StreamReader)
309
+ self._reader = reader
310
+ self._loop = loop
311
+ self._complete_fut = self._loop.create_future()
312
+ self._complete_fut.set_result(None)
313
+
314
+ def __repr__(self):
315
+ info = [self.__class__.__name__, f'transport={self._transport!r}']
316
+ if self._reader is not None:
317
+ info.append(f'reader={self._reader!r}')
318
+ return '<{}>'.format(' '.join(info))
319
+
320
+ @property
321
+ def transport(self):
322
+ return self._transport
323
+
324
+ def write(self, data):
325
+ self._transport.write(data)
326
+
327
+ def writelines(self, data):
328
+ self._transport.writelines(data)
329
+
330
+ def write_eof(self):
331
+ return self._transport.write_eof()
332
+
333
+ def can_write_eof(self):
334
+ return self._transport.can_write_eof()
335
+
336
+ def close(self):
337
+ return self._transport.close()
338
+
339
+ def is_closing(self):
340
+ return self._transport.is_closing()
341
+
342
+ async def wait_closed(self):
343
+ await self._protocol._get_close_waiter(self)
344
+
345
+ def get_extra_info(self, name, default=None):
346
+ return self._transport.get_extra_info(name, default)
347
+
348
+ async def drain(self):
349
+ """Flush the write buffer.
350
+
351
+ The intended use is to write
352
+
353
+ w.write(data)
354
+ await w.drain()
355
+ """
356
+ if self._reader is not None:
357
+ exc = self._reader.exception()
358
+ if exc is not None:
359
+ raise exc
360
+ if self._transport.is_closing():
361
+ # Wait for protocol.connection_lost() call
362
+ # Raise connection closing error if any,
363
+ # ConnectionResetError otherwise
364
+ # Yield to the event loop so connection_lost() may be
365
+ # called. Without this, _drain_helper() would return
366
+ # immediately, and code that calls
367
+ # write(...); await drain()
368
+ # in a loop would never call connection_lost(), so it
369
+ # would not see an error when the socket is closed.
370
+ await sleep(0)
371
+ await self._protocol._drain_helper()
372
+
373
+
374
+ class StreamReader:
375
+
376
+ _source_traceback = None
377
+
378
+ def __init__(self, limit=_DEFAULT_LIMIT, loop=None):
379
+ # The line length limit is a security feature;
380
+ # it also doubles as half the buffer limit.
381
+
382
+ if limit <= 0:
383
+ raise ValueError('Limit cannot be <= 0')
384
+
385
+ self._limit = limit
386
+ if loop is None:
387
+ self._loop = events._get_event_loop()
388
+ else:
389
+ self._loop = loop
390
+ self._buffer = bytearray()
391
+ self._eof = False # Whether we're done.
392
+ self._waiter = None # A future used by _wait_for_data()
393
+ self._exception = None
394
+ self._transport = None
395
+ self._paused = False
396
+ if self._loop.get_debug():
397
+ self._source_traceback = format_helpers.extract_stack(
398
+ sys._getframe(1))
399
+
400
+ def __repr__(self):
401
+ info = ['StreamReader']
402
+ if self._buffer:
403
+ info.append(f'{len(self._buffer)} bytes')
404
+ if self._eof:
405
+ info.append('eof')
406
+ if self._limit != _DEFAULT_LIMIT:
407
+ info.append(f'limit={self._limit}')
408
+ if self._waiter:
409
+ info.append(f'waiter={self._waiter!r}')
410
+ if self._exception:
411
+ info.append(f'exception={self._exception!r}')
412
+ if self._transport:
413
+ info.append(f'transport={self._transport!r}')
414
+ if self._paused:
415
+ info.append('paused')
416
+ return '<{}>'.format(' '.join(info))
417
+
418
+ def exception(self):
419
+ return self._exception
420
+
421
+ def set_exception(self, exc):
422
+ self._exception = exc
423
+
424
+ waiter = self._waiter
425
+ if waiter is not None:
426
+ self._waiter = None
427
+ if not waiter.cancelled():
428
+ waiter.set_exception(exc)
429
+
430
+ def _wakeup_waiter(self):
431
+ """Wakeup read*() functions waiting for data or EOF."""
432
+ waiter = self._waiter
433
+ if waiter is not None:
434
+ self._waiter = None
435
+ if not waiter.cancelled():
436
+ waiter.set_result(None)
437
+
438
+ def set_transport(self, transport):
439
+ assert self._transport is None, 'Transport already set'
440
+ self._transport = transport
441
+
442
+ def _maybe_resume_transport(self):
443
+ if self._paused and len(self._buffer) <= self._limit:
444
+ self._paused = False
445
+ self._transport.resume_reading()
446
+
447
+ def feed_eof(self):
448
+ self._eof = True
449
+ self._wakeup_waiter()
450
+
451
+ def at_eof(self):
452
+ """Return True if the buffer is empty and 'feed_eof' was called."""
453
+ return self._eof and not self._buffer
454
+
455
+ def feed_data(self, data):
456
+ assert not self._eof, 'feed_data after feed_eof'
457
+
458
+ if not data:
459
+ return
460
+
461
+ self._buffer.extend(data)
462
+ self._wakeup_waiter()
463
+
464
+ if (self._transport is not None and
465
+ not self._paused and
466
+ len(self._buffer) > 2 * self._limit):
467
+ try:
468
+ self._transport.pause_reading()
469
+ except NotImplementedError:
470
+ # The transport can't be paused.
471
+ # We'll just have to buffer all data.
472
+ # Forget the transport so we don't keep trying.
473
+ self._transport = None
474
+ else:
475
+ self._paused = True
476
+
477
+ async def _wait_for_data(self, func_name):
478
+ """Wait until feed_data() or feed_eof() is called.
479
+
480
+ If stream was paused, automatically resume it.
481
+ """
482
+ # StreamReader uses a future to link the protocol feed_data() method
483
+ # to a read coroutine. Running two read coroutines at the same time
484
+ # would have an unexpected behaviour. It would not possible to know
485
+ # which coroutine would get the next data.
486
+ if self._waiter is not None:
487
+ raise RuntimeError(
488
+ f'{func_name}() called while another coroutine is '
489
+ f'already waiting for incoming data')
490
+
491
+ assert not self._eof, '_wait_for_data after EOF'
492
+
493
+ # Waiting for data while paused will make deadlock, so prevent it.
494
+ # This is essential for readexactly(n) for case when n > self._limit.
495
+ if self._paused:
496
+ self._paused = False
497
+ self._transport.resume_reading()
498
+
499
+ self._waiter = self._loop.create_future()
500
+ try:
501
+ await self._waiter
502
+ finally:
503
+ self._waiter = None
504
+
505
+ async def readline(self):
506
+ """Read chunk of data from the stream until newline (b'\n') is found.
507
+
508
+ On success, return chunk that ends with newline. If only partial
509
+ line can be read due to EOF, return incomplete line without
510
+ terminating newline. When EOF was reached while no bytes read, empty
511
+ bytes object is returned.
512
+
513
+ If limit is reached, ValueError will be raised. In that case, if
514
+ newline was found, complete line including newline will be removed
515
+ from internal buffer. Else, internal buffer will be cleared. Limit is
516
+ compared against part of the line without newline.
517
+
518
+ If stream was paused, this function will automatically resume it if
519
+ needed.
520
+ """
521
+ sep = b'\n'
522
+ seplen = len(sep)
523
+ try:
524
+ line = await self.readuntil(sep)
525
+ except exceptions.IncompleteReadError as e:
526
+ return e.partial
527
+ except exceptions.LimitOverrunError as e:
528
+ if self._buffer.startswith(sep, e.consumed):
529
+ del self._buffer[:e.consumed + seplen]
530
+ else:
531
+ self._buffer.clear()
532
+ self._maybe_resume_transport()
533
+ raise ValueError(e.args[0])
534
+ return line
535
+
536
+ async def readuntil(self, separator=b'\n'):
537
+ """Read data from the stream until ``separator`` is found.
538
+
539
+ On success, the data and separator will be removed from the
540
+ internal buffer (consumed). Returned data will include the
541
+ separator at the end.
542
+
543
+ Configured stream limit is used to check result. Limit sets the
544
+ maximal length of data that can be returned, not counting the
545
+ separator.
546
+
547
+ If an EOF occurs and the complete separator is still not found,
548
+ an IncompleteReadError exception will be raised, and the internal
549
+ buffer will be reset. The IncompleteReadError.partial attribute
550
+ may contain the separator partially.
551
+
552
+ If the data cannot be read because of over limit, a
553
+ LimitOverrunError exception will be raised, and the data
554
+ will be left in the internal buffer, so it can be read again.
555
+ """
556
+ seplen = len(separator)
557
+ if seplen == 0:
558
+ raise ValueError('Separator should be at least one-byte string')
559
+
560
+ if self._exception is not None:
561
+ raise self._exception
562
+
563
+ # Consume whole buffer except last bytes, which length is
564
+ # one less than seplen. Let's check corner cases with
565
+ # separator='SEPARATOR':
566
+ # * we have received almost complete separator (without last
567
+ # byte). i.e buffer='some textSEPARATO'. In this case we
568
+ # can safely consume len(separator) - 1 bytes.
569
+ # * last byte of buffer is first byte of separator, i.e.
570
+ # buffer='abcdefghijklmnopqrS'. We may safely consume
571
+ # everything except that last byte, but this require to
572
+ # analyze bytes of buffer that match partial separator.
573
+ # This is slow and/or require FSM. For this case our
574
+ # implementation is not optimal, since require rescanning
575
+ # of data that is known to not belong to separator. In
576
+ # real world, separator will not be so long to notice
577
+ # performance problems. Even when reading MIME-encoded
578
+ # messages :)
579
+
580
+ # `offset` is the number of bytes from the beginning of the buffer
581
+ # where there is no occurrence of `separator`.
582
+ offset = 0
583
+
584
+ # Loop until we find `separator` in the buffer, exceed the buffer size,
585
+ # or an EOF has happened.
586
+ while True:
587
+ buflen = len(self._buffer)
588
+
589
+ # Check if we now have enough data in the buffer for `separator` to
590
+ # fit.
591
+ if buflen - offset >= seplen:
592
+ isep = self._buffer.find(separator, offset)
593
+
594
+ if isep != -1:
595
+ # `separator` is in the buffer. `isep` will be used later
596
+ # to retrieve the data.
597
+ break
598
+
599
+ # see upper comment for explanation.
600
+ offset = buflen + 1 - seplen
601
+ if offset > self._limit:
602
+ raise exceptions.LimitOverrunError(
603
+ 'Separator is not found, and chunk exceed the limit',
604
+ offset)
605
+
606
+ # Complete message (with full separator) may be present in buffer
607
+ # even when EOF flag is set. This may happen when the last chunk
608
+ # adds data which makes separator be found. That's why we check for
609
+ # EOF *ater* inspecting the buffer.
610
+ if self._eof:
611
+ chunk = bytes(self._buffer)
612
+ self._buffer.clear()
613
+ raise exceptions.IncompleteReadError(chunk, None)
614
+
615
+ # _wait_for_data() will resume reading if stream was paused.
616
+ await self._wait_for_data('readuntil')
617
+
618
+ if isep > self._limit:
619
+ raise exceptions.LimitOverrunError(
620
+ 'Separator is found, but chunk is longer than limit', isep)
621
+
622
+ chunk = self._buffer[:isep + seplen]
623
+ del self._buffer[:isep + seplen]
624
+ self._maybe_resume_transport()
625
+ return bytes(chunk)
626
+
627
+ async def read(self, n=-1):
628
+ """Read up to `n` bytes from the stream.
629
+
630
+ If `n` is not provided or set to -1,
631
+ read until EOF, then return all read bytes.
632
+ If EOF was received and the internal buffer is empty,
633
+ return an empty bytes object.
634
+
635
+ If `n` is 0, return an empty bytes object immediately.
636
+
637
+ If `n` is positive, return at most `n` available bytes
638
+ as soon as at least 1 byte is available in the internal buffer.
639
+ If EOF is received before any byte is read, return an empty
640
+ bytes object.
641
+
642
+ Returned value is not limited with limit, configured at stream
643
+ creation.
644
+
645
+ If stream was paused, this function will automatically resume it if
646
+ needed.
647
+ """
648
+
649
+ if self._exception is not None:
650
+ raise self._exception
651
+
652
+ if n == 0:
653
+ return b''
654
+
655
+ if n < 0:
656
+ # This used to just loop creating a new waiter hoping to
657
+ # collect everything in self._buffer, but that would
658
+ # deadlock if the subprocess sends more than self.limit
659
+ # bytes. So just call self.read(self._limit) until EOF.
660
+ blocks = []
661
+ while True:
662
+ block = await self.read(self._limit)
663
+ if not block:
664
+ break
665
+ blocks.append(block)
666
+ return b''.join(blocks)
667
+
668
+ if not self._buffer and not self._eof:
669
+ await self._wait_for_data('read')
670
+
671
+ # This will work right even if buffer is less than n bytes
672
+ data = bytes(self._buffer[:n])
673
+ del self._buffer[:n]
674
+
675
+ self._maybe_resume_transport()
676
+ return data
677
+
678
+ async def readexactly(self, n):
679
+ """Read exactly `n` bytes.
680
+
681
+ Raise an IncompleteReadError if EOF is reached before `n` bytes can be
682
+ read. The IncompleteReadError.partial attribute of the exception will
683
+ contain the partial read bytes.
684
+
685
+ if n is zero, return empty bytes object.
686
+
687
+ Returned value is not limited with limit, configured at stream
688
+ creation.
689
+
690
+ If stream was paused, this function will automatically resume it if
691
+ needed.
692
+ """
693
+ if n < 0:
694
+ raise ValueError('readexactly size can not be less than zero')
695
+
696
+ if self._exception is not None:
697
+ raise self._exception
698
+
699
+ if n == 0:
700
+ return b''
701
+
702
+ while len(self._buffer) < n:
703
+ if self._eof:
704
+ incomplete = bytes(self._buffer)
705
+ self._buffer.clear()
706
+ raise exceptions.IncompleteReadError(incomplete, n)
707
+
708
+ await self._wait_for_data('readexactly')
709
+
710
+ if len(self._buffer) == n:
711
+ data = bytes(self._buffer)
712
+ self._buffer.clear()
713
+ else:
714
+ data = bytes(self._buffer[:n])
715
+ del self._buffer[:n]
716
+ self._maybe_resume_transport()
717
+ return data
718
+
719
+ def __aiter__(self):
720
+ return self
721
+
722
+ async def __anext__(self):
723
+ val = await self.readline()
724
+ if val == b'':
725
+ raise StopAsyncIteration
726
+ return val
omnilmm/lib/python3.10/html/__init__.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ General functions for HTML manipulation.
3
+ """
4
+
5
+ import re as _re
6
+ from html.entities import html5 as _html5
7
+
8
+
9
+ __all__ = ['escape', 'unescape']
10
+
11
+
12
+ def escape(s, quote=True):
13
+ """
14
+ Replace special characters "&", "<" and ">" to HTML-safe sequences.
15
+ If the optional flag quote is true (the default), the quotation mark
16
+ characters, both double quote (") and single quote (') characters are also
17
+ translated.
18
+ """
19
+ s = s.replace("&", "&amp;") # Must be done first!
20
+ s = s.replace("<", "&lt;")
21
+ s = s.replace(">", "&gt;")
22
+ if quote:
23
+ s = s.replace('"', "&quot;")
24
+ s = s.replace('\'', "&#x27;")
25
+ return s
26
+
27
+
28
+ # see https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
29
+
30
+ _invalid_charrefs = {
31
+ 0x00: '\ufffd', # REPLACEMENT CHARACTER
32
+ 0x0d: '\r', # CARRIAGE RETURN
33
+ 0x80: '\u20ac', # EURO SIGN
34
+ 0x81: '\x81', # <control>
35
+ 0x82: '\u201a', # SINGLE LOW-9 QUOTATION MARK
36
+ 0x83: '\u0192', # LATIN SMALL LETTER F WITH HOOK
37
+ 0x84: '\u201e', # DOUBLE LOW-9 QUOTATION MARK
38
+ 0x85: '\u2026', # HORIZONTAL ELLIPSIS
39
+ 0x86: '\u2020', # DAGGER
40
+ 0x87: '\u2021', # DOUBLE DAGGER
41
+ 0x88: '\u02c6', # MODIFIER LETTER CIRCUMFLEX ACCENT
42
+ 0x89: '\u2030', # PER MILLE SIGN
43
+ 0x8a: '\u0160', # LATIN CAPITAL LETTER S WITH CARON
44
+ 0x8b: '\u2039', # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
45
+ 0x8c: '\u0152', # LATIN CAPITAL LIGATURE OE
46
+ 0x8d: '\x8d', # <control>
47
+ 0x8e: '\u017d', # LATIN CAPITAL LETTER Z WITH CARON
48
+ 0x8f: '\x8f', # <control>
49
+ 0x90: '\x90', # <control>
50
+ 0x91: '\u2018', # LEFT SINGLE QUOTATION MARK
51
+ 0x92: '\u2019', # RIGHT SINGLE QUOTATION MARK
52
+ 0x93: '\u201c', # LEFT DOUBLE QUOTATION MARK
53
+ 0x94: '\u201d', # RIGHT DOUBLE QUOTATION MARK
54
+ 0x95: '\u2022', # BULLET
55
+ 0x96: '\u2013', # EN DASH
56
+ 0x97: '\u2014', # EM DASH
57
+ 0x98: '\u02dc', # SMALL TILDE
58
+ 0x99: '\u2122', # TRADE MARK SIGN
59
+ 0x9a: '\u0161', # LATIN SMALL LETTER S WITH CARON
60
+ 0x9b: '\u203a', # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
61
+ 0x9c: '\u0153', # LATIN SMALL LIGATURE OE
62
+ 0x9d: '\x9d', # <control>
63
+ 0x9e: '\u017e', # LATIN SMALL LETTER Z WITH CARON
64
+ 0x9f: '\u0178', # LATIN CAPITAL LETTER Y WITH DIAERESIS
65
+ }
66
+
67
+ _invalid_codepoints = {
68
+ # 0x0001 to 0x0008
69
+ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
70
+ # 0x000E to 0x001F
71
+ 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
72
+ 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
73
+ # 0x007F to 0x009F
74
+ 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
75
+ 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
76
+ 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
77
+ # 0xFDD0 to 0xFDEF
78
+ 0xfdd0, 0xfdd1, 0xfdd2, 0xfdd3, 0xfdd4, 0xfdd5, 0xfdd6, 0xfdd7, 0xfdd8,
79
+ 0xfdd9, 0xfdda, 0xfddb, 0xfddc, 0xfddd, 0xfdde, 0xfddf, 0xfde0, 0xfde1,
80
+ 0xfde2, 0xfde3, 0xfde4, 0xfde5, 0xfde6, 0xfde7, 0xfde8, 0xfde9, 0xfdea,
81
+ 0xfdeb, 0xfdec, 0xfded, 0xfdee, 0xfdef,
82
+ # others
83
+ 0xb, 0xfffe, 0xffff, 0x1fffe, 0x1ffff, 0x2fffe, 0x2ffff, 0x3fffe, 0x3ffff,
84
+ 0x4fffe, 0x4ffff, 0x5fffe, 0x5ffff, 0x6fffe, 0x6ffff, 0x7fffe, 0x7ffff,
85
+ 0x8fffe, 0x8ffff, 0x9fffe, 0x9ffff, 0xafffe, 0xaffff, 0xbfffe, 0xbffff,
86
+ 0xcfffe, 0xcffff, 0xdfffe, 0xdffff, 0xefffe, 0xeffff, 0xffffe, 0xfffff,
87
+ 0x10fffe, 0x10ffff
88
+ }
89
+
90
+
91
+ def _replace_charref(s):
92
+ s = s.group(1)
93
+ if s[0] == '#':
94
+ # numeric charref
95
+ if s[1] in 'xX':
96
+ num = int(s[2:].rstrip(';'), 16)
97
+ else:
98
+ num = int(s[1:].rstrip(';'))
99
+ if num in _invalid_charrefs:
100
+ return _invalid_charrefs[num]
101
+ if 0xD800 <= num <= 0xDFFF or num > 0x10FFFF:
102
+ return '\uFFFD'
103
+ if num in _invalid_codepoints:
104
+ return ''
105
+ return chr(num)
106
+ else:
107
+ # named charref
108
+ if s in _html5:
109
+ return _html5[s]
110
+ # find the longest matching name (as defined by the standard)
111
+ for x in range(len(s)-1, 1, -1):
112
+ if s[:x] in _html5:
113
+ return _html5[s[:x]] + s[x:]
114
+ else:
115
+ return '&' + s
116
+
117
+
118
+ _charref = _re.compile(r'&(#[0-9]+;?'
119
+ r'|#[xX][0-9a-fA-F]+;?'
120
+ r'|[^\t\n\f <&#;]{1,32};?)')
121
+
122
+ def unescape(s):
123
+ """
124
+ Convert all named and numeric character references (e.g. &gt;, &#62;,
125
+ &x3e;) in the string s to the corresponding unicode characters.
126
+ This function uses the rules defined by the HTML 5 standard
127
+ for both valid and invalid character references, and the list of
128
+ HTML 5 named character references defined in html.entities.html5.
129
+ """
130
+ if '&' not in s:
131
+ return s
132
+ return _charref.sub(_replace_charref, s)
omnilmm/lib/python3.10/html/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (3.32 kB). View file
 
omnilmm/lib/python3.10/html/__pycache__/parser.cpython-310.pyc ADDED
Binary file (11 kB). View file
 
omnilmm/lib/python3.10/html/entities.py ADDED
@@ -0,0 +1,2510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """HTML character entity references."""
2
+
3
+ __all__ = ['html5', 'name2codepoint', 'codepoint2name', 'entitydefs']
4
+
5
+
6
+ # maps the HTML entity name to the Unicode code point
7
+ # from https://html.spec.whatwg.org/multipage/named-characters.html
8
+ name2codepoint = {
9
+ 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
10
+ 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1
11
+ 'Acirc': 0x00c2, # latin capital letter A with circumflex, U+00C2 ISOlat1
12
+ 'Agrave': 0x00c0, # latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
13
+ 'Alpha': 0x0391, # greek capital letter alpha, U+0391
14
+ 'Aring': 0x00c5, # latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
15
+ 'Atilde': 0x00c3, # latin capital letter A with tilde, U+00C3 ISOlat1
16
+ 'Auml': 0x00c4, # latin capital letter A with diaeresis, U+00C4 ISOlat1
17
+ 'Beta': 0x0392, # greek capital letter beta, U+0392
18
+ 'Ccedil': 0x00c7, # latin capital letter C with cedilla, U+00C7 ISOlat1
19
+ 'Chi': 0x03a7, # greek capital letter chi, U+03A7
20
+ 'Dagger': 0x2021, # double dagger, U+2021 ISOpub
21
+ 'Delta': 0x0394, # greek capital letter delta, U+0394 ISOgrk3
22
+ 'ETH': 0x00d0, # latin capital letter ETH, U+00D0 ISOlat1
23
+ 'Eacute': 0x00c9, # latin capital letter E with acute, U+00C9 ISOlat1
24
+ 'Ecirc': 0x00ca, # latin capital letter E with circumflex, U+00CA ISOlat1
25
+ 'Egrave': 0x00c8, # latin capital letter E with grave, U+00C8 ISOlat1
26
+ 'Epsilon': 0x0395, # greek capital letter epsilon, U+0395
27
+ 'Eta': 0x0397, # greek capital letter eta, U+0397
28
+ 'Euml': 0x00cb, # latin capital letter E with diaeresis, U+00CB ISOlat1
29
+ 'Gamma': 0x0393, # greek capital letter gamma, U+0393 ISOgrk3
30
+ 'Iacute': 0x00cd, # latin capital letter I with acute, U+00CD ISOlat1
31
+ 'Icirc': 0x00ce, # latin capital letter I with circumflex, U+00CE ISOlat1
32
+ 'Igrave': 0x00cc, # latin capital letter I with grave, U+00CC ISOlat1
33
+ 'Iota': 0x0399, # greek capital letter iota, U+0399
34
+ 'Iuml': 0x00cf, # latin capital letter I with diaeresis, U+00CF ISOlat1
35
+ 'Kappa': 0x039a, # greek capital letter kappa, U+039A
36
+ 'Lambda': 0x039b, # greek capital letter lambda, U+039B ISOgrk3
37
+ 'Mu': 0x039c, # greek capital letter mu, U+039C
38
+ 'Ntilde': 0x00d1, # latin capital letter N with tilde, U+00D1 ISOlat1
39
+ 'Nu': 0x039d, # greek capital letter nu, U+039D
40
+ 'OElig': 0x0152, # latin capital ligature OE, U+0152 ISOlat2
41
+ 'Oacute': 0x00d3, # latin capital letter O with acute, U+00D3 ISOlat1
42
+ 'Ocirc': 0x00d4, # latin capital letter O with circumflex, U+00D4 ISOlat1
43
+ 'Ograve': 0x00d2, # latin capital letter O with grave, U+00D2 ISOlat1
44
+ 'Omega': 0x03a9, # greek capital letter omega, U+03A9 ISOgrk3
45
+ 'Omicron': 0x039f, # greek capital letter omicron, U+039F
46
+ 'Oslash': 0x00d8, # latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
47
+ 'Otilde': 0x00d5, # latin capital letter O with tilde, U+00D5 ISOlat1
48
+ 'Ouml': 0x00d6, # latin capital letter O with diaeresis, U+00D6 ISOlat1
49
+ 'Phi': 0x03a6, # greek capital letter phi, U+03A6 ISOgrk3
50
+ 'Pi': 0x03a0, # greek capital letter pi, U+03A0 ISOgrk3
51
+ 'Prime': 0x2033, # double prime = seconds = inches, U+2033 ISOtech
52
+ 'Psi': 0x03a8, # greek capital letter psi, U+03A8 ISOgrk3
53
+ 'Rho': 0x03a1, # greek capital letter rho, U+03A1
54
+ 'Scaron': 0x0160, # latin capital letter S with caron, U+0160 ISOlat2
55
+ 'Sigma': 0x03a3, # greek capital letter sigma, U+03A3 ISOgrk3
56
+ 'THORN': 0x00de, # latin capital letter THORN, U+00DE ISOlat1
57
+ 'Tau': 0x03a4, # greek capital letter tau, U+03A4
58
+ 'Theta': 0x0398, # greek capital letter theta, U+0398 ISOgrk3
59
+ 'Uacute': 0x00da, # latin capital letter U with acute, U+00DA ISOlat1
60
+ 'Ucirc': 0x00db, # latin capital letter U with circumflex, U+00DB ISOlat1
61
+ 'Ugrave': 0x00d9, # latin capital letter U with grave, U+00D9 ISOlat1
62
+ 'Upsilon': 0x03a5, # greek capital letter upsilon, U+03A5 ISOgrk3
63
+ 'Uuml': 0x00dc, # latin capital letter U with diaeresis, U+00DC ISOlat1
64
+ 'Xi': 0x039e, # greek capital letter xi, U+039E ISOgrk3
65
+ 'Yacute': 0x00dd, # latin capital letter Y with acute, U+00DD ISOlat1
66
+ 'Yuml': 0x0178, # latin capital letter Y with diaeresis, U+0178 ISOlat2
67
+ 'Zeta': 0x0396, # greek capital letter zeta, U+0396
68
+ 'aacute': 0x00e1, # latin small letter a with acute, U+00E1 ISOlat1
69
+ 'acirc': 0x00e2, # latin small letter a with circumflex, U+00E2 ISOlat1
70
+ 'acute': 0x00b4, # acute accent = spacing acute, U+00B4 ISOdia
71
+ 'aelig': 0x00e6, # latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
72
+ 'agrave': 0x00e0, # latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
73
+ 'alefsym': 0x2135, # alef symbol = first transfinite cardinal, U+2135 NEW
74
+ 'alpha': 0x03b1, # greek small letter alpha, U+03B1 ISOgrk3
75
+ 'amp': 0x0026, # ampersand, U+0026 ISOnum
76
+ 'and': 0x2227, # logical and = wedge, U+2227 ISOtech
77
+ 'ang': 0x2220, # angle, U+2220 ISOamso
78
+ 'aring': 0x00e5, # latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
79
+ 'asymp': 0x2248, # almost equal to = asymptotic to, U+2248 ISOamsr
80
+ 'atilde': 0x00e3, # latin small letter a with tilde, U+00E3 ISOlat1
81
+ 'auml': 0x00e4, # latin small letter a with diaeresis, U+00E4 ISOlat1
82
+ 'bdquo': 0x201e, # double low-9 quotation mark, U+201E NEW
83
+ 'beta': 0x03b2, # greek small letter beta, U+03B2 ISOgrk3
84
+ 'brvbar': 0x00a6, # broken bar = broken vertical bar, U+00A6 ISOnum
85
+ 'bull': 0x2022, # bullet = black small circle, U+2022 ISOpub
86
+ 'cap': 0x2229, # intersection = cap, U+2229 ISOtech
87
+ 'ccedil': 0x00e7, # latin small letter c with cedilla, U+00E7 ISOlat1
88
+ 'cedil': 0x00b8, # cedilla = spacing cedilla, U+00B8 ISOdia
89
+ 'cent': 0x00a2, # cent sign, U+00A2 ISOnum
90
+ 'chi': 0x03c7, # greek small letter chi, U+03C7 ISOgrk3
91
+ 'circ': 0x02c6, # modifier letter circumflex accent, U+02C6 ISOpub
92
+ 'clubs': 0x2663, # black club suit = shamrock, U+2663 ISOpub
93
+ 'cong': 0x2245, # approximately equal to, U+2245 ISOtech
94
+ 'copy': 0x00a9, # copyright sign, U+00A9 ISOnum
95
+ 'crarr': 0x21b5, # downwards arrow with corner leftwards = carriage return, U+21B5 NEW
96
+ 'cup': 0x222a, # union = cup, U+222A ISOtech
97
+ 'curren': 0x00a4, # currency sign, U+00A4 ISOnum
98
+ 'dArr': 0x21d3, # downwards double arrow, U+21D3 ISOamsa
99
+ 'dagger': 0x2020, # dagger, U+2020 ISOpub
100
+ 'darr': 0x2193, # downwards arrow, U+2193 ISOnum
101
+ 'deg': 0x00b0, # degree sign, U+00B0 ISOnum
102
+ 'delta': 0x03b4, # greek small letter delta, U+03B4 ISOgrk3
103
+ 'diams': 0x2666, # black diamond suit, U+2666 ISOpub
104
+ 'divide': 0x00f7, # division sign, U+00F7 ISOnum
105
+ 'eacute': 0x00e9, # latin small letter e with acute, U+00E9 ISOlat1
106
+ 'ecirc': 0x00ea, # latin small letter e with circumflex, U+00EA ISOlat1
107
+ 'egrave': 0x00e8, # latin small letter e with grave, U+00E8 ISOlat1
108
+ 'empty': 0x2205, # empty set = null set = diameter, U+2205 ISOamso
109
+ 'emsp': 0x2003, # em space, U+2003 ISOpub
110
+ 'ensp': 0x2002, # en space, U+2002 ISOpub
111
+ 'epsilon': 0x03b5, # greek small letter epsilon, U+03B5 ISOgrk3
112
+ 'equiv': 0x2261, # identical to, U+2261 ISOtech
113
+ 'eta': 0x03b7, # greek small letter eta, U+03B7 ISOgrk3
114
+ 'eth': 0x00f0, # latin small letter eth, U+00F0 ISOlat1
115
+ 'euml': 0x00eb, # latin small letter e with diaeresis, U+00EB ISOlat1
116
+ 'euro': 0x20ac, # euro sign, U+20AC NEW
117
+ 'exist': 0x2203, # there exists, U+2203 ISOtech
118
+ 'fnof': 0x0192, # latin small f with hook = function = florin, U+0192 ISOtech
119
+ 'forall': 0x2200, # for all, U+2200 ISOtech
120
+ 'frac12': 0x00bd, # vulgar fraction one half = fraction one half, U+00BD ISOnum
121
+ 'frac14': 0x00bc, # vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
122
+ 'frac34': 0x00be, # vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
123
+ 'frasl': 0x2044, # fraction slash, U+2044 NEW
124
+ 'gamma': 0x03b3, # greek small letter gamma, U+03B3 ISOgrk3
125
+ 'ge': 0x2265, # greater-than or equal to, U+2265 ISOtech
126
+ 'gt': 0x003e, # greater-than sign, U+003E ISOnum
127
+ 'hArr': 0x21d4, # left right double arrow, U+21D4 ISOamsa
128
+ 'harr': 0x2194, # left right arrow, U+2194 ISOamsa
129
+ 'hearts': 0x2665, # black heart suit = valentine, U+2665 ISOpub
130
+ 'hellip': 0x2026, # horizontal ellipsis = three dot leader, U+2026 ISOpub
131
+ 'iacute': 0x00ed, # latin small letter i with acute, U+00ED ISOlat1
132
+ 'icirc': 0x00ee, # latin small letter i with circumflex, U+00EE ISOlat1
133
+ 'iexcl': 0x00a1, # inverted exclamation mark, U+00A1 ISOnum
134
+ 'igrave': 0x00ec, # latin small letter i with grave, U+00EC ISOlat1
135
+ 'image': 0x2111, # blackletter capital I = imaginary part, U+2111 ISOamso
136
+ 'infin': 0x221e, # infinity, U+221E ISOtech
137
+ 'int': 0x222b, # integral, U+222B ISOtech
138
+ 'iota': 0x03b9, # greek small letter iota, U+03B9 ISOgrk3
139
+ 'iquest': 0x00bf, # inverted question mark = turned question mark, U+00BF ISOnum
140
+ 'isin': 0x2208, # element of, U+2208 ISOtech
141
+ 'iuml': 0x00ef, # latin small letter i with diaeresis, U+00EF ISOlat1
142
+ 'kappa': 0x03ba, # greek small letter kappa, U+03BA ISOgrk3
143
+ 'lArr': 0x21d0, # leftwards double arrow, U+21D0 ISOtech
144
+ 'lambda': 0x03bb, # greek small letter lambda, U+03BB ISOgrk3
145
+ 'lang': 0x2329, # left-pointing angle bracket = bra, U+2329 ISOtech
146
+ 'laquo': 0x00ab, # left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
147
+ 'larr': 0x2190, # leftwards arrow, U+2190 ISOnum
148
+ 'lceil': 0x2308, # left ceiling = apl upstile, U+2308 ISOamsc
149
+ 'ldquo': 0x201c, # left double quotation mark, U+201C ISOnum
150
+ 'le': 0x2264, # less-than or equal to, U+2264 ISOtech
151
+ 'lfloor': 0x230a, # left floor = apl downstile, U+230A ISOamsc
152
+ 'lowast': 0x2217, # asterisk operator, U+2217 ISOtech
153
+ 'loz': 0x25ca, # lozenge, U+25CA ISOpub
154
+ 'lrm': 0x200e, # left-to-right mark, U+200E NEW RFC 2070
155
+ 'lsaquo': 0x2039, # single left-pointing angle quotation mark, U+2039 ISO proposed
156
+ 'lsquo': 0x2018, # left single quotation mark, U+2018 ISOnum
157
+ 'lt': 0x003c, # less-than sign, U+003C ISOnum
158
+ 'macr': 0x00af, # macron = spacing macron = overline = APL overbar, U+00AF ISOdia
159
+ 'mdash': 0x2014, # em dash, U+2014 ISOpub
160
+ 'micro': 0x00b5, # micro sign, U+00B5 ISOnum
161
+ 'middot': 0x00b7, # middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
162
+ 'minus': 0x2212, # minus sign, U+2212 ISOtech
163
+ 'mu': 0x03bc, # greek small letter mu, U+03BC ISOgrk3
164
+ 'nabla': 0x2207, # nabla = backward difference, U+2207 ISOtech
165
+ 'nbsp': 0x00a0, # no-break space = non-breaking space, U+00A0 ISOnum
166
+ 'ndash': 0x2013, # en dash, U+2013 ISOpub
167
+ 'ne': 0x2260, # not equal to, U+2260 ISOtech
168
+ 'ni': 0x220b, # contains as member, U+220B ISOtech
169
+ 'not': 0x00ac, # not sign, U+00AC ISOnum
170
+ 'notin': 0x2209, # not an element of, U+2209 ISOtech
171
+ 'nsub': 0x2284, # not a subset of, U+2284 ISOamsn
172
+ 'ntilde': 0x00f1, # latin small letter n with tilde, U+00F1 ISOlat1
173
+ 'nu': 0x03bd, # greek small letter nu, U+03BD ISOgrk3
174
+ 'oacute': 0x00f3, # latin small letter o with acute, U+00F3 ISOlat1
175
+ 'ocirc': 0x00f4, # latin small letter o with circumflex, U+00F4 ISOlat1
176
+ 'oelig': 0x0153, # latin small ligature oe, U+0153 ISOlat2
177
+ 'ograve': 0x00f2, # latin small letter o with grave, U+00F2 ISOlat1
178
+ 'oline': 0x203e, # overline = spacing overscore, U+203E NEW
179
+ 'omega': 0x03c9, # greek small letter omega, U+03C9 ISOgrk3
180
+ 'omicron': 0x03bf, # greek small letter omicron, U+03BF NEW
181
+ 'oplus': 0x2295, # circled plus = direct sum, U+2295 ISOamsb
182
+ 'or': 0x2228, # logical or = vee, U+2228 ISOtech
183
+ 'ordf': 0x00aa, # feminine ordinal indicator, U+00AA ISOnum
184
+ 'ordm': 0x00ba, # masculine ordinal indicator, U+00BA ISOnum
185
+ 'oslash': 0x00f8, # latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
186
+ 'otilde': 0x00f5, # latin small letter o with tilde, U+00F5 ISOlat1
187
+ 'otimes': 0x2297, # circled times = vector product, U+2297 ISOamsb
188
+ 'ouml': 0x00f6, # latin small letter o with diaeresis, U+00F6 ISOlat1
189
+ 'para': 0x00b6, # pilcrow sign = paragraph sign, U+00B6 ISOnum
190
+ 'part': 0x2202, # partial differential, U+2202 ISOtech
191
+ 'permil': 0x2030, # per mille sign, U+2030 ISOtech
192
+ 'perp': 0x22a5, # up tack = orthogonal to = perpendicular, U+22A5 ISOtech
193
+ 'phi': 0x03c6, # greek small letter phi, U+03C6 ISOgrk3
194
+ 'pi': 0x03c0, # greek small letter pi, U+03C0 ISOgrk3
195
+ 'piv': 0x03d6, # greek pi symbol, U+03D6 ISOgrk3
196
+ 'plusmn': 0x00b1, # plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
197
+ 'pound': 0x00a3, # pound sign, U+00A3 ISOnum
198
+ 'prime': 0x2032, # prime = minutes = feet, U+2032 ISOtech
199
+ 'prod': 0x220f, # n-ary product = product sign, U+220F ISOamsb
200
+ 'prop': 0x221d, # proportional to, U+221D ISOtech
201
+ 'psi': 0x03c8, # greek small letter psi, U+03C8 ISOgrk3
202
+ 'quot': 0x0022, # quotation mark = APL quote, U+0022 ISOnum
203
+ 'rArr': 0x21d2, # rightwards double arrow, U+21D2 ISOtech
204
+ 'radic': 0x221a, # square root = radical sign, U+221A ISOtech
205
+ 'rang': 0x232a, # right-pointing angle bracket = ket, U+232A ISOtech
206
+ 'raquo': 0x00bb, # right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
207
+ 'rarr': 0x2192, # rightwards arrow, U+2192 ISOnum
208
+ 'rceil': 0x2309, # right ceiling, U+2309 ISOamsc
209
+ 'rdquo': 0x201d, # right double quotation mark, U+201D ISOnum
210
+ 'real': 0x211c, # blackletter capital R = real part symbol, U+211C ISOamso
211
+ 'reg': 0x00ae, # registered sign = registered trade mark sign, U+00AE ISOnum
212
+ 'rfloor': 0x230b, # right floor, U+230B ISOamsc
213
+ 'rho': 0x03c1, # greek small letter rho, U+03C1 ISOgrk3
214
+ 'rlm': 0x200f, # right-to-left mark, U+200F NEW RFC 2070
215
+ 'rsaquo': 0x203a, # single right-pointing angle quotation mark, U+203A ISO proposed
216
+ 'rsquo': 0x2019, # right single quotation mark, U+2019 ISOnum
217
+ 'sbquo': 0x201a, # single low-9 quotation mark, U+201A NEW
218
+ 'scaron': 0x0161, # latin small letter s with caron, U+0161 ISOlat2
219
+ 'sdot': 0x22c5, # dot operator, U+22C5 ISOamsb
220
+ 'sect': 0x00a7, # section sign, U+00A7 ISOnum
221
+ 'shy': 0x00ad, # soft hyphen = discretionary hyphen, U+00AD ISOnum
222
+ 'sigma': 0x03c3, # greek small letter sigma, U+03C3 ISOgrk3
223
+ 'sigmaf': 0x03c2, # greek small letter final sigma, U+03C2 ISOgrk3
224
+ 'sim': 0x223c, # tilde operator = varies with = similar to, U+223C ISOtech
225
+ 'spades': 0x2660, # black spade suit, U+2660 ISOpub
226
+ 'sub': 0x2282, # subset of, U+2282 ISOtech
227
+ 'sube': 0x2286, # subset of or equal to, U+2286 ISOtech
228
+ 'sum': 0x2211, # n-ary summation, U+2211 ISOamsb
229
+ 'sup': 0x2283, # superset of, U+2283 ISOtech
230
+ 'sup1': 0x00b9, # superscript one = superscript digit one, U+00B9 ISOnum
231
+ 'sup2': 0x00b2, # superscript two = superscript digit two = squared, U+00B2 ISOnum
232
+ 'sup3': 0x00b3, # superscript three = superscript digit three = cubed, U+00B3 ISOnum
233
+ 'supe': 0x2287, # superset of or equal to, U+2287 ISOtech
234
+ 'szlig': 0x00df, # latin small letter sharp s = ess-zed, U+00DF ISOlat1
235
+ 'tau': 0x03c4, # greek small letter tau, U+03C4 ISOgrk3
236
+ 'there4': 0x2234, # therefore, U+2234 ISOtech
237
+ 'theta': 0x03b8, # greek small letter theta, U+03B8 ISOgrk3
238
+ 'thetasym': 0x03d1, # greek small letter theta symbol, U+03D1 NEW
239
+ 'thinsp': 0x2009, # thin space, U+2009 ISOpub
240
+ 'thorn': 0x00fe, # latin small letter thorn with, U+00FE ISOlat1
241
+ 'tilde': 0x02dc, # small tilde, U+02DC ISOdia
242
+ 'times': 0x00d7, # multiplication sign, U+00D7 ISOnum
243
+ 'trade': 0x2122, # trade mark sign, U+2122 ISOnum
244
+ 'uArr': 0x21d1, # upwards double arrow, U+21D1 ISOamsa
245
+ 'uacute': 0x00fa, # latin small letter u with acute, U+00FA ISOlat1
246
+ 'uarr': 0x2191, # upwards arrow, U+2191 ISOnum
247
+ 'ucirc': 0x00fb, # latin small letter u with circumflex, U+00FB ISOlat1
248
+ 'ugrave': 0x00f9, # latin small letter u with grave, U+00F9 ISOlat1
249
+ 'uml': 0x00a8, # diaeresis = spacing diaeresis, U+00A8 ISOdia
250
+ 'upsih': 0x03d2, # greek upsilon with hook symbol, U+03D2 NEW
251
+ 'upsilon': 0x03c5, # greek small letter upsilon, U+03C5 ISOgrk3
252
+ 'uuml': 0x00fc, # latin small letter u with diaeresis, U+00FC ISOlat1
253
+ 'weierp': 0x2118, # script capital P = power set = Weierstrass p, U+2118 ISOamso
254
+ 'xi': 0x03be, # greek small letter xi, U+03BE ISOgrk3
255
+ 'yacute': 0x00fd, # latin small letter y with acute, U+00FD ISOlat1
256
+ 'yen': 0x00a5, # yen sign = yuan sign, U+00A5 ISOnum
257
+ 'yuml': 0x00ff, # latin small letter y with diaeresis, U+00FF ISOlat1
258
+ 'zeta': 0x03b6, # greek small letter zeta, U+03B6 ISOgrk3
259
+ 'zwj': 0x200d, # zero width joiner, U+200D NEW RFC 2070
260
+ 'zwnj': 0x200c, # zero width non-joiner, U+200C NEW RFC 2070
261
+ }
262
+
263
+
264
+ # maps the HTML5 named character references to the equivalent Unicode character(s)
265
+ html5 = {
266
+ 'Aacute': '\xc1',
267
+ 'aacute': '\xe1',
268
+ 'Aacute;': '\xc1',
269
+ 'aacute;': '\xe1',
270
+ 'Abreve;': '\u0102',
271
+ 'abreve;': '\u0103',
272
+ 'ac;': '\u223e',
273
+ 'acd;': '\u223f',
274
+ 'acE;': '\u223e\u0333',
275
+ 'Acirc': '\xc2',
276
+ 'acirc': '\xe2',
277
+ 'Acirc;': '\xc2',
278
+ 'acirc;': '\xe2',
279
+ 'acute': '\xb4',
280
+ 'acute;': '\xb4',
281
+ 'Acy;': '\u0410',
282
+ 'acy;': '\u0430',
283
+ 'AElig': '\xc6',
284
+ 'aelig': '\xe6',
285
+ 'AElig;': '\xc6',
286
+ 'aelig;': '\xe6',
287
+ 'af;': '\u2061',
288
+ 'Afr;': '\U0001d504',
289
+ 'afr;': '\U0001d51e',
290
+ 'Agrave': '\xc0',
291
+ 'agrave': '\xe0',
292
+ 'Agrave;': '\xc0',
293
+ 'agrave;': '\xe0',
294
+ 'alefsym;': '\u2135',
295
+ 'aleph;': '\u2135',
296
+ 'Alpha;': '\u0391',
297
+ 'alpha;': '\u03b1',
298
+ 'Amacr;': '\u0100',
299
+ 'amacr;': '\u0101',
300
+ 'amalg;': '\u2a3f',
301
+ 'AMP': '&',
302
+ 'amp': '&',
303
+ 'AMP;': '&',
304
+ 'amp;': '&',
305
+ 'And;': '\u2a53',
306
+ 'and;': '\u2227',
307
+ 'andand;': '\u2a55',
308
+ 'andd;': '\u2a5c',
309
+ 'andslope;': '\u2a58',
310
+ 'andv;': '\u2a5a',
311
+ 'ang;': '\u2220',
312
+ 'ange;': '\u29a4',
313
+ 'angle;': '\u2220',
314
+ 'angmsd;': '\u2221',
315
+ 'angmsdaa;': '\u29a8',
316
+ 'angmsdab;': '\u29a9',
317
+ 'angmsdac;': '\u29aa',
318
+ 'angmsdad;': '\u29ab',
319
+ 'angmsdae;': '\u29ac',
320
+ 'angmsdaf;': '\u29ad',
321
+ 'angmsdag;': '\u29ae',
322
+ 'angmsdah;': '\u29af',
323
+ 'angrt;': '\u221f',
324
+ 'angrtvb;': '\u22be',
325
+ 'angrtvbd;': '\u299d',
326
+ 'angsph;': '\u2222',
327
+ 'angst;': '\xc5',
328
+ 'angzarr;': '\u237c',
329
+ 'Aogon;': '\u0104',
330
+ 'aogon;': '\u0105',
331
+ 'Aopf;': '\U0001d538',
332
+ 'aopf;': '\U0001d552',
333
+ 'ap;': '\u2248',
334
+ 'apacir;': '\u2a6f',
335
+ 'apE;': '\u2a70',
336
+ 'ape;': '\u224a',
337
+ 'apid;': '\u224b',
338
+ 'apos;': "'",
339
+ 'ApplyFunction;': '\u2061',
340
+ 'approx;': '\u2248',
341
+ 'approxeq;': '\u224a',
342
+ 'Aring': '\xc5',
343
+ 'aring': '\xe5',
344
+ 'Aring;': '\xc5',
345
+ 'aring;': '\xe5',
346
+ 'Ascr;': '\U0001d49c',
347
+ 'ascr;': '\U0001d4b6',
348
+ 'Assign;': '\u2254',
349
+ 'ast;': '*',
350
+ 'asymp;': '\u2248',
351
+ 'asympeq;': '\u224d',
352
+ 'Atilde': '\xc3',
353
+ 'atilde': '\xe3',
354
+ 'Atilde;': '\xc3',
355
+ 'atilde;': '\xe3',
356
+ 'Auml': '\xc4',
357
+ 'auml': '\xe4',
358
+ 'Auml;': '\xc4',
359
+ 'auml;': '\xe4',
360
+ 'awconint;': '\u2233',
361
+ 'awint;': '\u2a11',
362
+ 'backcong;': '\u224c',
363
+ 'backepsilon;': '\u03f6',
364
+ 'backprime;': '\u2035',
365
+ 'backsim;': '\u223d',
366
+ 'backsimeq;': '\u22cd',
367
+ 'Backslash;': '\u2216',
368
+ 'Barv;': '\u2ae7',
369
+ 'barvee;': '\u22bd',
370
+ 'Barwed;': '\u2306',
371
+ 'barwed;': '\u2305',
372
+ 'barwedge;': '\u2305',
373
+ 'bbrk;': '\u23b5',
374
+ 'bbrktbrk;': '\u23b6',
375
+ 'bcong;': '\u224c',
376
+ 'Bcy;': '\u0411',
377
+ 'bcy;': '\u0431',
378
+ 'bdquo;': '\u201e',
379
+ 'becaus;': '\u2235',
380
+ 'Because;': '\u2235',
381
+ 'because;': '\u2235',
382
+ 'bemptyv;': '\u29b0',
383
+ 'bepsi;': '\u03f6',
384
+ 'bernou;': '\u212c',
385
+ 'Bernoullis;': '\u212c',
386
+ 'Beta;': '\u0392',
387
+ 'beta;': '\u03b2',
388
+ 'beth;': '\u2136',
389
+ 'between;': '\u226c',
390
+ 'Bfr;': '\U0001d505',
391
+ 'bfr;': '\U0001d51f',
392
+ 'bigcap;': '\u22c2',
393
+ 'bigcirc;': '\u25ef',
394
+ 'bigcup;': '\u22c3',
395
+ 'bigodot;': '\u2a00',
396
+ 'bigoplus;': '\u2a01',
397
+ 'bigotimes;': '\u2a02',
398
+ 'bigsqcup;': '\u2a06',
399
+ 'bigstar;': '\u2605',
400
+ 'bigtriangledown;': '\u25bd',
401
+ 'bigtriangleup;': '\u25b3',
402
+ 'biguplus;': '\u2a04',
403
+ 'bigvee;': '\u22c1',
404
+ 'bigwedge;': '\u22c0',
405
+ 'bkarow;': '\u290d',
406
+ 'blacklozenge;': '\u29eb',
407
+ 'blacksquare;': '\u25aa',
408
+ 'blacktriangle;': '\u25b4',
409
+ 'blacktriangledown;': '\u25be',
410
+ 'blacktriangleleft;': '\u25c2',
411
+ 'blacktriangleright;': '\u25b8',
412
+ 'blank;': '\u2423',
413
+ 'blk12;': '\u2592',
414
+ 'blk14;': '\u2591',
415
+ 'blk34;': '\u2593',
416
+ 'block;': '\u2588',
417
+ 'bne;': '=\u20e5',
418
+ 'bnequiv;': '\u2261\u20e5',
419
+ 'bNot;': '\u2aed',
420
+ 'bnot;': '\u2310',
421
+ 'Bopf;': '\U0001d539',
422
+ 'bopf;': '\U0001d553',
423
+ 'bot;': '\u22a5',
424
+ 'bottom;': '\u22a5',
425
+ 'bowtie;': '\u22c8',
426
+ 'boxbox;': '\u29c9',
427
+ 'boxDL;': '\u2557',
428
+ 'boxDl;': '\u2556',
429
+ 'boxdL;': '\u2555',
430
+ 'boxdl;': '\u2510',
431
+ 'boxDR;': '\u2554',
432
+ 'boxDr;': '\u2553',
433
+ 'boxdR;': '\u2552',
434
+ 'boxdr;': '\u250c',
435
+ 'boxH;': '\u2550',
436
+ 'boxh;': '\u2500',
437
+ 'boxHD;': '\u2566',
438
+ 'boxHd;': '\u2564',
439
+ 'boxhD;': '\u2565',
440
+ 'boxhd;': '\u252c',
441
+ 'boxHU;': '\u2569',
442
+ 'boxHu;': '\u2567',
443
+ 'boxhU;': '\u2568',
444
+ 'boxhu;': '\u2534',
445
+ 'boxminus;': '\u229f',
446
+ 'boxplus;': '\u229e',
447
+ 'boxtimes;': '\u22a0',
448
+ 'boxUL;': '\u255d',
449
+ 'boxUl;': '\u255c',
450
+ 'boxuL;': '\u255b',
451
+ 'boxul;': '\u2518',
452
+ 'boxUR;': '\u255a',
453
+ 'boxUr;': '\u2559',
454
+ 'boxuR;': '\u2558',
455
+ 'boxur;': '\u2514',
456
+ 'boxV;': '\u2551',
457
+ 'boxv;': '\u2502',
458
+ 'boxVH;': '\u256c',
459
+ 'boxVh;': '\u256b',
460
+ 'boxvH;': '\u256a',
461
+ 'boxvh;': '\u253c',
462
+ 'boxVL;': '\u2563',
463
+ 'boxVl;': '\u2562',
464
+ 'boxvL;': '\u2561',
465
+ 'boxvl;': '\u2524',
466
+ 'boxVR;': '\u2560',
467
+ 'boxVr;': '\u255f',
468
+ 'boxvR;': '\u255e',
469
+ 'boxvr;': '\u251c',
470
+ 'bprime;': '\u2035',
471
+ 'Breve;': '\u02d8',
472
+ 'breve;': '\u02d8',
473
+ 'brvbar': '\xa6',
474
+ 'brvbar;': '\xa6',
475
+ 'Bscr;': '\u212c',
476
+ 'bscr;': '\U0001d4b7',
477
+ 'bsemi;': '\u204f',
478
+ 'bsim;': '\u223d',
479
+ 'bsime;': '\u22cd',
480
+ 'bsol;': '\\',
481
+ 'bsolb;': '\u29c5',
482
+ 'bsolhsub;': '\u27c8',
483
+ 'bull;': '\u2022',
484
+ 'bullet;': '\u2022',
485
+ 'bump;': '\u224e',
486
+ 'bumpE;': '\u2aae',
487
+ 'bumpe;': '\u224f',
488
+ 'Bumpeq;': '\u224e',
489
+ 'bumpeq;': '\u224f',
490
+ 'Cacute;': '\u0106',
491
+ 'cacute;': '\u0107',
492
+ 'Cap;': '\u22d2',
493
+ 'cap;': '\u2229',
494
+ 'capand;': '\u2a44',
495
+ 'capbrcup;': '\u2a49',
496
+ 'capcap;': '\u2a4b',
497
+ 'capcup;': '\u2a47',
498
+ 'capdot;': '\u2a40',
499
+ 'CapitalDifferentialD;': '\u2145',
500
+ 'caps;': '\u2229\ufe00',
501
+ 'caret;': '\u2041',
502
+ 'caron;': '\u02c7',
503
+ 'Cayleys;': '\u212d',
504
+ 'ccaps;': '\u2a4d',
505
+ 'Ccaron;': '\u010c',
506
+ 'ccaron;': '\u010d',
507
+ 'Ccedil': '\xc7',
508
+ 'ccedil': '\xe7',
509
+ 'Ccedil;': '\xc7',
510
+ 'ccedil;': '\xe7',
511
+ 'Ccirc;': '\u0108',
512
+ 'ccirc;': '\u0109',
513
+ 'Cconint;': '\u2230',
514
+ 'ccups;': '\u2a4c',
515
+ 'ccupssm;': '\u2a50',
516
+ 'Cdot;': '\u010a',
517
+ 'cdot;': '\u010b',
518
+ 'cedil': '\xb8',
519
+ 'cedil;': '\xb8',
520
+ 'Cedilla;': '\xb8',
521
+ 'cemptyv;': '\u29b2',
522
+ 'cent': '\xa2',
523
+ 'cent;': '\xa2',
524
+ 'CenterDot;': '\xb7',
525
+ 'centerdot;': '\xb7',
526
+ 'Cfr;': '\u212d',
527
+ 'cfr;': '\U0001d520',
528
+ 'CHcy;': '\u0427',
529
+ 'chcy;': '\u0447',
530
+ 'check;': '\u2713',
531
+ 'checkmark;': '\u2713',
532
+ 'Chi;': '\u03a7',
533
+ 'chi;': '\u03c7',
534
+ 'cir;': '\u25cb',
535
+ 'circ;': '\u02c6',
536
+ 'circeq;': '\u2257',
537
+ 'circlearrowleft;': '\u21ba',
538
+ 'circlearrowright;': '\u21bb',
539
+ 'circledast;': '\u229b',
540
+ 'circledcirc;': '\u229a',
541
+ 'circleddash;': '\u229d',
542
+ 'CircleDot;': '\u2299',
543
+ 'circledR;': '\xae',
544
+ 'circledS;': '\u24c8',
545
+ 'CircleMinus;': '\u2296',
546
+ 'CirclePlus;': '\u2295',
547
+ 'CircleTimes;': '\u2297',
548
+ 'cirE;': '\u29c3',
549
+ 'cire;': '\u2257',
550
+ 'cirfnint;': '\u2a10',
551
+ 'cirmid;': '\u2aef',
552
+ 'cirscir;': '\u29c2',
553
+ 'ClockwiseContourIntegral;': '\u2232',
554
+ 'CloseCurlyDoubleQuote;': '\u201d',
555
+ 'CloseCurlyQuote;': '\u2019',
556
+ 'clubs;': '\u2663',
557
+ 'clubsuit;': '\u2663',
558
+ 'Colon;': '\u2237',
559
+ 'colon;': ':',
560
+ 'Colone;': '\u2a74',
561
+ 'colone;': '\u2254',
562
+ 'coloneq;': '\u2254',
563
+ 'comma;': ',',
564
+ 'commat;': '@',
565
+ 'comp;': '\u2201',
566
+ 'compfn;': '\u2218',
567
+ 'complement;': '\u2201',
568
+ 'complexes;': '\u2102',
569
+ 'cong;': '\u2245',
570
+ 'congdot;': '\u2a6d',
571
+ 'Congruent;': '\u2261',
572
+ 'Conint;': '\u222f',
573
+ 'conint;': '\u222e',
574
+ 'ContourIntegral;': '\u222e',
575
+ 'Copf;': '\u2102',
576
+ 'copf;': '\U0001d554',
577
+ 'coprod;': '\u2210',
578
+ 'Coproduct;': '\u2210',
579
+ 'COPY': '\xa9',
580
+ 'copy': '\xa9',
581
+ 'COPY;': '\xa9',
582
+ 'copy;': '\xa9',
583
+ 'copysr;': '\u2117',
584
+ 'CounterClockwiseContourIntegral;': '\u2233',
585
+ 'crarr;': '\u21b5',
586
+ 'Cross;': '\u2a2f',
587
+ 'cross;': '\u2717',
588
+ 'Cscr;': '\U0001d49e',
589
+ 'cscr;': '\U0001d4b8',
590
+ 'csub;': '\u2acf',
591
+ 'csube;': '\u2ad1',
592
+ 'csup;': '\u2ad0',
593
+ 'csupe;': '\u2ad2',
594
+ 'ctdot;': '\u22ef',
595
+ 'cudarrl;': '\u2938',
596
+ 'cudarrr;': '\u2935',
597
+ 'cuepr;': '\u22de',
598
+ 'cuesc;': '\u22df',
599
+ 'cularr;': '\u21b6',
600
+ 'cularrp;': '\u293d',
601
+ 'Cup;': '\u22d3',
602
+ 'cup;': '\u222a',
603
+ 'cupbrcap;': '\u2a48',
604
+ 'CupCap;': '\u224d',
605
+ 'cupcap;': '\u2a46',
606
+ 'cupcup;': '\u2a4a',
607
+ 'cupdot;': '\u228d',
608
+ 'cupor;': '\u2a45',
609
+ 'cups;': '\u222a\ufe00',
610
+ 'curarr;': '\u21b7',
611
+ 'curarrm;': '\u293c',
612
+ 'curlyeqprec;': '\u22de',
613
+ 'curlyeqsucc;': '\u22df',
614
+ 'curlyvee;': '\u22ce',
615
+ 'curlywedge;': '\u22cf',
616
+ 'curren': '\xa4',
617
+ 'curren;': '\xa4',
618
+ 'curvearrowleft;': '\u21b6',
619
+ 'curvearrowright;': '\u21b7',
620
+ 'cuvee;': '\u22ce',
621
+ 'cuwed;': '\u22cf',
622
+ 'cwconint;': '\u2232',
623
+ 'cwint;': '\u2231',
624
+ 'cylcty;': '\u232d',
625
+ 'Dagger;': '\u2021',
626
+ 'dagger;': '\u2020',
627
+ 'daleth;': '\u2138',
628
+ 'Darr;': '\u21a1',
629
+ 'dArr;': '\u21d3',
630
+ 'darr;': '\u2193',
631
+ 'dash;': '\u2010',
632
+ 'Dashv;': '\u2ae4',
633
+ 'dashv;': '\u22a3',
634
+ 'dbkarow;': '\u290f',
635
+ 'dblac;': '\u02dd',
636
+ 'Dcaron;': '\u010e',
637
+ 'dcaron;': '\u010f',
638
+ 'Dcy;': '\u0414',
639
+ 'dcy;': '\u0434',
640
+ 'DD;': '\u2145',
641
+ 'dd;': '\u2146',
642
+ 'ddagger;': '\u2021',
643
+ 'ddarr;': '\u21ca',
644
+ 'DDotrahd;': '\u2911',
645
+ 'ddotseq;': '\u2a77',
646
+ 'deg': '\xb0',
647
+ 'deg;': '\xb0',
648
+ 'Del;': '\u2207',
649
+ 'Delta;': '\u0394',
650
+ 'delta;': '\u03b4',
651
+ 'demptyv;': '\u29b1',
652
+ 'dfisht;': '\u297f',
653
+ 'Dfr;': '\U0001d507',
654
+ 'dfr;': '\U0001d521',
655
+ 'dHar;': '\u2965',
656
+ 'dharl;': '\u21c3',
657
+ 'dharr;': '\u21c2',
658
+ 'DiacriticalAcute;': '\xb4',
659
+ 'DiacriticalDot;': '\u02d9',
660
+ 'DiacriticalDoubleAcute;': '\u02dd',
661
+ 'DiacriticalGrave;': '`',
662
+ 'DiacriticalTilde;': '\u02dc',
663
+ 'diam;': '\u22c4',
664
+ 'Diamond;': '\u22c4',
665
+ 'diamond;': '\u22c4',
666
+ 'diamondsuit;': '\u2666',
667
+ 'diams;': '\u2666',
668
+ 'die;': '\xa8',
669
+ 'DifferentialD;': '\u2146',
670
+ 'digamma;': '\u03dd',
671
+ 'disin;': '\u22f2',
672
+ 'div;': '\xf7',
673
+ 'divide': '\xf7',
674
+ 'divide;': '\xf7',
675
+ 'divideontimes;': '\u22c7',
676
+ 'divonx;': '\u22c7',
677
+ 'DJcy;': '\u0402',
678
+ 'djcy;': '\u0452',
679
+ 'dlcorn;': '\u231e',
680
+ 'dlcrop;': '\u230d',
681
+ 'dollar;': '$',
682
+ 'Dopf;': '\U0001d53b',
683
+ 'dopf;': '\U0001d555',
684
+ 'Dot;': '\xa8',
685
+ 'dot;': '\u02d9',
686
+ 'DotDot;': '\u20dc',
687
+ 'doteq;': '\u2250',
688
+ 'doteqdot;': '\u2251',
689
+ 'DotEqual;': '\u2250',
690
+ 'dotminus;': '\u2238',
691
+ 'dotplus;': '\u2214',
692
+ 'dotsquare;': '\u22a1',
693
+ 'doublebarwedge;': '\u2306',
694
+ 'DoubleContourIntegral;': '\u222f',
695
+ 'DoubleDot;': '\xa8',
696
+ 'DoubleDownArrow;': '\u21d3',
697
+ 'DoubleLeftArrow;': '\u21d0',
698
+ 'DoubleLeftRightArrow;': '\u21d4',
699
+ 'DoubleLeftTee;': '\u2ae4',
700
+ 'DoubleLongLeftArrow;': '\u27f8',
701
+ 'DoubleLongLeftRightArrow;': '\u27fa',
702
+ 'DoubleLongRightArrow;': '\u27f9',
703
+ 'DoubleRightArrow;': '\u21d2',
704
+ 'DoubleRightTee;': '\u22a8',
705
+ 'DoubleUpArrow;': '\u21d1',
706
+ 'DoubleUpDownArrow;': '\u21d5',
707
+ 'DoubleVerticalBar;': '\u2225',
708
+ 'DownArrow;': '\u2193',
709
+ 'Downarrow;': '\u21d3',
710
+ 'downarrow;': '\u2193',
711
+ 'DownArrowBar;': '\u2913',
712
+ 'DownArrowUpArrow;': '\u21f5',
713
+ 'DownBreve;': '\u0311',
714
+ 'downdownarrows;': '\u21ca',
715
+ 'downharpoonleft;': '\u21c3',
716
+ 'downharpoonright;': '\u21c2',
717
+ 'DownLeftRightVector;': '\u2950',
718
+ 'DownLeftTeeVector;': '\u295e',
719
+ 'DownLeftVector;': '\u21bd',
720
+ 'DownLeftVectorBar;': '\u2956',
721
+ 'DownRightTeeVector;': '\u295f',
722
+ 'DownRightVector;': '\u21c1',
723
+ 'DownRightVectorBar;': '\u2957',
724
+ 'DownTee;': '\u22a4',
725
+ 'DownTeeArrow;': '\u21a7',
726
+ 'drbkarow;': '\u2910',
727
+ 'drcorn;': '\u231f',
728
+ 'drcrop;': '\u230c',
729
+ 'Dscr;': '\U0001d49f',
730
+ 'dscr;': '\U0001d4b9',
731
+ 'DScy;': '\u0405',
732
+ 'dscy;': '\u0455',
733
+ 'dsol;': '\u29f6',
734
+ 'Dstrok;': '\u0110',
735
+ 'dstrok;': '\u0111',
736
+ 'dtdot;': '\u22f1',
737
+ 'dtri;': '\u25bf',
738
+ 'dtrif;': '\u25be',
739
+ 'duarr;': '\u21f5',
740
+ 'duhar;': '\u296f',
741
+ 'dwangle;': '\u29a6',
742
+ 'DZcy;': '\u040f',
743
+ 'dzcy;': '\u045f',
744
+ 'dzigrarr;': '\u27ff',
745
+ 'Eacute': '\xc9',
746
+ 'eacute': '\xe9',
747
+ 'Eacute;': '\xc9',
748
+ 'eacute;': '\xe9',
749
+ 'easter;': '\u2a6e',
750
+ 'Ecaron;': '\u011a',
751
+ 'ecaron;': '\u011b',
752
+ 'ecir;': '\u2256',
753
+ 'Ecirc': '\xca',
754
+ 'ecirc': '\xea',
755
+ 'Ecirc;': '\xca',
756
+ 'ecirc;': '\xea',
757
+ 'ecolon;': '\u2255',
758
+ 'Ecy;': '\u042d',
759
+ 'ecy;': '\u044d',
760
+ 'eDDot;': '\u2a77',
761
+ 'Edot;': '\u0116',
762
+ 'eDot;': '\u2251',
763
+ 'edot;': '\u0117',
764
+ 'ee;': '\u2147',
765
+ 'efDot;': '\u2252',
766
+ 'Efr;': '\U0001d508',
767
+ 'efr;': '\U0001d522',
768
+ 'eg;': '\u2a9a',
769
+ 'Egrave': '\xc8',
770
+ 'egrave': '\xe8',
771
+ 'Egrave;': '\xc8',
772
+ 'egrave;': '\xe8',
773
+ 'egs;': '\u2a96',
774
+ 'egsdot;': '\u2a98',
775
+ 'el;': '\u2a99',
776
+ 'Element;': '\u2208',
777
+ 'elinters;': '\u23e7',
778
+ 'ell;': '\u2113',
779
+ 'els;': '\u2a95',
780
+ 'elsdot;': '\u2a97',
781
+ 'Emacr;': '\u0112',
782
+ 'emacr;': '\u0113',
783
+ 'empty;': '\u2205',
784
+ 'emptyset;': '\u2205',
785
+ 'EmptySmallSquare;': '\u25fb',
786
+ 'emptyv;': '\u2205',
787
+ 'EmptyVerySmallSquare;': '\u25ab',
788
+ 'emsp13;': '\u2004',
789
+ 'emsp14;': '\u2005',
790
+ 'emsp;': '\u2003',
791
+ 'ENG;': '\u014a',
792
+ 'eng;': '\u014b',
793
+ 'ensp;': '\u2002',
794
+ 'Eogon;': '\u0118',
795
+ 'eogon;': '\u0119',
796
+ 'Eopf;': '\U0001d53c',
797
+ 'eopf;': '\U0001d556',
798
+ 'epar;': '\u22d5',
799
+ 'eparsl;': '\u29e3',
800
+ 'eplus;': '\u2a71',
801
+ 'epsi;': '\u03b5',
802
+ 'Epsilon;': '\u0395',
803
+ 'epsilon;': '\u03b5',
804
+ 'epsiv;': '\u03f5',
805
+ 'eqcirc;': '\u2256',
806
+ 'eqcolon;': '\u2255',
807
+ 'eqsim;': '\u2242',
808
+ 'eqslantgtr;': '\u2a96',
809
+ 'eqslantless;': '\u2a95',
810
+ 'Equal;': '\u2a75',
811
+ 'equals;': '=',
812
+ 'EqualTilde;': '\u2242',
813
+ 'equest;': '\u225f',
814
+ 'Equilibrium;': '\u21cc',
815
+ 'equiv;': '\u2261',
816
+ 'equivDD;': '\u2a78',
817
+ 'eqvparsl;': '\u29e5',
818
+ 'erarr;': '\u2971',
819
+ 'erDot;': '\u2253',
820
+ 'Escr;': '\u2130',
821
+ 'escr;': '\u212f',
822
+ 'esdot;': '\u2250',
823
+ 'Esim;': '\u2a73',
824
+ 'esim;': '\u2242',
825
+ 'Eta;': '\u0397',
826
+ 'eta;': '\u03b7',
827
+ 'ETH': '\xd0',
828
+ 'eth': '\xf0',
829
+ 'ETH;': '\xd0',
830
+ 'eth;': '\xf0',
831
+ 'Euml': '\xcb',
832
+ 'euml': '\xeb',
833
+ 'Euml;': '\xcb',
834
+ 'euml;': '\xeb',
835
+ 'euro;': '\u20ac',
836
+ 'excl;': '!',
837
+ 'exist;': '\u2203',
838
+ 'Exists;': '\u2203',
839
+ 'expectation;': '\u2130',
840
+ 'ExponentialE;': '\u2147',
841
+ 'exponentiale;': '\u2147',
842
+ 'fallingdotseq;': '\u2252',
843
+ 'Fcy;': '\u0424',
844
+ 'fcy;': '\u0444',
845
+ 'female;': '\u2640',
846
+ 'ffilig;': '\ufb03',
847
+ 'fflig;': '\ufb00',
848
+ 'ffllig;': '\ufb04',
849
+ 'Ffr;': '\U0001d509',
850
+ 'ffr;': '\U0001d523',
851
+ 'filig;': '\ufb01',
852
+ 'FilledSmallSquare;': '\u25fc',
853
+ 'FilledVerySmallSquare;': '\u25aa',
854
+ 'fjlig;': 'fj',
855
+ 'flat;': '\u266d',
856
+ 'fllig;': '\ufb02',
857
+ 'fltns;': '\u25b1',
858
+ 'fnof;': '\u0192',
859
+ 'Fopf;': '\U0001d53d',
860
+ 'fopf;': '\U0001d557',
861
+ 'ForAll;': '\u2200',
862
+ 'forall;': '\u2200',
863
+ 'fork;': '\u22d4',
864
+ 'forkv;': '\u2ad9',
865
+ 'Fouriertrf;': '\u2131',
866
+ 'fpartint;': '\u2a0d',
867
+ 'frac12': '\xbd',
868
+ 'frac12;': '\xbd',
869
+ 'frac13;': '\u2153',
870
+ 'frac14': '\xbc',
871
+ 'frac14;': '\xbc',
872
+ 'frac15;': '\u2155',
873
+ 'frac16;': '\u2159',
874
+ 'frac18;': '\u215b',
875
+ 'frac23;': '\u2154',
876
+ 'frac25;': '\u2156',
877
+ 'frac34': '\xbe',
878
+ 'frac34;': '\xbe',
879
+ 'frac35;': '\u2157',
880
+ 'frac38;': '\u215c',
881
+ 'frac45;': '\u2158',
882
+ 'frac56;': '\u215a',
883
+ 'frac58;': '\u215d',
884
+ 'frac78;': '\u215e',
885
+ 'frasl;': '\u2044',
886
+ 'frown;': '\u2322',
887
+ 'Fscr;': '\u2131',
888
+ 'fscr;': '\U0001d4bb',
889
+ 'gacute;': '\u01f5',
890
+ 'Gamma;': '\u0393',
891
+ 'gamma;': '\u03b3',
892
+ 'Gammad;': '\u03dc',
893
+ 'gammad;': '\u03dd',
894
+ 'gap;': '\u2a86',
895
+ 'Gbreve;': '\u011e',
896
+ 'gbreve;': '\u011f',
897
+ 'Gcedil;': '\u0122',
898
+ 'Gcirc;': '\u011c',
899
+ 'gcirc;': '\u011d',
900
+ 'Gcy;': '\u0413',
901
+ 'gcy;': '\u0433',
902
+ 'Gdot;': '\u0120',
903
+ 'gdot;': '\u0121',
904
+ 'gE;': '\u2267',
905
+ 'ge;': '\u2265',
906
+ 'gEl;': '\u2a8c',
907
+ 'gel;': '\u22db',
908
+ 'geq;': '\u2265',
909
+ 'geqq;': '\u2267',
910
+ 'geqslant;': '\u2a7e',
911
+ 'ges;': '\u2a7e',
912
+ 'gescc;': '\u2aa9',
913
+ 'gesdot;': '\u2a80',
914
+ 'gesdoto;': '\u2a82',
915
+ 'gesdotol;': '\u2a84',
916
+ 'gesl;': '\u22db\ufe00',
917
+ 'gesles;': '\u2a94',
918
+ 'Gfr;': '\U0001d50a',
919
+ 'gfr;': '\U0001d524',
920
+ 'Gg;': '\u22d9',
921
+ 'gg;': '\u226b',
922
+ 'ggg;': '\u22d9',
923
+ 'gimel;': '\u2137',
924
+ 'GJcy;': '\u0403',
925
+ 'gjcy;': '\u0453',
926
+ 'gl;': '\u2277',
927
+ 'gla;': '\u2aa5',
928
+ 'glE;': '\u2a92',
929
+ 'glj;': '\u2aa4',
930
+ 'gnap;': '\u2a8a',
931
+ 'gnapprox;': '\u2a8a',
932
+ 'gnE;': '\u2269',
933
+ 'gne;': '\u2a88',
934
+ 'gneq;': '\u2a88',
935
+ 'gneqq;': '\u2269',
936
+ 'gnsim;': '\u22e7',
937
+ 'Gopf;': '\U0001d53e',
938
+ 'gopf;': '\U0001d558',
939
+ 'grave;': '`',
940
+ 'GreaterEqual;': '\u2265',
941
+ 'GreaterEqualLess;': '\u22db',
942
+ 'GreaterFullEqual;': '\u2267',
943
+ 'GreaterGreater;': '\u2aa2',
944
+ 'GreaterLess;': '\u2277',
945
+ 'GreaterSlantEqual;': '\u2a7e',
946
+ 'GreaterTilde;': '\u2273',
947
+ 'Gscr;': '\U0001d4a2',
948
+ 'gscr;': '\u210a',
949
+ 'gsim;': '\u2273',
950
+ 'gsime;': '\u2a8e',
951
+ 'gsiml;': '\u2a90',
952
+ 'GT': '>',
953
+ 'gt': '>',
954
+ 'GT;': '>',
955
+ 'Gt;': '\u226b',
956
+ 'gt;': '>',
957
+ 'gtcc;': '\u2aa7',
958
+ 'gtcir;': '\u2a7a',
959
+ 'gtdot;': '\u22d7',
960
+ 'gtlPar;': '\u2995',
961
+ 'gtquest;': '\u2a7c',
962
+ 'gtrapprox;': '\u2a86',
963
+ 'gtrarr;': '\u2978',
964
+ 'gtrdot;': '\u22d7',
965
+ 'gtreqless;': '\u22db',
966
+ 'gtreqqless;': '\u2a8c',
967
+ 'gtrless;': '\u2277',
968
+ 'gtrsim;': '\u2273',
969
+ 'gvertneqq;': '\u2269\ufe00',
970
+ 'gvnE;': '\u2269\ufe00',
971
+ 'Hacek;': '\u02c7',
972
+ 'hairsp;': '\u200a',
973
+ 'half;': '\xbd',
974
+ 'hamilt;': '\u210b',
975
+ 'HARDcy;': '\u042a',
976
+ 'hardcy;': '\u044a',
977
+ 'hArr;': '\u21d4',
978
+ 'harr;': '\u2194',
979
+ 'harrcir;': '\u2948',
980
+ 'harrw;': '\u21ad',
981
+ 'Hat;': '^',
982
+ 'hbar;': '\u210f',
983
+ 'Hcirc;': '\u0124',
984
+ 'hcirc;': '\u0125',
985
+ 'hearts;': '\u2665',
986
+ 'heartsuit;': '\u2665',
987
+ 'hellip;': '\u2026',
988
+ 'hercon;': '\u22b9',
989
+ 'Hfr;': '\u210c',
990
+ 'hfr;': '\U0001d525',
991
+ 'HilbertSpace;': '\u210b',
992
+ 'hksearow;': '\u2925',
993
+ 'hkswarow;': '\u2926',
994
+ 'hoarr;': '\u21ff',
995
+ 'homtht;': '\u223b',
996
+ 'hookleftarrow;': '\u21a9',
997
+ 'hookrightarrow;': '\u21aa',
998
+ 'Hopf;': '\u210d',
999
+ 'hopf;': '\U0001d559',
1000
+ 'horbar;': '\u2015',
1001
+ 'HorizontalLine;': '\u2500',
1002
+ 'Hscr;': '\u210b',
1003
+ 'hscr;': '\U0001d4bd',
1004
+ 'hslash;': '\u210f',
1005
+ 'Hstrok;': '\u0126',
1006
+ 'hstrok;': '\u0127',
1007
+ 'HumpDownHump;': '\u224e',
1008
+ 'HumpEqual;': '\u224f',
1009
+ 'hybull;': '\u2043',
1010
+ 'hyphen;': '\u2010',
1011
+ 'Iacute': '\xcd',
1012
+ 'iacute': '\xed',
1013
+ 'Iacute;': '\xcd',
1014
+ 'iacute;': '\xed',
1015
+ 'ic;': '\u2063',
1016
+ 'Icirc': '\xce',
1017
+ 'icirc': '\xee',
1018
+ 'Icirc;': '\xce',
1019
+ 'icirc;': '\xee',
1020
+ 'Icy;': '\u0418',
1021
+ 'icy;': '\u0438',
1022
+ 'Idot;': '\u0130',
1023
+ 'IEcy;': '\u0415',
1024
+ 'iecy;': '\u0435',
1025
+ 'iexcl': '\xa1',
1026
+ 'iexcl;': '\xa1',
1027
+ 'iff;': '\u21d4',
1028
+ 'Ifr;': '\u2111',
1029
+ 'ifr;': '\U0001d526',
1030
+ 'Igrave': '\xcc',
1031
+ 'igrave': '\xec',
1032
+ 'Igrave;': '\xcc',
1033
+ 'igrave;': '\xec',
1034
+ 'ii;': '\u2148',
1035
+ 'iiiint;': '\u2a0c',
1036
+ 'iiint;': '\u222d',
1037
+ 'iinfin;': '\u29dc',
1038
+ 'iiota;': '\u2129',
1039
+ 'IJlig;': '\u0132',
1040
+ 'ijlig;': '\u0133',
1041
+ 'Im;': '\u2111',
1042
+ 'Imacr;': '\u012a',
1043
+ 'imacr;': '\u012b',
1044
+ 'image;': '\u2111',
1045
+ 'ImaginaryI;': '\u2148',
1046
+ 'imagline;': '\u2110',
1047
+ 'imagpart;': '\u2111',
1048
+ 'imath;': '\u0131',
1049
+ 'imof;': '\u22b7',
1050
+ 'imped;': '\u01b5',
1051
+ 'Implies;': '\u21d2',
1052
+ 'in;': '\u2208',
1053
+ 'incare;': '\u2105',
1054
+ 'infin;': '\u221e',
1055
+ 'infintie;': '\u29dd',
1056
+ 'inodot;': '\u0131',
1057
+ 'Int;': '\u222c',
1058
+ 'int;': '\u222b',
1059
+ 'intcal;': '\u22ba',
1060
+ 'integers;': '\u2124',
1061
+ 'Integral;': '\u222b',
1062
+ 'intercal;': '\u22ba',
1063
+ 'Intersection;': '\u22c2',
1064
+ 'intlarhk;': '\u2a17',
1065
+ 'intprod;': '\u2a3c',
1066
+ 'InvisibleComma;': '\u2063',
1067
+ 'InvisibleTimes;': '\u2062',
1068
+ 'IOcy;': '\u0401',
1069
+ 'iocy;': '\u0451',
1070
+ 'Iogon;': '\u012e',
1071
+ 'iogon;': '\u012f',
1072
+ 'Iopf;': '\U0001d540',
1073
+ 'iopf;': '\U0001d55a',
1074
+ 'Iota;': '\u0399',
1075
+ 'iota;': '\u03b9',
1076
+ 'iprod;': '\u2a3c',
1077
+ 'iquest': '\xbf',
1078
+ 'iquest;': '\xbf',
1079
+ 'Iscr;': '\u2110',
1080
+ 'iscr;': '\U0001d4be',
1081
+ 'isin;': '\u2208',
1082
+ 'isindot;': '\u22f5',
1083
+ 'isinE;': '\u22f9',
1084
+ 'isins;': '\u22f4',
1085
+ 'isinsv;': '\u22f3',
1086
+ 'isinv;': '\u2208',
1087
+ 'it;': '\u2062',
1088
+ 'Itilde;': '\u0128',
1089
+ 'itilde;': '\u0129',
1090
+ 'Iukcy;': '\u0406',
1091
+ 'iukcy;': '\u0456',
1092
+ 'Iuml': '\xcf',
1093
+ 'iuml': '\xef',
1094
+ 'Iuml;': '\xcf',
1095
+ 'iuml;': '\xef',
1096
+ 'Jcirc;': '\u0134',
1097
+ 'jcirc;': '\u0135',
1098
+ 'Jcy;': '\u0419',
1099
+ 'jcy;': '\u0439',
1100
+ 'Jfr;': '\U0001d50d',
1101
+ 'jfr;': '\U0001d527',
1102
+ 'jmath;': '\u0237',
1103
+ 'Jopf;': '\U0001d541',
1104
+ 'jopf;': '\U0001d55b',
1105
+ 'Jscr;': '\U0001d4a5',
1106
+ 'jscr;': '\U0001d4bf',
1107
+ 'Jsercy;': '\u0408',
1108
+ 'jsercy;': '\u0458',
1109
+ 'Jukcy;': '\u0404',
1110
+ 'jukcy;': '\u0454',
1111
+ 'Kappa;': '\u039a',
1112
+ 'kappa;': '\u03ba',
1113
+ 'kappav;': '\u03f0',
1114
+ 'Kcedil;': '\u0136',
1115
+ 'kcedil;': '\u0137',
1116
+ 'Kcy;': '\u041a',
1117
+ 'kcy;': '\u043a',
1118
+ 'Kfr;': '\U0001d50e',
1119
+ 'kfr;': '\U0001d528',
1120
+ 'kgreen;': '\u0138',
1121
+ 'KHcy;': '\u0425',
1122
+ 'khcy;': '\u0445',
1123
+ 'KJcy;': '\u040c',
1124
+ 'kjcy;': '\u045c',
1125
+ 'Kopf;': '\U0001d542',
1126
+ 'kopf;': '\U0001d55c',
1127
+ 'Kscr;': '\U0001d4a6',
1128
+ 'kscr;': '\U0001d4c0',
1129
+ 'lAarr;': '\u21da',
1130
+ 'Lacute;': '\u0139',
1131
+ 'lacute;': '\u013a',
1132
+ 'laemptyv;': '\u29b4',
1133
+ 'lagran;': '\u2112',
1134
+ 'Lambda;': '\u039b',
1135
+ 'lambda;': '\u03bb',
1136
+ 'Lang;': '\u27ea',
1137
+ 'lang;': '\u27e8',
1138
+ 'langd;': '\u2991',
1139
+ 'langle;': '\u27e8',
1140
+ 'lap;': '\u2a85',
1141
+ 'Laplacetrf;': '\u2112',
1142
+ 'laquo': '\xab',
1143
+ 'laquo;': '\xab',
1144
+ 'Larr;': '\u219e',
1145
+ 'lArr;': '\u21d0',
1146
+ 'larr;': '\u2190',
1147
+ 'larrb;': '\u21e4',
1148
+ 'larrbfs;': '\u291f',
1149
+ 'larrfs;': '\u291d',
1150
+ 'larrhk;': '\u21a9',
1151
+ 'larrlp;': '\u21ab',
1152
+ 'larrpl;': '\u2939',
1153
+ 'larrsim;': '\u2973',
1154
+ 'larrtl;': '\u21a2',
1155
+ 'lat;': '\u2aab',
1156
+ 'lAtail;': '\u291b',
1157
+ 'latail;': '\u2919',
1158
+ 'late;': '\u2aad',
1159
+ 'lates;': '\u2aad\ufe00',
1160
+ 'lBarr;': '\u290e',
1161
+ 'lbarr;': '\u290c',
1162
+ 'lbbrk;': '\u2772',
1163
+ 'lbrace;': '{',
1164
+ 'lbrack;': '[',
1165
+ 'lbrke;': '\u298b',
1166
+ 'lbrksld;': '\u298f',
1167
+ 'lbrkslu;': '\u298d',
1168
+ 'Lcaron;': '\u013d',
1169
+ 'lcaron;': '\u013e',
1170
+ 'Lcedil;': '\u013b',
1171
+ 'lcedil;': '\u013c',
1172
+ 'lceil;': '\u2308',
1173
+ 'lcub;': '{',
1174
+ 'Lcy;': '\u041b',
1175
+ 'lcy;': '\u043b',
1176
+ 'ldca;': '\u2936',
1177
+ 'ldquo;': '\u201c',
1178
+ 'ldquor;': '\u201e',
1179
+ 'ldrdhar;': '\u2967',
1180
+ 'ldrushar;': '\u294b',
1181
+ 'ldsh;': '\u21b2',
1182
+ 'lE;': '\u2266',
1183
+ 'le;': '\u2264',
1184
+ 'LeftAngleBracket;': '\u27e8',
1185
+ 'LeftArrow;': '\u2190',
1186
+ 'Leftarrow;': '\u21d0',
1187
+ 'leftarrow;': '\u2190',
1188
+ 'LeftArrowBar;': '\u21e4',
1189
+ 'LeftArrowRightArrow;': '\u21c6',
1190
+ 'leftarrowtail;': '\u21a2',
1191
+ 'LeftCeiling;': '\u2308',
1192
+ 'LeftDoubleBracket;': '\u27e6',
1193
+ 'LeftDownTeeVector;': '\u2961',
1194
+ 'LeftDownVector;': '\u21c3',
1195
+ 'LeftDownVectorBar;': '\u2959',
1196
+ 'LeftFloor;': '\u230a',
1197
+ 'leftharpoondown;': '\u21bd',
1198
+ 'leftharpoonup;': '\u21bc',
1199
+ 'leftleftarrows;': '\u21c7',
1200
+ 'LeftRightArrow;': '\u2194',
1201
+ 'Leftrightarrow;': '\u21d4',
1202
+ 'leftrightarrow;': '\u2194',
1203
+ 'leftrightarrows;': '\u21c6',
1204
+ 'leftrightharpoons;': '\u21cb',
1205
+ 'leftrightsquigarrow;': '\u21ad',
1206
+ 'LeftRightVector;': '\u294e',
1207
+ 'LeftTee;': '\u22a3',
1208
+ 'LeftTeeArrow;': '\u21a4',
1209
+ 'LeftTeeVector;': '\u295a',
1210
+ 'leftthreetimes;': '\u22cb',
1211
+ 'LeftTriangle;': '\u22b2',
1212
+ 'LeftTriangleBar;': '\u29cf',
1213
+ 'LeftTriangleEqual;': '\u22b4',
1214
+ 'LeftUpDownVector;': '\u2951',
1215
+ 'LeftUpTeeVector;': '\u2960',
1216
+ 'LeftUpVector;': '\u21bf',
1217
+ 'LeftUpVectorBar;': '\u2958',
1218
+ 'LeftVector;': '\u21bc',
1219
+ 'LeftVectorBar;': '\u2952',
1220
+ 'lEg;': '\u2a8b',
1221
+ 'leg;': '\u22da',
1222
+ 'leq;': '\u2264',
1223
+ 'leqq;': '\u2266',
1224
+ 'leqslant;': '\u2a7d',
1225
+ 'les;': '\u2a7d',
1226
+ 'lescc;': '\u2aa8',
1227
+ 'lesdot;': '\u2a7f',
1228
+ 'lesdoto;': '\u2a81',
1229
+ 'lesdotor;': '\u2a83',
1230
+ 'lesg;': '\u22da\ufe00',
1231
+ 'lesges;': '\u2a93',
1232
+ 'lessapprox;': '\u2a85',
1233
+ 'lessdot;': '\u22d6',
1234
+ 'lesseqgtr;': '\u22da',
1235
+ 'lesseqqgtr;': '\u2a8b',
1236
+ 'LessEqualGreater;': '\u22da',
1237
+ 'LessFullEqual;': '\u2266',
1238
+ 'LessGreater;': '\u2276',
1239
+ 'lessgtr;': '\u2276',
1240
+ 'LessLess;': '\u2aa1',
1241
+ 'lesssim;': '\u2272',
1242
+ 'LessSlantEqual;': '\u2a7d',
1243
+ 'LessTilde;': '\u2272',
1244
+ 'lfisht;': '\u297c',
1245
+ 'lfloor;': '\u230a',
1246
+ 'Lfr;': '\U0001d50f',
1247
+ 'lfr;': '\U0001d529',
1248
+ 'lg;': '\u2276',
1249
+ 'lgE;': '\u2a91',
1250
+ 'lHar;': '\u2962',
1251
+ 'lhard;': '\u21bd',
1252
+ 'lharu;': '\u21bc',
1253
+ 'lharul;': '\u296a',
1254
+ 'lhblk;': '\u2584',
1255
+ 'LJcy;': '\u0409',
1256
+ 'ljcy;': '\u0459',
1257
+ 'Ll;': '\u22d8',
1258
+ 'll;': '\u226a',
1259
+ 'llarr;': '\u21c7',
1260
+ 'llcorner;': '\u231e',
1261
+ 'Lleftarrow;': '\u21da',
1262
+ 'llhard;': '\u296b',
1263
+ 'lltri;': '\u25fa',
1264
+ 'Lmidot;': '\u013f',
1265
+ 'lmidot;': '\u0140',
1266
+ 'lmoust;': '\u23b0',
1267
+ 'lmoustache;': '\u23b0',
1268
+ 'lnap;': '\u2a89',
1269
+ 'lnapprox;': '\u2a89',
1270
+ 'lnE;': '\u2268',
1271
+ 'lne;': '\u2a87',
1272
+ 'lneq;': '\u2a87',
1273
+ 'lneqq;': '\u2268',
1274
+ 'lnsim;': '\u22e6',
1275
+ 'loang;': '\u27ec',
1276
+ 'loarr;': '\u21fd',
1277
+ 'lobrk;': '\u27e6',
1278
+ 'LongLeftArrow;': '\u27f5',
1279
+ 'Longleftarrow;': '\u27f8',
1280
+ 'longleftarrow;': '\u27f5',
1281
+ 'LongLeftRightArrow;': '\u27f7',
1282
+ 'Longleftrightarrow;': '\u27fa',
1283
+ 'longleftrightarrow;': '\u27f7',
1284
+ 'longmapsto;': '\u27fc',
1285
+ 'LongRightArrow;': '\u27f6',
1286
+ 'Longrightarrow;': '\u27f9',
1287
+ 'longrightarrow;': '\u27f6',
1288
+ 'looparrowleft;': '\u21ab',
1289
+ 'looparrowright;': '\u21ac',
1290
+ 'lopar;': '\u2985',
1291
+ 'Lopf;': '\U0001d543',
1292
+ 'lopf;': '\U0001d55d',
1293
+ 'loplus;': '\u2a2d',
1294
+ 'lotimes;': '\u2a34',
1295
+ 'lowast;': '\u2217',
1296
+ 'lowbar;': '_',
1297
+ 'LowerLeftArrow;': '\u2199',
1298
+ 'LowerRightArrow;': '\u2198',
1299
+ 'loz;': '\u25ca',
1300
+ 'lozenge;': '\u25ca',
1301
+ 'lozf;': '\u29eb',
1302
+ 'lpar;': '(',
1303
+ 'lparlt;': '\u2993',
1304
+ 'lrarr;': '\u21c6',
1305
+ 'lrcorner;': '\u231f',
1306
+ 'lrhar;': '\u21cb',
1307
+ 'lrhard;': '\u296d',
1308
+ 'lrm;': '\u200e',
1309
+ 'lrtri;': '\u22bf',
1310
+ 'lsaquo;': '\u2039',
1311
+ 'Lscr;': '\u2112',
1312
+ 'lscr;': '\U0001d4c1',
1313
+ 'Lsh;': '\u21b0',
1314
+ 'lsh;': '\u21b0',
1315
+ 'lsim;': '\u2272',
1316
+ 'lsime;': '\u2a8d',
1317
+ 'lsimg;': '\u2a8f',
1318
+ 'lsqb;': '[',
1319
+ 'lsquo;': '\u2018',
1320
+ 'lsquor;': '\u201a',
1321
+ 'Lstrok;': '\u0141',
1322
+ 'lstrok;': '\u0142',
1323
+ 'LT': '<',
1324
+ 'lt': '<',
1325
+ 'LT;': '<',
1326
+ 'Lt;': '\u226a',
1327
+ 'lt;': '<',
1328
+ 'ltcc;': '\u2aa6',
1329
+ 'ltcir;': '\u2a79',
1330
+ 'ltdot;': '\u22d6',
1331
+ 'lthree;': '\u22cb',
1332
+ 'ltimes;': '\u22c9',
1333
+ 'ltlarr;': '\u2976',
1334
+ 'ltquest;': '\u2a7b',
1335
+ 'ltri;': '\u25c3',
1336
+ 'ltrie;': '\u22b4',
1337
+ 'ltrif;': '\u25c2',
1338
+ 'ltrPar;': '\u2996',
1339
+ 'lurdshar;': '\u294a',
1340
+ 'luruhar;': '\u2966',
1341
+ 'lvertneqq;': '\u2268\ufe00',
1342
+ 'lvnE;': '\u2268\ufe00',
1343
+ 'macr': '\xaf',
1344
+ 'macr;': '\xaf',
1345
+ 'male;': '\u2642',
1346
+ 'malt;': '\u2720',
1347
+ 'maltese;': '\u2720',
1348
+ 'Map;': '\u2905',
1349
+ 'map;': '\u21a6',
1350
+ 'mapsto;': '\u21a6',
1351
+ 'mapstodown;': '\u21a7',
1352
+ 'mapstoleft;': '\u21a4',
1353
+ 'mapstoup;': '\u21a5',
1354
+ 'marker;': '\u25ae',
1355
+ 'mcomma;': '\u2a29',
1356
+ 'Mcy;': '\u041c',
1357
+ 'mcy;': '\u043c',
1358
+ 'mdash;': '\u2014',
1359
+ 'mDDot;': '\u223a',
1360
+ 'measuredangle;': '\u2221',
1361
+ 'MediumSpace;': '\u205f',
1362
+ 'Mellintrf;': '\u2133',
1363
+ 'Mfr;': '\U0001d510',
1364
+ 'mfr;': '\U0001d52a',
1365
+ 'mho;': '\u2127',
1366
+ 'micro': '\xb5',
1367
+ 'micro;': '\xb5',
1368
+ 'mid;': '\u2223',
1369
+ 'midast;': '*',
1370
+ 'midcir;': '\u2af0',
1371
+ 'middot': '\xb7',
1372
+ 'middot;': '\xb7',
1373
+ 'minus;': '\u2212',
1374
+ 'minusb;': '\u229f',
1375
+ 'minusd;': '\u2238',
1376
+ 'minusdu;': '\u2a2a',
1377
+ 'MinusPlus;': '\u2213',
1378
+ 'mlcp;': '\u2adb',
1379
+ 'mldr;': '\u2026',
1380
+ 'mnplus;': '\u2213',
1381
+ 'models;': '\u22a7',
1382
+ 'Mopf;': '\U0001d544',
1383
+ 'mopf;': '\U0001d55e',
1384
+ 'mp;': '\u2213',
1385
+ 'Mscr;': '\u2133',
1386
+ 'mscr;': '\U0001d4c2',
1387
+ 'mstpos;': '\u223e',
1388
+ 'Mu;': '\u039c',
1389
+ 'mu;': '\u03bc',
1390
+ 'multimap;': '\u22b8',
1391
+ 'mumap;': '\u22b8',
1392
+ 'nabla;': '\u2207',
1393
+ 'Nacute;': '\u0143',
1394
+ 'nacute;': '\u0144',
1395
+ 'nang;': '\u2220\u20d2',
1396
+ 'nap;': '\u2249',
1397
+ 'napE;': '\u2a70\u0338',
1398
+ 'napid;': '\u224b\u0338',
1399
+ 'napos;': '\u0149',
1400
+ 'napprox;': '\u2249',
1401
+ 'natur;': '\u266e',
1402
+ 'natural;': '\u266e',
1403
+ 'naturals;': '\u2115',
1404
+ 'nbsp': '\xa0',
1405
+ 'nbsp;': '\xa0',
1406
+ 'nbump;': '\u224e\u0338',
1407
+ 'nbumpe;': '\u224f\u0338',
1408
+ 'ncap;': '\u2a43',
1409
+ 'Ncaron;': '\u0147',
1410
+ 'ncaron;': '\u0148',
1411
+ 'Ncedil;': '\u0145',
1412
+ 'ncedil;': '\u0146',
1413
+ 'ncong;': '\u2247',
1414
+ 'ncongdot;': '\u2a6d\u0338',
1415
+ 'ncup;': '\u2a42',
1416
+ 'Ncy;': '\u041d',
1417
+ 'ncy;': '\u043d',
1418
+ 'ndash;': '\u2013',
1419
+ 'ne;': '\u2260',
1420
+ 'nearhk;': '\u2924',
1421
+ 'neArr;': '\u21d7',
1422
+ 'nearr;': '\u2197',
1423
+ 'nearrow;': '\u2197',
1424
+ 'nedot;': '\u2250\u0338',
1425
+ 'NegativeMediumSpace;': '\u200b',
1426
+ 'NegativeThickSpace;': '\u200b',
1427
+ 'NegativeThinSpace;': '\u200b',
1428
+ 'NegativeVeryThinSpace;': '\u200b',
1429
+ 'nequiv;': '\u2262',
1430
+ 'nesear;': '\u2928',
1431
+ 'nesim;': '\u2242\u0338',
1432
+ 'NestedGreaterGreater;': '\u226b',
1433
+ 'NestedLessLess;': '\u226a',
1434
+ 'NewLine;': '\n',
1435
+ 'nexist;': '\u2204',
1436
+ 'nexists;': '\u2204',
1437
+ 'Nfr;': '\U0001d511',
1438
+ 'nfr;': '\U0001d52b',
1439
+ 'ngE;': '\u2267\u0338',
1440
+ 'nge;': '\u2271',
1441
+ 'ngeq;': '\u2271',
1442
+ 'ngeqq;': '\u2267\u0338',
1443
+ 'ngeqslant;': '\u2a7e\u0338',
1444
+ 'nges;': '\u2a7e\u0338',
1445
+ 'nGg;': '\u22d9\u0338',
1446
+ 'ngsim;': '\u2275',
1447
+ 'nGt;': '\u226b\u20d2',
1448
+ 'ngt;': '\u226f',
1449
+ 'ngtr;': '\u226f',
1450
+ 'nGtv;': '\u226b\u0338',
1451
+ 'nhArr;': '\u21ce',
1452
+ 'nharr;': '\u21ae',
1453
+ 'nhpar;': '\u2af2',
1454
+ 'ni;': '\u220b',
1455
+ 'nis;': '\u22fc',
1456
+ 'nisd;': '\u22fa',
1457
+ 'niv;': '\u220b',
1458
+ 'NJcy;': '\u040a',
1459
+ 'njcy;': '\u045a',
1460
+ 'nlArr;': '\u21cd',
1461
+ 'nlarr;': '\u219a',
1462
+ 'nldr;': '\u2025',
1463
+ 'nlE;': '\u2266\u0338',
1464
+ 'nle;': '\u2270',
1465
+ 'nLeftarrow;': '\u21cd',
1466
+ 'nleftarrow;': '\u219a',
1467
+ 'nLeftrightarrow;': '\u21ce',
1468
+ 'nleftrightarrow;': '\u21ae',
1469
+ 'nleq;': '\u2270',
1470
+ 'nleqq;': '\u2266\u0338',
1471
+ 'nleqslant;': '\u2a7d\u0338',
1472
+ 'nles;': '\u2a7d\u0338',
1473
+ 'nless;': '\u226e',
1474
+ 'nLl;': '\u22d8\u0338',
1475
+ 'nlsim;': '\u2274',
1476
+ 'nLt;': '\u226a\u20d2',
1477
+ 'nlt;': '\u226e',
1478
+ 'nltri;': '\u22ea',
1479
+ 'nltrie;': '\u22ec',
1480
+ 'nLtv;': '\u226a\u0338',
1481
+ 'nmid;': '\u2224',
1482
+ 'NoBreak;': '\u2060',
1483
+ 'NonBreakingSpace;': '\xa0',
1484
+ 'Nopf;': '\u2115',
1485
+ 'nopf;': '\U0001d55f',
1486
+ 'not': '\xac',
1487
+ 'Not;': '\u2aec',
1488
+ 'not;': '\xac',
1489
+ 'NotCongruent;': '\u2262',
1490
+ 'NotCupCap;': '\u226d',
1491
+ 'NotDoubleVerticalBar;': '\u2226',
1492
+ 'NotElement;': '\u2209',
1493
+ 'NotEqual;': '\u2260',
1494
+ 'NotEqualTilde;': '\u2242\u0338',
1495
+ 'NotExists;': '\u2204',
1496
+ 'NotGreater;': '\u226f',
1497
+ 'NotGreaterEqual;': '\u2271',
1498
+ 'NotGreaterFullEqual;': '\u2267\u0338',
1499
+ 'NotGreaterGreater;': '\u226b\u0338',
1500
+ 'NotGreaterLess;': '\u2279',
1501
+ 'NotGreaterSlantEqual;': '\u2a7e\u0338',
1502
+ 'NotGreaterTilde;': '\u2275',
1503
+ 'NotHumpDownHump;': '\u224e\u0338',
1504
+ 'NotHumpEqual;': '\u224f\u0338',
1505
+ 'notin;': '\u2209',
1506
+ 'notindot;': '\u22f5\u0338',
1507
+ 'notinE;': '\u22f9\u0338',
1508
+ 'notinva;': '\u2209',
1509
+ 'notinvb;': '\u22f7',
1510
+ 'notinvc;': '\u22f6',
1511
+ 'NotLeftTriangle;': '\u22ea',
1512
+ 'NotLeftTriangleBar;': '\u29cf\u0338',
1513
+ 'NotLeftTriangleEqual;': '\u22ec',
1514
+ 'NotLess;': '\u226e',
1515
+ 'NotLessEqual;': '\u2270',
1516
+ 'NotLessGreater;': '\u2278',
1517
+ 'NotLessLess;': '\u226a\u0338',
1518
+ 'NotLessSlantEqual;': '\u2a7d\u0338',
1519
+ 'NotLessTilde;': '\u2274',
1520
+ 'NotNestedGreaterGreater;': '\u2aa2\u0338',
1521
+ 'NotNestedLessLess;': '\u2aa1\u0338',
1522
+ 'notni;': '\u220c',
1523
+ 'notniva;': '\u220c',
1524
+ 'notnivb;': '\u22fe',
1525
+ 'notnivc;': '\u22fd',
1526
+ 'NotPrecedes;': '\u2280',
1527
+ 'NotPrecedesEqual;': '\u2aaf\u0338',
1528
+ 'NotPrecedesSlantEqual;': '\u22e0',
1529
+ 'NotReverseElement;': '\u220c',
1530
+ 'NotRightTriangle;': '\u22eb',
1531
+ 'NotRightTriangleBar;': '\u29d0\u0338',
1532
+ 'NotRightTriangleEqual;': '\u22ed',
1533
+ 'NotSquareSubset;': '\u228f\u0338',
1534
+ 'NotSquareSubsetEqual;': '\u22e2',
1535
+ 'NotSquareSuperset;': '\u2290\u0338',
1536
+ 'NotSquareSupersetEqual;': '\u22e3',
1537
+ 'NotSubset;': '\u2282\u20d2',
1538
+ 'NotSubsetEqual;': '\u2288',
1539
+ 'NotSucceeds;': '\u2281',
1540
+ 'NotSucceedsEqual;': '\u2ab0\u0338',
1541
+ 'NotSucceedsSlantEqual;': '\u22e1',
1542
+ 'NotSucceedsTilde;': '\u227f\u0338',
1543
+ 'NotSuperset;': '\u2283\u20d2',
1544
+ 'NotSupersetEqual;': '\u2289',
1545
+ 'NotTilde;': '\u2241',
1546
+ 'NotTildeEqual;': '\u2244',
1547
+ 'NotTildeFullEqual;': '\u2247',
1548
+ 'NotTildeTilde;': '\u2249',
1549
+ 'NotVerticalBar;': '\u2224',
1550
+ 'npar;': '\u2226',
1551
+ 'nparallel;': '\u2226',
1552
+ 'nparsl;': '\u2afd\u20e5',
1553
+ 'npart;': '\u2202\u0338',
1554
+ 'npolint;': '\u2a14',
1555
+ 'npr;': '\u2280',
1556
+ 'nprcue;': '\u22e0',
1557
+ 'npre;': '\u2aaf\u0338',
1558
+ 'nprec;': '\u2280',
1559
+ 'npreceq;': '\u2aaf\u0338',
1560
+ 'nrArr;': '\u21cf',
1561
+ 'nrarr;': '\u219b',
1562
+ 'nrarrc;': '\u2933\u0338',
1563
+ 'nrarrw;': '\u219d\u0338',
1564
+ 'nRightarrow;': '\u21cf',
1565
+ 'nrightarrow;': '\u219b',
1566
+ 'nrtri;': '\u22eb',
1567
+ 'nrtrie;': '\u22ed',
1568
+ 'nsc;': '\u2281',
1569
+ 'nsccue;': '\u22e1',
1570
+ 'nsce;': '\u2ab0\u0338',
1571
+ 'Nscr;': '\U0001d4a9',
1572
+ 'nscr;': '\U0001d4c3',
1573
+ 'nshortmid;': '\u2224',
1574
+ 'nshortparallel;': '\u2226',
1575
+ 'nsim;': '\u2241',
1576
+ 'nsime;': '\u2244',
1577
+ 'nsimeq;': '\u2244',
1578
+ 'nsmid;': '\u2224',
1579
+ 'nspar;': '\u2226',
1580
+ 'nsqsube;': '\u22e2',
1581
+ 'nsqsupe;': '\u22e3',
1582
+ 'nsub;': '\u2284',
1583
+ 'nsubE;': '\u2ac5\u0338',
1584
+ 'nsube;': '\u2288',
1585
+ 'nsubset;': '\u2282\u20d2',
1586
+ 'nsubseteq;': '\u2288',
1587
+ 'nsubseteqq;': '\u2ac5\u0338',
1588
+ 'nsucc;': '\u2281',
1589
+ 'nsucceq;': '\u2ab0\u0338',
1590
+ 'nsup;': '\u2285',
1591
+ 'nsupE;': '\u2ac6\u0338',
1592
+ 'nsupe;': '\u2289',
1593
+ 'nsupset;': '\u2283\u20d2',
1594
+ 'nsupseteq;': '\u2289',
1595
+ 'nsupseteqq;': '\u2ac6\u0338',
1596
+ 'ntgl;': '\u2279',
1597
+ 'Ntilde': '\xd1',
1598
+ 'ntilde': '\xf1',
1599
+ 'Ntilde;': '\xd1',
1600
+ 'ntilde;': '\xf1',
1601
+ 'ntlg;': '\u2278',
1602
+ 'ntriangleleft;': '\u22ea',
1603
+ 'ntrianglelefteq;': '\u22ec',
1604
+ 'ntriangleright;': '\u22eb',
1605
+ 'ntrianglerighteq;': '\u22ed',
1606
+ 'Nu;': '\u039d',
1607
+ 'nu;': '\u03bd',
1608
+ 'num;': '#',
1609
+ 'numero;': '\u2116',
1610
+ 'numsp;': '\u2007',
1611
+ 'nvap;': '\u224d\u20d2',
1612
+ 'nVDash;': '\u22af',
1613
+ 'nVdash;': '\u22ae',
1614
+ 'nvDash;': '\u22ad',
1615
+ 'nvdash;': '\u22ac',
1616
+ 'nvge;': '\u2265\u20d2',
1617
+ 'nvgt;': '>\u20d2',
1618
+ 'nvHarr;': '\u2904',
1619
+ 'nvinfin;': '\u29de',
1620
+ 'nvlArr;': '\u2902',
1621
+ 'nvle;': '\u2264\u20d2',
1622
+ 'nvlt;': '<\u20d2',
1623
+ 'nvltrie;': '\u22b4\u20d2',
1624
+ 'nvrArr;': '\u2903',
1625
+ 'nvrtrie;': '\u22b5\u20d2',
1626
+ 'nvsim;': '\u223c\u20d2',
1627
+ 'nwarhk;': '\u2923',
1628
+ 'nwArr;': '\u21d6',
1629
+ 'nwarr;': '\u2196',
1630
+ 'nwarrow;': '\u2196',
1631
+ 'nwnear;': '\u2927',
1632
+ 'Oacute': '\xd3',
1633
+ 'oacute': '\xf3',
1634
+ 'Oacute;': '\xd3',
1635
+ 'oacute;': '\xf3',
1636
+ 'oast;': '\u229b',
1637
+ 'ocir;': '\u229a',
1638
+ 'Ocirc': '\xd4',
1639
+ 'ocirc': '\xf4',
1640
+ 'Ocirc;': '\xd4',
1641
+ 'ocirc;': '\xf4',
1642
+ 'Ocy;': '\u041e',
1643
+ 'ocy;': '\u043e',
1644
+ 'odash;': '\u229d',
1645
+ 'Odblac;': '\u0150',
1646
+ 'odblac;': '\u0151',
1647
+ 'odiv;': '\u2a38',
1648
+ 'odot;': '\u2299',
1649
+ 'odsold;': '\u29bc',
1650
+ 'OElig;': '\u0152',
1651
+ 'oelig;': '\u0153',
1652
+ 'ofcir;': '\u29bf',
1653
+ 'Ofr;': '\U0001d512',
1654
+ 'ofr;': '\U0001d52c',
1655
+ 'ogon;': '\u02db',
1656
+ 'Ograve': '\xd2',
1657
+ 'ograve': '\xf2',
1658
+ 'Ograve;': '\xd2',
1659
+ 'ograve;': '\xf2',
1660
+ 'ogt;': '\u29c1',
1661
+ 'ohbar;': '\u29b5',
1662
+ 'ohm;': '\u03a9',
1663
+ 'oint;': '\u222e',
1664
+ 'olarr;': '\u21ba',
1665
+ 'olcir;': '\u29be',
1666
+ 'olcross;': '\u29bb',
1667
+ 'oline;': '\u203e',
1668
+ 'olt;': '\u29c0',
1669
+ 'Omacr;': '\u014c',
1670
+ 'omacr;': '\u014d',
1671
+ 'Omega;': '\u03a9',
1672
+ 'omega;': '\u03c9',
1673
+ 'Omicron;': '\u039f',
1674
+ 'omicron;': '\u03bf',
1675
+ 'omid;': '\u29b6',
1676
+ 'ominus;': '\u2296',
1677
+ 'Oopf;': '\U0001d546',
1678
+ 'oopf;': '\U0001d560',
1679
+ 'opar;': '\u29b7',
1680
+ 'OpenCurlyDoubleQuote;': '\u201c',
1681
+ 'OpenCurlyQuote;': '\u2018',
1682
+ 'operp;': '\u29b9',
1683
+ 'oplus;': '\u2295',
1684
+ 'Or;': '\u2a54',
1685
+ 'or;': '\u2228',
1686
+ 'orarr;': '\u21bb',
1687
+ 'ord;': '\u2a5d',
1688
+ 'order;': '\u2134',
1689
+ 'orderof;': '\u2134',
1690
+ 'ordf': '\xaa',
1691
+ 'ordf;': '\xaa',
1692
+ 'ordm': '\xba',
1693
+ 'ordm;': '\xba',
1694
+ 'origof;': '\u22b6',
1695
+ 'oror;': '\u2a56',
1696
+ 'orslope;': '\u2a57',
1697
+ 'orv;': '\u2a5b',
1698
+ 'oS;': '\u24c8',
1699
+ 'Oscr;': '\U0001d4aa',
1700
+ 'oscr;': '\u2134',
1701
+ 'Oslash': '\xd8',
1702
+ 'oslash': '\xf8',
1703
+ 'Oslash;': '\xd8',
1704
+ 'oslash;': '\xf8',
1705
+ 'osol;': '\u2298',
1706
+ 'Otilde': '\xd5',
1707
+ 'otilde': '\xf5',
1708
+ 'Otilde;': '\xd5',
1709
+ 'otilde;': '\xf5',
1710
+ 'Otimes;': '\u2a37',
1711
+ 'otimes;': '\u2297',
1712
+ 'otimesas;': '\u2a36',
1713
+ 'Ouml': '\xd6',
1714
+ 'ouml': '\xf6',
1715
+ 'Ouml;': '\xd6',
1716
+ 'ouml;': '\xf6',
1717
+ 'ovbar;': '\u233d',
1718
+ 'OverBar;': '\u203e',
1719
+ 'OverBrace;': '\u23de',
1720
+ 'OverBracket;': '\u23b4',
1721
+ 'OverParenthesis;': '\u23dc',
1722
+ 'par;': '\u2225',
1723
+ 'para': '\xb6',
1724
+ 'para;': '\xb6',
1725
+ 'parallel;': '\u2225',
1726
+ 'parsim;': '\u2af3',
1727
+ 'parsl;': '\u2afd',
1728
+ 'part;': '\u2202',
1729
+ 'PartialD;': '\u2202',
1730
+ 'Pcy;': '\u041f',
1731
+ 'pcy;': '\u043f',
1732
+ 'percnt;': '%',
1733
+ 'period;': '.',
1734
+ 'permil;': '\u2030',
1735
+ 'perp;': '\u22a5',
1736
+ 'pertenk;': '\u2031',
1737
+ 'Pfr;': '\U0001d513',
1738
+ 'pfr;': '\U0001d52d',
1739
+ 'Phi;': '\u03a6',
1740
+ 'phi;': '\u03c6',
1741
+ 'phiv;': '\u03d5',
1742
+ 'phmmat;': '\u2133',
1743
+ 'phone;': '\u260e',
1744
+ 'Pi;': '\u03a0',
1745
+ 'pi;': '\u03c0',
1746
+ 'pitchfork;': '\u22d4',
1747
+ 'piv;': '\u03d6',
1748
+ 'planck;': '\u210f',
1749
+ 'planckh;': '\u210e',
1750
+ 'plankv;': '\u210f',
1751
+ 'plus;': '+',
1752
+ 'plusacir;': '\u2a23',
1753
+ 'plusb;': '\u229e',
1754
+ 'pluscir;': '\u2a22',
1755
+ 'plusdo;': '\u2214',
1756
+ 'plusdu;': '\u2a25',
1757
+ 'pluse;': '\u2a72',
1758
+ 'PlusMinus;': '\xb1',
1759
+ 'plusmn': '\xb1',
1760
+ 'plusmn;': '\xb1',
1761
+ 'plussim;': '\u2a26',
1762
+ 'plustwo;': '\u2a27',
1763
+ 'pm;': '\xb1',
1764
+ 'Poincareplane;': '\u210c',
1765
+ 'pointint;': '\u2a15',
1766
+ 'Popf;': '\u2119',
1767
+ 'popf;': '\U0001d561',
1768
+ 'pound': '\xa3',
1769
+ 'pound;': '\xa3',
1770
+ 'Pr;': '\u2abb',
1771
+ 'pr;': '\u227a',
1772
+ 'prap;': '\u2ab7',
1773
+ 'prcue;': '\u227c',
1774
+ 'prE;': '\u2ab3',
1775
+ 'pre;': '\u2aaf',
1776
+ 'prec;': '\u227a',
1777
+ 'precapprox;': '\u2ab7',
1778
+ 'preccurlyeq;': '\u227c',
1779
+ 'Precedes;': '\u227a',
1780
+ 'PrecedesEqual;': '\u2aaf',
1781
+ 'PrecedesSlantEqual;': '\u227c',
1782
+ 'PrecedesTilde;': '\u227e',
1783
+ 'preceq;': '\u2aaf',
1784
+ 'precnapprox;': '\u2ab9',
1785
+ 'precneqq;': '\u2ab5',
1786
+ 'precnsim;': '\u22e8',
1787
+ 'precsim;': '\u227e',
1788
+ 'Prime;': '\u2033',
1789
+ 'prime;': '\u2032',
1790
+ 'primes;': '\u2119',
1791
+ 'prnap;': '\u2ab9',
1792
+ 'prnE;': '\u2ab5',
1793
+ 'prnsim;': '\u22e8',
1794
+ 'prod;': '\u220f',
1795
+ 'Product;': '\u220f',
1796
+ 'profalar;': '\u232e',
1797
+ 'profline;': '\u2312',
1798
+ 'profsurf;': '\u2313',
1799
+ 'prop;': '\u221d',
1800
+ 'Proportion;': '\u2237',
1801
+ 'Proportional;': '\u221d',
1802
+ 'propto;': '\u221d',
1803
+ 'prsim;': '\u227e',
1804
+ 'prurel;': '\u22b0',
1805
+ 'Pscr;': '\U0001d4ab',
1806
+ 'pscr;': '\U0001d4c5',
1807
+ 'Psi;': '\u03a8',
1808
+ 'psi;': '\u03c8',
1809
+ 'puncsp;': '\u2008',
1810
+ 'Qfr;': '\U0001d514',
1811
+ 'qfr;': '\U0001d52e',
1812
+ 'qint;': '\u2a0c',
1813
+ 'Qopf;': '\u211a',
1814
+ 'qopf;': '\U0001d562',
1815
+ 'qprime;': '\u2057',
1816
+ 'Qscr;': '\U0001d4ac',
1817
+ 'qscr;': '\U0001d4c6',
1818
+ 'quaternions;': '\u210d',
1819
+ 'quatint;': '\u2a16',
1820
+ 'quest;': '?',
1821
+ 'questeq;': '\u225f',
1822
+ 'QUOT': '"',
1823
+ 'quot': '"',
1824
+ 'QUOT;': '"',
1825
+ 'quot;': '"',
1826
+ 'rAarr;': '\u21db',
1827
+ 'race;': '\u223d\u0331',
1828
+ 'Racute;': '\u0154',
1829
+ 'racute;': '\u0155',
1830
+ 'radic;': '\u221a',
1831
+ 'raemptyv;': '\u29b3',
1832
+ 'Rang;': '\u27eb',
1833
+ 'rang;': '\u27e9',
1834
+ 'rangd;': '\u2992',
1835
+ 'range;': '\u29a5',
1836
+ 'rangle;': '\u27e9',
1837
+ 'raquo': '\xbb',
1838
+ 'raquo;': '\xbb',
1839
+ 'Rarr;': '\u21a0',
1840
+ 'rArr;': '\u21d2',
1841
+ 'rarr;': '\u2192',
1842
+ 'rarrap;': '\u2975',
1843
+ 'rarrb;': '\u21e5',
1844
+ 'rarrbfs;': '\u2920',
1845
+ 'rarrc;': '\u2933',
1846
+ 'rarrfs;': '\u291e',
1847
+ 'rarrhk;': '\u21aa',
1848
+ 'rarrlp;': '\u21ac',
1849
+ 'rarrpl;': '\u2945',
1850
+ 'rarrsim;': '\u2974',
1851
+ 'Rarrtl;': '\u2916',
1852
+ 'rarrtl;': '\u21a3',
1853
+ 'rarrw;': '\u219d',
1854
+ 'rAtail;': '\u291c',
1855
+ 'ratail;': '\u291a',
1856
+ 'ratio;': '\u2236',
1857
+ 'rationals;': '\u211a',
1858
+ 'RBarr;': '\u2910',
1859
+ 'rBarr;': '\u290f',
1860
+ 'rbarr;': '\u290d',
1861
+ 'rbbrk;': '\u2773',
1862
+ 'rbrace;': '}',
1863
+ 'rbrack;': ']',
1864
+ 'rbrke;': '\u298c',
1865
+ 'rbrksld;': '\u298e',
1866
+ 'rbrkslu;': '\u2990',
1867
+ 'Rcaron;': '\u0158',
1868
+ 'rcaron;': '\u0159',
1869
+ 'Rcedil;': '\u0156',
1870
+ 'rcedil;': '\u0157',
1871
+ 'rceil;': '\u2309',
1872
+ 'rcub;': '}',
1873
+ 'Rcy;': '\u0420',
1874
+ 'rcy;': '\u0440',
1875
+ 'rdca;': '\u2937',
1876
+ 'rdldhar;': '\u2969',
1877
+ 'rdquo;': '\u201d',
1878
+ 'rdquor;': '\u201d',
1879
+ 'rdsh;': '\u21b3',
1880
+ 'Re;': '\u211c',
1881
+ 'real;': '\u211c',
1882
+ 'realine;': '\u211b',
1883
+ 'realpart;': '\u211c',
1884
+ 'reals;': '\u211d',
1885
+ 'rect;': '\u25ad',
1886
+ 'REG': '\xae',
1887
+ 'reg': '\xae',
1888
+ 'REG;': '\xae',
1889
+ 'reg;': '\xae',
1890
+ 'ReverseElement;': '\u220b',
1891
+ 'ReverseEquilibrium;': '\u21cb',
1892
+ 'ReverseUpEquilibrium;': '\u296f',
1893
+ 'rfisht;': '\u297d',
1894
+ 'rfloor;': '\u230b',
1895
+ 'Rfr;': '\u211c',
1896
+ 'rfr;': '\U0001d52f',
1897
+ 'rHar;': '\u2964',
1898
+ 'rhard;': '\u21c1',
1899
+ 'rharu;': '\u21c0',
1900
+ 'rharul;': '\u296c',
1901
+ 'Rho;': '\u03a1',
1902
+ 'rho;': '\u03c1',
1903
+ 'rhov;': '\u03f1',
1904
+ 'RightAngleBracket;': '\u27e9',
1905
+ 'RightArrow;': '\u2192',
1906
+ 'Rightarrow;': '\u21d2',
1907
+ 'rightarrow;': '\u2192',
1908
+ 'RightArrowBar;': '\u21e5',
1909
+ 'RightArrowLeftArrow;': '\u21c4',
1910
+ 'rightarrowtail;': '\u21a3',
1911
+ 'RightCeiling;': '\u2309',
1912
+ 'RightDoubleBracket;': '\u27e7',
1913
+ 'RightDownTeeVector;': '\u295d',
1914
+ 'RightDownVector;': '\u21c2',
1915
+ 'RightDownVectorBar;': '\u2955',
1916
+ 'RightFloor;': '\u230b',
1917
+ 'rightharpoondown;': '\u21c1',
1918
+ 'rightharpoonup;': '\u21c0',
1919
+ 'rightleftarrows;': '\u21c4',
1920
+ 'rightleftharpoons;': '\u21cc',
1921
+ 'rightrightarrows;': '\u21c9',
1922
+ 'rightsquigarrow;': '\u219d',
1923
+ 'RightTee;': '\u22a2',
1924
+ 'RightTeeArrow;': '\u21a6',
1925
+ 'RightTeeVector;': '\u295b',
1926
+ 'rightthreetimes;': '\u22cc',
1927
+ 'RightTriangle;': '\u22b3',
1928
+ 'RightTriangleBar;': '\u29d0',
1929
+ 'RightTriangleEqual;': '\u22b5',
1930
+ 'RightUpDownVector;': '\u294f',
1931
+ 'RightUpTeeVector;': '\u295c',
1932
+ 'RightUpVector;': '\u21be',
1933
+ 'RightUpVectorBar;': '\u2954',
1934
+ 'RightVector;': '\u21c0',
1935
+ 'RightVectorBar;': '\u2953',
1936
+ 'ring;': '\u02da',
1937
+ 'risingdotseq;': '\u2253',
1938
+ 'rlarr;': '\u21c4',
1939
+ 'rlhar;': '\u21cc',
1940
+ 'rlm;': '\u200f',
1941
+ 'rmoust;': '\u23b1',
1942
+ 'rmoustache;': '\u23b1',
1943
+ 'rnmid;': '\u2aee',
1944
+ 'roang;': '\u27ed',
1945
+ 'roarr;': '\u21fe',
1946
+ 'robrk;': '\u27e7',
1947
+ 'ropar;': '\u2986',
1948
+ 'Ropf;': '\u211d',
1949
+ 'ropf;': '\U0001d563',
1950
+ 'roplus;': '\u2a2e',
1951
+ 'rotimes;': '\u2a35',
1952
+ 'RoundImplies;': '\u2970',
1953
+ 'rpar;': ')',
1954
+ 'rpargt;': '\u2994',
1955
+ 'rppolint;': '\u2a12',
1956
+ 'rrarr;': '\u21c9',
1957
+ 'Rrightarrow;': '\u21db',
1958
+ 'rsaquo;': '\u203a',
1959
+ 'Rscr;': '\u211b',
1960
+ 'rscr;': '\U0001d4c7',
1961
+ 'Rsh;': '\u21b1',
1962
+ 'rsh;': '\u21b1',
1963
+ 'rsqb;': ']',
1964
+ 'rsquo;': '\u2019',
1965
+ 'rsquor;': '\u2019',
1966
+ 'rthree;': '\u22cc',
1967
+ 'rtimes;': '\u22ca',
1968
+ 'rtri;': '\u25b9',
1969
+ 'rtrie;': '\u22b5',
1970
+ 'rtrif;': '\u25b8',
1971
+ 'rtriltri;': '\u29ce',
1972
+ 'RuleDelayed;': '\u29f4',
1973
+ 'ruluhar;': '\u2968',
1974
+ 'rx;': '\u211e',
1975
+ 'Sacute;': '\u015a',
1976
+ 'sacute;': '\u015b',
1977
+ 'sbquo;': '\u201a',
1978
+ 'Sc;': '\u2abc',
1979
+ 'sc;': '\u227b',
1980
+ 'scap;': '\u2ab8',
1981
+ 'Scaron;': '\u0160',
1982
+ 'scaron;': '\u0161',
1983
+ 'sccue;': '\u227d',
1984
+ 'scE;': '\u2ab4',
1985
+ 'sce;': '\u2ab0',
1986
+ 'Scedil;': '\u015e',
1987
+ 'scedil;': '\u015f',
1988
+ 'Scirc;': '\u015c',
1989
+ 'scirc;': '\u015d',
1990
+ 'scnap;': '\u2aba',
1991
+ 'scnE;': '\u2ab6',
1992
+ 'scnsim;': '\u22e9',
1993
+ 'scpolint;': '\u2a13',
1994
+ 'scsim;': '\u227f',
1995
+ 'Scy;': '\u0421',
1996
+ 'scy;': '\u0441',
1997
+ 'sdot;': '\u22c5',
1998
+ 'sdotb;': '\u22a1',
1999
+ 'sdote;': '\u2a66',
2000
+ 'searhk;': '\u2925',
2001
+ 'seArr;': '\u21d8',
2002
+ 'searr;': '\u2198',
2003
+ 'searrow;': '\u2198',
2004
+ 'sect': '\xa7',
2005
+ 'sect;': '\xa7',
2006
+ 'semi;': ';',
2007
+ 'seswar;': '\u2929',
2008
+ 'setminus;': '\u2216',
2009
+ 'setmn;': '\u2216',
2010
+ 'sext;': '\u2736',
2011
+ 'Sfr;': '\U0001d516',
2012
+ 'sfr;': '\U0001d530',
2013
+ 'sfrown;': '\u2322',
2014
+ 'sharp;': '\u266f',
2015
+ 'SHCHcy;': '\u0429',
2016
+ 'shchcy;': '\u0449',
2017
+ 'SHcy;': '\u0428',
2018
+ 'shcy;': '\u0448',
2019
+ 'ShortDownArrow;': '\u2193',
2020
+ 'ShortLeftArrow;': '\u2190',
2021
+ 'shortmid;': '\u2223',
2022
+ 'shortparallel;': '\u2225',
2023
+ 'ShortRightArrow;': '\u2192',
2024
+ 'ShortUpArrow;': '\u2191',
2025
+ 'shy': '\xad',
2026
+ 'shy;': '\xad',
2027
+ 'Sigma;': '\u03a3',
2028
+ 'sigma;': '\u03c3',
2029
+ 'sigmaf;': '\u03c2',
2030
+ 'sigmav;': '\u03c2',
2031
+ 'sim;': '\u223c',
2032
+ 'simdot;': '\u2a6a',
2033
+ 'sime;': '\u2243',
2034
+ 'simeq;': '\u2243',
2035
+ 'simg;': '\u2a9e',
2036
+ 'simgE;': '\u2aa0',
2037
+ 'siml;': '\u2a9d',
2038
+ 'simlE;': '\u2a9f',
2039
+ 'simne;': '\u2246',
2040
+ 'simplus;': '\u2a24',
2041
+ 'simrarr;': '\u2972',
2042
+ 'slarr;': '\u2190',
2043
+ 'SmallCircle;': '\u2218',
2044
+ 'smallsetminus;': '\u2216',
2045
+ 'smashp;': '\u2a33',
2046
+ 'smeparsl;': '\u29e4',
2047
+ 'smid;': '\u2223',
2048
+ 'smile;': '\u2323',
2049
+ 'smt;': '\u2aaa',
2050
+ 'smte;': '\u2aac',
2051
+ 'smtes;': '\u2aac\ufe00',
2052
+ 'SOFTcy;': '\u042c',
2053
+ 'softcy;': '\u044c',
2054
+ 'sol;': '/',
2055
+ 'solb;': '\u29c4',
2056
+ 'solbar;': '\u233f',
2057
+ 'Sopf;': '\U0001d54a',
2058
+ 'sopf;': '\U0001d564',
2059
+ 'spades;': '\u2660',
2060
+ 'spadesuit;': '\u2660',
2061
+ 'spar;': '\u2225',
2062
+ 'sqcap;': '\u2293',
2063
+ 'sqcaps;': '\u2293\ufe00',
2064
+ 'sqcup;': '\u2294',
2065
+ 'sqcups;': '\u2294\ufe00',
2066
+ 'Sqrt;': '\u221a',
2067
+ 'sqsub;': '\u228f',
2068
+ 'sqsube;': '\u2291',
2069
+ 'sqsubset;': '\u228f',
2070
+ 'sqsubseteq;': '\u2291',
2071
+ 'sqsup;': '\u2290',
2072
+ 'sqsupe;': '\u2292',
2073
+ 'sqsupset;': '\u2290',
2074
+ 'sqsupseteq;': '\u2292',
2075
+ 'squ;': '\u25a1',
2076
+ 'Square;': '\u25a1',
2077
+ 'square;': '\u25a1',
2078
+ 'SquareIntersection;': '\u2293',
2079
+ 'SquareSubset;': '\u228f',
2080
+ 'SquareSubsetEqual;': '\u2291',
2081
+ 'SquareSuperset;': '\u2290',
2082
+ 'SquareSupersetEqual;': '\u2292',
2083
+ 'SquareUnion;': '\u2294',
2084
+ 'squarf;': '\u25aa',
2085
+ 'squf;': '\u25aa',
2086
+ 'srarr;': '\u2192',
2087
+ 'Sscr;': '\U0001d4ae',
2088
+ 'sscr;': '\U0001d4c8',
2089
+ 'ssetmn;': '\u2216',
2090
+ 'ssmile;': '\u2323',
2091
+ 'sstarf;': '\u22c6',
2092
+ 'Star;': '\u22c6',
2093
+ 'star;': '\u2606',
2094
+ 'starf;': '\u2605',
2095
+ 'straightepsilon;': '\u03f5',
2096
+ 'straightphi;': '\u03d5',
2097
+ 'strns;': '\xaf',
2098
+ 'Sub;': '\u22d0',
2099
+ 'sub;': '\u2282',
2100
+ 'subdot;': '\u2abd',
2101
+ 'subE;': '\u2ac5',
2102
+ 'sube;': '\u2286',
2103
+ 'subedot;': '\u2ac3',
2104
+ 'submult;': '\u2ac1',
2105
+ 'subnE;': '\u2acb',
2106
+ 'subne;': '\u228a',
2107
+ 'subplus;': '\u2abf',
2108
+ 'subrarr;': '\u2979',
2109
+ 'Subset;': '\u22d0',
2110
+ 'subset;': '\u2282',
2111
+ 'subseteq;': '\u2286',
2112
+ 'subseteqq;': '\u2ac5',
2113
+ 'SubsetEqual;': '\u2286',
2114
+ 'subsetneq;': '\u228a',
2115
+ 'subsetneqq;': '\u2acb',
2116
+ 'subsim;': '\u2ac7',
2117
+ 'subsub;': '\u2ad5',
2118
+ 'subsup;': '\u2ad3',
2119
+ 'succ;': '\u227b',
2120
+ 'succapprox;': '\u2ab8',
2121
+ 'succcurlyeq;': '\u227d',
2122
+ 'Succeeds;': '\u227b',
2123
+ 'SucceedsEqual;': '\u2ab0',
2124
+ 'SucceedsSlantEqual;': '\u227d',
2125
+ 'SucceedsTilde;': '\u227f',
2126
+ 'succeq;': '\u2ab0',
2127
+ 'succnapprox;': '\u2aba',
2128
+ 'succneqq;': '\u2ab6',
2129
+ 'succnsim;': '\u22e9',
2130
+ 'succsim;': '\u227f',
2131
+ 'SuchThat;': '\u220b',
2132
+ 'Sum;': '\u2211',
2133
+ 'sum;': '\u2211',
2134
+ 'sung;': '\u266a',
2135
+ 'sup1': '\xb9',
2136
+ 'sup1;': '\xb9',
2137
+ 'sup2': '\xb2',
2138
+ 'sup2;': '\xb2',
2139
+ 'sup3': '\xb3',
2140
+ 'sup3;': '\xb3',
2141
+ 'Sup;': '\u22d1',
2142
+ 'sup;': '\u2283',
2143
+ 'supdot;': '\u2abe',
2144
+ 'supdsub;': '\u2ad8',
2145
+ 'supE;': '\u2ac6',
2146
+ 'supe;': '\u2287',
2147
+ 'supedot;': '\u2ac4',
2148
+ 'Superset;': '\u2283',
2149
+ 'SupersetEqual;': '\u2287',
2150
+ 'suphsol;': '\u27c9',
2151
+ 'suphsub;': '\u2ad7',
2152
+ 'suplarr;': '\u297b',
2153
+ 'supmult;': '\u2ac2',
2154
+ 'supnE;': '\u2acc',
2155
+ 'supne;': '\u228b',
2156
+ 'supplus;': '\u2ac0',
2157
+ 'Supset;': '\u22d1',
2158
+ 'supset;': '\u2283',
2159
+ 'supseteq;': '\u2287',
2160
+ 'supseteqq;': '\u2ac6',
2161
+ 'supsetneq;': '\u228b',
2162
+ 'supsetneqq;': '\u2acc',
2163
+ 'supsim;': '\u2ac8',
2164
+ 'supsub;': '\u2ad4',
2165
+ 'supsup;': '\u2ad6',
2166
+ 'swarhk;': '\u2926',
2167
+ 'swArr;': '\u21d9',
2168
+ 'swarr;': '\u2199',
2169
+ 'swarrow;': '\u2199',
2170
+ 'swnwar;': '\u292a',
2171
+ 'szlig': '\xdf',
2172
+ 'szlig;': '\xdf',
2173
+ 'Tab;': '\t',
2174
+ 'target;': '\u2316',
2175
+ 'Tau;': '\u03a4',
2176
+ 'tau;': '\u03c4',
2177
+ 'tbrk;': '\u23b4',
2178
+ 'Tcaron;': '\u0164',
2179
+ 'tcaron;': '\u0165',
2180
+ 'Tcedil;': '\u0162',
2181
+ 'tcedil;': '\u0163',
2182
+ 'Tcy;': '\u0422',
2183
+ 'tcy;': '\u0442',
2184
+ 'tdot;': '\u20db',
2185
+ 'telrec;': '\u2315',
2186
+ 'Tfr;': '\U0001d517',
2187
+ 'tfr;': '\U0001d531',
2188
+ 'there4;': '\u2234',
2189
+ 'Therefore;': '\u2234',
2190
+ 'therefore;': '\u2234',
2191
+ 'Theta;': '\u0398',
2192
+ 'theta;': '\u03b8',
2193
+ 'thetasym;': '\u03d1',
2194
+ 'thetav;': '\u03d1',
2195
+ 'thickapprox;': '\u2248',
2196
+ 'thicksim;': '\u223c',
2197
+ 'ThickSpace;': '\u205f\u200a',
2198
+ 'thinsp;': '\u2009',
2199
+ 'ThinSpace;': '\u2009',
2200
+ 'thkap;': '\u2248',
2201
+ 'thksim;': '\u223c',
2202
+ 'THORN': '\xde',
2203
+ 'thorn': '\xfe',
2204
+ 'THORN;': '\xde',
2205
+ 'thorn;': '\xfe',
2206
+ 'Tilde;': '\u223c',
2207
+ 'tilde;': '\u02dc',
2208
+ 'TildeEqual;': '\u2243',
2209
+ 'TildeFullEqual;': '\u2245',
2210
+ 'TildeTilde;': '\u2248',
2211
+ 'times': '\xd7',
2212
+ 'times;': '\xd7',
2213
+ 'timesb;': '\u22a0',
2214
+ 'timesbar;': '\u2a31',
2215
+ 'timesd;': '\u2a30',
2216
+ 'tint;': '\u222d',
2217
+ 'toea;': '\u2928',
2218
+ 'top;': '\u22a4',
2219
+ 'topbot;': '\u2336',
2220
+ 'topcir;': '\u2af1',
2221
+ 'Topf;': '\U0001d54b',
2222
+ 'topf;': '\U0001d565',
2223
+ 'topfork;': '\u2ada',
2224
+ 'tosa;': '\u2929',
2225
+ 'tprime;': '\u2034',
2226
+ 'TRADE;': '\u2122',
2227
+ 'trade;': '\u2122',
2228
+ 'triangle;': '\u25b5',
2229
+ 'triangledown;': '\u25bf',
2230
+ 'triangleleft;': '\u25c3',
2231
+ 'trianglelefteq;': '\u22b4',
2232
+ 'triangleq;': '\u225c',
2233
+ 'triangleright;': '\u25b9',
2234
+ 'trianglerighteq;': '\u22b5',
2235
+ 'tridot;': '\u25ec',
2236
+ 'trie;': '\u225c',
2237
+ 'triminus;': '\u2a3a',
2238
+ 'TripleDot;': '\u20db',
2239
+ 'triplus;': '\u2a39',
2240
+ 'trisb;': '\u29cd',
2241
+ 'tritime;': '\u2a3b',
2242
+ 'trpezium;': '\u23e2',
2243
+ 'Tscr;': '\U0001d4af',
2244
+ 'tscr;': '\U0001d4c9',
2245
+ 'TScy;': '\u0426',
2246
+ 'tscy;': '\u0446',
2247
+ 'TSHcy;': '\u040b',
2248
+ 'tshcy;': '\u045b',
2249
+ 'Tstrok;': '\u0166',
2250
+ 'tstrok;': '\u0167',
2251
+ 'twixt;': '\u226c',
2252
+ 'twoheadleftarrow;': '\u219e',
2253
+ 'twoheadrightarrow;': '\u21a0',
2254
+ 'Uacute': '\xda',
2255
+ 'uacute': '\xfa',
2256
+ 'Uacute;': '\xda',
2257
+ 'uacute;': '\xfa',
2258
+ 'Uarr;': '\u219f',
2259
+ 'uArr;': '\u21d1',
2260
+ 'uarr;': '\u2191',
2261
+ 'Uarrocir;': '\u2949',
2262
+ 'Ubrcy;': '\u040e',
2263
+ 'ubrcy;': '\u045e',
2264
+ 'Ubreve;': '\u016c',
2265
+ 'ubreve;': '\u016d',
2266
+ 'Ucirc': '\xdb',
2267
+ 'ucirc': '\xfb',
2268
+ 'Ucirc;': '\xdb',
2269
+ 'ucirc;': '\xfb',
2270
+ 'Ucy;': '\u0423',
2271
+ 'ucy;': '\u0443',
2272
+ 'udarr;': '\u21c5',
2273
+ 'Udblac;': '\u0170',
2274
+ 'udblac;': '\u0171',
2275
+ 'udhar;': '\u296e',
2276
+ 'ufisht;': '\u297e',
2277
+ 'Ufr;': '\U0001d518',
2278
+ 'ufr;': '\U0001d532',
2279
+ 'Ugrave': '\xd9',
2280
+ 'ugrave': '\xf9',
2281
+ 'Ugrave;': '\xd9',
2282
+ 'ugrave;': '\xf9',
2283
+ 'uHar;': '\u2963',
2284
+ 'uharl;': '\u21bf',
2285
+ 'uharr;': '\u21be',
2286
+ 'uhblk;': '\u2580',
2287
+ 'ulcorn;': '\u231c',
2288
+ 'ulcorner;': '\u231c',
2289
+ 'ulcrop;': '\u230f',
2290
+ 'ultri;': '\u25f8',
2291
+ 'Umacr;': '\u016a',
2292
+ 'umacr;': '\u016b',
2293
+ 'uml': '\xa8',
2294
+ 'uml;': '\xa8',
2295
+ 'UnderBar;': '_',
2296
+ 'UnderBrace;': '\u23df',
2297
+ 'UnderBracket;': '\u23b5',
2298
+ 'UnderParenthesis;': '\u23dd',
2299
+ 'Union;': '\u22c3',
2300
+ 'UnionPlus;': '\u228e',
2301
+ 'Uogon;': '\u0172',
2302
+ 'uogon;': '\u0173',
2303
+ 'Uopf;': '\U0001d54c',
2304
+ 'uopf;': '\U0001d566',
2305
+ 'UpArrow;': '\u2191',
2306
+ 'Uparrow;': '\u21d1',
2307
+ 'uparrow;': '\u2191',
2308
+ 'UpArrowBar;': '\u2912',
2309
+ 'UpArrowDownArrow;': '\u21c5',
2310
+ 'UpDownArrow;': '\u2195',
2311
+ 'Updownarrow;': '\u21d5',
2312
+ 'updownarrow;': '\u2195',
2313
+ 'UpEquilibrium;': '\u296e',
2314
+ 'upharpoonleft;': '\u21bf',
2315
+ 'upharpoonright;': '\u21be',
2316
+ 'uplus;': '\u228e',
2317
+ 'UpperLeftArrow;': '\u2196',
2318
+ 'UpperRightArrow;': '\u2197',
2319
+ 'Upsi;': '\u03d2',
2320
+ 'upsi;': '\u03c5',
2321
+ 'upsih;': '\u03d2',
2322
+ 'Upsilon;': '\u03a5',
2323
+ 'upsilon;': '\u03c5',
2324
+ 'UpTee;': '\u22a5',
2325
+ 'UpTeeArrow;': '\u21a5',
2326
+ 'upuparrows;': '\u21c8',
2327
+ 'urcorn;': '\u231d',
2328
+ 'urcorner;': '\u231d',
2329
+ 'urcrop;': '\u230e',
2330
+ 'Uring;': '\u016e',
2331
+ 'uring;': '\u016f',
2332
+ 'urtri;': '\u25f9',
2333
+ 'Uscr;': '\U0001d4b0',
2334
+ 'uscr;': '\U0001d4ca',
2335
+ 'utdot;': '\u22f0',
2336
+ 'Utilde;': '\u0168',
2337
+ 'utilde;': '\u0169',
2338
+ 'utri;': '\u25b5',
2339
+ 'utrif;': '\u25b4',
2340
+ 'uuarr;': '\u21c8',
2341
+ 'Uuml': '\xdc',
2342
+ 'uuml': '\xfc',
2343
+ 'Uuml;': '\xdc',
2344
+ 'uuml;': '\xfc',
2345
+ 'uwangle;': '\u29a7',
2346
+ 'vangrt;': '\u299c',
2347
+ 'varepsilon;': '\u03f5',
2348
+ 'varkappa;': '\u03f0',
2349
+ 'varnothing;': '\u2205',
2350
+ 'varphi;': '\u03d5',
2351
+ 'varpi;': '\u03d6',
2352
+ 'varpropto;': '\u221d',
2353
+ 'vArr;': '\u21d5',
2354
+ 'varr;': '\u2195',
2355
+ 'varrho;': '\u03f1',
2356
+ 'varsigma;': '\u03c2',
2357
+ 'varsubsetneq;': '\u228a\ufe00',
2358
+ 'varsubsetneqq;': '\u2acb\ufe00',
2359
+ 'varsupsetneq;': '\u228b\ufe00',
2360
+ 'varsupsetneqq;': '\u2acc\ufe00',
2361
+ 'vartheta;': '\u03d1',
2362
+ 'vartriangleleft;': '\u22b2',
2363
+ 'vartriangleright;': '\u22b3',
2364
+ 'Vbar;': '\u2aeb',
2365
+ 'vBar;': '\u2ae8',
2366
+ 'vBarv;': '\u2ae9',
2367
+ 'Vcy;': '\u0412',
2368
+ 'vcy;': '\u0432',
2369
+ 'VDash;': '\u22ab',
2370
+ 'Vdash;': '\u22a9',
2371
+ 'vDash;': '\u22a8',
2372
+ 'vdash;': '\u22a2',
2373
+ 'Vdashl;': '\u2ae6',
2374
+ 'Vee;': '\u22c1',
2375
+ 'vee;': '\u2228',
2376
+ 'veebar;': '\u22bb',
2377
+ 'veeeq;': '\u225a',
2378
+ 'vellip;': '\u22ee',
2379
+ 'Verbar;': '\u2016',
2380
+ 'verbar;': '|',
2381
+ 'Vert;': '\u2016',
2382
+ 'vert;': '|',
2383
+ 'VerticalBar;': '\u2223',
2384
+ 'VerticalLine;': '|',
2385
+ 'VerticalSeparator;': '\u2758',
2386
+ 'VerticalTilde;': '\u2240',
2387
+ 'VeryThinSpace;': '\u200a',
2388
+ 'Vfr;': '\U0001d519',
2389
+ 'vfr;': '\U0001d533',
2390
+ 'vltri;': '\u22b2',
2391
+ 'vnsub;': '\u2282\u20d2',
2392
+ 'vnsup;': '\u2283\u20d2',
2393
+ 'Vopf;': '\U0001d54d',
2394
+ 'vopf;': '\U0001d567',
2395
+ 'vprop;': '\u221d',
2396
+ 'vrtri;': '\u22b3',
2397
+ 'Vscr;': '\U0001d4b1',
2398
+ 'vscr;': '\U0001d4cb',
2399
+ 'vsubnE;': '\u2acb\ufe00',
2400
+ 'vsubne;': '\u228a\ufe00',
2401
+ 'vsupnE;': '\u2acc\ufe00',
2402
+ 'vsupne;': '\u228b\ufe00',
2403
+ 'Vvdash;': '\u22aa',
2404
+ 'vzigzag;': '\u299a',
2405
+ 'Wcirc;': '\u0174',
2406
+ 'wcirc;': '\u0175',
2407
+ 'wedbar;': '\u2a5f',
2408
+ 'Wedge;': '\u22c0',
2409
+ 'wedge;': '\u2227',
2410
+ 'wedgeq;': '\u2259',
2411
+ 'weierp;': '\u2118',
2412
+ 'Wfr;': '\U0001d51a',
2413
+ 'wfr;': '\U0001d534',
2414
+ 'Wopf;': '\U0001d54e',
2415
+ 'wopf;': '\U0001d568',
2416
+ 'wp;': '\u2118',
2417
+ 'wr;': '\u2240',
2418
+ 'wreath;': '\u2240',
2419
+ 'Wscr;': '\U0001d4b2',
2420
+ 'wscr;': '\U0001d4cc',
2421
+ 'xcap;': '\u22c2',
2422
+ 'xcirc;': '\u25ef',
2423
+ 'xcup;': '\u22c3',
2424
+ 'xdtri;': '\u25bd',
2425
+ 'Xfr;': '\U0001d51b',
2426
+ 'xfr;': '\U0001d535',
2427
+ 'xhArr;': '\u27fa',
2428
+ 'xharr;': '\u27f7',
2429
+ 'Xi;': '\u039e',
2430
+ 'xi;': '\u03be',
2431
+ 'xlArr;': '\u27f8',
2432
+ 'xlarr;': '\u27f5',
2433
+ 'xmap;': '\u27fc',
2434
+ 'xnis;': '\u22fb',
2435
+ 'xodot;': '\u2a00',
2436
+ 'Xopf;': '\U0001d54f',
2437
+ 'xopf;': '\U0001d569',
2438
+ 'xoplus;': '\u2a01',
2439
+ 'xotime;': '\u2a02',
2440
+ 'xrArr;': '\u27f9',
2441
+ 'xrarr;': '\u27f6',
2442
+ 'Xscr;': '\U0001d4b3',
2443
+ 'xscr;': '\U0001d4cd',
2444
+ 'xsqcup;': '\u2a06',
2445
+ 'xuplus;': '\u2a04',
2446
+ 'xutri;': '\u25b3',
2447
+ 'xvee;': '\u22c1',
2448
+ 'xwedge;': '\u22c0',
2449
+ 'Yacute': '\xdd',
2450
+ 'yacute': '\xfd',
2451
+ 'Yacute;': '\xdd',
2452
+ 'yacute;': '\xfd',
2453
+ 'YAcy;': '\u042f',
2454
+ 'yacy;': '\u044f',
2455
+ 'Ycirc;': '\u0176',
2456
+ 'ycirc;': '\u0177',
2457
+ 'Ycy;': '\u042b',
2458
+ 'ycy;': '\u044b',
2459
+ 'yen': '\xa5',
2460
+ 'yen;': '\xa5',
2461
+ 'Yfr;': '\U0001d51c',
2462
+ 'yfr;': '\U0001d536',
2463
+ 'YIcy;': '\u0407',
2464
+ 'yicy;': '\u0457',
2465
+ 'Yopf;': '\U0001d550',
2466
+ 'yopf;': '\U0001d56a',
2467
+ 'Yscr;': '\U0001d4b4',
2468
+ 'yscr;': '\U0001d4ce',
2469
+ 'YUcy;': '\u042e',
2470
+ 'yucy;': '\u044e',
2471
+ 'yuml': '\xff',
2472
+ 'Yuml;': '\u0178',
2473
+ 'yuml;': '\xff',
2474
+ 'Zacute;': '\u0179',
2475
+ 'zacute;': '\u017a',
2476
+ 'Zcaron;': '\u017d',
2477
+ 'zcaron;': '\u017e',
2478
+ 'Zcy;': '\u0417',
2479
+ 'zcy;': '\u0437',
2480
+ 'Zdot;': '\u017b',
2481
+ 'zdot;': '\u017c',
2482
+ 'zeetrf;': '\u2128',
2483
+ 'ZeroWidthSpace;': '\u200b',
2484
+ 'Zeta;': '\u0396',
2485
+ 'zeta;': '\u03b6',
2486
+ 'Zfr;': '\u2128',
2487
+ 'zfr;': '\U0001d537',
2488
+ 'ZHcy;': '\u0416',
2489
+ 'zhcy;': '\u0436',
2490
+ 'zigrarr;': '\u21dd',
2491
+ 'Zopf;': '\u2124',
2492
+ 'zopf;': '\U0001d56b',
2493
+ 'Zscr;': '\U0001d4b5',
2494
+ 'zscr;': '\U0001d4cf',
2495
+ 'zwj;': '\u200d',
2496
+ 'zwnj;': '\u200c',
2497
+ }
2498
+
2499
+ # maps the Unicode code point to the HTML entity name
2500
+ codepoint2name = {}
2501
+
2502
+ # maps the HTML entity name to the character
2503
+ # (or a character reference if the character is outside the Latin-1 range)
2504
+ entitydefs = {}
2505
+
2506
+ for (name, codepoint) in name2codepoint.items():
2507
+ codepoint2name[codepoint] = name
2508
+ entitydefs[name] = chr(codepoint)
2509
+
2510
+ del name, codepoint
omnilmm/lib/python3.10/html/parser.py ADDED
@@ -0,0 +1,462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A parser for HTML and XHTML."""
2
+
3
+ # This file is based on sgmllib.py, but the API is slightly different.
4
+
5
+ # XXX There should be a way to distinguish between PCDATA (parsed
6
+ # character data -- the normal case), RCDATA (replaceable character
7
+ # data -- only char and entity references and end tags are special)
8
+ # and CDATA (character data -- only end tags are special).
9
+
10
+
11
+ import re
12
+ import _markupbase
13
+
14
+ from html import unescape
15
+
16
+
17
+ __all__ = ['HTMLParser']
18
+
19
+ # Regular expressions used for parsing
20
+
21
+ interesting_normal = re.compile('[&<]')
22
+ incomplete = re.compile('&[a-zA-Z#]')
23
+
24
+ entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')
25
+ charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')
26
+
27
+ starttagopen = re.compile('<[a-zA-Z]')
28
+ piclose = re.compile('>')
29
+ commentclose = re.compile(r'--\s*>')
30
+ # Note:
31
+ # 1) if you change tagfind/attrfind remember to update locatestarttagend too;
32
+ # 2) if you change tagfind/attrfind and/or locatestarttagend the parser will
33
+ # explode, so don't do it.
34
+ # see http://www.w3.org/TR/html5/tokenization.html#tag-open-state
35
+ # and http://www.w3.org/TR/html5/tokenization.html#tag-name-state
36
+ tagfind_tolerant = re.compile(r'([a-zA-Z][^\t\n\r\f />\x00]*)(?:\s|/(?!>))*')
37
+ attrfind_tolerant = re.compile(
38
+ r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
39
+ r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*')
40
+ locatestarttagend_tolerant = re.compile(r"""
41
+ <[a-zA-Z][^\t\n\r\f />\x00]* # tag name
42
+ (?:[\s/]* # optional whitespace before attribute name
43
+ (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name
44
+ (?:\s*=+\s* # value indicator
45
+ (?:'[^']*' # LITA-enclosed value
46
+ |"[^"]*" # LIT-enclosed value
47
+ |(?!['"])[^>\s]* # bare value
48
+ )
49
+ \s* # possibly followed by a space
50
+ )?(?:\s|/(?!>))*
51
+ )*
52
+ )?
53
+ \s* # trailing whitespace
54
+ """, re.VERBOSE)
55
+ endendtag = re.compile('>')
56
+ # the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between
57
+ # </ and the tag name, so maybe this should be fixed
58
+ endtagfind = re.compile(r'</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')
59
+
60
+
61
+
62
+ class HTMLParser(_markupbase.ParserBase):
63
+ """Find tags and other markup and call handler functions.
64
+
65
+ Usage:
66
+ p = HTMLParser()
67
+ p.feed(data)
68
+ ...
69
+ p.close()
70
+
71
+ Start tags are handled by calling self.handle_starttag() or
72
+ self.handle_startendtag(); end tags by self.handle_endtag(). The
73
+ data between tags is passed from the parser to the derived class
74
+ by calling self.handle_data() with the data as argument (the data
75
+ may be split up in arbitrary chunks). If convert_charrefs is
76
+ True the character references are converted automatically to the
77
+ corresponding Unicode character (and self.handle_data() is no
78
+ longer split in chunks), otherwise they are passed by calling
79
+ self.handle_entityref() or self.handle_charref() with the string
80
+ containing respectively the named or numeric reference as the
81
+ argument.
82
+ """
83
+
84
+ CDATA_CONTENT_ELEMENTS = ("script", "style")
85
+
86
+ def __init__(self, *, convert_charrefs=True):
87
+ """Initialize and reset this instance.
88
+
89
+ If convert_charrefs is True (the default), all character references
90
+ are automatically converted to the corresponding Unicode characters.
91
+ """
92
+ self.convert_charrefs = convert_charrefs
93
+ self.reset()
94
+
95
+ def reset(self):
96
+ """Reset this instance. Loses all unprocessed data."""
97
+ self.rawdata = ''
98
+ self.lasttag = '???'
99
+ self.interesting = interesting_normal
100
+ self.cdata_elem = None
101
+ _markupbase.ParserBase.reset(self)
102
+
103
+ def feed(self, data):
104
+ r"""Feed data to the parser.
105
+
106
+ Call this as often as you want, with as little or as much text
107
+ as you want (may include '\n').
108
+ """
109
+ self.rawdata = self.rawdata + data
110
+ self.goahead(0)
111
+
112
+ def close(self):
113
+ """Handle any buffered data."""
114
+ self.goahead(1)
115
+
116
+ __starttag_text = None
117
+
118
+ def get_starttag_text(self):
119
+ """Return full source of start tag: '<...>'."""
120
+ return self.__starttag_text
121
+
122
+ def set_cdata_mode(self, elem):
123
+ self.cdata_elem = elem.lower()
124
+ self.interesting = re.compile(r'</\s*%s\s*>' % self.cdata_elem, re.I)
125
+
126
+ def clear_cdata_mode(self):
127
+ self.interesting = interesting_normal
128
+ self.cdata_elem = None
129
+
130
+ # Internal -- handle data as far as reasonable. May leave state
131
+ # and data to be processed by a subsequent call. If 'end' is
132
+ # true, force handling all data as if followed by EOF marker.
133
+ def goahead(self, end):
134
+ rawdata = self.rawdata
135
+ i = 0
136
+ n = len(rawdata)
137
+ while i < n:
138
+ if self.convert_charrefs and not self.cdata_elem:
139
+ j = rawdata.find('<', i)
140
+ if j < 0:
141
+ # if we can't find the next <, either we are at the end
142
+ # or there's more text incoming. If the latter is True,
143
+ # we can't pass the text to handle_data in case we have
144
+ # a charref cut in half at end. Try to determine if
145
+ # this is the case before proceeding by looking for an
146
+ # & near the end and see if it's followed by a space or ;.
147
+ amppos = rawdata.rfind('&', max(i, n-34))
148
+ if (amppos >= 0 and
149
+ not re.compile(r'[\s;]').search(rawdata, amppos)):
150
+ break # wait till we get all the text
151
+ j = n
152
+ else:
153
+ match = self.interesting.search(rawdata, i) # < or &
154
+ if match:
155
+ j = match.start()
156
+ else:
157
+ if self.cdata_elem:
158
+ break
159
+ j = n
160
+ if i < j:
161
+ if self.convert_charrefs and not self.cdata_elem:
162
+ self.handle_data(unescape(rawdata[i:j]))
163
+ else:
164
+ self.handle_data(rawdata[i:j])
165
+ i = self.updatepos(i, j)
166
+ if i == n: break
167
+ startswith = rawdata.startswith
168
+ if startswith('<', i):
169
+ if starttagopen.match(rawdata, i): # < + letter
170
+ k = self.parse_starttag(i)
171
+ elif startswith("</", i):
172
+ k = self.parse_endtag(i)
173
+ elif startswith("<!--", i):
174
+ k = self.parse_comment(i)
175
+ elif startswith("<?", i):
176
+ k = self.parse_pi(i)
177
+ elif startswith("<!", i):
178
+ k = self.parse_html_declaration(i)
179
+ elif (i + 1) < n:
180
+ self.handle_data("<")
181
+ k = i + 1
182
+ else:
183
+ break
184
+ if k < 0:
185
+ if not end:
186
+ break
187
+ k = rawdata.find('>', i + 1)
188
+ if k < 0:
189
+ k = rawdata.find('<', i + 1)
190
+ if k < 0:
191
+ k = i + 1
192
+ else:
193
+ k += 1
194
+ if self.convert_charrefs and not self.cdata_elem:
195
+ self.handle_data(unescape(rawdata[i:k]))
196
+ else:
197
+ self.handle_data(rawdata[i:k])
198
+ i = self.updatepos(i, k)
199
+ elif startswith("&#", i):
200
+ match = charref.match(rawdata, i)
201
+ if match:
202
+ name = match.group()[2:-1]
203
+ self.handle_charref(name)
204
+ k = match.end()
205
+ if not startswith(';', k-1):
206
+ k = k - 1
207
+ i = self.updatepos(i, k)
208
+ continue
209
+ else:
210
+ if ";" in rawdata[i:]: # bail by consuming &#
211
+ self.handle_data(rawdata[i:i+2])
212
+ i = self.updatepos(i, i+2)
213
+ break
214
+ elif startswith('&', i):
215
+ match = entityref.match(rawdata, i)
216
+ if match:
217
+ name = match.group(1)
218
+ self.handle_entityref(name)
219
+ k = match.end()
220
+ if not startswith(';', k-1):
221
+ k = k - 1
222
+ i = self.updatepos(i, k)
223
+ continue
224
+ match = incomplete.match(rawdata, i)
225
+ if match:
226
+ # match.group() will contain at least 2 chars
227
+ if end and match.group() == rawdata[i:]:
228
+ k = match.end()
229
+ if k <= i:
230
+ k = n
231
+ i = self.updatepos(i, i + 1)
232
+ # incomplete
233
+ break
234
+ elif (i + 1) < n:
235
+ # not the end of the buffer, and can't be confused
236
+ # with some other construct
237
+ self.handle_data("&")
238
+ i = self.updatepos(i, i + 1)
239
+ else:
240
+ break
241
+ else:
242
+ assert 0, "interesting.search() lied"
243
+ # end while
244
+ if end and i < n and not self.cdata_elem:
245
+ if self.convert_charrefs and not self.cdata_elem:
246
+ self.handle_data(unescape(rawdata[i:n]))
247
+ else:
248
+ self.handle_data(rawdata[i:n])
249
+ i = self.updatepos(i, n)
250
+ self.rawdata = rawdata[i:]
251
+
252
+ # Internal -- parse html declarations, return length or -1 if not terminated
253
+ # See w3.org/TR/html5/tokenization.html#markup-declaration-open-state
254
+ # See also parse_declaration in _markupbase
255
+ def parse_html_declaration(self, i):
256
+ rawdata = self.rawdata
257
+ assert rawdata[i:i+2] == '<!', ('unexpected call to '
258
+ 'parse_html_declaration()')
259
+ if rawdata[i:i+4] == '<!--':
260
+ # this case is actually already handled in goahead()
261
+ return self.parse_comment(i)
262
+ elif rawdata[i:i+3] == '<![':
263
+ return self.parse_marked_section(i)
264
+ elif rawdata[i:i+9].lower() == '<!doctype':
265
+ # find the closing >
266
+ gtpos = rawdata.find('>', i+9)
267
+ if gtpos == -1:
268
+ return -1
269
+ self.handle_decl(rawdata[i+2:gtpos])
270
+ return gtpos+1
271
+ else:
272
+ return self.parse_bogus_comment(i)
273
+
274
+ # Internal -- parse bogus comment, return length or -1 if not terminated
275
+ # see http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state
276
+ def parse_bogus_comment(self, i, report=1):
277
+ rawdata = self.rawdata
278
+ assert rawdata[i:i+2] in ('<!', '</'), ('unexpected call to '
279
+ 'parse_comment()')
280
+ pos = rawdata.find('>', i+2)
281
+ if pos == -1:
282
+ return -1
283
+ if report:
284
+ self.handle_comment(rawdata[i+2:pos])
285
+ return pos + 1
286
+
287
+ # Internal -- parse processing instr, return end or -1 if not terminated
288
+ def parse_pi(self, i):
289
+ rawdata = self.rawdata
290
+ assert rawdata[i:i+2] == '<?', 'unexpected call to parse_pi()'
291
+ match = piclose.search(rawdata, i+2) # >
292
+ if not match:
293
+ return -1
294
+ j = match.start()
295
+ self.handle_pi(rawdata[i+2: j])
296
+ j = match.end()
297
+ return j
298
+
299
+ # Internal -- handle starttag, return end or -1 if not terminated
300
+ def parse_starttag(self, i):
301
+ self.__starttag_text = None
302
+ endpos = self.check_for_whole_start_tag(i)
303
+ if endpos < 0:
304
+ return endpos
305
+ rawdata = self.rawdata
306
+ self.__starttag_text = rawdata[i:endpos]
307
+
308
+ # Now parse the data between i+1 and j into a tag and attrs
309
+ attrs = []
310
+ match = tagfind_tolerant.match(rawdata, i+1)
311
+ assert match, 'unexpected call to parse_starttag()'
312
+ k = match.end()
313
+ self.lasttag = tag = match.group(1).lower()
314
+ while k < endpos:
315
+ m = attrfind_tolerant.match(rawdata, k)
316
+ if not m:
317
+ break
318
+ attrname, rest, attrvalue = m.group(1, 2, 3)
319
+ if not rest:
320
+ attrvalue = None
321
+ elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
322
+ attrvalue[:1] == '"' == attrvalue[-1:]:
323
+ attrvalue = attrvalue[1:-1]
324
+ if attrvalue:
325
+ attrvalue = unescape(attrvalue)
326
+ attrs.append((attrname.lower(), attrvalue))
327
+ k = m.end()
328
+
329
+ end = rawdata[k:endpos].strip()
330
+ if end not in (">", "/>"):
331
+ lineno, offset = self.getpos()
332
+ if "\n" in self.__starttag_text:
333
+ lineno = lineno + self.__starttag_text.count("\n")
334
+ offset = len(self.__starttag_text) \
335
+ - self.__starttag_text.rfind("\n")
336
+ else:
337
+ offset = offset + len(self.__starttag_text)
338
+ self.handle_data(rawdata[i:endpos])
339
+ return endpos
340
+ if end.endswith('/>'):
341
+ # XHTML-style empty tag: <span attr="value" />
342
+ self.handle_startendtag(tag, attrs)
343
+ else:
344
+ self.handle_starttag(tag, attrs)
345
+ if tag in self.CDATA_CONTENT_ELEMENTS:
346
+ self.set_cdata_mode(tag)
347
+ return endpos
348
+
349
+ # Internal -- check to see if we have a complete starttag; return end
350
+ # or -1 if incomplete.
351
+ def check_for_whole_start_tag(self, i):
352
+ rawdata = self.rawdata
353
+ m = locatestarttagend_tolerant.match(rawdata, i)
354
+ if m:
355
+ j = m.end()
356
+ next = rawdata[j:j+1]
357
+ if next == ">":
358
+ return j + 1
359
+ if next == "/":
360
+ if rawdata.startswith("/>", j):
361
+ return j + 2
362
+ if rawdata.startswith("/", j):
363
+ # buffer boundary
364
+ return -1
365
+ # else bogus input
366
+ if j > i:
367
+ return j
368
+ else:
369
+ return i + 1
370
+ if next == "":
371
+ # end of input
372
+ return -1
373
+ if next in ("abcdefghijklmnopqrstuvwxyz=/"
374
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
375
+ # end of input in or before attribute value, or we have the
376
+ # '/' from a '/>' ending
377
+ return -1
378
+ if j > i:
379
+ return j
380
+ else:
381
+ return i + 1
382
+ raise AssertionError("we should not get here!")
383
+
384
+ # Internal -- parse endtag, return end or -1 if incomplete
385
+ def parse_endtag(self, i):
386
+ rawdata = self.rawdata
387
+ assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag"
388
+ match = endendtag.search(rawdata, i+1) # >
389
+ if not match:
390
+ return -1
391
+ gtpos = match.end()
392
+ match = endtagfind.match(rawdata, i) # </ + tag + >
393
+ if not match:
394
+ if self.cdata_elem is not None:
395
+ self.handle_data(rawdata[i:gtpos])
396
+ return gtpos
397
+ # find the name: w3.org/TR/html5/tokenization.html#tag-name-state
398
+ namematch = tagfind_tolerant.match(rawdata, i+2)
399
+ if not namematch:
400
+ # w3.org/TR/html5/tokenization.html#end-tag-open-state
401
+ if rawdata[i:i+3] == '</>':
402
+ return i+3
403
+ else:
404
+ return self.parse_bogus_comment(i)
405
+ tagname = namematch.group(1).lower()
406
+ # consume and ignore other stuff between the name and the >
407
+ # Note: this is not 100% correct, since we might have things like
408
+ # </tag attr=">">, but looking for > after the name should cover
409
+ # most of the cases and is much simpler
410
+ gtpos = rawdata.find('>', namematch.end())
411
+ self.handle_endtag(tagname)
412
+ return gtpos+1
413
+
414
+ elem = match.group(1).lower() # script or style
415
+ if self.cdata_elem is not None:
416
+ if elem != self.cdata_elem:
417
+ self.handle_data(rawdata[i:gtpos])
418
+ return gtpos
419
+
420
+ self.handle_endtag(elem)
421
+ self.clear_cdata_mode()
422
+ return gtpos
423
+
424
+ # Overridable -- finish processing of start+end tag: <tag.../>
425
+ def handle_startendtag(self, tag, attrs):
426
+ self.handle_starttag(tag, attrs)
427
+ self.handle_endtag(tag)
428
+
429
+ # Overridable -- handle start tag
430
+ def handle_starttag(self, tag, attrs):
431
+ pass
432
+
433
+ # Overridable -- handle end tag
434
+ def handle_endtag(self, tag):
435
+ pass
436
+
437
+ # Overridable -- handle character reference
438
+ def handle_charref(self, name):
439
+ pass
440
+
441
+ # Overridable -- handle entity reference
442
+ def handle_entityref(self, name):
443
+ pass
444
+
445
+ # Overridable -- handle data
446
+ def handle_data(self, data):
447
+ pass
448
+
449
+ # Overridable -- handle comment
450
+ def handle_comment(self, data):
451
+ pass
452
+
453
+ # Overridable -- handle declaration
454
+ def handle_decl(self, decl):
455
+ pass
456
+
457
+ # Overridable -- handle processing instruction
458
+ def handle_pi(self, data):
459
+ pass
460
+
461
+ def unknown_decl(self, data):
462
+ pass
omnilmm/lib/python3.10/lib-dynload/_contextvars.cpython-310-x86_64-linux-gnu.so ADDED
Binary file (27 kB). View file
 
omnilmm/lib/python3.10/lib-dynload/_sha256.cpython-310-x86_64-linux-gnu.so ADDED
Binary file (94.3 kB). View file
 
omnilmm/lib/python3.10/lib-dynload/termios.cpython-310-x86_64-linux-gnu.so ADDED
Binary file (66.7 kB). View file
 
omnilmm/lib/python3.10/pydoc_data/__init__.py ADDED
File without changes
omnilmm/lib/python3.10/pydoc_data/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (389 Bytes). View file
 
omnilmm/lib/python3.10/pydoc_data/__pycache__/topics.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dffef3c0712bd73e5482a02854d50321d73026fe00e6b4eac72244eb11388085
3
+ size 473761
omnilmm/lib/python3.10/pydoc_data/_pydoc.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /*
2
+ CSS file for pydoc.
3
+
4
+ Contents of this file are subject to change without notice.
5
+
6
+ */
omnilmm/lib/python3.10/pydoc_data/topics.py ADDED
The diff for this file is too large to render. See raw diff