diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf-6.11.0.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf-6.11.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..d8b9936dad9ab2513fa6979f411560d3b6b57e37 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf-6.11.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.12.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf-6.11.0.dist-info/licenses/LICENSE b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf-6.11.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ab327d0312875458ba74983867f1b2622b6de39d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf-6.11.0.dist-info/licenses/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2006-2008, Mathieu Fenniak +Some contributions copyright (c) 2007, Ashish Kulkarni +Some contributions copyright (c) 2014, Steve Witham + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +* The name of the author may not be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_cmap.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_cmap.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce9843afdaa0d5f2f9c2c0d8f6e23fb252ba043a Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_cmap.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_doc_common.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_doc_common.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf714f756d6a81f90d0cd8c5be818305b850e304 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_doc_common.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_encryption.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_encryption.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..624d8a1b5a8c96ef94259d7f4484037bb4a860fd Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/_encryption.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/constants.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/constants.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..191401521cdabc849549611dbec9d44f88ec3882 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/constants.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/errors.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/errors.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..344b0f8048497d4a5755fba7f3e07cad005adf03 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/errors.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/filters.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/filters.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b22f6585331259970cc48c60d72042f7e3e5c5bc Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/filters.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/pagerange.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/pagerange.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5d4892335a850a33984311f472dc98cc0151c06 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/pagerange.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/papersizes.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/papersizes.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8284d9f96b6a489ae2b6c23fb59be2006b8db27a Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/papersizes.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/types.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/types.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8ef7eaafc718bf2dbb6d16298aa4fb1b2751026 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/types.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/xmp.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/xmp.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69f2685b478b13e7a270f56953bba3c15b21a2a5 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/__pycache__/xmp.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3693a5a87b8e212fe3919e9cef6700cfe71a1428 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/__init__.py @@ -0,0 +1,55 @@ +from .adobe_glyphs import adobe_glyphs +from .pdfdoc import _pdfdoc_encoding +from .std import _std_encoding +from .symbol import _symbol_encoding +from .zapfding import _zapfding_encoding + + +def fill_from_encoding(enc: str) -> list[str]: + lst: list[str] = [] + for x in range(256): + try: + lst += (bytes((x,)).decode(enc),) + except Exception: + lst += (chr(x),) + return lst + + +def rev_encoding(enc: list[str]) -> dict[str, int]: + rev: dict[str, int] = {} + for i in range(256): + char = enc[i] + if char == "\u0000": + continue + assert char not in rev, f"{char} at {i} already at {rev[char]}" + rev[char] = i + return rev + + +_win_encoding = fill_from_encoding("cp1252") +_mac_encoding = fill_from_encoding("mac_roman") + + +_pdfdoc_encoding_rev: dict[str, int] = rev_encoding(_pdfdoc_encoding) + + +charset_encoding: dict[str, list[str]] = { + "/StandardEncoding": _std_encoding, + "/WinAnsiEncoding": _win_encoding, + "/MacRomanEncoding": _mac_encoding, + "/PDFDocEncoding": _pdfdoc_encoding, + "/Symbol": _symbol_encoding, + "/ZapfDingbats": _zapfding_encoding, +} + +__all__ = [ + "_mac_encoding", + "_pdfdoc_encoding", + "_pdfdoc_encoding_rev", + "_std_encoding", + "_symbol_encoding", + "_win_encoding", + "_zapfding_encoding", + "adobe_glyphs", + "charset_encoding", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/_codecs.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/_codecs.py new file mode 100644 index 0000000000000000000000000000000000000000..93f95e5aad3aaf9c65ba15bbedb7acc88b2ba85f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/_codecs.py @@ -0,0 +1,281 @@ +""" +This module is for codecs only. + +While the codec implementation can contain details of the PDF specification, +the module should not do any PDF parsing. +""" + +import io +from abc import ABC, abstractmethod + +from pypdf._utils import logger_warning +from pypdf.errors import LimitReachedError + + +class Codec(ABC): + """Abstract base class for all codecs.""" + + @abstractmethod + def encode(self, data: bytes) -> bytes: + """ + Encode the input data. + + Args: + data: Data to encode. + + Returns: + Encoded data. + + """ + + @abstractmethod + def decode(self, data: bytes) -> bytes: + """ + Decode the input data. + + Args: + data: Data to decode. + + Returns: + Decoded data. + + """ + + +class LzwCodec(Codec): + """Lempel-Ziv-Welch (LZW) adaptive compression codec.""" + + CLEAR_TABLE_MARKER = 256 # Special code to indicate table reset + EOD_MARKER = 257 # End-of-data marker + INITIAL_BITS_PER_CODE = 9 # Initial code bit width + MAX_BITS_PER_CODE = 12 # Maximum code bit width + + def __init__(self, max_output_length: int = 75_000_000) -> None: + self.max_output_length = max_output_length + + def _initialize_encoding_table(self) -> None: + """Initialize the encoding table and state to initial conditions.""" + self.encoding_table: dict[bytes, int] = {bytes([i]): i for i in range(256)} + self.next_code = self.EOD_MARKER + 1 + self.bits_per_code = self.INITIAL_BITS_PER_CODE + self.max_code_value = (1 << self.bits_per_code) - 1 + + def _increase_next_code(self) -> None: + """Update bits_per_code and max_code_value if necessary.""" + self.next_code += 1 + if ( + self.next_code > self.max_code_value + and self.bits_per_code < self.MAX_BITS_PER_CODE + ): + self.bits_per_code += 1 + self.max_code_value = (1 << self.bits_per_code) - 1 + + def encode(self, data: bytes) -> bytes: + """ + Encode data using the LZW compression algorithm. + + Taken from PDF 1.7 specs, "7.4.4.2 Details of LZW Encoding". + """ + result_codes: list[int] = [] + + # The encoder shall begin by issuing a clear-table code + result_codes.append(self.CLEAR_TABLE_MARKER) + self._initialize_encoding_table() + + current_sequence = b"" + for byte in data: + next_sequence = current_sequence + bytes([byte]) + + if next_sequence in self.encoding_table: + # Extend current sequence if already in the table + current_sequence = next_sequence + else: + # Output code for the current sequence + result_codes.append(self.encoding_table[current_sequence]) + + # Add the new sequence to the table if there's room + if self.next_code <= (1 << self.MAX_BITS_PER_CODE) - 1: + self.encoding_table[next_sequence] = self.next_code + self._increase_next_code() + else: + # If the table is full, emit a clear-table command + result_codes.append(self.CLEAR_TABLE_MARKER) + self._initialize_encoding_table() + + # Start new sequence + current_sequence = bytes([byte]) + + # Ensure everything actually is encoded + if current_sequence: + result_codes.append(self.encoding_table[current_sequence]) + result_codes.append(self.EOD_MARKER) + + return self._pack_codes_into_bytes(result_codes) + + def _pack_codes_into_bytes(self, codes: list[int]) -> bytes: + """ + Convert the list of result codes into a continuous byte stream, with codes packed as per the code bit-width. + The bit-width starts at 9 bits and expands as needed. + """ + self._initialize_encoding_table() + buffer = 0 + bits_in_buffer = 0 + output = bytearray() + + for code in codes: + buffer = (buffer << self.bits_per_code) | code + bits_in_buffer += self.bits_per_code + + # Codes shall be packed into a continuous bit stream, high-order bit + # first. This stream shall then be divided into bytes, high-order bit + # first. + while bits_in_buffer >= 8: + bits_in_buffer -= 8 + output.append((buffer >> bits_in_buffer) & 0xFF) + + if code == self.CLEAR_TABLE_MARKER: + self._initialize_encoding_table() + elif code == self.EOD_MARKER: + continue + else: + self._increase_next_code() + + # Flush any remaining bits in the buffer + if bits_in_buffer > 0: + output.append((buffer << (8 - bits_in_buffer)) & 0xFF) + + return bytes(output) + + def _initialize_decoding_table(self) -> None: + self.max_code_value = (1 << self.MAX_BITS_PER_CODE) - 1 + self.decoding_table = [bytes([i]) for i in range(self.CLEAR_TABLE_MARKER)] + [ + b"" + ] * (self.max_code_value - self.CLEAR_TABLE_MARKER + 1) + self._table_index = self.EOD_MARKER + 1 + self._bits_to_get = 9 + + def _next_code_decode(self, data: bytes) -> int: + self._next_data: int + try: + while self._next_bits < self._bits_to_get: + self._next_data = (self._next_data << 8) | ( + data[self._byte_pointer] + ) + self._byte_pointer += 1 + self._next_bits += 8 + + code = ( + self._next_data >> (self._next_bits - self._bits_to_get) + ) & self._and_table[self._bits_to_get - 9] + self._next_bits -= self._bits_to_get + + # Reduce data to get rid of the overhead, + # which increases performance on large streams significantly. + self._next_data = self._next_data & 0xFFFFF + + return code + except IndexError: + return self.EOD_MARKER + + # The following method has been converted to Python from PDFsharp: + # https://github.com/empira/PDFsharp/blob/5fbf6ed14740bc4e16786816882d32e43af3ff5d/src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Filters/LzwDecode.cs + # + # Original license: + # + # ------------------------------------------------------------------------- + # Copyright (c) 2001-2024 empira Software GmbH, Troisdorf (Cologne Area), + # Germany + # + # http://docs.pdfsharp.net + # + # MIT License + # + # Permission is hereby granted, free of charge, to any person obtaining a + # copy of this software and associated documentation files (the "Software"), + # to deal in the Software without restriction, including without limitation + # the rights to use, copy, modify, merge, publish, distribute, sublicense, + # and/or sell copies of the Software, and to permit persons to whom the + # Software is furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included + # in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + # DEALINGS IN THE SOFTWARE. + # -------------------------------------------------------------------------- + def decode(self, data: bytes) -> bytes: + """ + The following code was converted to Python from the following code: + https://github.com/empira/PDFsharp/blob/master/src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Filters/LzwDecode.cs + """ + self._and_table = [511, 1023, 2047, 4095] + self._table_index = 0 + self._bits_to_get = 9 + self._byte_pointer = 0 + self._next_data = 0 + self._next_bits = 0 + + output_stream = io.BytesIO() + output_length = 0 + + self._initialize_decoding_table() + self._byte_pointer = 0 + self._next_data = 0 + self._next_bits = 0 + old_code = self.CLEAR_TABLE_MARKER + + while True: + code = self._next_code_decode(data) + if code == self.EOD_MARKER: + break + + if code == self.CLEAR_TABLE_MARKER: + self._initialize_decoding_table() + code = self._next_code_decode(data) + if code == self.EOD_MARKER: + break + output_stream.write(decoded := self.decoding_table[code]) + old_code = code + elif code < self._table_index: + decoded = self.decoding_table[code] + output_stream.write(decoded) + if old_code != self.CLEAR_TABLE_MARKER: + self._add_entry_decode(self.decoding_table[old_code], decoded[0]) + old_code = code + else: + # The code is not in the table and not one of the special codes + decoded = ( + self.decoding_table[old_code] + self.decoding_table[old_code][:1] + ) + output_stream.write(decoded) + self._add_entry_decode(self.decoding_table[old_code], decoded[0]) + old_code = code + + output_length += len(decoded) + if output_length > self.max_output_length: + raise LimitReachedError( + f"Limit reached while decompressing: {output_length} > {self.max_output_length}" + ) + + return output_stream.getvalue() + + def _add_entry_decode(self, old_string: bytes, new_char: int) -> None: + new_string = old_string + bytes([new_char]) + if self._table_index > self.max_code_value: + logger_warning("Ignoring too large LZW table index.", __name__) + return + self.decoding_table[self._table_index] = new_string + self._table_index += 1 + + # Update the number of bits to get based on the table index + if self._table_index == 511: + self._bits_to_get = 10 + elif self._table_index == 1023: + self._bits_to_get = 11 + elif self._table_index == 2047: + self._bits_to_get = 12 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/adobe_glyphs.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/adobe_glyphs.py new file mode 100644 index 0000000000000000000000000000000000000000..72d5ed3247b24e4c6887bf2e51001906ee2a3ffb --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/adobe_glyphs.py @@ -0,0 +1,13969 @@ +# https://raw.githubusercontent.com/adobe-type-tools/agl-aglfn/master/glyphlist.txt + +# converted manually to python +# Extended with data from GlyphNameFormatter: +# https://github.com/LettError/glyphNameFormatter + +# ----------------------------------------------------------- +# Copyright 2002-2019 Adobe (http://www.adobe.com/). +# +# Redistribution and use in source and binary forms, with or +# without modification, are permitted provided that the +# following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of Adobe nor the names of its contributors +# may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------- +# Name: Adobe Glyph List +# Table version: 2.0 +# Date: September 20, 2002 +# URL: https://github.com/adobe-type-tools/agl-aglfn +# +# Format: two semicolon-delimited fields: +# (1) glyph name--upper/lowercase letters and digits +# (2) Unicode scalar value--four uppercase hexadecimal digits +# +adobe_glyphs = { + "/A": "\u0041", + "/AA": "\uA732", + "/AE": "\u00C6", + "/AEacute": "\u01FC", + "/AEmacron": "\u01E2", + "/AEsmall": "\uF7E6", + "/AO": "\uA734", + "/AU": "\uA736", + "/AV": "\uA738", + "/AVhorizontalbar": "\uA73A", + "/AY": "\uA73C", + "/Aacute": "\u00C1", + "/Aacutesmall": "\uF7E1", + "/Abreve": "\u0102", + "/Abreveacute": "\u1EAE", + "/Abrevecyr": "\u04D0", + "/Abrevecyrillic": "\u04D0", + "/Abrevedotbelow": "\u1EB6", + "/Abrevegrave": "\u1EB0", + "/Abrevehoi": "\u1EB2", + "/Abrevehookabove": "\u1EB2", + "/Abrevetilde": "\u1EB4", + "/Acaron": "\u01CD", + "/Acircle": "\u24B6", + "/Acircleblack": "\u1F150", + "/Acircumflex": "\u00C2", + "/Acircumflexacute": "\u1EA4", + "/Acircumflexdotbelow": "\u1EAC", + "/Acircumflexgrave": "\u1EA6", + "/Acircumflexhoi": "\u1EA8", + "/Acircumflexhookabove": "\u1EA8", + "/Acircumflexsmall": "\uF7E2", + "/Acircumflextilde": "\u1EAA", + "/Acute": "\uF6C9", + "/Acutesmall": "\uF7B4", + "/Acyr": "\u0410", + "/Acyrillic": "\u0410", + "/Adblgrave": "\u0200", + "/Adieresis": "\u00C4", + "/Adieresiscyr": "\u04D2", + "/Adieresiscyrillic": "\u04D2", + "/Adieresismacron": "\u01DE", + "/Adieresissmall": "\uF7E4", + "/Adot": "\u0226", + "/Adotbelow": "\u1EA0", + "/Adotmacron": "\u01E0", + "/Agrave": "\u00C0", + "/Agravedbl": "\u0200", + "/Agravesmall": "\uF7E0", + "/Ahoi": "\u1EA2", + "/Ahookabove": "\u1EA2", + "/Aiecyr": "\u04D4", + "/Aiecyrillic": "\u04D4", + "/Ainvertedbreve": "\u0202", + "/Akbar": "\uFDF3", + "/Alayhe": "\uFDF7", + "/Allah": "\uFDF2", + "/Alpha": "\u0391", + "/Alphaacute": "\u1FBB", + "/Alphaasper": "\u1F09", + "/Alphaasperacute": "\u1F0D", + "/Alphaasperacuteiotasub": "\u1F8D", + "/Alphaaspergrave": "\u1F0B", + "/Alphaaspergraveiotasub": "\u1F8B", + "/Alphaasperiotasub": "\u1F89", + "/Alphaaspertilde": "\u1F0F", + "/Alphaaspertildeiotasub": "\u1F8F", + "/Alphabreve": "\u1FB8", + "/Alphagrave": "\u1FBA", + "/Alphaiotasub": "\u1FBC", + "/Alphalenis": "\u1F08", + "/Alphalenisacute": "\u1F0C", + "/Alphalenisacuteiotasub": "\u1F8C", + "/Alphalenisgrave": "\u1F0A", + "/Alphalenisgraveiotasub": "\u1F8A", + "/Alphalenisiotasub": "\u1F88", + "/Alphalenistilde": "\u1F0E", + "/Alphalenistildeiotasub": "\u1F8E", + "/Alphatonos": "\u0386", + "/Alphawithmacron": "\u1FB9", + "/Amacron": "\u0100", + "/Amonospace": "\uFF21", + "/Aogonek": "\u0104", + "/Aparens": "\u1F110", + "/Aring": "\u00C5", + "/Aringacute": "\u01FA", + "/Aringbelow": "\u1E00", + "/Aringsmall": "\uF7E5", + "/Asmall": "\uF761", + "/Asquare": "\u1F130", + "/Asquareblack": "\u1F170", + "/Astroke": "\u023A", + "/Atilde": "\u00C3", + "/Atildesmall": "\uF7E3", + "/Aturned": "\u2C6F", + "/Ayahend": "\u06DD", + "/Aybarmenian": "\u0531", + "/B": "\u0042", + "/Bcircle": "\u24B7", + "/Bcircleblack": "\u1F151", + "/Bdot": "\u1E02", + "/Bdotaccent": "\u1E02", + "/Bdotbelow": "\u1E04", + "/Becyr": "\u0411", + "/Becyrillic": "\u0411", + "/Benarmenian": "\u0532", + "/Beta": "\u0392", + "/Bflourish": "\uA796", + "/Bhook": "\u0181", + "/BismillahArRahmanArRaheem": "\uFDFD", + "/Blinebelow": "\u1E06", + "/Bmonospace": "\uFF22", + "/Bparens": "\u1F111", + "/Brevesmall": "\uF6F4", + "/Bscript": "\u212C", + "/Bsmall": "\uF762", + "/Bsquare": "\u1F131", + "/Bsquareblack": "\u1F171", + "/Bstroke": "\u0243", + "/Btopbar": "\u0182", + "/C": "\u0043", + "/CDcircle": "\u1F12D", + "/Caarmenian": "\u053E", + "/Cacute": "\u0106", + "/Caron": "\uF6CA", + "/Caronsmall": "\uF6F5", + "/Cbar": "\uA792", + "/Ccaron": "\u010C", + "/Ccedilla": "\u00C7", + "/Ccedillaacute": "\u1E08", + "/Ccedillasmall": "\uF7E7", + "/Ccircle": "\u24B8", + "/Ccircleblack": "\u1F152", + "/Ccircumflex": "\u0108", + "/Cdblstruck": "\u2102", + "/Cdot": "\u010A", + "/Cdotaccent": "\u010A", + "/Cdotreversed": "\uA73E", + "/Cedillasmall": "\uF7B8", + "/Cfraktur": "\u212D", + "/Chaarmenian": "\u0549", + "/Cheabkhasiancyrillic": "\u04BC", + "/Cheabkhcyr": "\u04BC", + "/Cheabkhtailcyr": "\u04BE", + "/Checyr": "\u0427", + "/Checyrillic": "\u0427", + "/Chedescenderabkhasiancyrillic": "\u04BE", + "/Chedescendercyrillic": "\u04B6", + "/Chedieresiscyr": "\u04F4", + "/Chedieresiscyrillic": "\u04F4", + "/Cheharmenian": "\u0543", + "/Chekhakascyr": "\u04CB", + "/Chekhakassiancyrillic": "\u04CB", + "/Chetailcyr": "\u04B6", + "/Chevertcyr": "\u04B8", + "/Cheverticalstrokecyrillic": "\u04B8", + "/Chi": "\u03A7", + "/Chook": "\u0187", + "/Circumflexsmall": "\uF6F6", + "/Citaliccircle": "\u1F12B", + "/Cmonospace": "\uFF23", + "/Coarmenian": "\u0551", + "/Con": "\uA76E", + "/Cparens": "\u1F112", + "/Csmall": "\uF763", + "/Csquare": "\u1F132", + "/Csquareblack": "\u1F172", + "/Cstretched": "\u0297", + "/Cstroke": "\u023B", + "/Cuatrillo": "\uA72C", + "/Cuatrillocomma": "\uA72E", + "/D": "\u0044", + "/DZ": "\u01F1", + "/DZcaron": "\u01C4", + "/Daarmenian": "\u0534", + "/Dafrican": "\u0189", + "/Dcaron": "\u010E", + "/Dcedilla": "\u1E10", + "/Dchecyr": "\u052C", + "/Dcircle": "\u24B9", + "/Dcircleblack": "\u1F153", + "/Dcircumflexbelow": "\u1E12", + "/Dcroat": "\u0110", + "/Ddblstruckitalic": "\u2145", + "/Ddot": "\u1E0A", + "/Ddotaccent": "\u1E0A", + "/Ddotbelow": "\u1E0C", + "/Decyr": "\u0414", + "/Decyrillic": "\u0414", + "/Deicoptic": "\u03EE", + "/Dekomicyr": "\u0500", + "/Delta": "\u2206", + "/Deltagreek": "\u0394", + "/Dhook": "\u018A", + "/Dieresis": "\uF6CB", + "/DieresisAcute": "\uF6CC", + "/DieresisGrave": "\uF6CD", + "/Dieresissmall": "\uF7A8", + "/Digamma": "\u03DC", + "/Digammagreek": "\u03DC", + "/Digammapamphylian": "\u0376", + "/Dinsular": "\uA779", + "/Djecyr": "\u0402", + "/Djecyrillic": "\u0402", + "/Djekomicyr": "\u0502", + "/Dlinebelow": "\u1E0E", + "/Dmonospace": "\uFF24", + "/Dotaccentsmall": "\uF6F7", + "/Dparens": "\u1F113", + "/Dslash": "\u0110", + "/Dsmall": "\uF764", + "/Dsquare": "\u1F133", + "/Dsquareblack": "\u1F173", + "/Dtopbar": "\u018B", + "/Dz": "\u01F2", + "/Dzcaron": "\u01C5", + "/Dzeabkhasiancyrillic": "\u04E0", + "/Dzeabkhcyr": "\u04E0", + "/Dzecyr": "\u0405", + "/Dzecyrillic": "\u0405", + "/Dzhecyr": "\u040F", + "/Dzhecyrillic": "\u040F", + "/Dzjekomicyr": "\u0506", + "/Dzzhecyr": "\u052A", + "/E": "\u0045", + "/Eacute": "\u00C9", + "/Eacutesmall": "\uF7E9", + "/Ebreve": "\u0114", + "/Ecaron": "\u011A", + "/Ecedilla": "\u0228", + "/Ecedillabreve": "\u1E1C", + "/Echarmenian": "\u0535", + "/Ecircle": "\u24BA", + "/Ecircleblack": "\u1F154", + "/Ecircumflex": "\u00CA", + "/Ecircumflexacute": "\u1EBE", + "/Ecircumflexbelow": "\u1E18", + "/Ecircumflexdotbelow": "\u1EC6", + "/Ecircumflexgrave": "\u1EC0", + "/Ecircumflexhoi": "\u1EC2", + "/Ecircumflexhookabove": "\u1EC2", + "/Ecircumflexsmall": "\uF7EA", + "/Ecircumflextilde": "\u1EC4", + "/Ecyrillic": "\u0404", + "/Edblgrave": "\u0204", + "/Edieresis": "\u00CB", + "/Edieresissmall": "\uF7EB", + "/Edot": "\u0116", + "/Edotaccent": "\u0116", + "/Edotbelow": "\u1EB8", + "/Efcyr": "\u0424", + "/Efcyrillic": "\u0424", + "/Egrave": "\u00C8", + "/Egravedbl": "\u0204", + "/Egravesmall": "\uF7E8", + "/Egyptain": "\uA724", + "/Egyptalef": "\uA722", + "/Eharmenian": "\u0537", + "/Ehoi": "\u1EBA", + "/Ehookabove": "\u1EBA", + "/Eightroman": "\u2167", + "/Einvertedbreve": "\u0206", + "/Eiotifiedcyr": "\u0464", + "/Eiotifiedcyrillic": "\u0464", + "/Elcyr": "\u041B", + "/Elcyrillic": "\u041B", + "/Elevenroman": "\u216A", + "/Elhookcyr": "\u0512", + "/Elmiddlehookcyr": "\u0520", + "/Elsharptailcyr": "\u04C5", + "/Eltailcyr": "\u052E", + "/Emacron": "\u0112", + "/Emacronacute": "\u1E16", + "/Emacrongrave": "\u1E14", + "/Emcyr": "\u041C", + "/Emcyrillic": "\u041C", + "/Emonospace": "\uFF25", + "/Emsharptailcyr": "\u04CD", + "/Encyr": "\u041D", + "/Encyrillic": "\u041D", + "/Endescendercyrillic": "\u04A2", + "/Eng": "\u014A", + "/Engecyr": "\u04A4", + "/Enghecyrillic": "\u04A4", + "/Enhookcyr": "\u04C7", + "/Enhookcyrillic": "\u04C7", + "/Enhookleftcyr": "\u0528", + "/Enmiddlehookcyr": "\u0522", + "/Ensharptailcyr": "\u04C9", + "/Entailcyr": "\u04A2", + "/Eogonek": "\u0118", + "/Eopen": "\u0190", + "/Eparens": "\u1F114", + "/Epsilon": "\u0395", + "/Epsilonacute": "\u1FC9", + "/Epsilonasper": "\u1F19", + "/Epsilonasperacute": "\u1F1D", + "/Epsilonaspergrave": "\u1F1B", + "/Epsilongrave": "\u1FC8", + "/Epsilonlenis": "\u1F18", + "/Epsilonlenisacute": "\u1F1C", + "/Epsilonlenisgrave": "\u1F1A", + "/Epsilontonos": "\u0388", + "/Ercyr": "\u0420", + "/Ercyrillic": "\u0420", + "/Ereversed": "\u018E", + "/Ereversedcyr": "\u042D", + "/Ereversedcyrillic": "\u042D", + "/Ereverseddieresiscyr": "\u04EC", + "/Ereversedopen": "\uA7AB", + "/Ertickcyr": "\u048E", + "/Escript": "\u2130", + "/Escyr": "\u0421", + "/Escyrillic": "\u0421", + "/Esdescendercyrillic": "\u04AA", + "/Esh": "\u01A9", + "/Esmall": "\uF765", + "/Esmallturned": "\u2C7B", + "/Esquare": "\u1F134", + "/Esquareblack": "\u1F174", + "/Estailcyr": "\u04AA", + "/Estroke": "\u0246", + "/Et": "\uA76A", + "/Eta": "\u0397", + "/Etaacute": "\u1FCB", + "/Etaasper": "\u1F29", + "/Etaasperacute": "\u1F2D", + "/Etaasperacuteiotasub": "\u1F9D", + "/Etaaspergrave": "\u1F2B", + "/Etaaspergraveiotasub": "\u1F9B", + "/Etaasperiotasub": "\u1F99", + "/Etaaspertilde": "\u1F2F", + "/Etaaspertildeiotasub": "\u1F9F", + "/Etagrave": "\u1FCA", + "/Etaiotasub": "\u1FCC", + "/Etalenis": "\u1F28", + "/Etalenisacute": "\u1F2C", + "/Etalenisacuteiotasub": "\u1F9C", + "/Etalenisgrave": "\u1F2A", + "/Etalenisgraveiotasub": "\u1F9A", + "/Etalenisiotasub": "\u1F98", + "/Etalenistilde": "\u1F2E", + "/Etalenistildeiotasub": "\u1F9E", + "/Etarmenian": "\u0538", + "/Etatonos": "\u0389", + "/Eth": "\u00D0", + "/Ethsmall": "\uF7F0", + "/Etilde": "\u1EBC", + "/Etildebelow": "\u1E1A", + "/Eukrcyr": "\u0404", + "/Euro": "\u20AC", + "/Ezh": "\u01B7", + "/Ezhcaron": "\u01EE", + "/Ezhreversed": "\u01B8", + "/F": "\u0046", + "/Fcircle": "\u24BB", + "/Fcircleblack": "\u1F155", + "/Fdot": "\u1E1E", + "/Fdotaccent": "\u1E1E", + "/Feharmenian": "\u0556", + "/Feicoptic": "\u03E4", + "/Fhook": "\u0191", + "/Finsular": "\uA77B", + "/Fitacyr": "\u0472", + "/Fitacyrillic": "\u0472", + "/Fiveroman": "\u2164", + "/Fmonospace": "\uFF26", + "/Fourroman": "\u2163", + "/Fparens": "\u1F115", + "/Fscript": "\u2131", + "/Fsmall": "\uF766", + "/Fsquare": "\u1F135", + "/Fsquareblack": "\u1F175", + "/Fstroke": "\uA798", + "/Fturned": "\u2132", + "/G": "\u0047", + "/GBsquare": "\u3387", + "/Gacute": "\u01F4", + "/Gamma": "\u0393", + "/Gammaafrican": "\u0194", + "/Gammadblstruck": "\u213E", + "/Gangiacoptic": "\u03EA", + "/Gbreve": "\u011E", + "/Gcaron": "\u01E6", + "/Gcedilla": "\u0122", + "/Gcircle": "\u24BC", + "/Gcircleblack": "\u1F156", + "/Gcircumflex": "\u011C", + "/Gcommaaccent": "\u0122", + "/Gdot": "\u0120", + "/Gdotaccent": "\u0120", + "/Gecyr": "\u0413", + "/Gecyrillic": "\u0413", + "/Gehookcyr": "\u0494", + "/Gehookstrokecyr": "\u04FA", + "/Germandbls": "\u1E9E", + "/Gestrokecyr": "\u0492", + "/Getailcyr": "\u04F6", + "/Geupcyr": "\u0490", + "/Ghadarmenian": "\u0542", + "/Ghemiddlehookcyrillic": "\u0494", + "/Ghestrokecyrillic": "\u0492", + "/Gheupturncyrillic": "\u0490", + "/Ghook": "\u0193", + "/Ghooksmall": "\u029B", + "/Gimarmenian": "\u0533", + "/Ginsular": "\uA77D", + "/Ginsularturned": "\uA77E", + "/Gjecyr": "\u0403", + "/Gjecyrillic": "\u0403", + "/Glottalstop": "\u0241", + "/Gmacron": "\u1E20", + "/Gmonospace": "\uFF27", + "/Gobliquestroke": "\uA7A0", + "/Gparens": "\u1F116", + "/Grave": "\uF6CE", + "/Gravesmall": "\uF760", + "/Gsmall": "\uF767", + "/Gsmallhook": "\u029B", + "/Gsquare": "\u1F136", + "/Gsquareblack": "\u1F176", + "/Gstroke": "\u01E4", + "/Gturnedsans": "\u2141", + "/H": "\u0048", + "/H18533": "\u25CF", + "/H18543": "\u25AA", + "/H18551": "\u25AB", + "/H22073": "\u25A1", + "/HPsquare": "\u33CB", + "/HVsquare": "\u1F14A", + "/Haabkhasiancyrillic": "\u04A8", + "/Haabkhcyr": "\u04A8", + "/Hacyr": "\u0425", + "/Hadescendercyrillic": "\u04B2", + "/Hahookcyr": "\u04FC", + "/Hardcyr": "\u042A", + "/Hardsigncyrillic": "\u042A", + "/Hastrokecyr": "\u04FE", + "/Hbar": "\u0126", + "/Hbrevebelow": "\u1E2A", + "/Hcaron": "\u021E", + "/Hcedilla": "\u1E28", + "/Hcircle": "\u24BD", + "/Hcircleblack": "\u1F157", + "/Hcircumflex": "\u0124", + "/Hdblstruck": "\u210D", + "/Hdescender": "\u2C67", + "/Hdieresis": "\u1E26", + "/Hdot": "\u1E22", + "/Hdotaccent": "\u1E22", + "/Hdotbelow": "\u1E24", + "/Heng": "\uA726", + "/Heta": "\u0370", + "/Hfraktur": "\u210C", + "/Hgfullwidth": "\u32CC", + "/Hhalf": "\u2C75", + "/Hhook": "\uA7AA", + "/Hmonospace": "\uFF28", + "/Hoarmenian": "\u0540", + "/HonAA": "\u0611", + "/HonRA": "\u0612", + "/HonSAW": "\u0610", + "/Horicoptic": "\u03E8", + "/Hparens": "\u1F117", + "/Hscript": "\u210B", + "/Hsmall": "\uF768", + "/Hsquare": "\u1F137", + "/Hsquareblack": "\u1F177", + "/Hstrokemod": "\uA7F8", + "/Hturned": "\uA78D", + "/Hungarumlaut": "\uF6CF", + "/Hungarumlautsmall": "\uF6F8", + "/Hwair": "\u01F6", + "/Hzsquare": "\u3390", + "/I": "\u0049", + "/IAcyrillic": "\u042F", + "/ICsquareblack": "\u1F18B", + "/IJ": "\u0132", + "/IUcyrillic": "\u042E", + "/Iacute": "\u00CD", + "/Iacutesmall": "\uF7ED", + "/Ibreve": "\u012C", + "/Icaron": "\u01CF", + "/Icircle": "\u24BE", + "/Icircleblack": "\u1F158", + "/Icircumflex": "\u00CE", + "/Icircumflexsmall": "\uF7EE", + "/Icyr": "\u0418", + "/Icyrillic": "\u0406", + "/Idblgrave": "\u0208", + "/Idieresis": "\u00CF", + "/Idieresisacute": "\u1E2E", + "/Idieresiscyr": "\u04E4", + "/Idieresiscyrillic": "\u04E4", + "/Idieresissmall": "\uF7EF", + "/Idot": "\u0130", + "/Idotaccent": "\u0130", + "/Idotbelow": "\u1ECA", + "/Iebrevecyr": "\u04D6", + "/Iebrevecyrillic": "\u04D6", + "/Iecyr": "\u0415", + "/Iecyrillic": "\u0415", + "/Iegravecyr": "\u0400", + "/Ifraktur": "\u2111", + "/Igrave": "\u00CC", + "/Igravecyr": "\u040D", + "/Igravedbl": "\u0208", + "/Igravesmall": "\uF7EC", + "/Ihoi": "\u1EC8", + "/Ihookabove": "\u1EC8", + "/Iicyrillic": "\u0418", + "/Iinvertedbreve": "\u020A", + "/Iishortcyrillic": "\u0419", + "/Imacron": "\u012A", + "/Imacroncyr": "\u04E2", + "/Imacroncyrillic": "\u04E2", + "/Imonospace": "\uFF29", + "/Iniarmenian": "\u053B", + "/Iocyr": "\u0401", + "/Iocyrillic": "\u0401", + "/Iogonek": "\u012E", + "/Iota": "\u0399", + "/Iotaacute": "\u1FDB", + "/Iotaafrican": "\u0196", + "/Iotaasper": "\u1F39", + "/Iotaasperacute": "\u1F3D", + "/Iotaaspergrave": "\u1F3B", + "/Iotaaspertilde": "\u1F3F", + "/Iotabreve": "\u1FD8", + "/Iotadieresis": "\u03AA", + "/Iotagrave": "\u1FDA", + "/Iotalenis": "\u1F38", + "/Iotalenisacute": "\u1F3C", + "/Iotalenisgrave": "\u1F3A", + "/Iotalenistilde": "\u1F3E", + "/Iotatonos": "\u038A", + "/Iotawithmacron": "\u1FD9", + "/Iparens": "\u1F118", + "/Is": "\uA76C", + "/Iscript": "\u2110", + "/Ishortcyr": "\u0419", + "/Ishortsharptailcyr": "\u048A", + "/Ismall": "\uF769", + "/Isquare": "\u1F138", + "/Isquareblack": "\u1F178", + "/Istroke": "\u0197", + "/Itilde": "\u0128", + "/Itildebelow": "\u1E2C", + "/Iukrcyr": "\u0406", + "/Izhitsacyr": "\u0474", + "/Izhitsacyrillic": "\u0474", + "/Izhitsadblgravecyrillic": "\u0476", + "/Izhitsagravedblcyr": "\u0476", + "/J": "\u004A", + "/Jaarmenian": "\u0541", + "/Jallajalalouhou": "\uFDFB", + "/Jcircle": "\u24BF", + "/Jcircleblack": "\u1F159", + "/Jcircumflex": "\u0134", + "/Jcrossed-tail": "\uA7B2", + "/Jecyr": "\u0408", + "/Jecyrillic": "\u0408", + "/Jheharmenian": "\u054B", + "/Jmonospace": "\uFF2A", + "/Jparens": "\u1F119", + "/Jsmall": "\uF76A", + "/Jsquare": "\u1F139", + "/Jsquareblack": "\u1F179", + "/Jstroke": "\u0248", + "/K": "\u004B", + "/KBsquare": "\u3385", + "/KKsquare": "\u33CD", + "/KORONIS": "\u1FBD", + "/Kaaleutcyr": "\u051E", + "/Kabashkcyr": "\u04A0", + "/Kabashkircyrillic": "\u04A0", + "/Kacute": "\u1E30", + "/Kacyr": "\u041A", + "/Kacyrillic": "\u041A", + "/Kadescendercyrillic": "\u049A", + "/Kahookcyr": "\u04C3", + "/Kahookcyrillic": "\u04C3", + "/Kaisymbol": "\u03CF", + "/Kappa": "\u039A", + "/Kastrokecyr": "\u049E", + "/Kastrokecyrillic": "\u049E", + "/Katailcyr": "\u049A", + "/Kaverticalstrokecyr": "\u049C", + "/Kaverticalstrokecyrillic": "\u049C", + "/Kcaron": "\u01E8", + "/Kcedilla": "\u0136", + "/Kcircle": "\u24C0", + "/Kcircleblack": "\u1F15A", + "/Kcommaaccent": "\u0136", + "/Kdescender": "\u2C69", + "/Kdiagonalstroke": "\uA742", + "/Kdotbelow": "\u1E32", + "/Keharmenian": "\u0554", + "/Kenarmenian": "\u053F", + "/Khacyrillic": "\u0425", + "/Kheicoptic": "\u03E6", + "/Khook": "\u0198", + "/Kjecyr": "\u040C", + "/Kjecyrillic": "\u040C", + "/Klinebelow": "\u1E34", + "/Kmonospace": "\uFF2B", + "/Kobliquestroke": "\uA7A2", + "/Koppa": "\u03DE", + "/Koppaarchaic": "\u03D8", + "/Koppacyr": "\u0480", + "/Koppacyrillic": "\u0480", + "/Koppagreek": "\u03DE", + "/Kparens": "\u1F11A", + "/Ksicyr": "\u046E", + "/Ksicyrillic": "\u046E", + "/Ksmall": "\uF76B", + "/Ksquare": "\u1F13A", + "/Ksquareblack": "\u1F17A", + "/Kstroke": "\uA740", + "/Kstrokediagonalstroke": "\uA744", + "/Kturned": "\uA7B0", + "/L": "\u004C", + "/LJ": "\u01C7", + "/LL": "\uF6BF", + "/LLwelsh": "\u1EFA", + "/LTDfullwidth": "\u32CF", + "/Lacute": "\u0139", + "/Lambda": "\u039B", + "/Lbar": "\u023D", + "/Lbelt": "\uA7AD", + "/Lbroken": "\uA746", + "/Lcaron": "\u013D", + "/Lcedilla": "\u013B", + "/Lcircle": "\u24C1", + "/Lcircleblack": "\u1F15B", + "/Lcircumflexbelow": "\u1E3C", + "/Lcommaaccent": "\u013B", + "/Ldblbar": "\u2C60", + "/Ldot": "\u013F", + "/Ldotaccent": "\u013F", + "/Ldotbelow": "\u1E36", + "/Ldotbelowmacron": "\u1E38", + "/Lhacyr": "\u0514", + "/Liwnarmenian": "\u053C", + "/Lj": "\u01C8", + "/Ljecyr": "\u0409", + "/Ljecyrillic": "\u0409", + "/Ljekomicyr": "\u0508", + "/Llinebelow": "\u1E3A", + "/Lmacrondot": "\u1E38", + "/Lmiddletilde": "\u2C62", + "/Lmonospace": "\uFF2C", + "/Lparens": "\u1F11B", + "/Lreversedsans": "\u2143", + "/Lscript": "\u2112", + "/Lslash": "\u0141", + "/Lslashsmall": "\uF6F9", + "/Lsmall": "\uF76C", + "/Lsquare": "\u1F13B", + "/Lsquareblack": "\u1F17B", + "/Lstroke": "\uA748", + "/Lturned": "\uA780", + "/Lturnedsans": "\u2142", + "/M": "\u004D", + "/MBsquare": "\u3386", + "/MVsquare": "\u1F14B", + "/Macron": "\uF6D0", + "/Macronsmall": "\uF7AF", + "/Macute": "\u1E3E", + "/Mcircle": "\u24C2", + "/Mcircleblack": "\u1F15C", + "/Mdot": "\u1E40", + "/Mdotaccent": "\u1E40", + "/Mdotbelow": "\u1E42", + "/Menarmenian": "\u0544", + "/Mhook": "\u2C6E", + "/Mmonospace": "\uFF2D", + "/Mohammad": "\uFDF4", + "/Mparens": "\u1F11C", + "/Mscript": "\u2133", + "/Msmall": "\uF76D", + "/Msquare": "\u1F13C", + "/Msquareblack": "\u1F17C", + "/Mturned": "\u019C", + "/Mturnedsmall": "\uA7FA", + "/Mu": "\u039C", + "/N": "\u004E", + "/NJ": "\u01CA", + "/Nacute": "\u0143", + "/Ncaron": "\u0147", + "/Ncedilla": "\u0145", + "/Ncircle": "\u24C3", + "/Ncircleblack": "\u1F15D", + "/Ncircumflexbelow": "\u1E4A", + "/Ncommaaccent": "\u0145", + "/Ndblstruck": "\u2115", + "/Ndescender": "\uA790", + "/Ndot": "\u1E44", + "/Ndotaccent": "\u1E44", + "/Ndotbelow": "\u1E46", + "/Ngrave": "\u01F8", + "/Nhookleft": "\u019D", + "/Nineroman": "\u2168", + "/Nj": "\u01CB", + "/Njecyr": "\u040A", + "/Njecyrillic": "\u040A", + "/Njekomicyr": "\u050A", + "/Nlinebelow": "\u1E48", + "/Nlongrightleg": "\u0220", + "/Nmonospace": "\uFF2E", + "/Nobliquestroke": "\uA7A4", + "/Nowarmenian": "\u0546", + "/Nparens": "\u1F11D", + "/Nsmall": "\uF76E", + "/Nsquare": "\u1F13D", + "/Nsquareblack": "\u1F17D", + "/Ntilde": "\u00D1", + "/Ntildesmall": "\uF7F1", + "/Nu": "\u039D", + "/O": "\u004F", + "/OE": "\u0152", + "/OEsmall": "\uF6FA", + "/OO": "\uA74E", + "/Oacute": "\u00D3", + "/Oacutesmall": "\uF7F3", + "/Obar": "\u019F", + "/Obarcyr": "\u04E8", + "/Obardieresiscyr": "\u04EA", + "/Obarredcyrillic": "\u04E8", + "/Obarreddieresiscyrillic": "\u04EA", + "/Obreve": "\u014E", + "/Ocaron": "\u01D1", + "/Ocenteredtilde": "\u019F", + "/Ocircle": "\u24C4", + "/Ocircleblack": "\u1F15E", + "/Ocircumflex": "\u00D4", + "/Ocircumflexacute": "\u1ED0", + "/Ocircumflexdotbelow": "\u1ED8", + "/Ocircumflexgrave": "\u1ED2", + "/Ocircumflexhoi": "\u1ED4", + "/Ocircumflexhookabove": "\u1ED4", + "/Ocircumflexsmall": "\uF7F4", + "/Ocircumflextilde": "\u1ED6", + "/Ocyr": "\u041E", + "/Ocyrillic": "\u041E", + "/Odblacute": "\u0150", + "/Odblgrave": "\u020C", + "/Odieresis": "\u00D6", + "/Odieresiscyr": "\u04E6", + "/Odieresiscyrillic": "\u04E6", + "/Odieresismacron": "\u022A", + "/Odieresissmall": "\uF7F6", + "/Odot": "\u022E", + "/Odotbelow": "\u1ECC", + "/Odotmacron": "\u0230", + "/Ogoneksmall": "\uF6FB", + "/Ograve": "\u00D2", + "/Ogravedbl": "\u020C", + "/Ogravesmall": "\uF7F2", + "/Oharmenian": "\u0555", + "/Ohm": "\u2126", + "/Ohoi": "\u1ECE", + "/Ohookabove": "\u1ECE", + "/Ohorn": "\u01A0", + "/Ohornacute": "\u1EDA", + "/Ohorndotbelow": "\u1EE2", + "/Ohorngrave": "\u1EDC", + "/Ohornhoi": "\u1EDE", + "/Ohornhookabove": "\u1EDE", + "/Ohorntilde": "\u1EE0", + "/Ohungarumlaut": "\u0150", + "/Oi": "\u01A2", + "/Oinvertedbreve": "\u020E", + "/Oloop": "\uA74C", + "/Omacron": "\u014C", + "/Omacronacute": "\u1E52", + "/Omacrongrave": "\u1E50", + "/Omega": "\u2126", + "/Omegaacute": "\u1FFB", + "/Omegaasper": "\u1F69", + "/Omegaasperacute": "\u1F6D", + "/Omegaasperacuteiotasub": "\u1FAD", + "/Omegaaspergrave": "\u1F6B", + "/Omegaaspergraveiotasub": "\u1FAB", + "/Omegaasperiotasub": "\u1FA9", + "/Omegaaspertilde": "\u1F6F", + "/Omegaaspertildeiotasub": "\u1FAF", + "/Omegacyr": "\u0460", + "/Omegacyrillic": "\u0460", + "/Omegagrave": "\u1FFA", + "/Omegagreek": "\u03A9", + "/Omegaiotasub": "\u1FFC", + "/Omegalenis": "\u1F68", + "/Omegalenisacute": "\u1F6C", + "/Omegalenisacuteiotasub": "\u1FAC", + "/Omegalenisgrave": "\u1F6A", + "/Omegalenisgraveiotasub": "\u1FAA", + "/Omegalenisiotasub": "\u1FA8", + "/Omegalenistilde": "\u1F6E", + "/Omegalenistildeiotasub": "\u1FAE", + "/Omegaroundcyr": "\u047A", + "/Omegaroundcyrillic": "\u047A", + "/Omegatitlocyr": "\u047C", + "/Omegatitlocyrillic": "\u047C", + "/Omegatonos": "\u038F", + "/Omicron": "\u039F", + "/Omicronacute": "\u1FF9", + "/Omicronasper": "\u1F49", + "/Omicronasperacute": "\u1F4D", + "/Omicronaspergrave": "\u1F4B", + "/Omicrongrave": "\u1FF8", + "/Omicronlenis": "\u1F48", + "/Omicronlenisacute": "\u1F4C", + "/Omicronlenisgrave": "\u1F4A", + "/Omicrontonos": "\u038C", + "/Omonospace": "\uFF2F", + "/Oneroman": "\u2160", + "/Oogonek": "\u01EA", + "/Oogonekmacron": "\u01EC", + "/Oopen": "\u0186", + "/Oparens": "\u1F11E", + "/Oslash": "\u00D8", + "/Oslashacute": "\u01FE", + "/Oslashsmall": "\uF7F8", + "/Osmall": "\uF76F", + "/Osquare": "\u1F13E", + "/Osquareblack": "\u1F17E", + "/Ostroke": "\uA74A", + "/Ostrokeacute": "\u01FE", + "/Otcyr": "\u047E", + "/Otcyrillic": "\u047E", + "/Otilde": "\u00D5", + "/Otildeacute": "\u1E4C", + "/Otildedieresis": "\u1E4E", + "/Otildemacron": "\u022C", + "/Otildesmall": "\uF7F5", + "/Ou": "\u0222", + "/P": "\u0050", + "/PAsquareblack": "\u1F18C", + "/PPVsquare": "\u1F14E", + "/Pacute": "\u1E54", + "/Palochkacyr": "\u04C0", + "/Pcircle": "\u24C5", + "/Pcircleblack": "\u1F15F", + "/Pcrosssquareblack": "\u1F18A", + "/Pdblstruck": "\u2119", + "/Pdot": "\u1E56", + "/Pdotaccent": "\u1E56", + "/Pecyr": "\u041F", + "/Pecyrillic": "\u041F", + "/Peharmenian": "\u054A", + "/Pehookcyr": "\u04A6", + "/Pemiddlehookcyrillic": "\u04A6", + "/Petailcyr": "\u0524", + "/Pflourish": "\uA752", + "/Phi": "\u03A6", + "/Phook": "\u01A4", + "/Pi": "\u03A0", + "/Pidblstruck": "\u213F", + "/Piwrarmenian": "\u0553", + "/Pmonospace": "\uFF30", + "/Pparens": "\u1F11F", + "/Psi": "\u03A8", + "/Psicyr": "\u0470", + "/Psicyrillic": "\u0470", + "/Psmall": "\uF770", + "/Psquare": "\u1F13F", + "/Psquareblack": "\u1F17F", + "/Pstroke": "\u2C63", + "/Pstrokedescender": "\uA750", + "/Ptail": "\uA754", + "/Q": "\u0051", + "/Qacyr": "\u051A", + "/QalaUsedAsKoranicStopSign": "\uFDF1", + "/Qcircle": "\u24C6", + "/Qcircleblack": "\u1F160", + "/Qdblstruck": "\u211A", + "/Qdiagonalstroke": "\uA758", + "/Qmonospace": "\uFF31", + "/Qparens": "\u1F120", + "/Qrotated": "\u213A", + "/Qsmall": "\uF771", + "/Qsmallhooktail": "\u024A", + "/Qsquare": "\u1F140", + "/Qsquareblack": "\u1F180", + "/Qstrokedescender": "\uA756", + "/R": "\u0052", + "/Raarmenian": "\u054C", + "/Racute": "\u0154", + "/Rasoul": "\uFDF6", + "/Rcaron": "\u0158", + "/Rcedilla": "\u0156", + "/Rcircle": "\u24C7", + "/Rcircleblack": "\u1F161", + "/Rcommaaccent": "\u0156", + "/Rdblgrave": "\u0210", + "/Rdblstruck": "\u211D", + "/Rdot": "\u1E58", + "/Rdotaccent": "\u1E58", + "/Rdotbelow": "\u1E5A", + "/Rdotbelowmacron": "\u1E5C", + "/Reharmenian": "\u0550", + "/Reverseddottedsigmalunatesymbol": "\u03FF", + "/Reversedzecyr": "\u0510", + "/Rfraktur": "\u211C", + "/Rgravedbl": "\u0210", + "/Rhacyr": "\u0516", + "/Rho": "\u03A1", + "/Rhoasper": "\u1FEC", + "/Ringsmall": "\uF6FC", + "/Rinsular": "\uA782", + "/Rinvertedbreve": "\u0212", + "/Rinvertedsmall": "\u0281", + "/Ritaliccircle": "\u1F12C", + "/Rlinebelow": "\u1E5E", + "/Rmacrondot": "\u1E5C", + "/Rmonospace": "\uFF32", + "/Robliquestroke": "\uA7A6", + "/Rparens": "\u1F121", + "/Rrotunda": "\uA75A", + "/Rscript": "\u211B", + "/Rsmall": "\uF772", + "/Rsmallinverted": "\u0281", + "/Rsmallinvertedsuperior": "\u02B6", + "/Rsquare": "\u1F141", + "/Rsquareblack": "\u1F181", + "/Rstroke": "\u024C", + "/Rsupinvertedmod": "\u02B6", + "/Rtail": "\u2C64", + "/RubElHizbstart": "\u06DE", + "/Rumrotunda": "\uA75C", + "/Rumsmall": "\uA776", + "/S": "\u0053", + "/SAsquareblack": "\u1F18D", + "/SDsquare": "\u1F14C", + "/SF010000": "\u250C", + "/SF020000": "\u2514", + "/SF030000": "\u2510", + "/SF040000": "\u2518", + "/SF050000": "\u253C", + "/SF060000": "\u252C", + "/SF070000": "\u2534", + "/SF080000": "\u251C", + "/SF090000": "\u2524", + "/SF100000": "\u2500", + "/SF110000": "\u2502", + "/SF190000": "\u2561", + "/SF200000": "\u2562", + "/SF210000": "\u2556", + "/SF220000": "\u2555", + "/SF230000": "\u2563", + "/SF240000": "\u2551", + "/SF250000": "\u2557", + "/SF260000": "\u255D", + "/SF270000": "\u255C", + "/SF280000": "\u255B", + "/SF360000": "\u255E", + "/SF370000": "\u255F", + "/SF380000": "\u255A", + "/SF390000": "\u2554", + "/SF400000": "\u2569", + "/SF410000": "\u2566", + "/SF420000": "\u2560", + "/SF430000": "\u2550", + "/SF440000": "\u256C", + "/SF450000": "\u2567", + "/SF460000": "\u2568", + "/SF470000": "\u2564", + "/SF480000": "\u2565", + "/SF490000": "\u2559", + "/SF500000": "\u2558", + "/SF510000": "\u2552", + "/SF520000": "\u2553", + "/SF530000": "\u256B", + "/SF540000": "\u256A", + "/SSsquare": "\u1F14D", + "/Sacute": "\u015A", + "/Sacutedotaccent": "\u1E64", + "/Safha": "\u0603", + "/Sajdah": "\u06E9", + "/Salam": "\uFDF5", + "/Salla": "\uFDF9", + "/SallaUsedAsKoranicStopSign": "\uFDF0", + "/SallallahouAlayheWasallam": "\uFDFA", + "/Saltillo": "\uA78B", + "/Sampi": "\u03E0", + "/Sampiarchaic": "\u0372", + "/Sampigreek": "\u03E0", + "/San": "\u03FA", + "/Sanah": "\u0601", + "/Scaron": "\u0160", + "/Scarondot": "\u1E66", + "/Scarondotaccent": "\u1E66", + "/Scaronsmall": "\uF6FD", + "/Scedilla": "\u015E", + "/Schwa": "\u018F", + "/Schwacyr": "\u04D8", + "/Schwacyrillic": "\u04D8", + "/Schwadieresiscyr": "\u04DA", + "/Schwadieresiscyrillic": "\u04DA", + "/Scircle": "\u24C8", + "/Scircleblack": "\u1F162", + "/Scircumflex": "\u015C", + "/Scommaaccent": "\u0218", + "/Scriptg": "\uA7AC", + "/Sdot": "\u1E60", + "/Sdotaccent": "\u1E60", + "/Sdotbelow": "\u1E62", + "/Sdotbelowdotabove": "\u1E68", + "/Sdotbelowdotaccent": "\u1E68", + "/Seharmenian": "\u054D", + "/Semisoftcyr": "\u048C", + "/Sevenroman": "\u2166", + "/Shaarmenian": "\u0547", + "/Shacyr": "\u0428", + "/Shacyrillic": "\u0428", + "/Shchacyr": "\u0429", + "/Shchacyrillic": "\u0429", + "/Sheicoptic": "\u03E2", + "/SheneGerishin:hb": "\u059E", + "/Shhacyr": "\u04BA", + "/Shhacyrillic": "\u04BA", + "/Shhatailcyr": "\u0526", + "/Shimacoptic": "\u03EC", + "/Sho": "\u03F7", + "/Sigma": "\u03A3", + "/Sigmalunatesymbol": "\u03F9", + "/Sigmalunatesymboldotted": "\u03FE", + "/Sigmareversedlunatesymbol": "\u03FD", + "/Sinsular": "\uA784", + "/Sixroman": "\u2165", + "/Sjekomicyr": "\u050C", + "/Smonospace": "\uFF33", + "/Sobliquestroke": "\uA7A8", + "/Softcyr": "\u042C", + "/Softsigncyrillic": "\u042C", + "/Sparens": "\u1F122", + "/Sshell": "\u1F12A", + "/Ssmall": "\uF773", + "/Ssquare": "\u1F142", + "/Ssquareblack": "\u1F182", + "/Sswashtail": "\u2C7E", + "/Stigma": "\u03DA", + "/Stigmagreek": "\u03DA", + "/T": "\u0054", + "/Tau": "\u03A4", + "/Tbar": "\u0166", + "/Tcaron": "\u0164", + "/Tcedilla": "\u0162", + "/Tcircle": "\u24C9", + "/Tcircleblack": "\u1F163", + "/Tcircumflexbelow": "\u1E70", + "/Tcommaaccent": "\u0162", + "/Tdot": "\u1E6A", + "/Tdotaccent": "\u1E6A", + "/Tdotbelow": "\u1E6C", + "/Tecyr": "\u0422", + "/Tecyrillic": "\u0422", + "/Tedescendercyrillic": "\u04AC", + "/Tenroman": "\u2169", + "/Tetailcyr": "\u04AC", + "/Tetsecyr": "\u04B4", + "/Tetsecyrillic": "\u04B4", + "/Theta": "\u0398", + "/Thetasymbol": "\u03F4", + "/Thook": "\u01AC", + "/Thorn": "\u00DE", + "/Thornsmall": "\uF7FE", + "/Thornstroke": "\uA764", + "/Thornstrokedescender": "\uA766", + "/Threeroman": "\u2162", + "/Tildesmall": "\uF6FE", + "/Tinsular": "\uA786", + "/Tiwnarmenian": "\u054F", + "/Tjekomicyr": "\u050E", + "/Tlinebelow": "\u1E6E", + "/Tmonospace": "\uFF34", + "/Toarmenian": "\u0539", + "/Tonefive": "\u01BC", + "/Tonesix": "\u0184", + "/Tonetwo": "\u01A7", + "/Tparens": "\u1F123", + "/Tresillo": "\uA72A", + "/Tretroflexhook": "\u01AE", + "/Tsecyr": "\u0426", + "/Tsecyrillic": "\u0426", + "/Tshecyr": "\u040B", + "/Tshecyrillic": "\u040B", + "/Tsmall": "\uF774", + "/Tsquare": "\u1F143", + "/Tsquareblack": "\u1F183", + "/Tturned": "\uA7B1", + "/Twelveroman": "\u216B", + "/Twithdiagonalstroke": "\u023E", + "/Tworoman": "\u2161", + "/Tz": "\uA728", + "/U": "\u0055", + "/Uacute": "\u00DA", + "/Uacutedblcyr": "\u04F2", + "/Uacutesmall": "\uF7FA", + "/Ubar": "\u0244", + "/Ubreve": "\u016C", + "/Ucaron": "\u01D3", + "/Ucircle": "\u24CA", + "/Ucircleblack": "\u1F164", + "/Ucircumflex": "\u00DB", + "/Ucircumflexbelow": "\u1E76", + "/Ucircumflexsmall": "\uF7FB", + "/Ucyr": "\u0423", + "/Ucyrillic": "\u0423", + "/Udblacute": "\u0170", + "/Udblgrave": "\u0214", + "/Udieresis": "\u00DC", + "/Udieresisacute": "\u01D7", + "/Udieresisbelow": "\u1E72", + "/Udieresiscaron": "\u01D9", + "/Udieresiscyr": "\u04F0", + "/Udieresiscyrillic": "\u04F0", + "/Udieresisgrave": "\u01DB", + "/Udieresismacron": "\u01D5", + "/Udieresissmall": "\uF7FC", + "/Udotbelow": "\u1EE4", + "/Ugrave": "\u00D9", + "/Ugravedbl": "\u0214", + "/Ugravesmall": "\uF7F9", + "/Uhoi": "\u1EE6", + "/Uhookabove": "\u1EE6", + "/Uhorn": "\u01AF", + "/Uhornacute": "\u1EE8", + "/Uhorndotbelow": "\u1EF0", + "/Uhorngrave": "\u1EEA", + "/Uhornhoi": "\u1EEC", + "/Uhornhookabove": "\u1EEC", + "/Uhorntilde": "\u1EEE", + "/Uhungarumlaut": "\u0170", + "/Uhungarumlautcyrillic": "\u04F2", + "/Uinvertedbreve": "\u0216", + "/Ukcyr": "\u0478", + "/Ukcyrillic": "\u0478", + "/Umacron": "\u016A", + "/Umacroncyr": "\u04EE", + "/Umacroncyrillic": "\u04EE", + "/Umacrondieresis": "\u1E7A", + "/Umonospace": "\uFF35", + "/Uogonek": "\u0172", + "/Uparens": "\u1F124", + "/Upsilon": "\u03A5", + "/Upsilon1": "\u03D2", + "/Upsilonacute": "\u1FEB", + "/Upsilonacutehooksymbol": "\u03D3", + "/Upsilonacutehooksymbolgreek": "\u03D3", + "/Upsilonadieresishooksymbol": "\u03D4", + "/Upsilonafrican": "\u01B1", + "/Upsilonasper": "\u1F59", + "/Upsilonasperacute": "\u1F5D", + "/Upsilonaspergrave": "\u1F5B", + "/Upsilonaspertilde": "\u1F5F", + "/Upsilonbreve": "\u1FE8", + "/Upsilondieresis": "\u03AB", + "/Upsilondieresishooksymbolgreek": "\u03D4", + "/Upsilongrave": "\u1FEA", + "/Upsilonhooksymbol": "\u03D2", + "/Upsilontonos": "\u038E", + "/Upsilonwithmacron": "\u1FE9", + "/Uring": "\u016E", + "/Ushortcyr": "\u040E", + "/Ushortcyrillic": "\u040E", + "/Usmall": "\uF775", + "/Usquare": "\u1F144", + "/Usquareblack": "\u1F184", + "/Ustraightcyr": "\u04AE", + "/Ustraightcyrillic": "\u04AE", + "/Ustraightstrokecyr": "\u04B0", + "/Ustraightstrokecyrillic": "\u04B0", + "/Utilde": "\u0168", + "/Utildeacute": "\u1E78", + "/Utildebelow": "\u1E74", + "/V": "\u0056", + "/Vcircle": "\u24CB", + "/Vcircleblack": "\u1F165", + "/Vdiagonalstroke": "\uA75E", + "/Vdotbelow": "\u1E7E", + "/Vecyr": "\u0412", + "/Vecyrillic": "\u0412", + "/Vend": "\uA768", + "/Vewarmenian": "\u054E", + "/Vhook": "\u01B2", + "/Visigothicz": "\uA762", + "/Vmod": "\u2C7D", + "/Vmonospace": "\uFF36", + "/Voarmenian": "\u0548", + "/Volapukae": "\uA79A", + "/Volapukoe": "\uA79C", + "/Volapukue": "\uA79E", + "/Vparens": "\u1F125", + "/Vsmall": "\uF776", + "/Vsquare": "\u1F145", + "/Vsquareblack": "\u1F185", + "/Vtilde": "\u1E7C", + "/Vturned": "\u0245", + "/Vwelsh": "\u1EFC", + "/Vy": "\uA760", + "/W": "\u0057", + "/WZcircle": "\u1F12E", + "/Wacute": "\u1E82", + "/Wasallam": "\uFDF8", + "/Wcircle": "\u24CC", + "/Wcircleblack": "\u1F166", + "/Wcircumflex": "\u0174", + "/Wdieresis": "\u1E84", + "/Wdot": "\u1E86", + "/Wdotaccent": "\u1E86", + "/Wdotbelow": "\u1E88", + "/Wecyr": "\u051C", + "/Wgrave": "\u1E80", + "/Whook": "\u2C72", + "/Wmonospace": "\uFF37", + "/Wparens": "\u1F126", + "/Wsmall": "\uF777", + "/Wsquare": "\u1F146", + "/Wsquareblack": "\u1F186", + "/Wynn": "\u01F7", + "/X": "\u0058", + "/Xatailcyr": "\u04B2", + "/Xcircle": "\u24CD", + "/Xcircleblack": "\u1F167", + "/Xdieresis": "\u1E8C", + "/Xdot": "\u1E8A", + "/Xdotaccent": "\u1E8A", + "/Xeharmenian": "\u053D", + "/Xi": "\u039E", + "/Xmonospace": "\uFF38", + "/Xparens": "\u1F127", + "/Xsmall": "\uF778", + "/Xsquare": "\u1F147", + "/Xsquareblack": "\u1F187", + "/Y": "\u0059", + "/Yacute": "\u00DD", + "/Yacutesmall": "\uF7FD", + "/Yacyr": "\u042F", + "/Yaecyr": "\u0518", + "/Yatcyr": "\u0462", + "/Yatcyrillic": "\u0462", + "/Ycircle": "\u24CE", + "/Ycircleblack": "\u1F168", + "/Ycircumflex": "\u0176", + "/Ydieresis": "\u0178", + "/Ydieresissmall": "\uF7FF", + "/Ydot": "\u1E8E", + "/Ydotaccent": "\u1E8E", + "/Ydotbelow": "\u1EF4", + "/Yericyrillic": "\u042B", + "/Yerudieresiscyrillic": "\u04F8", + "/Ygrave": "\u1EF2", + "/Yhoi": "\u1EF6", + "/Yhook": "\u01B3", + "/Yhookabove": "\u1EF6", + "/Yiarmenian": "\u0545", + "/Yicyrillic": "\u0407", + "/Yiwnarmenian": "\u0552", + "/Ylongcyr": "\u042B", + "/Ylongdieresiscyr": "\u04F8", + "/Yloop": "\u1EFE", + "/Ymacron": "\u0232", + "/Ymonospace": "\uFF39", + "/Yogh": "\u021C", + "/Yot": "\u037F", + "/Yparens": "\u1F128", + "/Ysmall": "\uF779", + "/Ysquare": "\u1F148", + "/Ysquareblack": "\u1F188", + "/Ystroke": "\u024E", + "/Ytilde": "\u1EF8", + "/Yturnedsans": "\u2144", + "/Yucyr": "\u042E", + "/Yukrcyr": "\u0407", + "/Yusbigcyr": "\u046A", + "/Yusbigcyrillic": "\u046A", + "/Yusbigiotifiedcyr": "\u046C", + "/Yusbigiotifiedcyrillic": "\u046C", + "/Yuslittlecyr": "\u0466", + "/Yuslittlecyrillic": "\u0466", + "/Yuslittleiotifiedcyr": "\u0468", + "/Yuslittleiotifiedcyrillic": "\u0468", + "/Z": "\u005A", + "/Zaarmenian": "\u0536", + "/Zacute": "\u0179", + "/Zcaron": "\u017D", + "/Zcaronsmall": "\uF6FF", + "/Zcircle": "\u24CF", + "/Zcircleblack": "\u1F169", + "/Zcircumflex": "\u1E90", + "/Zdblstruck": "\u2124", + "/Zdescender": "\u2C6B", + "/Zdot": "\u017B", + "/Zdotaccent": "\u017B", + "/Zdotbelow": "\u1E92", + "/Zecyr": "\u0417", + "/Zecyrillic": "\u0417", + "/Zedescendercyrillic": "\u0498", + "/Zedieresiscyr": "\u04DE", + "/Zedieresiscyrillic": "\u04DE", + "/Zeta": "\u0396", + "/Zetailcyr": "\u0498", + "/Zfraktur": "\u2128", + "/Zhearmenian": "\u053A", + "/Zhebrevecyr": "\u04C1", + "/Zhebrevecyrillic": "\u04C1", + "/Zhecyr": "\u0416", + "/Zhecyrillic": "\u0416", + "/Zhedescendercyrillic": "\u0496", + "/Zhedieresiscyr": "\u04DC", + "/Zhedieresiscyrillic": "\u04DC", + "/Zhetailcyr": "\u0496", + "/Zhook": "\u0224", + "/Zjekomicyr": "\u0504", + "/Zlinebelow": "\u1E94", + "/Zmonospace": "\uFF3A", + "/Zparens": "\u1F129", + "/Zsmall": "\uF77A", + "/Zsquare": "\u1F149", + "/Zsquareblack": "\u1F189", + "/Zstroke": "\u01B5", + "/Zswashtail": "\u2C7F", + "/a": "\u0061", + "/a.inferior": "\u2090", + "/aHonRAA": "\u0613", + "/aa": "\uA733", + "/aabengali": "\u0986", + "/aacute": "\u00E1", + "/aadeva": "\u0906", + "/aagujarati": "\u0A86", + "/aagurmukhi": "\u0A06", + "/aamatragurmukhi": "\u0A3E", + "/aarusquare": "\u3303", + "/aavowelsignbengali": "\u09BE", + "/aavowelsigndeva": "\u093E", + "/aavowelsigngujarati": "\u0ABE", + "/abbreviationmarkarmenian": "\u055F", + "/abbreviationsigndeva": "\u0970", + "/abengali": "\u0985", + "/abopomofo": "\u311A", + "/abreve": "\u0103", + "/abreveacute": "\u1EAF", + "/abrevecyr": "\u04D1", + "/abrevecyrillic": "\u04D1", + "/abrevedotbelow": "\u1EB7", + "/abrevegrave": "\u1EB1", + "/abrevehoi": "\u1EB3", + "/abrevehookabove": "\u1EB3", + "/abrevetilde": "\u1EB5", + "/absquareblack": "\u1F18E", + "/acaron": "\u01CE", + "/accountof": "\u2100", + "/accurrent": "\u23E6", + "/acircle": "\u24D0", + "/acirclekatakana": "\u32D0", + "/acircumflex": "\u00E2", + "/acircumflexacute": "\u1EA5", + "/acircumflexdotbelow": "\u1EAD", + "/acircumflexgrave": "\u1EA7", + "/acircumflexhoi": "\u1EA9", + "/acircumflexhookabove": "\u1EA9", + "/acircumflextilde": "\u1EAB", + "/activatearabicformshaping": "\u206D", + "/activatesymmetricswapping": "\u206B", + "/acute": "\u00B4", + "/acutebelowcmb": "\u0317", + "/acutecmb": "\u0301", + "/acutecomb": "\u0301", + "/acutedblmiddlemod": "\u02F6", + "/acutedeva": "\u0954", + "/acutelowmod": "\u02CF", + "/acutemod": "\u02CA", + "/acutetonecmb": "\u0341", + "/acyr": "\u0430", + "/acyrillic": "\u0430", + "/adblgrave": "\u0201", + "/addakgurmukhi": "\u0A71", + "/addressedsubject": "\u2101", + "/adegadegpada": "\uA9CB", + "/adegpada": "\uA9CA", + "/adeva": "\u0905", + "/adieresis": "\u00E4", + "/adieresiscyr": "\u04D3", + "/adieresiscyrillic": "\u04D3", + "/adieresismacron": "\u01DF", + "/adishakti": "\u262C", + "/admissionTickets": "\u1F39F", + "/adot": "\u0227", + "/adotbelow": "\u1EA1", + "/adotmacron": "\u01E1", + "/ae": "\u00E6", + "/aeacute": "\u01FD", + "/aekorean": "\u3150", + "/aemacron": "\u01E3", + "/aerialTramway": "\u1F6A1", + "/afghani": "\u060B", + "/afii00208": "\u2015", + "/afii08941": "\u20A4", + "/afii10017": "\u0410", + "/afii10018": "\u0411", + "/afii10019": "\u0412", + "/afii10020": "\u0413", + "/afii10021": "\u0414", + "/afii10022": "\u0415", + "/afii10023": "\u0401", + "/afii10024": "\u0416", + "/afii10025": "\u0417", + "/afii10026": "\u0418", + "/afii10027": "\u0419", + "/afii10028": "\u041A", + "/afii10029": "\u041B", + "/afii10030": "\u041C", + "/afii10031": "\u041D", + "/afii10032": "\u041E", + "/afii10033": "\u041F", + "/afii10034": "\u0420", + "/afii10035": "\u0421", + "/afii10036": "\u0422", + "/afii10037": "\u0423", + "/afii10038": "\u0424", + "/afii10039": "\u0425", + "/afii10040": "\u0426", + "/afii10041": "\u0427", + "/afii10042": "\u0428", + "/afii10043": "\u0429", + "/afii10044": "\u042A", + "/afii10045": "\u042B", + "/afii10046": "\u042C", + "/afii10047": "\u042D", + "/afii10048": "\u042E", + "/afii10049": "\u042F", + "/afii10050": "\u0490", + "/afii10051": "\u0402", + "/afii10052": "\u0403", + "/afii10053": "\u0404", + "/afii10054": "\u0405", + "/afii10055": "\u0406", + "/afii10056": "\u0407", + "/afii10057": "\u0408", + "/afii10058": "\u0409", + "/afii10059": "\u040A", + "/afii10060": "\u040B", + "/afii10061": "\u040C", + "/afii10062": "\u040E", + "/afii10063": "\uF6C4", + "/afii10064": "\uF6C5", + "/afii10065": "\u0430", + "/afii10066": "\u0431", + "/afii10067": "\u0432", + "/afii10068": "\u0433", + "/afii10069": "\u0434", + "/afii10070": "\u0435", + "/afii10071": "\u0451", + "/afii10072": "\u0436", + "/afii10073": "\u0437", + "/afii10074": "\u0438", + "/afii10075": "\u0439", + "/afii10076": "\u043A", + "/afii10077": "\u043B", + "/afii10078": "\u043C", + "/afii10079": "\u043D", + "/afii10080": "\u043E", + "/afii10081": "\u043F", + "/afii10082": "\u0440", + "/afii10083": "\u0441", + "/afii10084": "\u0442", + "/afii10085": "\u0443", + "/afii10086": "\u0444", + "/afii10087": "\u0445", + "/afii10088": "\u0446", + "/afii10089": "\u0447", + "/afii10090": "\u0448", + "/afii10091": "\u0449", + "/afii10092": "\u044A", + "/afii10093": "\u044B", + "/afii10094": "\u044C", + "/afii10095": "\u044D", + "/afii10096": "\u044E", + "/afii10097": "\u044F", + "/afii10098": "\u0491", + "/afii10099": "\u0452", + "/afii10100": "\u0453", + "/afii10101": "\u0454", + "/afii10102": "\u0455", + "/afii10103": "\u0456", + "/afii10104": "\u0457", + "/afii10105": "\u0458", + "/afii10106": "\u0459", + "/afii10107": "\u045A", + "/afii10108": "\u045B", + "/afii10109": "\u045C", + "/afii10110": "\u045E", + "/afii10145": "\u040F", + "/afii10146": "\u0462", + "/afii10147": "\u0472", + "/afii10148": "\u0474", + "/afii10192": "\uF6C6", + "/afii10193": "\u045F", + "/afii10194": "\u0463", + "/afii10195": "\u0473", + "/afii10196": "\u0475", + "/afii10831": "\uF6C7", + "/afii10832": "\uF6C8", + "/afii10846": "\u04D9", + "/afii299": "\u200E", + "/afii300": "\u200F", + "/afii301": "\u200D", + "/afii57381": "\u066A", + "/afii57388": "\u060C", + "/afii57392": "\u0660", + "/afii57393": "\u0661", + "/afii57394": "\u0662", + "/afii57395": "\u0663", + "/afii57396": "\u0664", + "/afii57397": "\u0665", + "/afii57398": "\u0666", + "/afii57399": "\u0667", + "/afii57400": "\u0668", + "/afii57401": "\u0669", + "/afii57403": "\u061B", + "/afii57407": "\u061F", + "/afii57409": "\u0621", + "/afii57410": "\u0622", + "/afii57411": "\u0623", + "/afii57412": "\u0624", + "/afii57413": "\u0625", + "/afii57414": "\u0626", + "/afii57415": "\u0627", + "/afii57416": "\u0628", + "/afii57417": "\u0629", + "/afii57418": "\u062A", + "/afii57419": "\u062B", + "/afii57420": "\u062C", + "/afii57421": "\u062D", + "/afii57422": "\u062E", + "/afii57423": "\u062F", + "/afii57424": "\u0630", + "/afii57425": "\u0631", + "/afii57426": "\u0632", + "/afii57427": "\u0633", + "/afii57428": "\u0634", + "/afii57429": "\u0635", + "/afii57430": "\u0636", + "/afii57431": "\u0637", + "/afii57432": "\u0638", + "/afii57433": "\u0639", + "/afii57434": "\u063A", + "/afii57440": "\u0640", + "/afii57441": "\u0641", + "/afii57442": "\u0642", + "/afii57443": "\u0643", + "/afii57444": "\u0644", + "/afii57445": "\u0645", + "/afii57446": "\u0646", + "/afii57448": "\u0648", + "/afii57449": "\u0649", + "/afii57450": "\u064A", + "/afii57451": "\u064B", + "/afii57452": "\u064C", + "/afii57453": "\u064D", + "/afii57454": "\u064E", + "/afii57455": "\u064F", + "/afii57456": "\u0650", + "/afii57457": "\u0651", + "/afii57458": "\u0652", + "/afii57470": "\u0647", + "/afii57505": "\u06A4", + "/afii57506": "\u067E", + "/afii57507": "\u0686", + "/afii57508": "\u0698", + "/afii57509": "\u06AF", + "/afii57511": "\u0679", + "/afii57512": "\u0688", + "/afii57513": "\u0691", + "/afii57514": "\u06BA", + "/afii57519": "\u06D2", + "/afii57534": "\u06D5", + "/afii57636": "\u20AA", + "/afii57645": "\u05BE", + "/afii57658": "\u05C3", + "/afii57664": "\u05D0", + "/afii57665": "\u05D1", + "/afii57666": "\u05D2", + "/afii57667": "\u05D3", + "/afii57668": "\u05D4", + "/afii57669": "\u05D5", + "/afii57670": "\u05D6", + "/afii57671": "\u05D7", + "/afii57672": "\u05D8", + "/afii57673": "\u05D9", + "/afii57674": "\u05DA", + "/afii57675": "\u05DB", + "/afii57676": "\u05DC", + "/afii57677": "\u05DD", + "/afii57678": "\u05DE", + "/afii57679": "\u05DF", + "/afii57680": "\u05E0", + "/afii57681": "\u05E1", + "/afii57682": "\u05E2", + "/afii57683": "\u05E3", + "/afii57684": "\u05E4", + "/afii57685": "\u05E5", + "/afii57686": "\u05E6", + "/afii57687": "\u05E7", + "/afii57688": "\u05E8", + "/afii57689": "\u05E9", + "/afii57690": "\u05EA", + "/afii57694": "\uFB2A", + "/afii57695": "\uFB2B", + "/afii57700": "\uFB4B", + "/afii57705": "\uFB1F", + "/afii57716": "\u05F0", + "/afii57717": "\u05F1", + "/afii57718": "\u05F2", + "/afii57723": "\uFB35", + "/afii57793": "\u05B4", + "/afii57794": "\u05B5", + "/afii57795": "\u05B6", + "/afii57796": "\u05BB", + "/afii57797": "\u05B8", + "/afii57798": "\u05B7", + "/afii57799": "\u05B0", + "/afii57800": "\u05B2", + "/afii57801": "\u05B1", + "/afii57802": "\u05B3", + "/afii57803": "\u05C2", + "/afii57804": "\u05C1", + "/afii57806": "\u05B9", + "/afii57807": "\u05BC", + "/afii57839": "\u05BD", + "/afii57841": "\u05BF", + "/afii57842": "\u05C0", + "/afii57929": "\u02BC", + "/afii61248": "\u2105", + "/afii61289": "\u2113", + "/afii61352": "\u2116", + "/afii61573": "\u202C", + "/afii61574": "\u202D", + "/afii61575": "\u202E", + "/afii61664": "\u200C", + "/afii63167": "\u066D", + "/afii64937": "\u02BD", + "/agrave": "\u00E0", + "/agravedbl": "\u0201", + "/agujarati": "\u0A85", + "/agurmukhi": "\u0A05", + "/ahiragana": "\u3042", + "/ahoi": "\u1EA3", + "/ahookabove": "\u1EA3", + "/aibengali": "\u0990", + "/aibopomofo": "\u311E", + "/aideva": "\u0910", + "/aiecyr": "\u04D5", + "/aiecyrillic": "\u04D5", + "/aigujarati": "\u0A90", + "/aigurmukhi": "\u0A10", + "/aimatragurmukhi": "\u0A48", + "/ain.fina": "\uFECA", + "/ain.init": "\uFECB", + "/ain.init_alefmaksura.fina": "\uFCF7", + "/ain.init_jeem.fina": "\uFC29", + "/ain.init_jeem.medi": "\uFCBA", + "/ain.init_jeem.medi_meem.medi": "\uFDC4", + "/ain.init_meem.fina": "\uFC2A", + "/ain.init_meem.medi": "\uFCBB", + "/ain.init_meem.medi_meem.medi": "\uFD77", + "/ain.init_yeh.fina": "\uFCF8", + "/ain.isol": "\uFEC9", + "/ain.medi": "\uFECC", + "/ain.medi_alefmaksura.fina": "\uFD13", + "/ain.medi_jeem.medi_meem.fina": "\uFD75", + "/ain.medi_meem.medi_alefmaksura.fina": "\uFD78", + "/ain.medi_meem.medi_meem.fina": "\uFD76", + "/ain.medi_meem.medi_yeh.fina": "\uFDB6", + "/ain.medi_yeh.fina": "\uFD14", + "/ainThreeDotsDownAbove": "\u075E", + "/ainTwoDotsAbove": "\u075D", + "/ainTwoDotsVerticallyAbove": "\u075F", + "/ainarabic": "\u0639", + "/ainfinalarabic": "\uFECA", + "/aininitialarabic": "\uFECB", + "/ainmedialarabic": "\uFECC", + "/ainthreedotsabove": "\u06A0", + "/ainvertedbreve": "\u0203", + "/airplaneArriving": "\u1F6EC", + "/airplaneDeparture": "\u1F6EB", + "/aivowelsignbengali": "\u09C8", + "/aivowelsigndeva": "\u0948", + "/aivowelsigngujarati": "\u0AC8", + "/akatakana": "\u30A2", + "/akatakanahalfwidth": "\uFF71", + "/akorean": "\u314F", + "/aktieselskab": "\u214D", + "/alarmclock": "\u23F0", + "/alef": "\u05D0", + "/alef.fina": "\uFE8E", + "/alef.init_fathatan.fina": "\uFD3D", + "/alef.isol": "\uFE8D", + "/alef.medi_fathatan.fina": "\uFD3C", + "/alef:hb": "\u05D0", + "/alefDigitThreeAbove": "\u0774", + "/alefDigitTwoAbove": "\u0773", + "/alefLamYehabove": "\u0616", + "/alefabove": "\u0670", + "/alefarabic": "\u0627", + "/alefdageshhebrew": "\uFB30", + "/aleffinalarabic": "\uFE8E", + "/alefhamza": "\u0623", + "/alefhamza.fina": "\uFE84", + "/alefhamza.isol": "\uFE83", + "/alefhamzaabovearabic": "\u0623", + "/alefhamzaabovefinalarabic": "\uFE84", + "/alefhamzabelow": "\u0625", + "/alefhamzabelow.fina": "\uFE88", + "/alefhamzabelow.isol": "\uFE87", + "/alefhamzabelowarabic": "\u0625", + "/alefhamzabelowfinalarabic": "\uFE88", + "/alefhebrew": "\u05D0", + "/alefhighhamza": "\u0675", + "/aleflamedhebrew": "\uFB4F", + "/alefmadda": "\u0622", + "/alefmadda.fina": "\uFE82", + "/alefmadda.isol": "\uFE81", + "/alefmaddaabovearabic": "\u0622", + "/alefmaddaabovefinalarabic": "\uFE82", + "/alefmaksura": "\u0649", + "/alefmaksura.fina": "\uFEF0", + "/alefmaksura.init_superscriptalef.fina": "\uFC5D", + "/alefmaksura.isol": "\uFEEF", + "/alefmaksura.medi_superscriptalef.fina": "\uFC90", + "/alefmaksuraarabic": "\u0649", + "/alefmaksurafinalarabic": "\uFEF0", + "/alefmaksurainitialarabic": "\uFEF3", + "/alefmaksuramedialarabic": "\uFEF4", + "/alefpatahhebrew": "\uFB2E", + "/alefqamatshebrew": "\uFB2F", + "/alefwasla": "\u0671", + "/alefwasla.fina": "\uFB51", + "/alefwasla.isol": "\uFB50", + "/alefwavyhamza": "\u0672", + "/alefwavyhamzabelow": "\u0673", + "/alefwide:hb": "\uFB21", + "/alefwithmapiq:hb": "\uFB30", + "/alefwithpatah:hb": "\uFB2E", + "/alefwithqamats:hb": "\uFB2F", + "/alembic": "\u2697", + "/aleph": "\u2135", + "/alienMonster": "\u1F47E", + "/allaroundprofile": "\u232E", + "/allequal": "\u224C", + "/allianceideographiccircled": "\u32AF", + "/allianceideographicparen": "\u323F", + "/almostequalorequal": "\u224A", + "/alpha": "\u03B1", + "/alphaacute": "\u1F71", + "/alphaacuteiotasub": "\u1FB4", + "/alphaasper": "\u1F01", + "/alphaasperacute": "\u1F05", + "/alphaasperacuteiotasub": "\u1F85", + "/alphaaspergrave": "\u1F03", + "/alphaaspergraveiotasub": "\u1F83", + "/alphaasperiotasub": "\u1F81", + "/alphaaspertilde": "\u1F07", + "/alphaaspertildeiotasub": "\u1F87", + "/alphabreve": "\u1FB0", + "/alphafunc": "\u237A", + "/alphagrave": "\u1F70", + "/alphagraveiotasub": "\u1FB2", + "/alphaiotasub": "\u1FB3", + "/alphalenis": "\u1F00", + "/alphalenisacute": "\u1F04", + "/alphalenisacuteiotasub": "\u1F84", + "/alphalenisgrave": "\u1F02", + "/alphalenisgraveiotasub": "\u1F82", + "/alphalenisiotasub": "\u1F80", + "/alphalenistilde": "\u1F06", + "/alphalenistildeiotasub": "\u1F86", + "/alphatilde": "\u1FB6", + "/alphatildeiotasub": "\u1FB7", + "/alphatonos": "\u03AC", + "/alphaturned": "\u0252", + "/alphaunderlinefunc": "\u2376", + "/alphawithmacron": "\u1FB1", + "/alternateonewayleftwaytraffic": "\u26D5", + "/alternative": "\u2387", + "/amacron": "\u0101", + "/ambulance": "\u1F691", + "/americanFootball": "\u1F3C8", + "/amfullwidth": "\u33C2", + "/amonospace": "\uFF41", + "/amountofcheck": "\u2447", + "/ampersand": "\u0026", + "/ampersandSindhi": "\u06FD", + "/ampersandmonospace": "\uFF06", + "/ampersandsmall": "\uF726", + "/ampersandturned": "\u214B", + "/amphora": "\u1F3FA", + "/amsquare": "\u33C2", + "/anbopomofo": "\u3122", + "/anchor": "\u2693", + "/ancoradown": "\u2E14", + "/ancoraup": "\u2E15", + "/andappada": "\uA9C3", + "/angbopomofo": "\u3124", + "/anger": "\u1F4A2", + "/angkhankhuthai": "\u0E5A", + "/angle": "\u2220", + "/anglearcright": "\u22BE", + "/anglebracketleft": "\u3008", + "/anglebracketleftvertical": "\uFE3F", + "/anglebracketright": "\u3009", + "/anglebracketrightvertical": "\uFE40", + "/angledottedright": "\u2E16", + "/angleleft": "\u2329", + "/anglemarkerdottedsubstitutionright": "\u2E01", + "/anglemarkersubstitutionright": "\u2E00", + "/angleright": "\u232A", + "/anglezigzagarrowdownright": "\u237C", + "/angryFace": "\u1F620", + "/angstrom": "\u212B", + "/anguishedFace": "\u1F627", + "/ankh": "\u2625", + "/anoteleia": "\u0387", + "/anpeasquare": "\u3302", + "/ant": "\u1F41C", + "/antennaBars": "\u1F4F6", + "/anticlockwiseDownwardsAndUpwardsOpenCircleArrows": "\u1F504", + "/anudattadeva": "\u0952", + "/anusvarabengali": "\u0982", + "/anusvaradeva": "\u0902", + "/anusvaragujarati": "\u0A82", + "/ao": "\uA735", + "/aogonek": "\u0105", + "/aovermfullwidth": "\u33DF", + "/apaatosquare": "\u3300", + "/aparen": "\u249C", + "/aparenthesized": "\u249C", + "/apostrophearmenian": "\u055A", + "/apostrophedblmod": "\u02EE", + "/apostrophemod": "\u02BC", + "/apple": "\uF8FF", + "/approaches": "\u2250", + "/approacheslimit": "\u2250", + "/approxequal": "\u2248", + "/approxequalorimage": "\u2252", + "/approximatelybutnotactuallyequal": "\u2246", + "/approximatelyequal": "\u2245", + "/approximatelyequalorimage": "\u2252", + "/apriltelegraph": "\u32C3", + "/aquarius": "\u2652", + "/ar:ae": "\u06D5", + "/ar:ain": "\u0639", + "/ar:alef": "\u0627", + "/ar:comma": "\u060C", + "/ar:cuberoot": "\u0606", + "/ar:decimalseparator": "\u066B", + "/ar:e": "\u06D0", + "/ar:eight": "\u0668", + "/ar:feh": "\u0641", + "/ar:five": "\u0665", + "/ar:four": "\u0664", + "/ar:fourthroot": "\u0607", + "/ar:kaf": "\u0643", + "/ar:ng": "\u06AD", + "/ar:nine": "\u0669", + "/ar:numbersign": "\u0600", + "/ar:oe": "\u06C6", + "/ar:one": "\u0661", + "/ar:peh": "\u067E", + "/ar:percent": "\u066A", + "/ar:perthousand": "\u060A", + "/ar:question": "\u061F", + "/ar:reh": "\u0631", + "/ar:semicolon": "\u061B", + "/ar:seven": "\u0667", + "/ar:shadda": "\u0651", + "/ar:six": "\u0666", + "/ar:sukun": "\u0652", + "/ar:three": "\u0663", + "/ar:two": "\u0662", + "/ar:u": "\u06C7", + "/ar:ve": "\u06CB", + "/ar:yu": "\u06C8", + "/ar:zero": "\u0660", + "/araeaekorean": "\u318E", + "/araeakorean": "\u318D", + "/arc": "\u2312", + "/archaicmepigraphic": "\uA7FF", + "/aries": "\u2648", + "/arighthalfring": "\u1E9A", + "/aring": "\u00E5", + "/aringacute": "\u01FB", + "/aringbelow": "\u1E01", + "/armn:Ayb": "\u0531", + "/armn:Ben": "\u0532", + "/armn:Ca": "\u053E", + "/armn:Cha": "\u0549", + "/armn:Cheh": "\u0543", + "/armn:Co": "\u0551", + "/armn:DRAMSIGN": "\u058F", + "/armn:Da": "\u0534", + "/armn:Ech": "\u0535", + "/armn:Eh": "\u0537", + "/armn:Et": "\u0538", + "/armn:Feh": "\u0556", + "/armn:Ghad": "\u0542", + "/armn:Gim": "\u0533", + "/armn:Ho": "\u0540", + "/armn:Ini": "\u053B", + "/armn:Ja": "\u0541", + "/armn:Jheh": "\u054B", + "/armn:Keh": "\u0554", + "/armn:Ken": "\u053F", + "/armn:Liwn": "\u053C", + "/armn:Men": "\u0544", + "/armn:Now": "\u0546", + "/armn:Oh": "\u0555", + "/armn:Peh": "\u054A", + "/armn:Piwr": "\u0553", + "/armn:Ra": "\u054C", + "/armn:Reh": "\u0550", + "/armn:Seh": "\u054D", + "/armn:Sha": "\u0547", + "/armn:Tiwn": "\u054F", + "/armn:To": "\u0539", + "/armn:Vew": "\u054E", + "/armn:Vo": "\u0548", + "/armn:Xeh": "\u053D", + "/armn:Yi": "\u0545", + "/armn:Yiwn": "\u0552", + "/armn:Za": "\u0536", + "/armn:Zhe": "\u053A", + "/armn:abbreviationmark": "\u055F", + "/armn:apostrophe": "\u055A", + "/armn:ayb": "\u0561", + "/armn:ben": "\u0562", + "/armn:ca": "\u056E", + "/armn:cha": "\u0579", + "/armn:cheh": "\u0573", + "/armn:co": "\u0581", + "/armn:comma": "\u055D", + "/armn:da": "\u0564", + "/armn:ech": "\u0565", + "/armn:ech_yiwn": "\u0587", + "/armn:eh": "\u0567", + "/armn:emphasismark": "\u055B", + "/armn:et": "\u0568", + "/armn:exclam": "\u055C", + "/armn:feh": "\u0586", + "/armn:ghad": "\u0572", + "/armn:gim": "\u0563", + "/armn:ho": "\u0570", + "/armn:hyphen": "\u058A", + "/armn:ini": "\u056B", + "/armn:ja": "\u0571", + "/armn:jheh": "\u057B", + "/armn:keh": "\u0584", + "/armn:ken": "\u056F", + "/armn:leftfacingeternitysign": "\u058E", + "/armn:liwn": "\u056C", + "/armn:men": "\u0574", + "/armn:men_ech": "\uFB14", + "/armn:men_ini": "\uFB15", + "/armn:men_now": "\uFB13", + "/armn:men_xeh": "\uFB17", + "/armn:now": "\u0576", + "/armn:oh": "\u0585", + "/armn:peh": "\u057A", + "/armn:period": "\u0589", + "/armn:piwr": "\u0583", + "/armn:question": "\u055E", + "/armn:ra": "\u057C", + "/armn:reh": "\u0580", + "/armn:rightfacingeternitysign": "\u058D", + "/armn:ringhalfleft": "\u0559", + "/armn:seh": "\u057D", + "/armn:sha": "\u0577", + "/armn:tiwn": "\u057F", + "/armn:to": "\u0569", + "/armn:vew": "\u057E", + "/armn:vew_now": "\uFB16", + "/armn:vo": "\u0578", + "/armn:xeh": "\u056D", + "/armn:yi": "\u0575", + "/armn:yiwn": "\u0582", + "/armn:za": "\u0566", + "/armn:zhe": "\u056A", + "/arrowNE": "\u2197", + "/arrowNW": "\u2196", + "/arrowSE": "\u2198", + "/arrowSW": "\u2199", + "/arrowanticlockwiseopencircle": "\u21BA", + "/arrowanticlockwisesemicircle": "\u21B6", + "/arrowboth": "\u2194", + "/arrowclockwiseopencircle": "\u21BB", + "/arrowclockwisesemicircle": "\u21B7", + "/arrowdashdown": "\u21E3", + "/arrowdashleft": "\u21E0", + "/arrowdashright": "\u21E2", + "/arrowdashup": "\u21E1", + "/arrowdblboth": "\u21D4", + "/arrowdbldown": "\u21D3", + "/arrowdblleft": "\u21D0", + "/arrowdblright": "\u21D2", + "/arrowdblup": "\u21D1", + "/arrowdown": "\u2193", + "/arrowdowndashed": "\u21E3", + "/arrowdownfrombar": "\u21A7", + "/arrowdownleft": "\u2199", + "/arrowdownright": "\u2198", + "/arrowdowntwoheaded": "\u21A1", + "/arrowdownwhite": "\u21E9", + "/arrowdownzigzag": "\u21AF", + "/arrowheaddown": "\u2304", + "/arrowheaddownlowmod": "\u02EF", + "/arrowheaddownmod": "\u02C5", + "/arrowheadleftlowmod": "\u02F1", + "/arrowheadleftmod": "\u02C2", + "/arrowheadrightlowmod": "\u02F2", + "/arrowheadrightmod": "\u02C3", + "/arrowheadtwobarsuphorizontal": "\u2324", + "/arrowheadup": "\u2303", + "/arrowheaduplowmod": "\u02F0", + "/arrowheadupmod": "\u02C4", + "/arrowhorizex": "\uF8E7", + "/arrowleft": "\u2190", + "/arrowleftdashed": "\u21E0", + "/arrowleftdbl": "\u21D0", + "/arrowleftdblstroke": "\u21CD", + "/arrowleftdowncorner": "\u21B5", + "/arrowleftdowntip": "\u21B2", + "/arrowleftfrombar": "\u21A4", + "/arrowlefthook": "\u21A9", + "/arrowleftloop": "\u21AB", + "/arrowleftlowmod": "\u02FF", + "/arrowleftoverright": "\u21C6", + "/arrowleftoverrighttobar": "\u21B9", + "/arrowleftright": "\u2194", + "/arrowleftrightstroke": "\u21AE", + "/arrowleftrightwave": "\u21AD", + "/arrowleftsquiggle": "\u21DC", + "/arrowleftstroke": "\u219A", + "/arrowlefttail": "\u21A2", + "/arrowlefttobar": "\u21E4", + "/arrowlefttwoheaded": "\u219E", + "/arrowleftuptip": "\u21B0", + "/arrowleftwave": "\u219C", + "/arrowleftwhite": "\u21E6", + "/arrowlongNWtobar": "\u21B8", + "/arrowright": "\u2192", + "/arrowrightdashed": "\u21E2", + "/arrowrightdblstroke": "\u21CF", + "/arrowrightdowncorner": "\u21B4", + "/arrowrightdowntip": "\u21B3", + "/arrowrightfrombar": "\u21A6", + "/arrowrightheavy": "\u279E", + "/arrowrighthook": "\u21AA", + "/arrowrightloop": "\u21AC", + "/arrowrightoverleft": "\u21C4", + "/arrowrightsmallcircle": "\u21F4", + "/arrowrightsquiggle": "\u21DD", + "/arrowrightstroke": "\u219B", + "/arrowrighttail": "\u21A3", + "/arrowrighttobar": "\u21E5", + "/arrowrighttwoheaded": "\u21A0", + "/arrowrightwave": "\u219D", + "/arrowrightwhite": "\u21E8", + "/arrowspaireddown": "\u21CA", + "/arrowspairedleft": "\u21C7", + "/arrowspairedright": "\u21C9", + "/arrowspairedup": "\u21C8", + "/arrowtableft": "\u21E4", + "/arrowtabright": "\u21E5", + "/arrowup": "\u2191", + "/arrowupdashed": "\u21E1", + "/arrowupdn": "\u2195", + "/arrowupdnbse": "\u21A8", + "/arrowupdown": "\u2195", + "/arrowupdownbase": "\u21A8", + "/arrowupdownwithbase": "\u21A8", + "/arrowupfrombar": "\u21A5", + "/arrowupleft": "\u2196", + "/arrowupleftofdown": "\u21C5", + "/arrowupright": "\u2197", + "/arrowuprighttip": "\u21B1", + "/arrowuptwoheaded": "\u219F", + "/arrowupwhite": "\u21E7", + "/arrowvertex": "\uF8E6", + "/articulatedLorry": "\u1F69B", + "/artistPalette": "\u1F3A8", + "/aruhuasquare": "\u3301", + "/asciicircum": "\u005E", + "/asciicircummonospace": "\uFF3E", + "/asciitilde": "\u007E", + "/asciitildemonospace": "\uFF5E", + "/ascript": "\u0251", + "/ascriptturned": "\u0252", + "/asmallhiragana": "\u3041", + "/asmallkatakana": "\u30A1", + "/asmallkatakanahalfwidth": "\uFF67", + "/asper": "\u1FFE", + "/asperacute": "\u1FDE", + "/aspergrave": "\u1FDD", + "/aspertilde": "\u1FDF", + "/assertion": "\u22A6", + "/asterisk": "\u002A", + "/asteriskaltonearabic": "\u066D", + "/asteriskarabic": "\u066D", + "/asteriskmath": "\u2217", + "/asteriskmonospace": "\uFF0A", + "/asterisksmall": "\uFE61", + "/asterism": "\u2042", + "/astonishedFace": "\u1F632", + "/astroke": "\u2C65", + "/astronomicaluranus": "\u26E2", + "/asuperior": "\uF6E9", + "/asympticallyequal": "\u2243", + "/asymptoticallyequal": "\u2243", + "/at": "\u0040", + "/athleticShoe": "\u1F45F", + "/atilde": "\u00E3", + "/atmonospace": "\uFF20", + "/atnachHafukh:hb": "\u05A2", + "/atom": "\u269B", + "/atsmall": "\uFE6B", + "/attentionideographiccircled": "\u329F", + "/aturned": "\u0250", + "/au": "\uA737", + "/aubengali": "\u0994", + "/aubergine": "\u1F346", + "/aubopomofo": "\u3120", + "/audeva": "\u0914", + "/aufullwidth": "\u3373", + "/augujarati": "\u0A94", + "/augurmukhi": "\u0A14", + "/augusttelegraph": "\u32C7", + "/aulengthmarkbengali": "\u09D7", + "/aumatragurmukhi": "\u0A4C", + "/austral": "\u20B3", + "/automatedTellerMachine": "\u1F3E7", + "/automobile": "\u1F697", + "/auvowelsignbengali": "\u09CC", + "/auvowelsigndeva": "\u094C", + "/auvowelsigngujarati": "\u0ACC", + "/av": "\uA739", + "/avagrahadeva": "\u093D", + "/avhorizontalbar": "\uA73B", + "/ay": "\uA73D", + "/aybarmenian": "\u0561", + "/ayin": "\u05E2", + "/ayin:hb": "\u05E2", + "/ayinalt:hb": "\uFB20", + "/ayinaltonehebrew": "\uFB20", + "/ayinhebrew": "\u05E2", + "/azla:hb": "\u059C", + "/b": "\u0062", + "/baarerusquare": "\u332D", + "/babengali": "\u09AC", + "/babyAngel": "\u1F47C", + "/babyBottle": "\u1F37C", + "/babyChick": "\u1F424", + "/backLeftwardsArrowAbove": "\u1F519", + "/backOfEnvelope": "\u1F582", + "/backslash": "\u005C", + "/backslashbarfunc": "\u2340", + "/backslashdbl": "\u244A", + "/backslashmonospace": "\uFF3C", + "/bactrianCamel": "\u1F42B", + "/badeva": "\u092C", + "/badmintonRacquetAndShuttlecock": "\u1F3F8", + "/bagdelimitersshapeleft": "\u27C5", + "/bagdelimitersshaperight": "\u27C6", + "/baggageClaim": "\u1F6C4", + "/bagujarati": "\u0AAC", + "/bagurmukhi": "\u0A2C", + "/bahiragana": "\u3070", + "/bahtthai": "\u0E3F", + "/bakatakana": "\u30D0", + "/balloon": "\u1F388", + "/ballotBoldScriptX": "\u1F5F6", + "/ballotBoxBallot": "\u1F5F3", + "/ballotBoxBoldCheck": "\u1F5F9", + "/ballotBoxBoldScriptX": "\u1F5F7", + "/ballotBoxScriptX": "\u1F5F5", + "/ballotScriptX": "\u1F5F4", + "/bamurda": "\uA9A8", + "/banana": "\u1F34C", + "/bank": "\u1F3E6", + "/banknoteDollarSign": "\u1F4B5", + "/banknoteEuroSign": "\u1F4B6", + "/banknotePoundSign": "\u1F4B7", + "/banknoteYenSign": "\u1F4B4", + "/bar": "\u007C", + "/barChart": "\u1F4CA", + "/barberPole": "\u1F488", + "/barfullwidth": "\u3374", + "/barmonospace": "\uFF5C", + "/barquillverticalleft": "\u2E20", + "/barquillverticalright": "\u2E21", + "/baseball": "\u26BE", + "/basketballAndHoop": "\u1F3C0", + "/bath": "\u1F6C0", + "/bathtub": "\u1F6C1", + "/battery": "\u1F50B", + "/bbopomofo": "\u3105", + "/bcircle": "\u24D1", + "/bdot": "\u1E03", + "/bdotaccent": "\u1E03", + "/bdotbelow": "\u1E05", + "/beachUmbrella": "\u1F3D6", + "/beamedAscendingMusicalNotes": "\u1F39C", + "/beamedDescendingMusicalNotes": "\u1F39D", + "/beamedeighthnotes": "\u266B", + "/beamedsixteenthnotes": "\u266C", + "/beamfunc": "\u2336", + "/bearFace": "\u1F43B", + "/beatingHeart": "\u1F493", + "/because": "\u2235", + "/becyr": "\u0431", + "/becyrillic": "\u0431", + "/bed": "\u1F6CF", + "/beeh": "\u067B", + "/beeh.fina": "\uFB53", + "/beeh.init": "\uFB54", + "/beeh.isol": "\uFB52", + "/beeh.medi": "\uFB55", + "/beerMug": "\u1F37A", + "/beetasquare": "\u333C", + "/beh": "\u0628", + "/beh.fina": "\uFE90", + "/beh.init": "\uFE91", + "/beh.init_alefmaksura.fina": "\uFC09", + "/beh.init_hah.fina": "\uFC06", + "/beh.init_hah.medi": "\uFC9D", + "/beh.init_heh.medi": "\uFCA0", + "/beh.init_jeem.fina": "\uFC05", + "/beh.init_jeem.medi": "\uFC9C", + "/beh.init_khah.fina": "\uFC07", + "/beh.init_khah.medi": "\uFC9E", + "/beh.init_meem.fina": "\uFC08", + "/beh.init_meem.medi": "\uFC9F", + "/beh.init_yeh.fina": "\uFC0A", + "/beh.isol": "\uFE8F", + "/beh.medi": "\uFE92", + "/beh.medi_alefmaksura.fina": "\uFC6E", + "/beh.medi_hah.medi_yeh.fina": "\uFDC2", + "/beh.medi_heh.medi": "\uFCE2", + "/beh.medi_khah.medi_yeh.fina": "\uFD9E", + "/beh.medi_meem.fina": "\uFC6C", + "/beh.medi_meem.medi": "\uFCE1", + "/beh.medi_noon.fina": "\uFC6D", + "/beh.medi_reh.fina": "\uFC6A", + "/beh.medi_yeh.fina": "\uFC6F", + "/beh.medi_zain.fina": "\uFC6B", + "/behDotBelowThreeDotsAbove": "\u0751", + "/behInvertedSmallVBelow": "\u0755", + "/behSmallV": "\u0756", + "/behThreeDotsHorizontallyBelow": "\u0750", + "/behThreeDotsUpBelow": "\u0752", + "/behThreeDotsUpBelowTwoDotsAbove": "\u0753", + "/behTwoDotsBelowDotAbove": "\u0754", + "/beharabic": "\u0628", + "/beheh": "\u0680", + "/beheh.fina": "\uFB5B", + "/beheh.init": "\uFB5C", + "/beheh.isol": "\uFB5A", + "/beheh.medi": "\uFB5D", + "/behfinalarabic": "\uFE90", + "/behinitialarabic": "\uFE91", + "/behiragana": "\u3079", + "/behmedialarabic": "\uFE92", + "/behmeeminitialarabic": "\uFC9F", + "/behmeemisolatedarabic": "\uFC08", + "/behnoonfinalarabic": "\uFC6D", + "/bekatakana": "\u30D9", + "/bellCancellationStroke": "\u1F515", + "/bellhopBell": "\u1F6CE", + "/beltbuckle": "\u2444", + "/benarmenian": "\u0562", + "/beng:a": "\u0985", + "/beng:aa": "\u0986", + "/beng:aasign": "\u09BE", + "/beng:abbreviationsign": "\u09FD", + "/beng:ai": "\u0990", + "/beng:aisign": "\u09C8", + "/beng:anji": "\u0980", + "/beng:anusvara": "\u0982", + "/beng:au": "\u0994", + "/beng:aulengthmark": "\u09D7", + "/beng:ausign": "\u09CC", + "/beng:avagraha": "\u09BD", + "/beng:ba": "\u09AC", + "/beng:bha": "\u09AD", + "/beng:ca": "\u099A", + "/beng:candrabindu": "\u0981", + "/beng:cha": "\u099B", + "/beng:currencyoneless": "\u09F8", + "/beng:da": "\u09A6", + "/beng:dda": "\u09A1", + "/beng:ddha": "\u09A2", + "/beng:dha": "\u09A7", + "/beng:e": "\u098F", + "/beng:eight": "\u09EE", + "/beng:esign": "\u09C7", + "/beng:five": "\u09EB", + "/beng:four": "\u09EA", + "/beng:fourcurrencynumerator": "\u09F7", + "/beng:ga": "\u0997", + "/beng:gandamark": "\u09FB", + "/beng:gha": "\u0998", + "/beng:ha": "\u09B9", + "/beng:i": "\u0987", + "/beng:ii": "\u0988", + "/beng:iisign": "\u09C0", + "/beng:isign": "\u09BF", + "/beng:isshar": "\u09FA", + "/beng:ja": "\u099C", + "/beng:jha": "\u099D", + "/beng:ka": "\u0995", + "/beng:kha": "\u0996", + "/beng:khandata": "\u09CE", + "/beng:la": "\u09B2", + "/beng:llvocal": "\u09E1", + "/beng:llvocalsign": "\u09E3", + "/beng:lvocal": "\u098C", + "/beng:lvocalsign": "\u09E2", + "/beng:ma": "\u09AE", + "/beng:na": "\u09A8", + "/beng:nga": "\u0999", + "/beng:nine": "\u09EF", + "/beng:nna": "\u09A3", + "/beng:nukta": "\u09BC", + "/beng:nya": "\u099E", + "/beng:o": "\u0993", + "/beng:one": "\u09E7", + "/beng:onecurrencynumerator": "\u09F4", + "/beng:osign": "\u09CB", + "/beng:pa": "\u09AA", + "/beng:pha": "\u09AB", + "/beng:ra": "\u09B0", + "/beng:ralowdiagonal": "\u09F1", + "/beng:ramiddiagonal": "\u09F0", + "/beng:rha": "\u09DD", + "/beng:rra": "\u09DC", + "/beng:rrvocal": "\u09E0", + "/beng:rrvocalsign": "\u09C4", + "/beng:rupee": "\u09F3", + "/beng:rupeemark": "\u09F2", + "/beng:rvocal": "\u098B", + "/beng:rvocalsign": "\u09C3", + "/beng:sa": "\u09B8", + "/beng:seven": "\u09ED", + "/beng:sha": "\u09B6", + "/beng:six": "\u09EC", + "/beng:sixteencurrencydenominator": "\u09F9", + "/beng:ssa": "\u09B7", + "/beng:ta": "\u09A4", + "/beng:tha": "\u09A5", + "/beng:three": "\u09E9", + "/beng:threecurrencynumerator": "\u09F6", + "/beng:tta": "\u099F", + "/beng:ttha": "\u09A0", + "/beng:two": "\u09E8", + "/beng:twocurrencynumerator": "\u09F5", + "/beng:u": "\u0989", + "/beng:usign": "\u09C1", + "/beng:uu": "\u098A", + "/beng:uusign": "\u09C2", + "/beng:vedicanusvara": "\u09FC", + "/beng:virama": "\u09CD", + "/beng:visarga": "\u0983", + "/beng:ya": "\u09AF", + "/beng:yya": "\u09DF", + "/beng:zero": "\u09E6", + "/bentoBox": "\u1F371", + "/benzenering": "\u232C", + "/benzeneringcircle": "\u23E3", + "/bet": "\u05D1", + "/bet:hb": "\u05D1", + "/beta": "\u03B2", + "/betasymbol": "\u03D0", + "/betasymbolgreek": "\u03D0", + "/betdagesh": "\uFB31", + "/betdageshhebrew": "\uFB31", + "/bethebrew": "\u05D1", + "/betrafehebrew": "\uFB4C", + "/between": "\u226C", + "/betwithdagesh:hb": "\uFB31", + "/betwithrafe:hb": "\uFB4C", + "/bflourish": "\uA797", + "/bhabengali": "\u09AD", + "/bhadeva": "\u092D", + "/bhagujarati": "\u0AAD", + "/bhagurmukhi": "\u0A2D", + "/bhook": "\u0253", + "/bicycle": "\u1F6B2", + "/bicyclist": "\u1F6B4", + "/bihiragana": "\u3073", + "/bikatakana": "\u30D3", + "/bikini": "\u1F459", + "/bilabialclick": "\u0298", + "/billiards": "\u1F3B1", + "/bindigurmukhi": "\u0A02", + "/biohazard": "\u2623", + "/bird": "\u1F426", + "/birthdayCake": "\u1F382", + "/birusquare": "\u3331", + "/bishopblack": "\u265D", + "/bishopwhite": "\u2657", + "/bitcoin": "\u20BF", + "/blackDownPointingBackhandIndex": "\u1F5A3", + "/blackDroplet": "\u1F322", + "/blackFolder": "\u1F5BF", + "/blackHardShellFloppyDisk": "\u1F5AA", + "/blackHeart": "\u1F5A4", + "/blackLeftPointingBackhandIndex": "\u1F59C", + "/blackPennant": "\u1F3F2", + "/blackPushpin": "\u1F588", + "/blackRightPointingBackhandIndex": "\u1F59D", + "/blackRosette": "\u1F3F6", + "/blackSkullAndCrossbones": "\u1F571", + "/blackSquareButton": "\u1F532", + "/blackTouchtoneTelephone": "\u1F57F", + "/blackUpPointingBackhandIndex": "\u1F5A2", + "/blackcircle": "\u25CF", + "/blackcircleforrecord": "\u23FA", + "/blackdiamond": "\u25C6", + "/blackdownpointingtriangle": "\u25BC", + "/blackforstopsquare": "\u23F9", + "/blackleftpointingpointer": "\u25C4", + "/blackleftpointingtriangle": "\u25C0", + "/blacklenticularbracketleft": "\u3010", + "/blacklenticularbracketleftvertical": "\uFE3B", + "/blacklenticularbracketright": "\u3011", + "/blacklenticularbracketrightvertical": "\uFE3C", + "/blacklowerlefttriangle": "\u25E3", + "/blacklowerrighttriangle": "\u25E2", + "/blackmediumpointingtriangledown": "\u23F7", + "/blackmediumpointingtriangleleft": "\u23F4", + "/blackmediumpointingtriangleright": "\u23F5", + "/blackmediumpointingtriangleup": "\u23F6", + "/blackpointingdoubletrianglebarverticalleft": "\u23EE", + "/blackpointingdoubletrianglebarverticalright": "\u23ED", + "/blackpointingdoubletriangledown": "\u23EC", + "/blackpointingdoubletriangleleft": "\u23EA", + "/blackpointingdoubletriangleright": "\u23E9", + "/blackpointingdoubletriangleup": "\u23EB", + "/blackpointingtriangledoublebarverticalright": "\u23EF", + "/blackrectangle": "\u25AC", + "/blackrightpointingpointer": "\u25BA", + "/blackrightpointingtriangle": "\u25B6", + "/blacksmallsquare": "\u25AA", + "/blacksmilingface": "\u263B", + "/blacksquare": "\u25A0", + "/blackstar": "\u2605", + "/blackupperlefttriangle": "\u25E4", + "/blackupperrighttriangle": "\u25E5", + "/blackuppointingsmalltriangle": "\u25B4", + "/blackuppointingtriangle": "\u25B2", + "/blackwardsbulletleft": "\u204C", + "/blackwardsbulletright": "\u204D", + "/blank": "\u2423", + "/blinebelow": "\u1E07", + "/block": "\u2588", + "/blossom": "\u1F33C", + "/blowfish": "\u1F421", + "/blueBook": "\u1F4D8", + "/blueHeart": "\u1F499", + "/bmonospace": "\uFF42", + "/boar": "\u1F417", + "/board": "\u2328", + "/bobaimaithai": "\u0E1A", + "/bohiragana": "\u307C", + "/bokatakana": "\u30DC", + "/bomb": "\u1F4A3", + "/book": "\u1F56E", + "/bookmark": "\u1F516", + "/bookmarkTabs": "\u1F4D1", + "/books": "\u1F4DA", + "/bopo:a": "\u311A", + "/bopo:ai": "\u311E", + "/bopo:an": "\u3122", + "/bopo:ang": "\u3124", + "/bopo:au": "\u3120", + "/bopo:b": "\u3105", + "/bopo:c": "\u3118", + "/bopo:ch": "\u3114", + "/bopo:d": "\u3109", + "/bopo:e": "\u311C", + "/bopo:eh": "\u311D", + "/bopo:ei": "\u311F", + "/bopo:en": "\u3123", + "/bopo:eng": "\u3125", + "/bopo:er": "\u3126", + "/bopo:f": "\u3108", + "/bopo:g": "\u310D", + "/bopo:gn": "\u312C", + "/bopo:h": "\u310F", + "/bopo:i": "\u3127", + "/bopo:ih": "\u312D", + "/bopo:iu": "\u3129", + "/bopo:j": "\u3110", + "/bopo:k": "\u310E", + "/bopo:l": "\u310C", + "/bopo:m": "\u3107", + "/bopo:n": "\u310B", + "/bopo:ng": "\u312B", + "/bopo:o": "\u311B", + "/bopo:ou": "\u3121", + "/bopo:owithdotabove": "\u312E", + "/bopo:p": "\u3106", + "/bopo:q": "\u3111", + "/bopo:r": "\u3116", + "/bopo:s": "\u3119", + "/bopo:sh": "\u3115", + "/bopo:t": "\u310A", + "/bopo:u": "\u3128", + "/bopo:v": "\u312A", + "/bopo:x": "\u3112", + "/bopo:z": "\u3117", + "/bopo:zh": "\u3113", + "/borutosquare": "\u333E", + "/bottlePoppingCork": "\u1F37E", + "/bouquet": "\u1F490", + "/bouquetOfFlowers": "\u1F395", + "/bowAndArrow": "\u1F3F9", + "/bowlOfHygieia": "\u1F54F", + "/bowling": "\u1F3B3", + "/boxlineverticalleft": "\u23B8", + "/boxlineverticalright": "\u23B9", + "/boy": "\u1F466", + "/boys": "\u1F6C9", + "/bparen": "\u249D", + "/bparenthesized": "\u249D", + "/bqfullwidth": "\u33C3", + "/bqsquare": "\u33C3", + "/braceex": "\uF8F4", + "/braceleft": "\u007B", + "/braceleftbt": "\uF8F3", + "/braceleftmid": "\uF8F2", + "/braceleftmonospace": "\uFF5B", + "/braceleftsmall": "\uFE5B", + "/bracelefttp": "\uF8F1", + "/braceleftvertical": "\uFE37", + "/braceright": "\u007D", + "/bracerightbt": "\uF8FE", + "/bracerightmid": "\uF8FD", + "/bracerightmonospace": "\uFF5D", + "/bracerightsmall": "\uFE5C", + "/bracerighttp": "\uF8FC", + "/bracerightvertical": "\uFE38", + "/bracketangledblleft": "\u27EA", + "/bracketangledblright": "\u27EB", + "/bracketangleleft": "\u27E8", + "/bracketangleright": "\u27E9", + "/bracketbottomcurly": "\u23DF", + "/bracketbottomsquare": "\u23B5", + "/bracketcornerupleftsquare": "\u23A1", + "/bracketcorneruprightsquare": "\u23A4", + "/bracketdottedsubstitutionleft": "\u2E04", + "/bracketdottedsubstitutionright": "\u2E05", + "/bracketextensioncurly": "\u23AA", + "/bracketextensionleftsquare": "\u23A2", + "/bracketextensionrightsquare": "\u23A5", + "/brackethalfbottomleft": "\u2E24", + "/brackethalfbottomright": "\u2E25", + "/brackethalftopleft": "\u2E22", + "/brackethalftopright": "\u2E23", + "/brackethookupleftcurly": "\u23A7", + "/brackethookuprightcurly": "\u23AB", + "/bracketleft": "\u005B", + "/bracketleftbt": "\uF8F0", + "/bracketleftex": "\uF8EF", + "/bracketleftmonospace": "\uFF3B", + "/bracketleftsquarequill": "\u2045", + "/bracketlefttp": "\uF8EE", + "/bracketlowercornerleftsquare": "\u23A3", + "/bracketlowercornerrightsquare": "\u23A6", + "/bracketlowerhookleftcurly": "\u23A9", + "/bracketlowerhookrightcurly": "\u23AD", + "/bracketmiddlepieceleftcurly": "\u23A8", + "/bracketmiddlepiecerightcurly": "\u23AC", + "/bracketoverbrackettopbottomsquare": "\u23B6", + "/bracketparaphraselowleft": "\u2E1C", + "/bracketparaphraselowright": "\u2E1D", + "/bracketraisedleft": "\u2E0C", + "/bracketraisedright": "\u2E0D", + "/bracketright": "\u005D", + "/bracketrightbt": "\uF8FB", + "/bracketrightex": "\uF8FA", + "/bracketrightmonospace": "\uFF3D", + "/bracketrightsquarequill": "\u2046", + "/bracketrighttp": "\uF8F9", + "/bracketsectionupleftlowerrightcurly": "\u23B0", + "/bracketsectionuprightlowerleftcurly": "\u23B1", + "/bracketshellbottom": "\u23E1", + "/bracketshelltop": "\u23E0", + "/bracketshellwhiteleft": "\u27EC", + "/bracketshellwhiteright": "\u27ED", + "/bracketsubstitutionleft": "\u2E02", + "/bracketsubstitutionright": "\u2E03", + "/brackettopcurly": "\u23DE", + "/brackettopsquare": "\u23B4", + "/brackettranspositionleft": "\u2E09", + "/brackettranspositionright": "\u2E0A", + "/bracketwhitesquareleft": "\u27E6", + "/bracketwhitesquareright": "\u27E7", + "/branchbankidentification": "\u2446", + "/bread": "\u1F35E", + "/breve": "\u02D8", + "/brevebelowcmb": "\u032E", + "/brevecmb": "\u0306", + "/breveinvertedbelowcmb": "\u032F", + "/breveinvertedcmb": "\u0311", + "/breveinverteddoublecmb": "\u0361", + "/brevemetrical": "\u23D1", + "/brideVeil": "\u1F470", + "/bridgeAtNight": "\u1F309", + "/bridgebelowcmb": "\u032A", + "/bridgeinvertedbelowcmb": "\u033A", + "/briefcase": "\u1F4BC", + "/brll:blank": "\u2800", + "/brokenHeart": "\u1F494", + "/brokenbar": "\u00A6", + "/brokencirclenorthwestarrow": "\u238B", + "/bstroke": "\u0180", + "/bsuperior": "\uF6EA", + "/btopbar": "\u0183", + "/bug": "\u1F41B", + "/buhiragana": "\u3076", + "/buildingConstruction": "\u1F3D7", + "/bukatakana": "\u30D6", + "/bullet": "\u2022", + "/bulletinverse": "\u25D8", + "/bulletoperator": "\u2219", + "/bullhorn": "\u1F56B", + "/bullhornSoundWaves": "\u1F56C", + "/bullseye": "\u25CE", + "/burrito": "\u1F32F", + "/bus": "\u1F68C", + "/busStop": "\u1F68F", + "/bussyerusquare": "\u3334", + "/bustInSilhouette": "\u1F464", + "/bustsInSilhouette": "\u1F465", + "/c": "\u0063", + "/caarmenian": "\u056E", + "/cabengali": "\u099A", + "/cactus": "\u1F335", + "/cacute": "\u0107", + "/cadauna": "\u2106", + "/cadeva": "\u091A", + "/caduceus": "\u2624", + "/cagujarati": "\u0A9A", + "/cagurmukhi": "\u0A1A", + "/cakraconsonant": "\uA9BF", + "/calendar": "\u1F4C5", + "/calfullwidth": "\u3388", + "/callideographicparen": "\u323A", + "/calsquare": "\u3388", + "/camera": "\u1F4F7", + "/cameraFlash": "\u1F4F8", + "/camping": "\u1F3D5", + "/camurda": "\uA996", + "/cancellationX": "\u1F5D9", + "/cancer": "\u264B", + "/candle": "\u1F56F", + "/candrabindubengali": "\u0981", + "/candrabinducmb": "\u0310", + "/candrabindudeva": "\u0901", + "/candrabindugujarati": "\u0A81", + "/candy": "\u1F36C", + "/canoe": "\u1F6F6", + "/capitulum": "\u2E3F", + "/capricorn": "\u2651", + "/capslock": "\u21EA", + "/cardFileBox": "\u1F5C3", + "/cardIndex": "\u1F4C7", + "/cardIndexDividers": "\u1F5C2", + "/careof": "\u2105", + "/caret": "\u2038", + "/caretinsertionpoint": "\u2041", + "/carettildedownfunc": "\u2371", + "/carettildeupfunc": "\u2372", + "/caron": "\u02C7", + "/caronbelowcmb": "\u032C", + "/caroncmb": "\u030C", + "/carouselHorse": "\u1F3A0", + "/carpStreamer": "\u1F38F", + "/carriagereturn": "\u21B5", + "/carsliding": "\u26D0", + "/castle": "\u26EB", + "/cat": "\u1F408", + "/catFace": "\u1F431", + "/catFaceWithTearsOfJoy": "\u1F639", + "/catFaceWithWrySmile": "\u1F63C", + "/caution": "\u2621", + "/cbar": "\uA793", + "/cbopomofo": "\u3118", + "/ccaron": "\u010D", + "/ccedilla": "\u00E7", + "/ccedillaacute": "\u1E09", + "/ccfullwidth": "\u33C4", + "/ccircle": "\u24D2", + "/ccircumflex": "\u0109", + "/ccurl": "\u0255", + "/cdfullwidth": "\u33C5", + "/cdot": "\u010B", + "/cdotaccent": "\u010B", + "/cdotreversed": "\uA73F", + "/cdsquare": "\u33C5", + "/cecak": "\uA981", + "/cecaktelu": "\uA9B3", + "/cedi": "\u20B5", + "/cedilla": "\u00B8", + "/cedillacmb": "\u0327", + "/ceilingleft": "\u2308", + "/ceilingright": "\u2309", + "/celticCross": "\u1F548", + "/cent": "\u00A2", + "/centigrade": "\u2103", + "/centinferior": "\uF6DF", + "/centmonospace": "\uFFE0", + "/centoldstyle": "\uF7A2", + "/centreddotwhitediamond": "\u27D0", + "/centreideographiccircled": "\u32A5", + "/centreline": "\u2104", + "/centrelineverticalsquarewhite": "\u2385", + "/centsuperior": "\uF6E0", + "/ceres": "\u26B3", + "/chaarmenian": "\u0579", + "/chabengali": "\u099B", + "/chadeva": "\u091B", + "/chagujarati": "\u0A9B", + "/chagurmukhi": "\u0A1B", + "/chains": "\u26D3", + "/chair": "\u2441", + "/chamkocircle": "\u327C", + "/charactertie": "\u2040", + "/chartDownwardsTrend": "\u1F4C9", + "/chartUpwardsTrend": "\u1F4C8", + "/chartUpwardsTrendAndYenSign": "\u1F4B9", + "/chbopomofo": "\u3114", + "/cheabkhasiancyrillic": "\u04BD", + "/cheabkhcyr": "\u04BD", + "/cheabkhtailcyr": "\u04BF", + "/checkbox": "\u2610", + "/checkboxchecked": "\u2611", + "/checkboxx": "\u2612", + "/checkmark": "\u2713", + "/checyr": "\u0447", + "/checyrillic": "\u0447", + "/chedescenderabkhasiancyrillic": "\u04BF", + "/chedescendercyrillic": "\u04B7", + "/chedieresiscyr": "\u04F5", + "/chedieresiscyrillic": "\u04F5", + "/cheeringMegaphone": "\u1F4E3", + "/cheharmenian": "\u0573", + "/chekhakascyr": "\u04CC", + "/chekhakassiancyrillic": "\u04CC", + "/chequeredFlag": "\u1F3C1", + "/cherries": "\u1F352", + "/cherryBlossom": "\u1F338", + "/chestnut": "\u1F330", + "/chetailcyr": "\u04B7", + "/chevertcyr": "\u04B9", + "/cheverticalstrokecyrillic": "\u04B9", + "/chi": "\u03C7", + "/chicken": "\u1F414", + "/chieuchacirclekorean": "\u3277", + "/chieuchaparenkorean": "\u3217", + "/chieuchcirclekorean": "\u3269", + "/chieuchkorean": "\u314A", + "/chieuchparenkorean": "\u3209", + "/childrenCrossing": "\u1F6B8", + "/chipmunk": "\u1F43F", + "/chirho": "\u2627", + "/chiron": "\u26B7", + "/chochangthai": "\u0E0A", + "/chochanthai": "\u0E08", + "/chochingthai": "\u0E09", + "/chochoethai": "\u0E0C", + "/chocolateBar": "\u1F36B", + "/chook": "\u0188", + "/christmasTree": "\u1F384", + "/church": "\u26EA", + "/cieucacirclekorean": "\u3276", + "/cieucaparenkorean": "\u3216", + "/cieuccirclekorean": "\u3268", + "/cieuckorean": "\u3148", + "/cieucparenkorean": "\u3208", + "/cieucuparenkorean": "\u321C", + "/cinema": "\u1F3A6", + "/circle": "\u25CB", + "/circleallbutupperquadrantleftblack": "\u25D5", + "/circlebackslashfunc": "\u2349", + "/circleblack": "\u25CF", + "/circledCrossPommee": "\u1F540", + "/circledInformationSource": "\u1F6C8", + "/circledasteriskoperator": "\u229B", + "/circledbarnotchhorizontal": "\u2389", + "/circledcrossinglanes": "\u26D2", + "/circleddash": "\u229D", + "/circleddivisionslash": "\u2298", + "/circleddotoperator": "\u2299", + "/circledequals": "\u229C", + "/circlediaeresisfunc": "\u2365", + "/circledminus": "\u2296", + "/circledot": "\u2299", + "/circledotrightwhite": "\u2686", + "/circledotted": "\u25CC", + "/circledringoperator": "\u229A", + "/circledtriangledown": "\u238A", + "/circlehalfleftblack": "\u25D0", + "/circlehalfrightblack": "\u25D1", + "/circleinversewhite": "\u25D9", + "/circlejotfunc": "\u233E", + "/circlelowerhalfblack": "\u25D2", + "/circlelowerquadrantleftwhite": "\u25F5", + "/circlelowerquadrantrightwhite": "\u25F6", + "/circlemultiply": "\u2297", + "/circleot": "\u2299", + "/circleplus": "\u2295", + "/circlepostalmark": "\u3036", + "/circlestarfunc": "\u235F", + "/circlestilefunc": "\u233D", + "/circlestroketwodotsaboveheavy": "\u26E3", + "/circletwodotsblackwhite": "\u2689", + "/circletwodotswhite": "\u2687", + "/circleunderlinefunc": "\u235C", + "/circleupperhalfblack": "\u25D3", + "/circleupperquadrantleftwhite": "\u25F4", + "/circleupperquadrantrightblack": "\u25D4", + "/circleupperquadrantrightwhite": "\u25F7", + "/circleverticalfill": "\u25CD", + "/circlewhite": "\u25CB", + "/circlewhitedotrightblack": "\u2688", + "/circlewithlefthalfblack": "\u25D0", + "/circlewithrighthalfblack": "\u25D1", + "/circumflex": "\u02C6", + "/circumflexbelowcmb": "\u032D", + "/circumflexcmb": "\u0302", + "/circumflexlow": "\uA788", + "/circusTent": "\u1F3AA", + "/cityscape": "\u1F3D9", + "/cityscapeAtDusk": "\u1F306", + "/cjk:ideographiccomma": "\u3001", + "/cjk:tortoiseshellbracketleft": "\u3014", + "/cjk:tortoiseshellbracketright": "\u3015", + "/clamshellMobilePhone": "\u1F581", + "/clapperBoard": "\u1F3AC", + "/clappingHandsSign": "\u1F44F", + "/classicalBuilding": "\u1F3DB", + "/clear": "\u2327", + "/clearscreen": "\u239A", + "/clickalveolar": "\u01C2", + "/clickbilabial": "\u0298", + "/clickdental": "\u01C0", + "/clicklateral": "\u01C1", + "/clickretroflex": "\u01C3", + "/clinkingBeerMugs": "\u1F37B", + "/clipboard": "\u1F4CB", + "/clockFaceEight-thirty": "\u1F563", + "/clockFaceEightOclock": "\u1F557", + "/clockFaceEleven-thirty": "\u1F566", + "/clockFaceElevenOclock": "\u1F55A", + "/clockFaceFive-thirty": "\u1F560", + "/clockFaceFiveOclock": "\u1F554", + "/clockFaceFour-thirty": "\u1F55F", + "/clockFaceFourOclock": "\u1F553", + "/clockFaceNine-thirty": "\u1F564", + "/clockFaceNineOclock": "\u1F558", + "/clockFaceOne-thirty": "\u1F55C", + "/clockFaceOneOclock": "\u1F550", + "/clockFaceSeven-thirty": "\u1F562", + "/clockFaceSevenOclock": "\u1F556", + "/clockFaceSix-thirty": "\u1F561", + "/clockFaceSixOclock": "\u1F555", + "/clockFaceTen-thirty": "\u1F565", + "/clockFaceTenOclock": "\u1F559", + "/clockFaceThree-thirty": "\u1F55E", + "/clockFaceThreeOclock": "\u1F552", + "/clockFaceTwelve-thirty": "\u1F567", + "/clockFaceTwelveOclock": "\u1F55B", + "/clockFaceTwo-thirty": "\u1F55D", + "/clockFaceTwoOclock": "\u1F551", + "/clockwiseDownwardsAndUpwardsOpenCircleArrows": "\u1F503", + "/clockwiseRightAndLeftSemicircleArrows": "\u1F5D8", + "/clockwiseRightwardsAndLeftwardsOpenCircleArrows": "\u1F501", + "/clockwiseRightwardsAndLeftwardsOpenCircleArrowsCircledOneOverlay": "\u1F502", + "/closedBook": "\u1F4D5", + "/closedLockKey": "\u1F510", + "/closedMailboxLoweredFlag": "\u1F4EA", + "/closedMailboxRaisedFlag": "\u1F4EB", + "/closedUmbrella": "\u1F302", + "/closedentryleft": "\u26DC", + "/closeup": "\u2050", + "/cloud": "\u2601", + "/cloudLightning": "\u1F329", + "/cloudRain": "\u1F327", + "/cloudSnow": "\u1F328", + "/cloudTornado": "\u1F32A", + "/clsquare": "\u1F191", + "/club": "\u2663", + "/clubblack": "\u2663", + "/clubsuitblack": "\u2663", + "/clubsuitwhite": "\u2667", + "/clubwhite": "\u2667", + "/cm2fullwidth": "\u33A0", + "/cm3fullwidth": "\u33A4", + "/cmb:a": "\u0363", + "/cmb:aaboveflat": "\u1DD3", + "/cmb:aboveogonek": "\u1DCE", + "/cmb:acute": "\u0301", + "/cmb:acutebelow": "\u0317", + "/cmb:acutegraveacute": "\u1DC9", + "/cmb:acutemacron": "\u1DC7", + "/cmb:acutetone": "\u0341", + "/cmb:adieresis": "\u1DF2", + "/cmb:ae": "\u1DD4", + "/cmb:almostequalabove": "\u034C", + "/cmb:almostequaltobelow": "\u1DFD", + "/cmb:alpha": "\u1DE7", + "/cmb:ao": "\u1DD5", + "/cmb:arrowheadleftbelow": "\u0354", + "/cmb:arrowheadrightabove": "\u0350", + "/cmb:arrowheadrightarrowheadupbelow": "\u0356", + "/cmb:arrowheadrightbelow": "\u0355", + "/cmb:arrowleftrightbelow": "\u034D", + "/cmb:arrowrightdoublebelow": "\u0362", + "/cmb:arrowupbelow": "\u034E", + "/cmb:asteriskbelow": "\u0359", + "/cmb:av": "\u1DD6", + "/cmb:b": "\u1DE8", + "/cmb:belowbreve": "\u032E", + "/cmb:beta": "\u1DE9", + "/cmb:breve": "\u0306", + "/cmb:brevemacron": "\u1DCB", + "/cmb:bridgeabove": "\u0346", + "/cmb:bridgebelow": "\u032A", + "/cmb:c": "\u0368", + "/cmb:candrabindu": "\u0310", + "/cmb:caron": "\u030C", + "/cmb:caronbelow": "\u032C", + "/cmb:ccedilla": "\u1DD7", + "/cmb:cedilla": "\u0327", + "/cmb:circumflex": "\u0302", + "/cmb:circumflexbelow": "\u032D", + "/cmb:commaaccentbelow": "\u0326", + "/cmb:commaturnedabove": "\u0312", + "/cmb:d": "\u0369", + "/cmb:dblarchinvertedbelow": "\u032B", + "/cmb:dbloverline": "\u033F", + "/cmb:dblverticallineabove": "\u030E", + "/cmb:dblverticallinebelow": "\u0348", + "/cmb:deletionmark": "\u1DFB", + "/cmb:dialytikatonos": "\u0344", + "/cmb:dieresis": "\u0308", + "/cmb:dieresisbelow": "\u0324", + "/cmb:dotaboveleft": "\u1DF8", + "/cmb:dotaccent": "\u0307", + "/cmb:dotbelowcomb": "\u0323", + "/cmb:dotrightabove": "\u0358", + "/cmb:dottedacute": "\u1DC1", + "/cmb:dottedgrave": "\u1DC0", + "/cmb:doubleabovecircumflex": "\u1DCD", + "/cmb:doublebelowbreve": "\u035C", + "/cmb:doublebreve": "\u035D", + "/cmb:doubleinvertedbelowbreve": "\u1DFC", + "/cmb:doubleringbelow": "\u035A", + "/cmb:downtackbelow": "\u031E", + "/cmb:e": "\u0364", + "/cmb:equalbelow": "\u0347", + "/cmb:esh": "\u1DEF", + "/cmb:eth": "\u1DD9", + "/cmb:f": "\u1DEB", + "/cmb:fermata": "\u0352", + "/cmb:g": "\u1DDA", + "/cmb:graphemejoiner": "\u034F", + "/cmb:grave": "\u0300", + "/cmb:graveacutegrave": "\u1DC8", + "/cmb:gravebelow": "\u0316", + "/cmb:gravedouble": "\u030F", + "/cmb:gravemacron": "\u1DC5", + "/cmb:gravetone": "\u0340", + "/cmb:gsmall": "\u1DDB", + "/cmb:h": "\u036A", + "/cmb:halfleftringabove": "\u0351", + "/cmb:halfleftringbelow": "\u031C", + "/cmb:halfrightringabove": "\u0357", + "/cmb:halfrightringbelow": "\u0339", + "/cmb:homotheticabove": "\u034B", + "/cmb:hookabove": "\u0309", + "/cmb:horn": "\u031B", + "/cmb:hungarumlaut": "\u030B", + "/cmb:i": "\u0365", + "/cmb:insulard": "\u1DD8", + "/cmb:invertedbelowbreve": "\u032F", + "/cmb:invertedbreve": "\u0311", + "/cmb:invertedbridgebelow": "\u033A", + "/cmb:inverteddoublebreve": "\u0361", + "/cmb:iotasub": "\u0345", + "/cmb:isbelow": "\u1DD0", + "/cmb:k": "\u1DDC", + "/cmb:kavykaaboveleft": "\u1DF7", + "/cmb:kavykaaboveright": "\u1DF6", + "/cmb:koronis": "\u0343", + "/cmb:l": "\u1DDD", + "/cmb:leftangleabove": "\u031A", + "/cmb:leftanglebelow": "\u0349", + "/cmb:leftarrowheadabove": "\u1DFE", + "/cmb:lefttackbelow": "\u0318", + "/cmb:lineverticalabove": "\u030D", + "/cmb:lineverticalbelow": "\u0329", + "/cmb:longs": "\u1DE5", + "/cmb:lowline": "\u0332", + "/cmb:lowlinedouble": "\u0333", + "/cmb:lsmall": "\u1DDE", + "/cmb:lwithdoublemiddletilde": "\u1DEC", + "/cmb:m": "\u036B", + "/cmb:macron": "\u0304", + "/cmb:macronacute": "\u1DC4", + "/cmb:macronbelow": "\u0331", + "/cmb:macronbreve": "\u1DCC", + "/cmb:macrondouble": "\u035E", + "/cmb:macrondoublebelow": "\u035F", + "/cmb:macrongrave": "\u1DC6", + "/cmb:minusbelow": "\u0320", + "/cmb:msmall": "\u1DDF", + "/cmb:n": "\u1DE0", + "/cmb:nottildeabove": "\u034A", + "/cmb:nsmall": "\u1DE1", + "/cmb:o": "\u0366", + "/cmb:odieresis": "\u1DF3", + "/cmb:ogonek": "\u0328", + "/cmb:overlaystrokelong": "\u0336", + "/cmb:overlaystrokeshort": "\u0335", + "/cmb:overline": "\u0305", + "/cmb:owithlightcentralizationstroke": "\u1DED", + "/cmb:p": "\u1DEE", + "/cmb:palatalizedhookbelow": "\u0321", + "/cmb:perispomeni": "\u0342", + "/cmb:plusbelow": "\u031F", + "/cmb:r": "\u036C", + "/cmb:rbelow": "\u1DCA", + "/cmb:retroflexhookbelow": "\u0322", + "/cmb:reversedcommaabove": "\u0314", + "/cmb:rightarrowheadanddownarrowheadbelow": "\u1DFF", + "/cmb:righttackbelow": "\u0319", + "/cmb:ringabove": "\u030A", + "/cmb:ringbelow": "\u0325", + "/cmb:rrotunda": "\u1DE3", + "/cmb:rsmall": "\u1DE2", + "/cmb:s": "\u1DE4", + "/cmb:schwa": "\u1DEA", + "/cmb:seagullbelow": "\u033C", + "/cmb:snakebelow": "\u1DC2", + "/cmb:soliduslongoverlay": "\u0338", + "/cmb:solidusshortoverlay": "\u0337", + "/cmb:squarebelow": "\u033B", + "/cmb:suspensionmark": "\u1DC3", + "/cmb:t": "\u036D", + "/cmb:tilde": "\u0303", + "/cmb:tildebelow": "\u0330", + "/cmb:tildedouble": "\u0360", + "/cmb:tildeoverlay": "\u0334", + "/cmb:tildevertical": "\u033E", + "/cmb:turnedabove": "\u0313", + "/cmb:turnedcommaabove": "\u0315", + "/cmb:u": "\u0367", + "/cmb:udieresis": "\u1DF4", + "/cmb:uptackabove": "\u1DF5", + "/cmb:uptackbelow": "\u031D", + "/cmb:urabove": "\u1DD1", + "/cmb:usabove": "\u1DD2", + "/cmb:uwithlightcentralizationstroke": "\u1DF0", + "/cmb:v": "\u036E", + "/cmb:w": "\u1DF1", + "/cmb:wideinvertedbridgebelow": "\u1DF9", + "/cmb:x": "\u036F", + "/cmb:xabove": "\u033D", + "/cmb:xbelow": "\u0353", + "/cmb:z": "\u1DE6", + "/cmb:zigzagabove": "\u035B", + "/cmb:zigzagbelow": "\u1DCF", + "/cmcubedsquare": "\u33A4", + "/cmfullwidth": "\u339D", + "/cmonospace": "\uFF43", + "/cmsquaredsquare": "\u33A0", + "/cntr:acknowledge": "\u2406", + "/cntr:backspace": "\u2408", + "/cntr:bell": "\u2407", + "/cntr:blank": "\u2422", + "/cntr:cancel": "\u2418", + "/cntr:carriagereturn": "\u240D", + "/cntr:datalinkescape": "\u2410", + "/cntr:delete": "\u2421", + "/cntr:deleteformtwo": "\u2425", + "/cntr:devicecontrolfour": "\u2414", + "/cntr:devicecontrolone": "\u2411", + "/cntr:devicecontrolthree": "\u2413", + "/cntr:devicecontroltwo": "\u2412", + "/cntr:endofmedium": "\u2419", + "/cntr:endoftext": "\u2403", + "/cntr:endoftransmission": "\u2404", + "/cntr:endoftransmissionblock": "\u2417", + "/cntr:enquiry": "\u2405", + "/cntr:escape": "\u241B", + "/cntr:fileseparator": "\u241C", + "/cntr:formfeed": "\u240C", + "/cntr:groupseparator": "\u241D", + "/cntr:horizontaltab": "\u2409", + "/cntr:linefeed": "\u240A", + "/cntr:negativeacknowledge": "\u2415", + "/cntr:newline": "\u2424", + "/cntr:null": "\u2400", + "/cntr:openbox": "\u2423", + "/cntr:recordseparator": "\u241E", + "/cntr:shiftin": "\u240F", + "/cntr:shiftout": "\u240E", + "/cntr:space": "\u2420", + "/cntr:startofheading": "\u2401", + "/cntr:startoftext": "\u2402", + "/cntr:substitute": "\u241A", + "/cntr:substituteformtwo": "\u2426", + "/cntr:synchronousidle": "\u2416", + "/cntr:unitseparator": "\u241F", + "/cntr:verticaltab": "\u240B", + "/coarmenian": "\u0581", + "/cocktailGlass": "\u1F378", + "/coffin": "\u26B0", + "/cofullwidth": "\u33C7", + "/collision": "\u1F4A5", + "/colon": "\u003A", + "/colonequals": "\u2254", + "/colonmod": "\uA789", + "/colonmonetary": "\u20A1", + "/colonmonospace": "\uFF1A", + "/colonraisedmod": "\u02F8", + "/colonsign": "\u20A1", + "/colonsmall": "\uFE55", + "/colontriangularhalfmod": "\u02D1", + "/colontriangularmod": "\u02D0", + "/comet": "\u2604", + "/comma": "\u002C", + "/commaabovecmb": "\u0313", + "/commaaboverightcmb": "\u0315", + "/commaaccent": "\uF6C3", + "/commaarabic": "\u060C", + "/commaarmenian": "\u055D", + "/commabarfunc": "\u236A", + "/commainferior": "\uF6E1", + "/commamonospace": "\uFF0C", + "/commaraised": "\u2E34", + "/commareversed": "\u2E41", + "/commareversedabovecmb": "\u0314", + "/commareversedmod": "\u02BD", + "/commasmall": "\uFE50", + "/commasuperior": "\uF6E2", + "/commaturnedabovecmb": "\u0312", + "/commaturnedmod": "\u02BB", + "/commercialat": "\uFE6B", + "/commercialminussign": "\u2052", + "/compass": "\u263C", + "/complement": "\u2201", + "/composition": "\u2384", + "/compression": "\u1F5DC", + "/con": "\uA76F", + "/confettiBall": "\u1F38A", + "/confoundedFace": "\u1F616", + "/confusedFace": "\u1F615", + "/congratulationideographiccircled": "\u3297", + "/congratulationideographicparen": "\u3237", + "/congruent": "\u2245", + "/conicaltaper": "\u2332", + "/conjunction": "\u260C", + "/consquareupblack": "\u26FE", + "/constructionSign": "\u1F6A7", + "/constructionWorker": "\u1F477", + "/containsasmembersmall": "\u220D", + "/containsasnormalsubgroorequalup": "\u22B5", + "/containsasnormalsubgroup": "\u22B3", + "/containslonghorizontalstroke": "\u22FA", + "/containsoverbar": "\u22FD", + "/containsoverbarsmall": "\u22FE", + "/containssmallverticalbarhorizontalstroke": "\u22FC", + "/containsverticalbarhorizontalstroke": "\u22FB", + "/continuousunderline": "\u2381", + "/contourintegral": "\u222E", + "/control": "\u2303", + "/controlACK": "\u0006", + "/controlBEL": "\u0007", + "/controlBS": "\u0008", + "/controlCAN": "\u0018", + "/controlCR": "\u000D", + "/controlDC1": "\u0011", + "/controlDC2": "\u0012", + "/controlDC3": "\u0013", + "/controlDC4": "\u0014", + "/controlDEL": "\u007F", + "/controlDLE": "\u0010", + "/controlEM": "\u0019", + "/controlENQ": "\u0005", + "/controlEOT": "\u0004", + "/controlESC": "\u001B", + "/controlETB": "\u0017", + "/controlETX": "\u0003", + "/controlFF": "\u000C", + "/controlFS": "\u001C", + "/controlGS": "\u001D", + "/controlHT": "\u0009", + "/controlKnobs": "\u1F39B", + "/controlLF": "\u000A", + "/controlNAK": "\u0015", + "/controlRS": "\u001E", + "/controlSI": "\u000F", + "/controlSO": "\u000E", + "/controlSOT": "\u0002", + "/controlSTX": "\u0001", + "/controlSUB": "\u001A", + "/controlSYN": "\u0016", + "/controlUS": "\u001F", + "/controlVT": "\u000B", + "/convavediamondwhite": "\u27E1", + "/convenienceStore": "\u1F3EA", + "/cookedRice": "\u1F35A", + "/cookie": "\u1F36A", + "/cooking": "\u1F373", + "/coolsquare": "\u1F192", + "/coproductarray": "\u2210", + "/copyideographiccircled": "\u32A2", + "/copyright": "\u00A9", + "/copyrightsans": "\uF8E9", + "/copyrightserif": "\uF6D9", + "/cornerbottomleft": "\u231E", + "/cornerbottomright": "\u231F", + "/cornerbracketleft": "\u300C", + "/cornerbracketlefthalfwidth": "\uFF62", + "/cornerbracketleftvertical": "\uFE41", + "/cornerbracketright": "\u300D", + "/cornerbracketrighthalfwidth": "\uFF63", + "/cornerbracketrightvertical": "\uFE42", + "/cornerdotupleft": "\u27D4", + "/cornertopleft": "\u231C", + "/cornertopright": "\u231D", + "/coroniseditorial": "\u2E0E", + "/corporationsquare": "\u337F", + "/correctideographiccircled": "\u32A3", + "/corresponds": "\u2258", + "/cosquare": "\u33C7", + "/couchAndLamp": "\u1F6CB", + "/counterbore": "\u2334", + "/countersink": "\u2335", + "/coupleHeart": "\u1F491", + "/coverkgfullwidth": "\u33C6", + "/coverkgsquare": "\u33C6", + "/cow": "\u1F404", + "/cowFace": "\u1F42E", + "/cpalatalhook": "\uA794", + "/cparen": "\u249E", + "/cparenthesized": "\u249E", + "/creditCard": "\u1F4B3", + "/crescentMoon": "\u1F319", + "/creversed": "\u2184", + "/cricketBatAndBall": "\u1F3CF", + "/crocodile": "\u1F40A", + "/cropbottomleft": "\u230D", + "/cropbottomright": "\u230C", + "/croptopleft": "\u230F", + "/croptopright": "\u230E", + "/crossPommee": "\u1F542", + "/crossPommeeHalf-circleBelow": "\u1F541", + "/crossedFlags": "\u1F38C", + "/crossedswords": "\u2694", + "/crossinglanes": "\u26CC", + "/crossmod": "\u02DF", + "/crossofjerusalem": "\u2629", + "/crossoflorraine": "\u2628", + "/crossonshieldblack": "\u26E8", + "/crown": "\u1F451", + "/crrn:rupee": "\u20A8", + "/cruzeiro": "\u20A2", + "/cryingCatFace": "\u1F63F", + "/cryingFace": "\u1F622", + "/crystalBall": "\u1F52E", + "/cstretched": "\u0297", + "/cstroke": "\u023C", + "/cuatrillo": "\uA72D", + "/cuatrillocomma": "\uA72F", + "/curlyand": "\u22CF", + "/curlylogicaland": "\u22CF", + "/curlylogicalor": "\u22CE", + "/curlyor": "\u22CE", + "/currency": "\u00A4", + "/currencyExchange": "\u1F4B1", + "/curryAndRice": "\u1F35B", + "/custard": "\u1F36E", + "/customeraccountnumber": "\u2449", + "/customs": "\u1F6C3", + "/cyclone": "\u1F300", + "/cylindricity": "\u232D", + "/cyrBreve": "\uF6D1", + "/cyrFlex": "\uF6D2", + "/cyrbreve": "\uF6D4", + "/cyrflex": "\uF6D5", + "/d": "\u0064", + "/daarmenian": "\u0564", + "/daasusquare": "\u3324", + "/dabengali": "\u09A6", + "/dad": "\u0636", + "/dad.fina": "\uFEBE", + "/dad.init": "\uFEBF", + "/dad.init_alefmaksura.fina": "\uFD07", + "/dad.init_hah.fina": "\uFC23", + "/dad.init_hah.medi": "\uFCB5", + "/dad.init_jeem.fina": "\uFC22", + "/dad.init_jeem.medi": "\uFCB4", + "/dad.init_khah.fina": "\uFC24", + "/dad.init_khah.medi": "\uFCB6", + "/dad.init_khah.medi_meem.medi": "\uFD70", + "/dad.init_meem.fina": "\uFC25", + "/dad.init_meem.medi": "\uFCB7", + "/dad.init_reh.fina": "\uFD10", + "/dad.init_yeh.fina": "\uFD08", + "/dad.isol": "\uFEBD", + "/dad.medi": "\uFEC0", + "/dad.medi_alefmaksura.fina": "\uFD23", + "/dad.medi_hah.medi_alefmaksura.fina": "\uFD6E", + "/dad.medi_hah.medi_yeh.fina": "\uFDAB", + "/dad.medi_khah.medi_meem.fina": "\uFD6F", + "/dad.medi_reh.fina": "\uFD2C", + "/dad.medi_yeh.fina": "\uFD24", + "/dadarabic": "\u0636", + "/daddotbelow": "\u06FB", + "/dadeva": "\u0926", + "/dadfinalarabic": "\uFEBE", + "/dadinitialarabic": "\uFEBF", + "/dadmedialarabic": "\uFEC0", + "/dafullwidth": "\u3372", + "/dagesh": "\u05BC", + "/dagesh:hb": "\u05BC", + "/dageshhebrew": "\u05BC", + "/dagger": "\u2020", + "/daggerKnife": "\u1F5E1", + "/daggerdbl": "\u2021", + "/daggerwithguardleft": "\u2E36", + "/daggerwithguardright": "\u2E37", + "/dagujarati": "\u0AA6", + "/dagurmukhi": "\u0A26", + "/dahal": "\u068C", + "/dahal.fina": "\uFB85", + "/dahal.isol": "\uFB84", + "/dahiragana": "\u3060", + "/dakatakana": "\u30C0", + "/dal": "\u062F", + "/dal.fina": "\uFEAA", + "/dal.isol": "\uFEA9", + "/dalInvertedSmallVBelow": "\u075A", + "/dalTwoDotsVerticallyBelowSmallTah": "\u0759", + "/dalarabic": "\u062F", + "/daldotbelow": "\u068A", + "/daldotbelowtahsmall": "\u068B", + "/daldownthreedotsabove": "\u068F", + "/dalet": "\u05D3", + "/dalet:hb": "\u05D3", + "/daletdagesh": "\uFB33", + "/daletdageshhebrew": "\uFB33", + "/dalethatafpatah": "\u05D3", + "/dalethatafpatahhebrew": "\u05D3", + "/dalethatafsegol": "\u05D3", + "/dalethatafsegolhebrew": "\u05D3", + "/dalethebrew": "\u05D3", + "/dalethiriq": "\u05D3", + "/dalethiriqhebrew": "\u05D3", + "/daletholam": "\u05D3", + "/daletholamhebrew": "\u05D3", + "/daletpatah": "\u05D3", + "/daletpatahhebrew": "\u05D3", + "/daletqamats": "\u05D3", + "/daletqamatshebrew": "\u05D3", + "/daletqubuts": "\u05D3", + "/daletqubutshebrew": "\u05D3", + "/daletsegol": "\u05D3", + "/daletsegolhebrew": "\u05D3", + "/daletsheva": "\u05D3", + "/daletshevahebrew": "\u05D3", + "/dalettsere": "\u05D3", + "/dalettserehebrew": "\u05D3", + "/daletwide:hb": "\uFB22", + "/daletwithdagesh:hb": "\uFB33", + "/dalfinalarabic": "\uFEAA", + "/dalfourdotsabove": "\u0690", + "/dalinvertedV": "\u06EE", + "/dalring": "\u0689", + "/damahaprana": "\uA9A3", + "/damma": "\u064F", + "/dammaIsol": "\uFE78", + "/dammaMedi": "\uFE79", + "/dammaarabic": "\u064F", + "/dammalowarabic": "\u064F", + "/dammareversed": "\u065D", + "/dammasmall": "\u0619", + "/dammatan": "\u064C", + "/dammatanIsol": "\uFE72", + "/dammatanaltonearabic": "\u064C", + "/dammatanarabic": "\u064C", + "/dancer": "\u1F483", + "/danda": "\u0964", + "/dango": "\u1F361", + "/darga:hb": "\u05A7", + "/dargahebrew": "\u05A7", + "/dargalefthebrew": "\u05A7", + "/darkShade": "\u2593", + "/darkSunglasses": "\u1F576", + "/dashwithupturnleft": "\u2E43", + "/dasiacmbcyr": "\u0485", + "/dasiapneumatacyrilliccmb": "\u0485", + "/dateseparator": "\u060D", + "/dayeighteentelegraph": "\u33F1", + "/dayeighttelegraph": "\u33E7", + "/dayeleventelegraph": "\u33EA", + "/dayfifteentelegraph": "\u33EE", + "/dayfivetelegraph": "\u33E4", + "/dayfourteentelegraph": "\u33ED", + "/dayfourtelegraph": "\u33E3", + "/daynineteentelegraph": "\u33F2", + "/dayninetelegraph": "\u33E8", + "/dayonetelegraph": "\u33E0", + "/dayseventeentelegraph": "\u33F0", + "/dayseventelegraph": "\u33E6", + "/daysixteentelegraph": "\u33EF", + "/daysixtelegraph": "\u33E5", + "/daytentelegraph": "\u33E9", + "/daythirteentelegraph": "\u33EC", + "/daythirtyonetelegraph": "\u33FE", + "/daythirtytelegraph": "\u33FD", + "/daythreetelegraph": "\u33E2", + "/daytwelvetelegraph": "\u33EB", + "/daytwentyeighttelegraph": "\u33FB", + "/daytwentyfivetelegraph": "\u33F8", + "/daytwentyfourtelegraph": "\u33F7", + "/daytwentyninetelegraph": "\u33FC", + "/daytwentyonetelegraph": "\u33F4", + "/daytwentyseventelegraph": "\u33FA", + "/daytwentysixtelegraph": "\u33F9", + "/daytwentytelegraph": "\u33F3", + "/daytwentythreetelegraph": "\u33F6", + "/daytwentytwotelegraph": "\u33F5", + "/daytwotelegraph": "\u33E1", + "/dbdigraph": "\u0238", + "/dbfullwidth": "\u33C8", + "/dblGrave": "\uF6D3", + "/dblanglebracketleft": "\u300A", + "/dblanglebracketleftvertical": "\uFE3D", + "/dblanglebracketright": "\u300B", + "/dblanglebracketrightvertical": "\uFE3E", + "/dblarchinvertedbelowcmb": "\u032B", + "/dblarrowNE": "\u21D7", + "/dblarrowNW": "\u21D6", + "/dblarrowSE": "\u21D8", + "/dblarrowSW": "\u21D9", + "/dblarrowdown": "\u21D3", + "/dblarrowleft": "\u21D4", + "/dblarrowleftright": "\u21D4", + "/dblarrowleftrightstroke": "\u21CE", + "/dblarrowleftstroke": "\u21CD", + "/dblarrowright": "\u21D2", + "/dblarrowrightstroke": "\u21CF", + "/dblarrowup": "\u21D1", + "/dblarrowupdown": "\u21D5", + "/dbldanda": "\u0965", + "/dbldnhorz": "\u2566", + "/dbldnleft": "\u2557", + "/dbldnright": "\u2554", + "/dblgrave": "\uF6D6", + "/dblgravecmb": "\u030F", + "/dblhorz": "\u2550", + "/dblintegral": "\u222C", + "/dbllowline": "\u2017", + "/dbllowlinecmb": "\u0333", + "/dbloverlinecmb": "\u033F", + "/dblprimemod": "\u02BA", + "/dblstrokearrowdown": "\u21DF", + "/dblstrokearrowup": "\u21DE", + "/dbluphorz": "\u2569", + "/dblupleft": "\u255D", + "/dblupright": "\u255A", + "/dblvert": "\u2551", + "/dblverthorz": "\u256C", + "/dblverticalbar": "\u2016", + "/dblverticallineabovecmb": "\u030E", + "/dblvertleft": "\u2563", + "/dblvertright": "\u2560", + "/dbopomofo": "\u3109", + "/dbsquare": "\u33C8", + "/dcaron": "\u010F", + "/dcedilla": "\u1E11", + "/dchecyr": "\u052D", + "/dcircle": "\u24D3", + "/dcircumflexbelow": "\u1E13", + "/dcroat": "\u0111", + "/dcurl": "\u0221", + "/ddabengali": "\u09A1", + "/ddadeva": "\u0921", + "/ddagujarati": "\u0AA1", + "/ddagurmukhi": "\u0A21", + "/ddahal": "\u068D", + "/ddahal.fina": "\uFB83", + "/ddahal.isol": "\uFB82", + "/ddal": "\u0688", + "/ddal.fina": "\uFB89", + "/ddal.isol": "\uFB88", + "/ddalarabic": "\u0688", + "/ddalfinalarabic": "\uFB89", + "/ddamahaprana": "\uA99E", + "/ddblstruckitalic": "\u2146", + "/dddhadeva": "\u095C", + "/ddhabengali": "\u09A2", + "/ddhadeva": "\u0922", + "/ddhagujarati": "\u0AA2", + "/ddhagurmukhi": "\u0A22", + "/ddot": "\u1E0B", + "/ddotaccent": "\u1E0B", + "/ddotbelow": "\u1E0D", + "/decembertelegraph": "\u32CB", + "/deciduousTree": "\u1F333", + "/decimalexponent": "\u23E8", + "/decimalseparatorarabic": "\u066B", + "/decimalseparatorpersian": "\u066B", + "/decreaseFontSize": "\u1F5DB", + "/decyr": "\u0434", + "/decyrillic": "\u0434", + "/degree": "\u00B0", + "/degreecelsius": "\u2103", + "/degreefahrenheit": "\u2109", + "/dehi:hb": "\u05AD", + "/dehihebrew": "\u05AD", + "/dehiragana": "\u3067", + "/deicoptic": "\u03EF", + "/dekatakana": "\u30C7", + "/dekomicyr": "\u0501", + "/deldiaeresisfunc": "\u2362", + "/deleteleft": "\u232B", + "/deleteright": "\u2326", + "/deliveryTruck": "\u1F69A", + "/delstilefunc": "\u2352", + "/delta": "\u03B4", + "/deltaequal": "\u225C", + "/deltastilefunc": "\u234B", + "/deltaturned": "\u018D", + "/deltaunderlinefunc": "\u2359", + "/deltildefunc": "\u236B", + "/denominatorminusonenumeratorbengali": "\u09F8", + "/dentistrybottomverticalleft": "\u23CC", + "/dentistrybottomverticalright": "\u23BF", + "/dentistrycircledownhorizontal": "\u23C1", + "/dentistrycircleuphorizontal": "\u23C2", + "/dentistrycirclevertical": "\u23C0", + "/dentistrydownhorizontal": "\u23C9", + "/dentistrytopverticalleft": "\u23CB", + "/dentistrytopverticalright": "\u23BE", + "/dentistrytriangledownhorizontal": "\u23C4", + "/dentistrytriangleuphorizontal": "\u23C5", + "/dentistrytrianglevertical": "\u23C3", + "/dentistryuphorizontal": "\u23CA", + "/dentistrywavedownhorizontal": "\u23C7", + "/dentistrywaveuphorizontal": "\u23C8", + "/dentistrywavevertical": "\u23C6", + "/departmentStore": "\u1F3EC", + "/derelictHouseBuilding": "\u1F3DA", + "/desert": "\u1F3DC", + "/desertIsland": "\u1F3DD", + "/desisquare": "\u3325", + "/desktopComputer": "\u1F5A5", + "/desktopWindow": "\u1F5D4", + "/deva:a": "\u0905", + "/deva:aa": "\u0906", + "/deva:aasign": "\u093E", + "/deva:abbreviation": "\u0970", + "/deva:acandra": "\u0972", + "/deva:acute": "\u0954", + "/deva:ai": "\u0910", + "/deva:aisign": "\u0948", + "/deva:anudatta": "\u0952", + "/deva:anusvara": "\u0902", + "/deva:ashort": "\u0904", + "/deva:au": "\u0914", + "/deva:ausign": "\u094C", + "/deva:avagraha": "\u093D", + "/deva:aw": "\u0975", + "/deva:awsign": "\u094F", + "/deva:ba": "\u092C", + "/deva:bba": "\u097F", + "/deva:bha": "\u092D", + "/deva:ca": "\u091A", + "/deva:candrabindu": "\u0901", + "/deva:candrabinduinverted": "\u0900", + "/deva:cha": "\u091B", + "/deva:da": "\u0926", + "/deva:danda": "\u0964", + "/deva:dbldanda": "\u0965", + "/deva:dda": "\u0921", + "/deva:ddda": "\u097E", + "/deva:dddha": "\u095C", + "/deva:ddha": "\u0922", + "/deva:dha": "\u0927", + "/deva:dothigh": "\u0971", + "/deva:e": "\u090F", + "/deva:ecandra": "\u090D", + "/deva:eight": "\u096E", + "/deva:eshort": "\u090E", + "/deva:esign": "\u0947", + "/deva:esigncandra": "\u0945", + "/deva:esignprishthamatra": "\u094E", + "/deva:esignshort": "\u0946", + "/deva:fa": "\u095E", + "/deva:five": "\u096B", + "/deva:four": "\u096A", + "/deva:ga": "\u0917", + "/deva:gga": "\u097B", + "/deva:gha": "\u0918", + "/deva:ghha": "\u095A", + "/deva:glottalstop": "\u097D", + "/deva:grave": "\u0953", + "/deva:ha": "\u0939", + "/deva:i": "\u0907", + "/deva:ii": "\u0908", + "/deva:iisign": "\u0940", + "/deva:isign": "\u093F", + "/deva:ja": "\u091C", + "/deva:jha": "\u091D", + "/deva:jja": "\u097C", + "/deva:ka": "\u0915", + "/deva:kha": "\u0916", + "/deva:khha": "\u0959", + "/deva:la": "\u0932", + "/deva:lla": "\u0933", + "/deva:llla": "\u0934", + "/deva:llvocal": "\u0961", + "/deva:llvocalsign": "\u0963", + "/deva:lvocal": "\u090C", + "/deva:lvocalsign": "\u0962", + "/deva:ma": "\u092E", + "/deva:marwaridda": "\u0978", + "/deva:na": "\u0928", + "/deva:nga": "\u0919", + "/deva:nine": "\u096F", + "/deva:nna": "\u0923", + "/deva:nnna": "\u0929", + "/deva:nukta": "\u093C", + "/deva:nya": "\u091E", + "/deva:o": "\u0913", + "/deva:ocandra": "\u0911", + "/deva:oe": "\u0973", + "/deva:oesign": "\u093A", + "/deva:om": "\u0950", + "/deva:one": "\u0967", + "/deva:ooe": "\u0974", + "/deva:ooesign": "\u093B", + "/deva:oshort": "\u0912", + "/deva:osign": "\u094B", + "/deva:osigncandra": "\u0949", + "/deva:osignshort": "\u094A", + "/deva:pa": "\u092A", + "/deva:pha": "\u092B", + "/deva:qa": "\u0958", + "/deva:ra": "\u0930", + "/deva:rha": "\u095D", + "/deva:rra": "\u0931", + "/deva:rrvocal": "\u0960", + "/deva:rrvocalsign": "\u0944", + "/deva:rvocal": "\u090B", + "/deva:rvocalsign": "\u0943", + "/deva:sa": "\u0938", + "/deva:seven": "\u096D", + "/deva:sha": "\u0936", + "/deva:signelongcandra": "\u0955", + "/deva:six": "\u096C", + "/deva:ssa": "\u0937", + "/deva:ta": "\u0924", + "/deva:tha": "\u0925", + "/deva:three": "\u0969", + "/deva:tta": "\u091F", + "/deva:ttha": "\u0920", + "/deva:two": "\u0968", + "/deva:u": "\u0909", + "/deva:udatta": "\u0951", + "/deva:ue": "\u0976", + "/deva:uesign": "\u0956", + "/deva:usign": "\u0941", + "/deva:uu": "\u090A", + "/deva:uue": "\u0977", + "/deva:uuesign": "\u0957", + "/deva:uusign": "\u0942", + "/deva:va": "\u0935", + "/deva:virama": "\u094D", + "/deva:visarga": "\u0903", + "/deva:ya": "\u092F", + "/deva:yaheavy": "\u097A", + "/deva:yya": "\u095F", + "/deva:za": "\u095B", + "/deva:zero": "\u0966", + "/deva:zha": "\u0979", + "/dezh": "\u02A4", + "/dfemaledbl": "\u26A2", + "/dhabengali": "\u09A7", + "/dhadeva": "\u0927", + "/dhagujarati": "\u0AA7", + "/dhagurmukhi": "\u0A27", + "/dhook": "\u0257", + "/diaeresisgreaterfunc": "\u2369", + "/dialytikatonos": "\u0385", + "/dialytikatonoscmb": "\u0344", + "/diametersign": "\u2300", + "/diamond": "\u2666", + "/diamondShapeADotInside": "\u1F4A0", + "/diamondinsquarewhite": "\u26CB", + "/diamondoperator": "\u22C4", + "/diamondsuitwhite": "\u2662", + "/diamondunderlinefunc": "\u235A", + "/diamondwhitewithdiamondsmallblack": "\u25C8", + "/diefive": "\u2684", + "/diefour": "\u2683", + "/dieone": "\u2680", + "/dieresis": "\u00A8", + "/dieresisacute": "\uF6D7", + "/dieresisbelowcmb": "\u0324", + "/dieresiscmb": "\u0308", + "/dieresisgrave": "\uF6D8", + "/dieresistilde": "\u1FC1", + "/dieresistonos": "\u0385", + "/dieselLocomotive": "\u1F6F2", + "/diesix": "\u2685", + "/diethree": "\u2682", + "/dietwo": "\u2681", + "/differencebetween": "\u224F", + "/digamma": "\u03DD", + "/digammapamphylian": "\u0377", + "/digramgreateryang": "\u268C", + "/digramgreateryin": "\u268F", + "/digramlesseryang": "\u268E", + "/digramlesseryin": "\u268D", + "/dihiragana": "\u3062", + "/dikatakana": "\u30C2", + "/dimensionorigin": "\u2331", + "/dingbatSAns-serifzerocircle": "\u1F10B", + "/dingbatSAns-serifzerocircleblack": "\u1F10C", + "/dinsular": "\uA77A", + "/directHit": "\u1F3AF", + "/directcurrentformtwo": "\u2393", + "/dirgamurevowel": "\uA9BB", + "/disabledcar": "\u26CD", + "/disappointedButRelievedFace": "\u1F625", + "/disappointedFace": "\u1F61E", + "/discontinuousunderline": "\u2382", + "/dittomark": "\u3003", + "/divide": "\u00F7", + "/divides": "\u2223", + "/divisionslash": "\u2215", + "/divisiontimes": "\u22C7", + "/divorce": "\u26AE", + "/dizzy": "\u1F4AB", + "/dizzyFace": "\u1F635", + "/djecyr": "\u0452", + "/djecyrillic": "\u0452", + "/djekomicyr": "\u0503", + "/dkshade": "\u2593", + "/dlfullwidth": "\u3397", + "/dlinebelow": "\u1E0F", + "/dlogicalorsquare": "\u27CF", + "/dlogicalsquare": "\u27CE", + "/dlsquare": "\u3397", + "/dm2fullwidth": "\u3378", + "/dm3fullwidth": "\u3379", + "/dmacron": "\u0111", + "/dmaledbl": "\u26A3", + "/dmfullwidth": "\u3377", + "/dmonospace": "\uFF44", + "/dnblock": "\u2584", + "/dndblhorzsng": "\u2565", + "/dndblleftsng": "\u2556", + "/dndblrightsng": "\u2553", + "/dngb:airplane": "\u2708", + "/dngb:arrowfeatheredblackNE": "\u27B6", + "/dngb:arrowfeatheredblackSE": "\u27B4", + "/dngb:arrowfeatheredblackheavyNE": "\u27B9", + "/dngb:arrowfeatheredblackheavySE": "\u27B7", + "/dngb:arrowheadrightblack": "\u27A4", + "/dngb:arrowheadrightthreeDbottomlight": "\u27A3", + "/dngb:arrowheadrightthreeDtoplight": "\u27A2", + "/dngb:arrowheavyNE": "\u279A", + "/dngb:arrowheavySE": "\u2798", + "/dngb:arrowrightbacktiltedshadowedwhite": "\u27AB", + "/dngb:arrowrightblack": "\u27A1", + "/dngb:arrowrightcircledwhiteheavy": "\u27B2", + "/dngb:arrowrightcurvedownblackheavy": "\u27A5", + "/dngb:arrowrightcurveupblackheavy": "\u27A6", + "/dngb:arrowrightfeatheredblack": "\u27B5", + "/dngb:arrowrightfeatheredblackheavy": "\u27B8", + "/dngb:arrowrightfeatheredwhite": "\u27B3", + "/dngb:arrowrightfronttiltedshadowedwhite": "\u27AC", + "/dngb:arrowrightheavy": "\u2799", + "/dngb:arrowrightleftshadedwhite": "\u27AA", + "/dngb:arrowrightoutlinedopen": "\u27BE", + "/dngb:arrowrightpointed": "\u279B", + "/dngb:arrowrightpointedblackheavy": "\u27A8", + "/dngb:arrowrightrightshadedwhite": "\u27A9", + "/dngb:arrowrightroundheavy": "\u279C", + "/dngb:arrowrightsquatblack": "\u27A7", + "/dngb:arrowrighttriangle": "\u279D", + "/dngb:arrowrighttriangledashed": "\u279F", + "/dngb:arrowrighttriangledashedheavy": "\u27A0", + "/dngb:arrowrighttriangleheavy": "\u279E", + "/dngb:arrowrightwedge": "\u27BC", + "/dngb:arrowrightwedgeheavy": "\u27BD", + "/dngb:arrowrightwideheavy": "\u2794", + "/dngb:arrowshadowrightlowerwhiteheavy": "\u27AD", + "/dngb:arrowshadowrightnotchedlowerwhite": "\u27AF", + "/dngb:arrowshadowrightnotchedupperwhite": "\u27B1", + "/dngb:arrowshadowrightupperwhiteheavy": "\u27AE", + "/dngb:arrowteardropright": "\u27BA", + "/dngb:arrowteardroprightheavy": "\u27BB", + "/dngb:asteriskballoon": "\u2749", + "/dngb:asteriskballoonfour": "\u2723", + "/dngb:asteriskballoonheavyfour": "\u2724", + "/dngb:asteriskcentreopen": "\u2732", + "/dngb:asteriskclubfour": "\u2725", + "/dngb:asteriskheavy": "\u2731", + "/dngb:asteriskpointedsixteen": "\u273A", + "/dngb:asteriskteardrop": "\u273B", + "/dngb:asteriskteardropcentreopen": "\u273C", + "/dngb:asteriskteardropfour": "\u2722", + "/dngb:asteriskteardropheavy": "\u273D", + "/dngb:asteriskteardroppinwheelheavy": "\u2743", + "/dngb:asteriskteardroppropellereight": "\u274A", + "/dngb:asteriskteardroppropellerheavyeight": "\u274B", + "/dngb:ballotx": "\u2717", + "/dngb:ballotxheavy": "\u2718", + "/dngb:bracketleftpointedangleheavyornament": "\u2770", + "/dngb:bracketleftpointedanglemediumornament": "\u276C", + "/dngb:bracketrightpointedangleheavyornament": "\u2771", + "/dngb:bracketrightpointedanglemediumornament": "\u276D", + "/dngb:bracketshellleftlightornament": "\u2772", + "/dngb:bracketshellrightlightornament": "\u2773", + "/dngb:check": "\u2713", + "/dngb:checkheavy": "\u2714", + "/dngb:checkwhiteheavy": "\u2705", + "/dngb:chevronsnowflakeheavy": "\u2746", + "/dngb:circleshadowedwhite": "\u274D", + "/dngb:commaheavydoubleornament": "\u275E", + "/dngb:commaheavydoubleturnedornament": "\u275D", + "/dngb:commaheavyornament": "\u275C", + "/dngb:commaheavyturnedornament": "\u275B", + "/dngb:compasstarpointedblackeight": "\u2737", + "/dngb:compasstarpointedblackheavyeight": "\u2738", + "/dngb:cross": "\u274C", + "/dngb:crosscentreopen": "\u271B", + "/dngb:crosscentreopenheavy": "\u271C", + "/dngb:curlybracketleftmediumornament": "\u2774", + "/dngb:curlybracketrightmediumornament": "\u2775", + "/dngb:curlyloop": "\u27B0", + "/dngb:curlyloopdouble": "\u27BF", + "/dngb:curvedstemparagraphsignornament": "\u2761", + "/dngb:diamondminusxblackwhite": "\u2756", + "/dngb:divisionsignheavy": "\u2797", + "/dngb:eightnegativecircled": "\u277D", + "/dngb:eightsanscircled": "\u2787", + "/dngb:eightsansnegativecircled": "\u2791", + "/dngb:envelope": "\u2709", + "/dngb:exclamationheavy": "\u2757", + "/dngb:exclamationheavyornament": "\u2762", + "/dngb:exclamationwhiteornament": "\u2755", + "/dngb:fivenegativecircled": "\u277A", + "/dngb:fivesanscircled": "\u2784", + "/dngb:fivesansnegativecircled": "\u278E", + "/dngb:floralheart": "\u2766", + "/dngb:floralheartbulletrotated": "\u2767", + "/dngb:floretteblack": "\u273F", + "/dngb:floretteoutlinedpetalledblackeight": "\u2741", + "/dngb:florettepetalledblackwhitesix": "\u273E", + "/dngb:florettewhite": "\u2740", + "/dngb:fournegativecircled": "\u2779", + "/dngb:foursanscircled": "\u2783", + "/dngb:foursansnegativecircled": "\u278D", + "/dngb:greekcrossheavy": "\u271A", + "/dngb:greekcrossoutlined": "\u2719", + "/dngb:heartblackheavy": "\u2764", + "/dngb:heartbulletrotatedblackheavy": "\u2765", + "/dngb:heartexclamationheavyornament": "\u2763", + "/dngb:hvictory": "\u270C", + "/dngb:hwriting": "\u270D", + "/dngb:latincross": "\u271D", + "/dngb:latincrossoutlined": "\u271F", + "/dngb:latincrossshadowedwhite": "\u271E", + "/dngb:lowcommaheavydoubleornament": "\u2760", + "/dngb:lowcommaheavyornament": "\u275F", + "/dngb:maltesecross": "\u2720", + "/dngb:minussignheavy": "\u2796", + "/dngb:multiplicationx": "\u2715", + "/dngb:multiplicationxheavy": "\u2716", + "/dngb:nibblack": "\u2712", + "/dngb:nibwhite": "\u2711", + "/dngb:ninenegativecircled": "\u277E", + "/dngb:ninesanscircled": "\u2788", + "/dngb:ninesansnegativecircled": "\u2792", + "/dngb:onenegativecircled": "\u2776", + "/dngb:onesanscircled": "\u2780", + "/dngb:onesansnegativecircled": "\u278A", + "/dngb:parenthesisleftflattenedmediumornament": "\u276A", + "/dngb:parenthesisleftmediumornament": "\u2768", + "/dngb:parenthesisrightflattenedmediumornament": "\u276B", + "/dngb:parenthesisrightmediumornament": "\u2769", + "/dngb:pencil": "\u270F", + "/dngb:pencillowerright": "\u270E", + "/dngb:pencilupperright": "\u2710", + "/dngb:plussignheavy": "\u2795", + "/dngb:questionblackornament": "\u2753", + "/dngb:questionwhiteornament": "\u2754", + "/dngb:quotationleftpointedangleheavyornament": "\u276E", + "/dngb:quotationrightpointedangleheavyornament": "\u276F", + "/dngb:raisedfist": "\u270A", + "/dngb:raisedh": "\u270B", + "/dngb:safetyscissorsblack": "\u2700", + "/dngb:scissorsblack": "\u2702", + "/dngb:scissorslowerblade": "\u2703", + "/dngb:scissorsupperblade": "\u2701", + "/dngb:scissorswhite": "\u2704", + "/dngb:sevennegativecircled": "\u277C", + "/dngb:sevensanscircled": "\u2786", + "/dngb:sevensansnegativecircled": "\u2790", + "/dngb:sixnegativecircled": "\u277B", + "/dngb:sixsanscircled": "\u2785", + "/dngb:sixsansnegativecircled": "\u278F", + "/dngb:snowflake": "\u2744", + "/dngb:snowflaketight": "\u2745", + "/dngb:sparkle": "\u2747", + "/dngb:sparkleheavy": "\u2748", + "/dngb:sparkles": "\u2728", + "/dngb:spokedasteriskeight": "\u2733", + "/dngb:squaredcrossnegative": "\u274E", + "/dngb:squarelowerrightshadowedwhite": "\u2751", + "/dngb:squareshadowlowerrightwhite": "\u274F", + "/dngb:squareshadowupperrightwhite": "\u2750", + "/dngb:squareupperrightshadowedwhite": "\u2752", + "/dngb:starcentreblackwhite": "\u272C", + "/dngb:starcentreopenblack": "\u272B", + "/dngb:starcentreopenpointedcircledeight": "\u2742", + "/dngb:starcircledwhite": "\u272A", + "/dngb:starofdavid": "\u2721", + "/dngb:staroutlinedblack": "\u272D", + "/dngb:staroutlinedblackheavy": "\u272E", + "/dngb:staroutlinedstresswhite": "\u2729", + "/dngb:starpinwheel": "\u272F", + "/dngb:starpointedblackeight": "\u2734", + "/dngb:starpointedblackfour": "\u2726", + "/dngb:starpointedblacksix": "\u2736", + "/dngb:starpointedblacktwelve": "\u2739", + "/dngb:starpointedpinwheeleight": "\u2735", + "/dngb:starpointedwhitefour": "\u2727", + "/dngb:starshadowedwhite": "\u2730", + "/dngb:tapedrive": "\u2707", + "/dngb:telephonelocationsign": "\u2706", + "/dngb:tennegativecircled": "\u277F", + "/dngb:tensanscircled": "\u2789", + "/dngb:tensansnegativecircled": "\u2793", + "/dngb:threenegativecircled": "\u2778", + "/dngb:threesanscircled": "\u2782", + "/dngb:threesansnegativecircled": "\u278C", + "/dngb:twonegativecircled": "\u2777", + "/dngb:twosanscircled": "\u2781", + "/dngb:twosansnegativecircled": "\u278B", + "/dngb:verticalbarheavy": "\u275A", + "/dngb:verticalbarlight": "\u2758", + "/dngb:verticalbarmedium": "\u2759", + "/dnheavyhorzlight": "\u2530", + "/dnheavyleftlight": "\u2512", + "/dnheavyleftuplight": "\u2527", + "/dnheavyrightlight": "\u250E", + "/dnheavyrightuplight": "\u251F", + "/dnheavyuphorzlight": "\u2541", + "/dnlighthorzheavy": "\u252F", + "/dnlightleftheavy": "\u2511", + "/dnlightleftupheavy": "\u2529", + "/dnlightrightheavy": "\u250D", + "/dnlightrightupheavy": "\u2521", + "/dnlightuphorzheavy": "\u2547", + "/dnsnghorzdbl": "\u2564", + "/dnsngleftdbl": "\u2555", + "/dnsngrightdbl": "\u2552", + "/doNotLitter": "\u1F6AF", + "/dochadathai": "\u0E0E", + "/document": "\u1F5CE", + "/documentPicture": "\u1F5BB", + "/documentText": "\u1F5B9", + "/documentTextAndPicture": "\u1F5BA", + "/dodekthai": "\u0E14", + "/doesnotcontainasnormalsubgroorequalup": "\u22ED", + "/doesnotcontainasnormalsubgroup": "\u22EB", + "/doesnotdivide": "\u2224", + "/doesnotforce": "\u22AE", + "/doesnotprecede": "\u2280", + "/doesnotprecedeorequal": "\u22E0", + "/doesnotprove": "\u22AC", + "/doesnotsucceed": "\u2281", + "/doesnotsucceedorequal": "\u22E1", + "/dog": "\u1F415", + "/dogFace": "\u1F436", + "/dohiragana": "\u3069", + "/dokatakana": "\u30C9", + "/dollar": "\u0024", + "/dollarinferior": "\uF6E3", + "/dollarmonospace": "\uFF04", + "/dollaroldstyle": "\uF724", + "/dollarsmall": "\uFE69", + "/dollarsuperior": "\uF6E4", + "/dolphin": "\u1F42C", + "/dominohorizontal_00_00": "\u1F031", + "/dominohorizontal_00_01": "\u1F032", + "/dominohorizontal_00_02": "\u1F033", + "/dominohorizontal_00_03": "\u1F034", + "/dominohorizontal_00_04": "\u1F035", + "/dominohorizontal_00_05": "\u1F036", + "/dominohorizontal_00_06": "\u1F037", + "/dominohorizontal_01_00": "\u1F038", + "/dominohorizontal_01_01": "\u1F039", + "/dominohorizontal_01_02": "\u1F03A", + "/dominohorizontal_01_03": "\u1F03B", + "/dominohorizontal_01_04": "\u1F03C", + "/dominohorizontal_01_05": "\u1F03D", + "/dominohorizontal_01_06": "\u1F03E", + "/dominohorizontal_02_00": "\u1F03F", + "/dominohorizontal_02_01": "\u1F040", + "/dominohorizontal_02_02": "\u1F041", + "/dominohorizontal_02_03": "\u1F042", + "/dominohorizontal_02_04": "\u1F043", + "/dominohorizontal_02_05": "\u1F044", + "/dominohorizontal_02_06": "\u1F045", + "/dominohorizontal_03_00": "\u1F046", + "/dominohorizontal_03_01": "\u1F047", + "/dominohorizontal_03_02": "\u1F048", + "/dominohorizontal_03_03": "\u1F049", + "/dominohorizontal_03_04": "\u1F04A", + "/dominohorizontal_03_05": "\u1F04B", + "/dominohorizontal_03_06": "\u1F04C", + "/dominohorizontal_04_00": "\u1F04D", + "/dominohorizontal_04_01": "\u1F04E", + "/dominohorizontal_04_02": "\u1F04F", + "/dominohorizontal_04_03": "\u1F050", + "/dominohorizontal_04_04": "\u1F051", + "/dominohorizontal_04_05": "\u1F052", + "/dominohorizontal_04_06": "\u1F053", + "/dominohorizontal_05_00": "\u1F054", + "/dominohorizontal_05_01": "\u1F055", + "/dominohorizontal_05_02": "\u1F056", + "/dominohorizontal_05_03": "\u1F057", + "/dominohorizontal_05_04": "\u1F058", + "/dominohorizontal_05_05": "\u1F059", + "/dominohorizontal_05_06": "\u1F05A", + "/dominohorizontal_06_00": "\u1F05B", + "/dominohorizontal_06_01": "\u1F05C", + "/dominohorizontal_06_02": "\u1F05D", + "/dominohorizontal_06_03": "\u1F05E", + "/dominohorizontal_06_04": "\u1F05F", + "/dominohorizontal_06_05": "\u1F060", + "/dominohorizontal_06_06": "\u1F061", + "/dominohorizontalback": "\u1F030", + "/dominovertical_00_00": "\u1F063", + "/dominovertical_00_01": "\u1F064", + "/dominovertical_00_02": "\u1F065", + "/dominovertical_00_03": "\u1F066", + "/dominovertical_00_04": "\u1F067", + "/dominovertical_00_05": "\u1F068", + "/dominovertical_00_06": "\u1F069", + "/dominovertical_01_00": "\u1F06A", + "/dominovertical_01_01": "\u1F06B", + "/dominovertical_01_02": "\u1F06C", + "/dominovertical_01_03": "\u1F06D", + "/dominovertical_01_04": "\u1F06E", + "/dominovertical_01_05": "\u1F06F", + "/dominovertical_01_06": "\u1F070", + "/dominovertical_02_00": "\u1F071", + "/dominovertical_02_01": "\u1F072", + "/dominovertical_02_02": "\u1F073", + "/dominovertical_02_03": "\u1F074", + "/dominovertical_02_04": "\u1F075", + "/dominovertical_02_05": "\u1F076", + "/dominovertical_02_06": "\u1F077", + "/dominovertical_03_00": "\u1F078", + "/dominovertical_03_01": "\u1F079", + "/dominovertical_03_02": "\u1F07A", + "/dominovertical_03_03": "\u1F07B", + "/dominovertical_03_04": "\u1F07C", + "/dominovertical_03_05": "\u1F07D", + "/dominovertical_03_06": "\u1F07E", + "/dominovertical_04_00": "\u1F07F", + "/dominovertical_04_01": "\u1F080", + "/dominovertical_04_02": "\u1F081", + "/dominovertical_04_03": "\u1F082", + "/dominovertical_04_04": "\u1F083", + "/dominovertical_04_05": "\u1F084", + "/dominovertical_04_06": "\u1F085", + "/dominovertical_05_00": "\u1F086", + "/dominovertical_05_01": "\u1F087", + "/dominovertical_05_02": "\u1F088", + "/dominovertical_05_03": "\u1F089", + "/dominovertical_05_04": "\u1F08A", + "/dominovertical_05_05": "\u1F08B", + "/dominovertical_05_06": "\u1F08C", + "/dominovertical_06_00": "\u1F08D", + "/dominovertical_06_01": "\u1F08E", + "/dominovertical_06_02": "\u1F08F", + "/dominovertical_06_03": "\u1F090", + "/dominovertical_06_04": "\u1F091", + "/dominovertical_06_05": "\u1F092", + "/dominovertical_06_06": "\u1F093", + "/dominoverticalback": "\u1F062", + "/dong": "\u20AB", + "/door": "\u1F6AA", + "/dorusquare": "\u3326", + "/dot": "\u27D1", + "/dotaccent": "\u02D9", + "/dotaccentcmb": "\u0307", + "/dotbelowcmb": "\u0323", + "/dotbelowcomb": "\u0323", + "/dotkatakana": "\u30FB", + "/dotlessbeh": "\u066E", + "/dotlessfeh": "\u06A1", + "/dotlessi": "\u0131", + "/dotlessj": "\uF6BE", + "/dotlessjstroke": "\u025F", + "/dotlessjstrokehook": "\u0284", + "/dotlesskhahabove": "\u06E1", + "/dotlessqaf": "\u066F", + "/dotlower:hb": "\u05C5", + "/dotmath": "\u22C5", + "/dotminus": "\u2238", + "/dotplus": "\u2214", + "/dotraised": "\u2E33", + "/dots1": "\u2801", + "/dots12": "\u2803", + "/dots123": "\u2807", + "/dots1234": "\u280F", + "/dots12345": "\u281F", + "/dots123456": "\u283F", + "/dots1234567": "\u287F", + "/dots12345678": "\u28FF", + "/dots1234568": "\u28BF", + "/dots123457": "\u285F", + "/dots1234578": "\u28DF", + "/dots123458": "\u289F", + "/dots12346": "\u282F", + "/dots123467": "\u286F", + "/dots1234678": "\u28EF", + "/dots123468": "\u28AF", + "/dots12347": "\u284F", + "/dots123478": "\u28CF", + "/dots12348": "\u288F", + "/dots1235": "\u2817", + "/dots12356": "\u2837", + "/dots123567": "\u2877", + "/dots1235678": "\u28F7", + "/dots123568": "\u28B7", + "/dots12357": "\u2857", + "/dots123578": "\u28D7", + "/dots12358": "\u2897", + "/dots1236": "\u2827", + "/dots12367": "\u2867", + "/dots123678": "\u28E7", + "/dots12368": "\u28A7", + "/dots1237": "\u2847", + "/dots12378": "\u28C7", + "/dots1238": "\u2887", + "/dots124": "\u280B", + "/dots1245": "\u281B", + "/dots12456": "\u283B", + "/dots124567": "\u287B", + "/dots1245678": "\u28FB", + "/dots124568": "\u28BB", + "/dots12457": "\u285B", + "/dots124578": "\u28DB", + "/dots12458": "\u289B", + "/dots1246": "\u282B", + "/dots12467": "\u286B", + "/dots124678": "\u28EB", + "/dots12468": "\u28AB", + "/dots1247": "\u284B", + "/dots12478": "\u28CB", + "/dots1248": "\u288B", + "/dots125": "\u2813", + "/dots1256": "\u2833", + "/dots12567": "\u2873", + "/dots125678": "\u28F3", + "/dots12568": "\u28B3", + "/dots1257": "\u2853", + "/dots12578": "\u28D3", + "/dots1258": "\u2893", + "/dots126": "\u2823", + "/dots1267": "\u2863", + "/dots12678": "\u28E3", + "/dots1268": "\u28A3", + "/dots127": "\u2843", + "/dots1278": "\u28C3", + "/dots128": "\u2883", + "/dots13": "\u2805", + "/dots134": "\u280D", + "/dots1345": "\u281D", + "/dots13456": "\u283D", + "/dots134567": "\u287D", + "/dots1345678": "\u28FD", + "/dots134568": "\u28BD", + "/dots13457": "\u285D", + "/dots134578": "\u28DD", + "/dots13458": "\u289D", + "/dots1346": "\u282D", + "/dots13467": "\u286D", + "/dots134678": "\u28ED", + "/dots13468": "\u28AD", + "/dots1347": "\u284D", + "/dots13478": "\u28CD", + "/dots1348": "\u288D", + "/dots135": "\u2815", + "/dots1356": "\u2835", + "/dots13567": "\u2875", + "/dots135678": "\u28F5", + "/dots13568": "\u28B5", + "/dots1357": "\u2855", + "/dots13578": "\u28D5", + "/dots1358": "\u2895", + "/dots136": "\u2825", + "/dots1367": "\u2865", + "/dots13678": "\u28E5", + "/dots1368": "\u28A5", + "/dots137": "\u2845", + "/dots1378": "\u28C5", + "/dots138": "\u2885", + "/dots14": "\u2809", + "/dots145": "\u2819", + "/dots1456": "\u2839", + "/dots14567": "\u2879", + "/dots145678": "\u28F9", + "/dots14568": "\u28B9", + "/dots1457": "\u2859", + "/dots14578": "\u28D9", + "/dots1458": "\u2899", + "/dots146": "\u2829", + "/dots1467": "\u2869", + "/dots14678": "\u28E9", + "/dots1468": "\u28A9", + "/dots147": "\u2849", + "/dots1478": "\u28C9", + "/dots148": "\u2889", + "/dots15": "\u2811", + "/dots156": "\u2831", + "/dots1567": "\u2871", + "/dots15678": "\u28F1", + "/dots1568": "\u28B1", + "/dots157": "\u2851", + "/dots1578": "\u28D1", + "/dots158": "\u2891", + "/dots16": "\u2821", + "/dots167": "\u2861", + "/dots1678": "\u28E1", + "/dots168": "\u28A1", + "/dots17": "\u2841", + "/dots178": "\u28C1", + "/dots18": "\u2881", + "/dots2": "\u2802", + "/dots23": "\u2806", + "/dots234": "\u280E", + "/dots2345": "\u281E", + "/dots23456": "\u283E", + "/dots234567": "\u287E", + "/dots2345678": "\u28FE", + "/dots234568": "\u28BE", + "/dots23457": "\u285E", + "/dots234578": "\u28DE", + "/dots23458": "\u289E", + "/dots2346": "\u282E", + "/dots23467": "\u286E", + "/dots234678": "\u28EE", + "/dots23468": "\u28AE", + "/dots2347": "\u284E", + "/dots23478": "\u28CE", + "/dots2348": "\u288E", + "/dots235": "\u2816", + "/dots2356": "\u2836", + "/dots23567": "\u2876", + "/dots235678": "\u28F6", + "/dots23568": "\u28B6", + "/dots2357": "\u2856", + "/dots23578": "\u28D6", + "/dots2358": "\u2896", + "/dots236": "\u2826", + "/dots2367": "\u2866", + "/dots23678": "\u28E6", + "/dots2368": "\u28A6", + "/dots237": "\u2846", + "/dots2378": "\u28C6", + "/dots238": "\u2886", + "/dots24": "\u280A", + "/dots245": "\u281A", + "/dots2456": "\u283A", + "/dots24567": "\u287A", + "/dots245678": "\u28FA", + "/dots24568": "\u28BA", + "/dots2457": "\u285A", + "/dots24578": "\u28DA", + "/dots2458": "\u289A", + "/dots246": "\u282A", + "/dots2467": "\u286A", + "/dots24678": "\u28EA", + "/dots2468": "\u28AA", + "/dots247": "\u284A", + "/dots2478": "\u28CA", + "/dots248": "\u288A", + "/dots25": "\u2812", + "/dots256": "\u2832", + "/dots2567": "\u2872", + "/dots25678": "\u28F2", + "/dots2568": "\u28B2", + "/dots257": "\u2852", + "/dots2578": "\u28D2", + "/dots258": "\u2892", + "/dots26": "\u2822", + "/dots267": "\u2862", + "/dots2678": "\u28E2", + "/dots268": "\u28A2", + "/dots27": "\u2842", + "/dots278": "\u28C2", + "/dots28": "\u2882", + "/dots3": "\u2804", + "/dots34": "\u280C", + "/dots345": "\u281C", + "/dots3456": "\u283C", + "/dots34567": "\u287C", + "/dots345678": "\u28FC", + "/dots34568": "\u28BC", + "/dots3457": "\u285C", + "/dots34578": "\u28DC", + "/dots3458": "\u289C", + "/dots346": "\u282C", + "/dots3467": "\u286C", + "/dots34678": "\u28EC", + "/dots3468": "\u28AC", + "/dots347": "\u284C", + "/dots3478": "\u28CC", + "/dots348": "\u288C", + "/dots35": "\u2814", + "/dots356": "\u2834", + "/dots3567": "\u2874", + "/dots35678": "\u28F4", + "/dots3568": "\u28B4", + "/dots357": "\u2854", + "/dots3578": "\u28D4", + "/dots358": "\u2894", + "/dots36": "\u2824", + "/dots367": "\u2864", + "/dots3678": "\u28E4", + "/dots368": "\u28A4", + "/dots37": "\u2844", + "/dots378": "\u28C4", + "/dots38": "\u2884", + "/dots4": "\u2808", + "/dots45": "\u2818", + "/dots456": "\u2838", + "/dots4567": "\u2878", + "/dots45678": "\u28F8", + "/dots4568": "\u28B8", + "/dots457": "\u2858", + "/dots4578": "\u28D8", + "/dots458": "\u2898", + "/dots46": "\u2828", + "/dots467": "\u2868", + "/dots4678": "\u28E8", + "/dots468": "\u28A8", + "/dots47": "\u2848", + "/dots478": "\u28C8", + "/dots48": "\u2888", + "/dots5": "\u2810", + "/dots56": "\u2830", + "/dots567": "\u2870", + "/dots5678": "\u28F0", + "/dots568": "\u28B0", + "/dots57": "\u2850", + "/dots578": "\u28D0", + "/dots58": "\u2890", + "/dots6": "\u2820", + "/dots67": "\u2860", + "/dots678": "\u28E0", + "/dots68": "\u28A0", + "/dots7": "\u2840", + "/dots78": "\u28C0", + "/dots8": "\u2880", + "/dotsquarefour": "\u2E2C", + "/dottedcircle": "\u25CC", + "/dottedcross": "\u205C", + "/dotupper:hb": "\u05C4", + "/doublebarvertical": "\u23F8", + "/doubleyodpatah": "\uFB1F", + "/doubleyodpatahhebrew": "\uFB1F", + "/doughnut": "\u1F369", + "/doveOfPeace": "\u1F54A", + "/downtackbelowcmb": "\u031E", + "/downtackmod": "\u02D5", + "/downwarrowleftofuparrow": "\u21F5", + "/dparen": "\u249F", + "/dparenthesized": "\u249F", + "/drachma": "\u20AF", + "/dragon": "\u1F409", + "/dragonFace": "\u1F432", + "/draughtskingblack": "\u26C3", + "/draughtskingwhite": "\u26C1", + "/draughtsmanblack": "\u26C2", + "/draughtsmanwhite": "\u26C0", + "/dress": "\u1F457", + "/driveslow": "\u26DA", + "/dromedaryCamel": "\u1F42A", + "/droplet": "\u1F4A7", + "/dsquare": "\u1F1A5", + "/dsuperior": "\uF6EB", + "/dtail": "\u0256", + "/dtopbar": "\u018C", + "/duhiragana": "\u3065", + "/dukatakana": "\u30C5", + "/dul": "\u068E", + "/dul.fina": "\uFB87", + "/dul.isol": "\uFB86", + "/dum": "\uA771", + "/dvd": "\u1F4C0", + "/dyeh": "\u0684", + "/dyeh.fina": "\uFB73", + "/dyeh.init": "\uFB74", + "/dyeh.isol": "\uFB72", + "/dyeh.medi": "\uFB75", + "/dz": "\u01F3", + "/dzaltone": "\u02A3", + "/dzcaron": "\u01C6", + "/dzcurl": "\u02A5", + "/dzeabkhasiancyrillic": "\u04E1", + "/dzeabkhcyr": "\u04E1", + "/dzecyr": "\u0455", + "/dzecyrillic": "\u0455", + "/dzed": "\u02A3", + "/dzedcurl": "\u02A5", + "/dzhecyr": "\u045F", + "/dzhecyrillic": "\u045F", + "/dzjekomicyr": "\u0507", + "/dzzhecyr": "\u052B", + "/e": "\u0065", + "/e-mail": "\u1F4E7", + "/e.fina": "\uFBE5", + "/e.inferior": "\u2091", + "/e.init": "\uFBE6", + "/e.isol": "\uFBE4", + "/e.medi": "\uFBE7", + "/eVfullwidth": "\u32CE", + "/eacute": "\u00E9", + "/earOfMaize": "\u1F33D", + "/earOfRice": "\u1F33E", + "/earth": "\u2641", + "/earthGlobeAmericas": "\u1F30E", + "/earthGlobeAsiaAustralia": "\u1F30F", + "/earthGlobeEuropeAfrica": "\u1F30D", + "/earthground": "\u23DA", + "/earthideographiccircled": "\u328F", + "/earthideographicparen": "\u322F", + "/eastsyriaccross": "\u2671", + "/ebengali": "\u098F", + "/ebopomofo": "\u311C", + "/ebreve": "\u0115", + "/ecandradeva": "\u090D", + "/ecandragujarati": "\u0A8D", + "/ecandravowelsigndeva": "\u0945", + "/ecandravowelsigngujarati": "\u0AC5", + "/ecaron": "\u011B", + "/ecedilla": "\u0229", + "/ecedillabreve": "\u1E1D", + "/echarmenian": "\u0565", + "/echyiwnarmenian": "\u0587", + "/ecircle": "\u24D4", + "/ecirclekatakana": "\u32D3", + "/ecircumflex": "\u00EA", + "/ecircumflexacute": "\u1EBF", + "/ecircumflexbelow": "\u1E19", + "/ecircumflexdotbelow": "\u1EC7", + "/ecircumflexgrave": "\u1EC1", + "/ecircumflexhoi": "\u1EC3", + "/ecircumflexhookabove": "\u1EC3", + "/ecircumflextilde": "\u1EC5", + "/ecyrillic": "\u0454", + "/edblgrave": "\u0205", + "/edblstruckitalic": "\u2147", + "/edeva": "\u090F", + "/edieresis": "\u00EB", + "/edot": "\u0117", + "/edotaccent": "\u0117", + "/edotbelow": "\u1EB9", + "/eegurmukhi": "\u0A0F", + "/eekaasquare": "\u3308", + "/eematragurmukhi": "\u0A47", + "/efcyr": "\u0444", + "/efcyrillic": "\u0444", + "/egrave": "\u00E8", + "/egravedbl": "\u0205", + "/egujarati": "\u0A8F", + "/egyptain": "\uA725", + "/egyptalef": "\uA723", + "/eharmenian": "\u0567", + "/ehbopomofo": "\u311D", + "/ehiragana": "\u3048", + "/ehoi": "\u1EBB", + "/ehookabove": "\u1EBB", + "/eibopomofo": "\u311F", + "/eight": "\u0038", + "/eight.inferior": "\u2088", + "/eight.roman": "\u2167", + "/eight.romansmall": "\u2177", + "/eight.superior": "\u2078", + "/eightarabic": "\u0668", + "/eightbengali": "\u09EE", + "/eightcircle": "\u2467", + "/eightcircledbl": "\u24FC", + "/eightcircleinversesansserif": "\u2791", + "/eightcomma": "\u1F109", + "/eightdeva": "\u096E", + "/eighteencircle": "\u2471", + "/eighteencircleblack": "\u24F2", + "/eighteenparen": "\u2485", + "/eighteenparenthesized": "\u2485", + "/eighteenperiod": "\u2499", + "/eightfar": "\u06F8", + "/eightgujarati": "\u0AEE", + "/eightgurmukhi": "\u0A6E", + "/eighthackarabic": "\u0668", + "/eighthangzhou": "\u3028", + "/eighthnote": "\u266A", + "/eighthnotebeamed": "\u266B", + "/eightideographiccircled": "\u3287", + "/eightideographicparen": "\u3227", + "/eightinferior": "\u2088", + "/eightksquare": "\u1F19F", + "/eightmonospace": "\uFF18", + "/eightoldstyle": "\uF738", + "/eightparen": "\u247B", + "/eightparenthesized": "\u247B", + "/eightperiod": "\u248F", + "/eightpersian": "\u06F8", + "/eightroman": "\u2177", + "/eightsuperior": "\u2078", + "/eightthai": "\u0E58", + "/eightycirclesquare": "\u324F", + "/einvertedbreve": "\u0207", + "/eiotifiedcyr": "\u0465", + "/eiotifiedcyrillic": "\u0465", + "/eject": "\u23CF", + "/ekatakana": "\u30A8", + "/ekatakanahalfwidth": "\uFF74", + "/ekonkargurmukhi": "\u0A74", + "/ekorean": "\u3154", + "/elcyr": "\u043B", + "/elcyrillic": "\u043B", + "/electricLightBulb": "\u1F4A1", + "/electricPlug": "\u1F50C", + "/electricTorch": "\u1F526", + "/electricalintersection": "\u23E7", + "/electricarrow": "\u2301", + "/element": "\u2208", + "/elementdotabove": "\u22F5", + "/elementlonghorizontalstroke": "\u22F2", + "/elementopeningup": "\u27D2", + "/elementoverbar": "\u22F6", + "/elementoverbarsmall": "\u22F7", + "/elementsmall": "\u220A", + "/elementsmallverticalbarhorizontalstroke": "\u22F4", + "/elementtwoshorizontalstroke": "\u22F9", + "/elementunderbar": "\u22F8", + "/elementverticalbarhorizontalstroke": "\u22F3", + "/elephant": "\u1F418", + "/eleven.roman": "\u216A", + "/eleven.romansmall": "\u217A", + "/elevencircle": "\u246A", + "/elevencircleblack": "\u24EB", + "/elevenparen": "\u247E", + "/elevenparenthesized": "\u247E", + "/elevenperiod": "\u2492", + "/elevenroman": "\u217A", + "/elhookcyr": "\u0513", + "/ellipsis": "\u2026", + "/ellipsisdiagonaldownright": "\u22F1", + "/ellipsisdiagonalupright": "\u22F0", + "/ellipsismidhorizontal": "\u22EF", + "/ellipsisvertical": "\u22EE", + "/elmiddlehookcyr": "\u0521", + "/elsharptailcyr": "\u04C6", + "/eltailcyr": "\u052F", + "/emacron": "\u0113", + "/emacronacute": "\u1E17", + "/emacrongrave": "\u1E15", + "/emcyr": "\u043C", + "/emcyrillic": "\u043C", + "/emdash": "\u2014", + "/emdashdbl": "\u2E3A", + "/emdashtpl": "\u2E3B", + "/emdashvertical": "\uFE31", + "/emojiModifierFitzpatrickType-1-2": "\u1F3FB", + "/emojiModifierFitzpatrickType-3": "\u1F3FC", + "/emojiModifierFitzpatrickType-4": "\u1F3FD", + "/emojiModifierFitzpatrickType-5": "\u1F3FE", + "/emojiModifierFitzpatrickType-6": "\u1F3FF", + "/emonospace": "\uFF45", + "/emphasis": "\u2383", + "/emphasismarkarmenian": "\u055B", + "/emptyDocument": "\u1F5CB", + "/emptyNote": "\u1F5C5", + "/emptyNotePad": "\u1F5C7", + "/emptyNotePage": "\u1F5C6", + "/emptyPage": "\u1F5CC", + "/emptyPages": "\u1F5CD", + "/emptyset": "\u2205", + "/emquad": "\u2001", + "/emsharptailcyr": "\u04CE", + "/emspace": "\u2003", + "/enbopomofo": "\u3123", + "/encyr": "\u043D", + "/encyrillic": "\u043D", + "/endLeftwardsArrowAbove": "\u1F51A", + "/endash": "\u2013", + "/endashvertical": "\uFE32", + "/endescendercyrillic": "\u04A3", + "/endpro": "\u220E", + "/eng": "\u014B", + "/engbopomofo": "\u3125", + "/engecyr": "\u04A5", + "/enghecyrillic": "\u04A5", + "/enhookcyr": "\u04C8", + "/enhookcyrillic": "\u04C8", + "/enhookleftcyr": "\u0529", + "/enmiddlehookcyr": "\u0523", + "/enotch": "\u2C78", + "/enquad": "\u2000", + "/ensharptailcyr": "\u04CA", + "/enspace": "\u2002", + "/entailcyr": "\u04A3", + "/enter": "\u2386", + "/enterpriseideographiccircled": "\u32AD", + "/enterpriseideographicparen": "\u323D", + "/envelopeDownwardsArrowAbove": "\u1F4E9", + "/envelopeLightning": "\u1F584", + "/eogonek": "\u0119", + "/eokorean": "\u3153", + "/eopen": "\u025B", + "/eopenclosed": "\u029A", + "/eopenreversed": "\u025C", + "/eopenreversedclosed": "\u025E", + "/eopenreversedhook": "\u025D", + "/eparen": "\u24A0", + "/eparenthesized": "\u24A0", + "/epsilon": "\u03B5", + "/epsilonacute": "\u1F73", + "/epsilonasper": "\u1F11", + "/epsilonasperacute": "\u1F15", + "/epsilonaspergrave": "\u1F13", + "/epsilongrave": "\u1F72", + "/epsilonlenis": "\u1F10", + "/epsilonlenisacute": "\u1F14", + "/epsilonlenisgrave": "\u1F12", + "/epsilonlunatesymbol": "\u03F5", + "/epsilonreversedlunatesymbol": "\u03F6", + "/epsilontonos": "\u03AD", + "/epsilonunderlinefunc": "\u2377", + "/equal": "\u003D", + "/equal.inferior": "\u208C", + "/equal.superior": "\u207C", + "/equalandparallel": "\u22D5", + "/equalbydefinition": "\u225D", + "/equalmonospace": "\uFF1D", + "/equalorgreater": "\u22DD", + "/equalorless": "\u22DC", + "/equalorprecedes": "\u22DE", + "/equalorsucceeds": "\u22DF", + "/equalscolon": "\u2255", + "/equalsmall": "\uFE66", + "/equalsuperior": "\u207C", + "/equiangular": "\u225A", + "/equivalence": "\u2261", + "/equivalent": "\u224D", + "/eranameheiseisquare": "\u337B", + "/eranamemeizisquare": "\u337E", + "/eranamesyouwasquare": "\u337C", + "/eranametaisyousquare": "\u337D", + "/eraseleft": "\u232B", + "/eraseright": "\u2326", + "/erbopomofo": "\u3126", + "/ercyr": "\u0440", + "/ercyrillic": "\u0440", + "/ereversed": "\u0258", + "/ereversedcyr": "\u044D", + "/ereversedcyrillic": "\u044D", + "/ereverseddieresiscyr": "\u04ED", + "/ergfullwidth": "\u32CD", + "/ertickcyr": "\u048F", + "/escript": "\u212F", + "/escyr": "\u0441", + "/escyrillic": "\u0441", + "/esdescendercyrillic": "\u04AB", + "/esh": "\u0283", + "/eshcurl": "\u0286", + "/eshortdeva": "\u090E", + "/eshortvowelsigndeva": "\u0946", + "/eshreversedloop": "\u01AA", + "/eshsquatreversed": "\u0285", + "/esmallhiragana": "\u3047", + "/esmallkatakana": "\u30A7", + "/esmallkatakanahalfwidth": "\uFF6A", + "/estailcyr": "\u04AB", + "/estimated": "\u212E", + "/estimates": "\u2259", + "/estroke": "\u0247", + "/esukuudosquare": "\u3307", + "/esuperior": "\uF6EC", + "/et": "\uA76B", + "/eta": "\u03B7", + "/etaacute": "\u1F75", + "/etaacuteiotasub": "\u1FC4", + "/etaasper": "\u1F21", + "/etaasperacute": "\u1F25", + "/etaasperacuteiotasub": "\u1F95", + "/etaaspergrave": "\u1F23", + "/etaaspergraveiotasub": "\u1F93", + "/etaasperiotasub": "\u1F91", + "/etaaspertilde": "\u1F27", + "/etaaspertildeiotasub": "\u1F97", + "/etagrave": "\u1F74", + "/etagraveiotasub": "\u1FC2", + "/etaiotasub": "\u1FC3", + "/etalenis": "\u1F20", + "/etalenisacute": "\u1F24", + "/etalenisacuteiotasub": "\u1F94", + "/etalenisgrave": "\u1F22", + "/etalenisgraveiotasub": "\u1F92", + "/etalenisiotasub": "\u1F90", + "/etalenistilde": "\u1F26", + "/etalenistildeiotasub": "\u1F96", + "/etarmenian": "\u0568", + "/etatilde": "\u1FC6", + "/etatildeiotasub": "\u1FC7", + "/etatonos": "\u03AE", + "/eth": "\u00F0", + "/ethi:aaglottal": "\u12A3", + "/ethi:aglottal": "\u12A0", + "/ethi:ba": "\u1260", + "/ethi:baa": "\u1263", + "/ethi:be": "\u1265", + "/ethi:bee": "\u1264", + "/ethi:bi": "\u1262", + "/ethi:bo": "\u1266", + "/ethi:bu": "\u1261", + "/ethi:bwa": "\u1267", + "/ethi:ca": "\u1278", + "/ethi:caa": "\u127B", + "/ethi:ce": "\u127D", + "/ethi:cee": "\u127C", + "/ethi:cha": "\u1328", + "/ethi:chaa": "\u132B", + "/ethi:che": "\u132D", + "/ethi:chee": "\u132C", + "/ethi:chi": "\u132A", + "/ethi:cho": "\u132E", + "/ethi:chu": "\u1329", + "/ethi:chwa": "\u132F", + "/ethi:ci": "\u127A", + "/ethi:co": "\u127E", + "/ethi:colon": "\u1365", + "/ethi:comma": "\u1363", + "/ethi:cu": "\u1279", + "/ethi:cwa": "\u127F", + "/ethi:da": "\u12F0", + "/ethi:daa": "\u12F3", + "/ethi:dda": "\u12F8", + "/ethi:ddaa": "\u12FB", + "/ethi:dde": "\u12FD", + "/ethi:ddee": "\u12FC", + "/ethi:ddi": "\u12FA", + "/ethi:ddo": "\u12FE", + "/ethi:ddu": "\u12F9", + "/ethi:ddwa": "\u12FF", + "/ethi:de": "\u12F5", + "/ethi:dee": "\u12F4", + "/ethi:di": "\u12F2", + "/ethi:do": "\u12F6", + "/ethi:du": "\u12F1", + "/ethi:dwa": "\u12F7", + "/ethi:eeglottal": "\u12A4", + "/ethi:eglottal": "\u12A5", + "/ethi:eight": "\u1370", + "/ethi:eighty": "\u1379", + "/ethi:fa": "\u1348", + "/ethi:faa": "\u134B", + "/ethi:fe": "\u134D", + "/ethi:fee": "\u134C", + "/ethi:fi": "\u134A", + "/ethi:fifty": "\u1376", + "/ethi:five": "\u136D", + "/ethi:fo": "\u134E", + "/ethi:forty": "\u1375", + "/ethi:four": "\u136C", + "/ethi:fu": "\u1349", + "/ethi:fullstop": "\u1362", + "/ethi:fwa": "\u134F", + "/ethi:fya": "\u135A", + "/ethi:ga": "\u1308", + "/ethi:gaa": "\u130B", + "/ethi:ge": "\u130D", + "/ethi:gee": "\u130C", + "/ethi:geminationandvowellengthmarkcmb": "\u135D", + "/ethi:geminationmarkcmb": "\u135F", + "/ethi:gga": "\u1318", + "/ethi:ggaa": "\u131B", + "/ethi:gge": "\u131D", + "/ethi:ggee": "\u131C", + "/ethi:ggi": "\u131A", + "/ethi:ggo": "\u131E", + "/ethi:ggu": "\u1319", + "/ethi:ggwaa": "\u131F", + "/ethi:gi": "\u130A", + "/ethi:go": "\u130E", + "/ethi:goa": "\u130F", + "/ethi:gu": "\u1309", + "/ethi:gwa": "\u1310", + "/ethi:gwaa": "\u1313", + "/ethi:gwe": "\u1315", + "/ethi:gwee": "\u1314", + "/ethi:gwi": "\u1312", + "/ethi:ha": "\u1200", + "/ethi:haa": "\u1203", + "/ethi:he": "\u1205", + "/ethi:hee": "\u1204", + "/ethi:hha": "\u1210", + "/ethi:hhaa": "\u1213", + "/ethi:hhe": "\u1215", + "/ethi:hhee": "\u1214", + "/ethi:hhi": "\u1212", + "/ethi:hho": "\u1216", + "/ethi:hhu": "\u1211", + "/ethi:hhwa": "\u1217", + "/ethi:hi": "\u1202", + "/ethi:ho": "\u1206", + "/ethi:hoa": "\u1207", + "/ethi:hu": "\u1201", + "/ethi:hundred": "\u137B", + "/ethi:iglottal": "\u12A2", + "/ethi:ja": "\u1300", + "/ethi:jaa": "\u1303", + "/ethi:je": "\u1305", + "/ethi:jee": "\u1304", + "/ethi:ji": "\u1302", + "/ethi:jo": "\u1306", + "/ethi:ju": "\u1301", + "/ethi:jwa": "\u1307", + "/ethi:ka": "\u12A8", + "/ethi:kaa": "\u12AB", + "/ethi:ke": "\u12AD", + "/ethi:kee": "\u12AC", + "/ethi:ki": "\u12AA", + "/ethi:ko": "\u12AE", + "/ethi:koa": "\u12AF", + "/ethi:ku": "\u12A9", + "/ethi:kwa": "\u12B0", + "/ethi:kwaa": "\u12B3", + "/ethi:kwe": "\u12B5", + "/ethi:kwee": "\u12B4", + "/ethi:kwi": "\u12B2", + "/ethi:kxa": "\u12B8", + "/ethi:kxaa": "\u12BB", + "/ethi:kxe": "\u12BD", + "/ethi:kxee": "\u12BC", + "/ethi:kxi": "\u12BA", + "/ethi:kxo": "\u12BE", + "/ethi:kxu": "\u12B9", + "/ethi:kxwa": "\u12C0", + "/ethi:kxwaa": "\u12C3", + "/ethi:kxwe": "\u12C5", + "/ethi:kxwee": "\u12C4", + "/ethi:kxwi": "\u12C2", + "/ethi:la": "\u1208", + "/ethi:laa": "\u120B", + "/ethi:le": "\u120D", + "/ethi:lee": "\u120C", + "/ethi:li": "\u120A", + "/ethi:lo": "\u120E", + "/ethi:lu": "\u1209", + "/ethi:lwa": "\u120F", + "/ethi:ma": "\u1218", + "/ethi:maa": "\u121B", + "/ethi:me": "\u121D", + "/ethi:mee": "\u121C", + "/ethi:mi": "\u121A", + "/ethi:mo": "\u121E", + "/ethi:mu": "\u1219", + "/ethi:mwa": "\u121F", + "/ethi:mya": "\u1359", + "/ethi:na": "\u1290", + "/ethi:naa": "\u1293", + "/ethi:ne": "\u1295", + "/ethi:nee": "\u1294", + "/ethi:ni": "\u1292", + "/ethi:nine": "\u1371", + "/ethi:ninety": "\u137A", + "/ethi:no": "\u1296", + "/ethi:nu": "\u1291", + "/ethi:nwa": "\u1297", + "/ethi:nya": "\u1298", + "/ethi:nyaa": "\u129B", + "/ethi:nye": "\u129D", + "/ethi:nyee": "\u129C", + "/ethi:nyi": "\u129A", + "/ethi:nyo": "\u129E", + "/ethi:nyu": "\u1299", + "/ethi:nywa": "\u129F", + "/ethi:oglottal": "\u12A6", + "/ethi:one": "\u1369", + "/ethi:pa": "\u1350", + "/ethi:paa": "\u1353", + "/ethi:paragraphseparator": "\u1368", + "/ethi:pe": "\u1355", + "/ethi:pee": "\u1354", + "/ethi:pha": "\u1330", + "/ethi:phaa": "\u1333", + "/ethi:pharyngeala": "\u12D0", + "/ethi:pharyngealaa": "\u12D3", + "/ethi:pharyngeale": "\u12D5", + "/ethi:pharyngealee": "\u12D4", + "/ethi:pharyngeali": "\u12D2", + "/ethi:pharyngealo": "\u12D6", + "/ethi:pharyngealu": "\u12D1", + "/ethi:phe": "\u1335", + "/ethi:phee": "\u1334", + "/ethi:phi": "\u1332", + "/ethi:pho": "\u1336", + "/ethi:phu": "\u1331", + "/ethi:phwa": "\u1337", + "/ethi:pi": "\u1352", + "/ethi:po": "\u1356", + "/ethi:prefacecolon": "\u1366", + "/ethi:pu": "\u1351", + "/ethi:pwa": "\u1357", + "/ethi:qa": "\u1240", + "/ethi:qaa": "\u1243", + "/ethi:qe": "\u1245", + "/ethi:qee": "\u1244", + "/ethi:qha": "\u1250", + "/ethi:qhaa": "\u1253", + "/ethi:qhe": "\u1255", + "/ethi:qhee": "\u1254", + "/ethi:qhi": "\u1252", + "/ethi:qho": "\u1256", + "/ethi:qhu": "\u1251", + "/ethi:qhwa": "\u1258", + "/ethi:qhwaa": "\u125B", + "/ethi:qhwe": "\u125D", + "/ethi:qhwee": "\u125C", + "/ethi:qhwi": "\u125A", + "/ethi:qi": "\u1242", + "/ethi:qo": "\u1246", + "/ethi:qoa": "\u1247", + "/ethi:qu": "\u1241", + "/ethi:questionmark": "\u1367", + "/ethi:qwa": "\u1248", + "/ethi:qwaa": "\u124B", + "/ethi:qwe": "\u124D", + "/ethi:qwee": "\u124C", + "/ethi:qwi": "\u124A", + "/ethi:ra": "\u1228", + "/ethi:raa": "\u122B", + "/ethi:re": "\u122D", + "/ethi:ree": "\u122C", + "/ethi:ri": "\u122A", + "/ethi:ro": "\u122E", + "/ethi:ru": "\u1229", + "/ethi:rwa": "\u122F", + "/ethi:rya": "\u1358", + "/ethi:sa": "\u1230", + "/ethi:saa": "\u1233", + "/ethi:se": "\u1235", + "/ethi:sectionmark": "\u1360", + "/ethi:see": "\u1234", + "/ethi:semicolon": "\u1364", + "/ethi:seven": "\u136F", + "/ethi:seventy": "\u1378", + "/ethi:sha": "\u1238", + "/ethi:shaa": "\u123B", + "/ethi:she": "\u123D", + "/ethi:shee": "\u123C", + "/ethi:shi": "\u123A", + "/ethi:sho": "\u123E", + "/ethi:shu": "\u1239", + "/ethi:shwa": "\u123F", + "/ethi:si": "\u1232", + "/ethi:six": "\u136E", + "/ethi:sixty": "\u1377", + "/ethi:so": "\u1236", + "/ethi:su": "\u1231", + "/ethi:swa": "\u1237", + "/ethi:sza": "\u1220", + "/ethi:szaa": "\u1223", + "/ethi:sze": "\u1225", + "/ethi:szee": "\u1224", + "/ethi:szi": "\u1222", + "/ethi:szo": "\u1226", + "/ethi:szu": "\u1221", + "/ethi:szwa": "\u1227", + "/ethi:ta": "\u1270", + "/ethi:taa": "\u1273", + "/ethi:te": "\u1275", + "/ethi:tee": "\u1274", + "/ethi:ten": "\u1372", + "/ethi:tenthousand": "\u137C", + "/ethi:tha": "\u1320", + "/ethi:thaa": "\u1323", + "/ethi:the": "\u1325", + "/ethi:thee": "\u1324", + "/ethi:thi": "\u1322", + "/ethi:thirty": "\u1374", + "/ethi:tho": "\u1326", + "/ethi:three": "\u136B", + "/ethi:thu": "\u1321", + "/ethi:thwa": "\u1327", + "/ethi:ti": "\u1272", + "/ethi:to": "\u1276", + "/ethi:tsa": "\u1338", + "/ethi:tsaa": "\u133B", + "/ethi:tse": "\u133D", + "/ethi:tsee": "\u133C", + "/ethi:tsi": "\u133A", + "/ethi:tso": "\u133E", + "/ethi:tsu": "\u1339", + "/ethi:tswa": "\u133F", + "/ethi:tu": "\u1271", + "/ethi:twa": "\u1277", + "/ethi:twenty": "\u1373", + "/ethi:two": "\u136A", + "/ethi:tza": "\u1340", + "/ethi:tzaa": "\u1343", + "/ethi:tze": "\u1345", + "/ethi:tzee": "\u1344", + "/ethi:tzi": "\u1342", + "/ethi:tzo": "\u1346", + "/ethi:tzoa": "\u1347", + "/ethi:tzu": "\u1341", + "/ethi:uglottal": "\u12A1", + "/ethi:va": "\u1268", + "/ethi:vaa": "\u126B", + "/ethi:ve": "\u126D", + "/ethi:vee": "\u126C", + "/ethi:vi": "\u126A", + "/ethi:vo": "\u126E", + "/ethi:vowellengthmarkcmb": "\u135E", + "/ethi:vu": "\u1269", + "/ethi:vwa": "\u126F", + "/ethi:wa": "\u12C8", + "/ethi:waa": "\u12CB", + "/ethi:waglottal": "\u12A7", + "/ethi:we": "\u12CD", + "/ethi:wee": "\u12CC", + "/ethi:wi": "\u12CA", + "/ethi:wo": "\u12CE", + "/ethi:woa": "\u12CF", + "/ethi:wordspace": "\u1361", + "/ethi:wu": "\u12C9", + "/ethi:xa": "\u1280", + "/ethi:xaa": "\u1283", + "/ethi:xe": "\u1285", + "/ethi:xee": "\u1284", + "/ethi:xi": "\u1282", + "/ethi:xo": "\u1286", + "/ethi:xoa": "\u1287", + "/ethi:xu": "\u1281", + "/ethi:xwa": "\u1288", + "/ethi:xwaa": "\u128B", + "/ethi:xwe": "\u128D", + "/ethi:xwee": "\u128C", + "/ethi:xwi": "\u128A", + "/ethi:ya": "\u12E8", + "/ethi:yaa": "\u12EB", + "/ethi:ye": "\u12ED", + "/ethi:yee": "\u12EC", + "/ethi:yi": "\u12EA", + "/ethi:yo": "\u12EE", + "/ethi:yoa": "\u12EF", + "/ethi:yu": "\u12E9", + "/ethi:za": "\u12D8", + "/ethi:zaa": "\u12DB", + "/ethi:ze": "\u12DD", + "/ethi:zee": "\u12DC", + "/ethi:zha": "\u12E0", + "/ethi:zhaa": "\u12E3", + "/ethi:zhe": "\u12E5", + "/ethi:zhee": "\u12E4", + "/ethi:zhi": "\u12E2", + "/ethi:zho": "\u12E6", + "/ethi:zhu": "\u12E1", + "/ethi:zhwa": "\u12E7", + "/ethi:zi": "\u12DA", + "/ethi:zo": "\u12DE", + "/ethi:zu": "\u12D9", + "/ethi:zwa": "\u12DF", + "/etilde": "\u1EBD", + "/etildebelow": "\u1E1B", + "/etnahta:hb": "\u0591", + "/etnahtafoukhhebrew": "\u0591", + "/etnahtafoukhlefthebrew": "\u0591", + "/etnahtahebrew": "\u0591", + "/etnahtalefthebrew": "\u0591", + "/eturned": "\u01DD", + "/eukorean": "\u3161", + "/eukrcyr": "\u0454", + "/euler": "\u2107", + "/euro": "\u20AC", + "/euroarchaic": "\u20A0", + "/europeanCastle": "\u1F3F0", + "/europeanPostOffice": "\u1F3E4", + "/evergreenTree": "\u1F332", + "/evowelsignbengali": "\u09C7", + "/evowelsigndeva": "\u0947", + "/evowelsigngujarati": "\u0AC7", + "/excellentideographiccircled": "\u329D", + "/excess": "\u2239", + "/exclam": "\u0021", + "/exclamarmenian": "\u055C", + "/exclamationquestion": "\u2049", + "/exclamdbl": "\u203C", + "/exclamdown": "\u00A1", + "/exclamdownsmall": "\uF7A1", + "/exclammonospace": "\uFF01", + "/exclamsmall": "\uF721", + "/existential": "\u2203", + "/expressionlessFace": "\u1F611", + "/extraterrestrialAlien": "\u1F47D", + "/eye": "\u1F441", + "/eyeglasses": "\u1F453", + "/eyes": "\u1F440", + "/ezh": "\u0292", + "/ezhcaron": "\u01EF", + "/ezhcurl": "\u0293", + "/ezhreversed": "\u01B9", + "/ezhtail": "\u01BA", + "/f": "\u0066", + "/f_f": "\uFB00", + "/f_f_i": "\uFB03", + "/f_f_l": "\uFB04", + "/faceMassage": "\u1F486", + "/faceSavouringDeliciousFood": "\u1F60B", + "/faceScreamingInFear": "\u1F631", + "/faceThrowingAKiss": "\u1F618", + "/faceWithColdSweat": "\u1F613", + "/faceWithLookOfTriumph": "\u1F624", + "/faceWithMedicalMask": "\u1F637", + "/faceWithNoGoodGesture": "\u1F645", + "/faceWithOkGesture": "\u1F646", + "/faceWithOpenMouth": "\u1F62E", + "/faceWithOpenMouthAndColdSweat": "\u1F630", + "/faceWithRollingEyes": "\u1F644", + "/faceWithStuckOutTongue": "\u1F61B", + "/faceWithStuckOutTongueAndTightlyClosedEyes": "\u1F61D", + "/faceWithStuckOutTongueAndWinkingEye": "\u1F61C", + "/faceWithTearsOfJoy": "\u1F602", + "/faceWithoutMouth": "\u1F636", + "/facsimile": "\u213B", + "/factory": "\u1F3ED", + "/fadeva": "\u095E", + "/fagurmukhi": "\u0A5E", + "/fahrenheit": "\u2109", + "/fallenLeaf": "\u1F342", + "/fallingdiagonal": "\u27CD", + "/fallingdiagonalincircleinsquareblackwhite": "\u26DE", + "/family": "\u1F46A", + "/farsi": "\u262B", + "/farsiYehDigitFourBelow": "\u0777", + "/farsiYehDigitThreeAbove": "\u0776", + "/farsiYehDigitTwoAbove": "\u0775", + "/fatha": "\u064E", + "/fathaIsol": "\uFE76", + "/fathaMedi": "\uFE77", + "/fathaarabic": "\u064E", + "/fathalowarabic": "\u064E", + "/fathasmall": "\u0618", + "/fathatan": "\u064B", + "/fathatanIsol": "\uFE70", + "/fathatanarabic": "\u064B", + "/fathatwodotsdots": "\u065E", + "/fatherChristmas": "\u1F385", + "/faxIcon": "\u1F5B7", + "/faxMachine": "\u1F4E0", + "/fbopomofo": "\u3108", + "/fcircle": "\u24D5", + "/fdot": "\u1E1F", + "/fdotaccent": "\u1E1F", + "/fearfulFace": "\u1F628", + "/februarytelegraph": "\u32C1", + "/feh.fina": "\uFED2", + "/feh.init": "\uFED3", + "/feh.init_alefmaksura.fina": "\uFC31", + "/feh.init_hah.fina": "\uFC2E", + "/feh.init_hah.medi": "\uFCBF", + "/feh.init_jeem.fina": "\uFC2D", + "/feh.init_jeem.medi": "\uFCBE", + "/feh.init_khah.fina": "\uFC2F", + "/feh.init_khah.medi": "\uFCC0", + "/feh.init_khah.medi_meem.medi": "\uFD7D", + "/feh.init_meem.fina": "\uFC30", + "/feh.init_meem.medi": "\uFCC1", + "/feh.init_yeh.fina": "\uFC32", + "/feh.isol": "\uFED1", + "/feh.medi": "\uFED4", + "/feh.medi_alefmaksura.fina": "\uFC7C", + "/feh.medi_khah.medi_meem.fina": "\uFD7C", + "/feh.medi_meem.medi_yeh.fina": "\uFDC1", + "/feh.medi_yeh.fina": "\uFC7D", + "/fehThreeDotsUpBelow": "\u0761", + "/fehTwoDotsBelow": "\u0760", + "/feharabic": "\u0641", + "/feharmenian": "\u0586", + "/fehdotbelow": "\u06A3", + "/fehdotbelowright": "\u06A2", + "/fehfinalarabic": "\uFED2", + "/fehinitialarabic": "\uFED3", + "/fehmedialarabic": "\uFED4", + "/fehthreedotsbelow": "\u06A5", + "/feicoptic": "\u03E5", + "/female": "\u2640", + "/femaleideographiccircled": "\u329B", + "/feng": "\u02A9", + "/ferrisWheel": "\u1F3A1", + "/ferry": "\u26F4", + "/festivalideographicparen": "\u3240", + "/ff": "\uFB00", + "/ffi": "\uFB03", + "/ffl": "\uFB04", + "/fhook": "\u0192", + "/fi": "\uFB01", # ligature "fi" + "/fieldHockeyStickAndBall": "\u1F3D1", + "/fifteencircle": "\u246E", + "/fifteencircleblack": "\u24EF", + "/fifteenparen": "\u2482", + "/fifteenparenthesized": "\u2482", + "/fifteenperiod": "\u2496", + "/fifty.roman": "\u216C", + "/fifty.romansmall": "\u217C", + "/fiftycircle": "\u32BF", + "/fiftycirclesquare": "\u324C", + "/fiftyearlyform.roman": "\u2186", + "/fiftythousand.roman": "\u2187", + "/figuredash": "\u2012", + "/figurespace": "\u2007", + "/fileCabinet": "\u1F5C4", + "/fileFolder": "\u1F4C1", + "/filledbox": "\u25A0", + "/filledrect": "\u25AC", + "/filledstopabove": "\u06EC", + "/filmFrames": "\u1F39E", + "/filmProjector": "\u1F4FD", + "/finalkaf": "\u05DA", + "/finalkaf:hb": "\u05DA", + "/finalkafdagesh": "\uFB3A", + "/finalkafdageshhebrew": "\uFB3A", + "/finalkafhebrew": "\u05DA", + "/finalkafqamats": "\u05DA", + "/finalkafqamatshebrew": "\u05DA", + "/finalkafsheva": "\u05DA", + "/finalkafshevahebrew": "\u05DA", + "/finalkafwithdagesh:hb": "\uFB3A", + "/finalmem": "\u05DD", + "/finalmem:hb": "\u05DD", + "/finalmemhebrew": "\u05DD", + "/finalmemwide:hb": "\uFB26", + "/finalnun": "\u05DF", + "/finalnun:hb": "\u05DF", + "/finalnunhebrew": "\u05DF", + "/finalpe": "\u05E3", + "/finalpe:hb": "\u05E3", + "/finalpehebrew": "\u05E3", + "/finalpewithdagesh:hb": "\uFB43", + "/finalsigma": "\u03C2", + "/finaltsadi": "\u05E5", + "/finaltsadi:hb": "\u05E5", + "/finaltsadihebrew": "\u05E5", + "/financialideographiccircled": "\u3296", + "/financialideographicparen": "\u3236", + "/finsular": "\uA77C", + "/fire": "\u1F525", + "/fireEngine": "\u1F692", + "/fireideographiccircled": "\u328B", + "/fireideographicparen": "\u322B", + "/fireworkSparkler": "\u1F387", + "/fireworks": "\u1F386", + "/firstQuarterMoon": "\u1F313", + "/firstQuarterMoonFace": "\u1F31B", + "/firstquartermoon": "\u263D", + "/firststrongisolate": "\u2068", + "/firsttonechinese": "\u02C9", + "/fish": "\u1F41F", + "/fishCakeSwirlDesign": "\u1F365", + "/fisheye": "\u25C9", + "/fishingPoleAndFish": "\u1F3A3", + "/fistedHandSign": "\u1F44A", + "/fitacyr": "\u0473", + "/fitacyrillic": "\u0473", + "/five": "\u0035", + "/five.inferior": "\u2085", + "/five.roman": "\u2164", + "/five.romansmall": "\u2174", + "/five.superior": "\u2075", + "/fivearabic": "\u0665", + "/fivebengali": "\u09EB", + "/fivecircle": "\u2464", + "/fivecircledbl": "\u24F9", + "/fivecircleinversesansserif": "\u278E", + "/fivecomma": "\u1F106", + "/fivedeva": "\u096B", + "/fivedot": "\u2E2D", + "/fivedotpunctuation": "\u2059", + "/fiveeighths": "\u215D", + "/fivefar": "\u06F5", + "/fivegujarati": "\u0AEB", + "/fivegurmukhi": "\u0A6B", + "/fivehackarabic": "\u0665", + "/fivehangzhou": "\u3025", + "/fivehundred.roman": "\u216E", + "/fivehundred.romansmall": "\u217E", + "/fiveideographiccircled": "\u3284", + "/fiveideographicparen": "\u3224", + "/fiveinferior": "\u2085", + "/fivemonospace": "\uFF15", + "/fiveoldstyle": "\uF735", + "/fiveparen": "\u2478", + "/fiveparenthesized": "\u2478", + "/fiveperiod": "\u248C", + "/fivepersian": "\u06F5", + "/fivepointedstar": "\u066D", + "/fivepointonesquare": "\u1F1A0", + "/fiveroman": "\u2174", + "/fivesixths": "\u215A", + "/fivesuperior": "\u2075", + "/fivethai": "\u0E55", + "/fivethousand.roman": "\u2181", + "/fl": "\uFB02", + "/flagblack": "\u2691", + "/flaghorizontalmiddlestripeblackwhite": "\u26FF", + "/flaginhole": "\u26F3", + "/flagwhite": "\u2690", + "/flatness": "\u23E5", + "/fleurdelis": "\u269C", + "/flexedBiceps": "\u1F4AA", + "/floorleft": "\u230A", + "/floorright": "\u230B", + "/floppyDisk": "\u1F4BE", + "/floralheartbulletreversedrotated": "\u2619", + "/florin": "\u0192", + "/flower": "\u2698", + "/flowerPlayingCards": "\u1F3B4", + "/flowerpunctuationmark": "\u2055", + "/flushedFace": "\u1F633", + "/flyingEnvelope": "\u1F585", + "/flyingSaucer": "\u1F6F8", + "/fmfullwidth": "\u3399", + "/fmonospace": "\uFF46", + "/fmsquare": "\u3399", + "/fofanthai": "\u0E1F", + "/fofathai": "\u0E1D", + "/fog": "\u1F32B", + "/foggy": "\u1F301", + "/folder": "\u1F5C0", + "/fongmanthai": "\u0E4F", + "/footnote": "\u0602", + "/footprints": "\u1F463", + "/footsquare": "\u23CD", + "/forall": "\u2200", + "/forces": "\u22A9", + "/fork": "\u2442", + "/forkKnife": "\u1F374", + "/forkKnifePlate": "\u1F37D", + "/forsamaritan": "\u214F", + "/fortycircle": "\u32B5", + "/fortycirclesquare": "\u324B", + "/fortyeightcircle": "\u32BD", + "/fortyfivecircle": "\u32BA", + "/fortyfourcircle": "\u32B9", + "/fortyninecircle": "\u32BE", + "/fortyonecircle": "\u32B6", + "/fortysevencircle": "\u32BC", + "/fortysixcircle": "\u32BB", + "/fortythreecircle": "\u32B8", + "/fortytwocircle": "\u32B7", + "/fountain": "\u26F2", + "/four": "\u0034", + "/four.inferior": "\u2084", + "/four.roman": "\u2163", + "/four.romansmall": "\u2173", + "/four.superior": "\u2074", + "/fourLeafClover": "\u1F340", + "/fourarabic": "\u0664", + "/fourbengali": "\u09EA", + "/fourcircle": "\u2463", + "/fourcircledbl": "\u24F8", + "/fourcircleinversesansserif": "\u278D", + "/fourcomma": "\u1F105", + "/fourdeva": "\u096A", + "/fourdotmark": "\u205B", + "/fourdotpunctuation": "\u2058", + "/fourfar": "\u06F4", + "/fourfifths": "\u2158", + "/fourgujarati": "\u0AEA", + "/fourgurmukhi": "\u0A6A", + "/fourhackarabic": "\u0664", + "/fourhangzhou": "\u3024", + "/fourideographiccircled": "\u3283", + "/fourideographicparen": "\u3223", + "/fourinferior": "\u2084", + "/fourksquare": "\u1F19E", + "/fourmonospace": "\uFF14", + "/fournumeratorbengali": "\u09F7", + "/fouroldstyle": "\uF734", + "/fourparen": "\u2477", + "/fourparenthesized": "\u2477", + "/fourperemspace": "\u2005", + "/fourperiod": "\u248B", + "/fourpersian": "\u06F4", + "/fourroman": "\u2173", + "/foursuperior": "\u2074", + "/fourteencircle": "\u246D", + "/fourteencircleblack": "\u24EE", + "/fourteenparen": "\u2481", + "/fourteenparenthesized": "\u2481", + "/fourteenperiod": "\u2495", + "/fourthai": "\u0E54", + "/fourthtonechinese": "\u02CB", + "/fparen": "\u24A1", + "/fparenthesized": "\u24A1", + "/fraction": "\u2044", + "/frameAnX": "\u1F5BE", + "/framePicture": "\u1F5BC", + "/frameTiles": "\u1F5BD", + "/franc": "\u20A3", + "/freesquare": "\u1F193", + "/frenchFries": "\u1F35F", + "/freversedepigraphic": "\uA7FB", + "/friedShrimp": "\u1F364", + "/frogFace": "\u1F438", + "/front-facingBabyChick": "\u1F425", + "/frown": "\u2322", + "/frowningFaceWithOpenMouth": "\u1F626", + "/frowningfacewhite": "\u2639", + "/fstroke": "\uA799", + "/fturned": "\u214E", + "/fuelpump": "\u26FD", + "/fullBlock": "\u2588", + "/fullMoon": "\u1F315", + "/fullMoonFace": "\u1F31D", + "/functionapplication": "\u2061", + "/funeralurn": "\u26B1", + "/fuse": "\u23DB", + "/fwd:A": "\uFF21", + "/fwd:B": "\uFF22", + "/fwd:C": "\uFF23", + "/fwd:D": "\uFF24", + "/fwd:E": "\uFF25", + "/fwd:F": "\uFF26", + "/fwd:G": "\uFF27", + "/fwd:H": "\uFF28", + "/fwd:I": "\uFF29", + "/fwd:J": "\uFF2A", + "/fwd:K": "\uFF2B", + "/fwd:L": "\uFF2C", + "/fwd:M": "\uFF2D", + "/fwd:N": "\uFF2E", + "/fwd:O": "\uFF2F", + "/fwd:P": "\uFF30", + "/fwd:Q": "\uFF31", + "/fwd:R": "\uFF32", + "/fwd:S": "\uFF33", + "/fwd:T": "\uFF34", + "/fwd:U": "\uFF35", + "/fwd:V": "\uFF36", + "/fwd:W": "\uFF37", + "/fwd:X": "\uFF38", + "/fwd:Y": "\uFF39", + "/fwd:Z": "\uFF3A", + "/fwd:a": "\uFF41", + "/fwd:ampersand": "\uFF06", + "/fwd:asciicircum": "\uFF3E", + "/fwd:asciitilde": "\uFF5E", + "/fwd:asterisk": "\uFF0A", + "/fwd:at": "\uFF20", + "/fwd:b": "\uFF42", + "/fwd:backslash": "\uFF3C", + "/fwd:bar": "\uFF5C", + "/fwd:braceleft": "\uFF5B", + "/fwd:braceright": "\uFF5D", + "/fwd:bracketleft": "\uFF3B", + "/fwd:bracketright": "\uFF3D", + "/fwd:brokenbar": "\uFFE4", + "/fwd:c": "\uFF43", + "/fwd:centsign": "\uFFE0", + "/fwd:colon": "\uFF1A", + "/fwd:comma": "\uFF0C", + "/fwd:d": "\uFF44", + "/fwd:dollar": "\uFF04", + "/fwd:e": "\uFF45", + "/fwd:eight": "\uFF18", + "/fwd:equal": "\uFF1D", + "/fwd:exclam": "\uFF01", + "/fwd:f": "\uFF46", + "/fwd:five": "\uFF15", + "/fwd:four": "\uFF14", + "/fwd:g": "\uFF47", + "/fwd:grave": "\uFF40", + "/fwd:greater": "\uFF1E", + "/fwd:h": "\uFF48", + "/fwd:hyphen": "\uFF0D", + "/fwd:i": "\uFF49", + "/fwd:j": "\uFF4A", + "/fwd:k": "\uFF4B", + "/fwd:l": "\uFF4C", + "/fwd:leftwhiteparenthesis": "\uFF5F", + "/fwd:less": "\uFF1C", + "/fwd:m": "\uFF4D", + "/fwd:macron": "\uFFE3", + "/fwd:n": "\uFF4E", + "/fwd:nine": "\uFF19", + "/fwd:notsign": "\uFFE2", + "/fwd:numbersign": "\uFF03", + "/fwd:o": "\uFF4F", + "/fwd:one": "\uFF11", + "/fwd:p": "\uFF50", + "/fwd:parenthesisleft": "\uFF08", + "/fwd:parenthesisright": "\uFF09", + "/fwd:percent": "\uFF05", + "/fwd:period": "\uFF0E", + "/fwd:plus": "\uFF0B", + "/fwd:poundsign": "\uFFE1", + "/fwd:q": "\uFF51", + "/fwd:question": "\uFF1F", + "/fwd:quotedbl": "\uFF02", + "/fwd:quotesingle": "\uFF07", + "/fwd:r": "\uFF52", + "/fwd:rightwhiteparenthesis": "\uFF60", + "/fwd:s": "\uFF53", + "/fwd:semicolon": "\uFF1B", + "/fwd:seven": "\uFF17", + "/fwd:six": "\uFF16", + "/fwd:slash": "\uFF0F", + "/fwd:t": "\uFF54", + "/fwd:three": "\uFF13", + "/fwd:two": "\uFF12", + "/fwd:u": "\uFF55", + "/fwd:underscore": "\uFF3F", + "/fwd:v": "\uFF56", + "/fwd:w": "\uFF57", + "/fwd:wonsign": "\uFFE6", + "/fwd:x": "\uFF58", + "/fwd:y": "\uFF59", + "/fwd:yensign": "\uFFE5", + "/fwd:z": "\uFF5A", + "/fwd:zero": "\uFF10", + "/g": "\u0067", + "/gabengali": "\u0997", + "/gacute": "\u01F5", + "/gadeva": "\u0917", + "/gaf": "\u06AF", + "/gaf.fina": "\uFB93", + "/gaf.init": "\uFB94", + "/gaf.isol": "\uFB92", + "/gaf.medi": "\uFB95", + "/gafarabic": "\u06AF", + "/gaffinalarabic": "\uFB93", + "/gafinitialarabic": "\uFB94", + "/gafmedialarabic": "\uFB95", + "/gafring": "\u06B0", + "/gafthreedotsabove": "\u06B4", + "/gaftwodotsbelow": "\u06B2", + "/gagujarati": "\u0A97", + "/gagurmukhi": "\u0A17", + "/gahiragana": "\u304C", + "/gakatakana": "\u30AC", + "/galsquare": "\u33FF", + "/gameDie": "\u1F3B2", + "/gamma": "\u03B3", + "/gammadblstruck": "\u213D", + "/gammalatinsmall": "\u0263", + "/gammasuperior": "\u02E0", + "/gammasupmod": "\u02E0", + "/gamurda": "\uA993", + "/gangiacoptic": "\u03EB", + "/ganmasquare": "\u330F", + "/garonsquare": "\u330E", + "/gbfullwidth": "\u3387", + "/gbopomofo": "\u310D", + "/gbreve": "\u011F", + "/gcaron": "\u01E7", + "/gcedilla": "\u0123", + "/gcircle": "\u24D6", + "/gcircumflex": "\u011D", + "/gcommaaccent": "\u0123", + "/gdot": "\u0121", + "/gdotaccent": "\u0121", + "/gear": "\u2699", + "/gearhles": "\u26EE", + "/gearouthub": "\u26ED", + "/gecyr": "\u0433", + "/gecyrillic": "\u0433", + "/gehiragana": "\u3052", + "/gehookcyr": "\u0495", + "/gehookstrokecyr": "\u04FB", + "/gekatakana": "\u30B2", + "/gemStone": "\u1F48E", + "/gemini": "\u264A", + "/geometricallyequal": "\u2251", + "/geometricallyequivalent": "\u224E", + "/geometricproportion": "\u223A", + "/geresh:hb": "\u05F3", + "/gereshMuqdam:hb": "\u059D", + "/gereshaccenthebrew": "\u059C", + "/gereshhebrew": "\u05F3", + "/gereshmuqdamhebrew": "\u059D", + "/germandbls": "\u00DF", + "/germanpenny": "\u20B0", + "/gershayim:hb": "\u05F4", + "/gershayimaccenthebrew": "\u059E", + "/gershayimhebrew": "\u05F4", + "/gestrokecyr": "\u0493", + "/getailcyr": "\u04F7", + "/getamark": "\u3013", + "/geupcyr": "\u0491", + "/ghabengali": "\u0998", + "/ghadarmenian": "\u0572", + "/ghadeva": "\u0918", + "/ghagujarati": "\u0A98", + "/ghagurmukhi": "\u0A18", + "/ghain": "\u063A", + "/ghain.fina": "\uFECE", + "/ghain.init": "\uFECF", + "/ghain.init_alefmaksura.fina": "\uFCF9", + "/ghain.init_jeem.fina": "\uFC2B", + "/ghain.init_jeem.medi": "\uFCBC", + "/ghain.init_meem.fina": "\uFC2C", + "/ghain.init_meem.medi": "\uFCBD", + "/ghain.init_yeh.fina": "\uFCFA", + "/ghain.isol": "\uFECD", + "/ghain.medi": "\uFED0", + "/ghain.medi_alefmaksura.fina": "\uFD15", + "/ghain.medi_meem.medi_alefmaksura.fina": "\uFD7B", + "/ghain.medi_meem.medi_meem.fina": "\uFD79", + "/ghain.medi_meem.medi_yeh.fina": "\uFD7A", + "/ghain.medi_yeh.fina": "\uFD16", + "/ghainarabic": "\u063A", + "/ghaindotbelow": "\u06FC", + "/ghainfinalarabic": "\uFECE", + "/ghaininitialarabic": "\uFECF", + "/ghainmedialarabic": "\uFED0", + "/ghemiddlehookcyrillic": "\u0495", + "/ghestrokecyrillic": "\u0493", + "/gheupturncyrillic": "\u0491", + "/ghhadeva": "\u095A", + "/ghhagurmukhi": "\u0A5A", + "/ghook": "\u0260", + "/ghost": "\u1F47B", + "/ghzfullwidth": "\u3393", + "/ghzsquare": "\u3393", + "/gigasquare": "\u3310", + "/gihiragana": "\u304E", + "/gikatakana": "\u30AE", + "/gimarmenian": "\u0563", + "/gimel": "\u05D2", + "/gimel:hb": "\u05D2", + "/gimeldagesh": "\uFB32", + "/gimeldageshhebrew": "\uFB32", + "/gimelhebrew": "\u05D2", + "/gimelwithdagesh:hb": "\uFB32", + "/giniisquare": "\u3311", + "/ginsularturned": "\uA77F", + "/girl": "\u1F467", + "/girls": "\u1F6CA", + "/girudaasquare": "\u3313", + "/gjecyr": "\u0453", + "/gjecyrillic": "\u0453", + "/globeMeridians": "\u1F310", + "/glottalinvertedstroke": "\u01BE", + "/glottalstop": "\u0294", + "/glottalstopinverted": "\u0296", + "/glottalstopmod": "\u02C0", + "/glottalstopreversed": "\u0295", + "/glottalstopreversedmod": "\u02C1", + "/glottalstopreversedsuperior": "\u02E4", + "/glottalstopstroke": "\u02A1", + "/glottalstopstrokereversed": "\u02A2", + "/glottalstopsupreversedmod": "\u02E4", + "/glowingStar": "\u1F31F", + "/gmacron": "\u1E21", + "/gmonospace": "\uFF47", + "/gmtr:diamondblack": "\u25C6", + "/gmtr:diamondwhite": "\u25C7", + "/gnrl:hyphen": "\u2010", + "/goat": "\u1F410", + "/gobliquestroke": "\uA7A1", + "/gohiragana": "\u3054", + "/gokatakana": "\u30B4", + "/golfer": "\u1F3CC", + "/gpafullwidth": "\u33AC", + "/gparen": "\u24A2", + "/gparenthesized": "\u24A2", + "/gpasquare": "\u33AC", + "/gr:acute": "\u1FFD", + "/gr:grave": "\u1FEF", + "/gr:question": "\u037E", + "/gr:tilde": "\u1FC0", + "/gradient": "\u2207", + "/graduationCap": "\u1F393", + "/grapes": "\u1F347", + "/grave": "\u0060", + "/gravebelowcmb": "\u0316", + "/gravecmb": "\u0300", + "/gravecomb": "\u0300", + "/gravedblmiddlemod": "\u02F5", + "/gravedeva": "\u0953", + "/gravelowmod": "\u02CE", + "/gravemiddlemod": "\u02F4", + "/gravemod": "\u02CB", + "/gravemonospace": "\uFF40", + "/gravetonecmb": "\u0340", + "/greater": "\u003E", + "/greaterbutnotequal": "\u2269", + "/greaterbutnotequivalent": "\u22E7", + "/greaterdot": "\u22D7", + "/greaterequal": "\u2265", + "/greaterequalorless": "\u22DB", + "/greatermonospace": "\uFF1E", + "/greaterorequivalent": "\u2273", + "/greaterorless": "\u2277", + "/greateroverequal": "\u2267", + "/greatersmall": "\uFE65", + "/greenApple": "\u1F34F", + "/greenBook": "\u1F4D7", + "/greenHeart": "\u1F49A", + "/grimacingFace": "\u1F62C", + "/grinningCatFaceWithSmilingEyes": "\u1F638", + "/grinningFace": "\u1F600", + "/grinningFaceWithSmilingEyes": "\u1F601", + "/growingHeart": "\u1F497", + "/gscript": "\u0261", + "/gstroke": "\u01E5", + "/guarani": "\u20B2", + "/guardsman": "\u1F482", + "/gueh": "\u06B3", + "/gueh.fina": "\uFB97", + "/gueh.init": "\uFB98", + "/gueh.isol": "\uFB96", + "/gueh.medi": "\uFB99", + "/guhiragana": "\u3050", + "/guillemetleft": "\u00AB", + "/guillemetright": "\u00BB", + "/guillemotleft": "\u00AB", + "/guillemotright": "\u00BB", + "/guilsinglleft": "\u2039", + "/guilsinglright": "\u203A", + "/guitar": "\u1F3B8", + "/gujr:a": "\u0A85", + "/gujr:aa": "\u0A86", + "/gujr:aasign": "\u0ABE", + "/gujr:abbreviation": "\u0AF0", + "/gujr:ai": "\u0A90", + "/gujr:aisign": "\u0AC8", + "/gujr:anusvara": "\u0A82", + "/gujr:au": "\u0A94", + "/gujr:ausign": "\u0ACC", + "/gujr:avagraha": "\u0ABD", + "/gujr:ba": "\u0AAC", + "/gujr:bha": "\u0AAD", + "/gujr:binducandra": "\u0A81", + "/gujr:ca": "\u0A9A", + "/gujr:cha": "\u0A9B", + "/gujr:circlenuktaabove": "\u0AFE", + "/gujr:da": "\u0AA6", + "/gujr:dda": "\u0AA1", + "/gujr:ddha": "\u0AA2", + "/gujr:dha": "\u0AA7", + "/gujr:e": "\u0A8F", + "/gujr:ecandra": "\u0A8D", + "/gujr:eight": "\u0AEE", + "/gujr:esign": "\u0AC7", + "/gujr:esigncandra": "\u0AC5", + "/gujr:five": "\u0AEB", + "/gujr:four": "\u0AEA", + "/gujr:ga": "\u0A97", + "/gujr:gha": "\u0A98", + "/gujr:ha": "\u0AB9", + "/gujr:i": "\u0A87", + "/gujr:ii": "\u0A88", + "/gujr:iisign": "\u0AC0", + "/gujr:isign": "\u0ABF", + "/gujr:ja": "\u0A9C", + "/gujr:jha": "\u0A9D", + "/gujr:ka": "\u0A95", + "/gujr:kha": "\u0A96", + "/gujr:la": "\u0AB2", + "/gujr:lla": "\u0AB3", + "/gujr:llvocal": "\u0AE1", + "/gujr:llvocalsign": "\u0AE3", + "/gujr:lvocal": "\u0A8C", + "/gujr:lvocalsign": "\u0AE2", + "/gujr:ma": "\u0AAE", + "/gujr:maddah": "\u0AFC", + "/gujr:na": "\u0AA8", + "/gujr:nga": "\u0A99", + "/gujr:nine": "\u0AEF", + "/gujr:nna": "\u0AA3", + "/gujr:nukta": "\u0ABC", + "/gujr:nya": "\u0A9E", + "/gujr:o": "\u0A93", + "/gujr:ocandra": "\u0A91", + "/gujr:om": "\u0AD0", + "/gujr:one": "\u0AE7", + "/gujr:osign": "\u0ACB", + "/gujr:osigncandra": "\u0AC9", + "/gujr:pa": "\u0AAA", + "/gujr:pha": "\u0AAB", + "/gujr:ra": "\u0AB0", + "/gujr:rrvocal": "\u0AE0", + "/gujr:rrvocalsign": "\u0AC4", + "/gujr:rupee": "\u0AF1", + "/gujr:rvocal": "\u0A8B", + "/gujr:rvocalsign": "\u0AC3", + "/gujr:sa": "\u0AB8", + "/gujr:seven": "\u0AED", + "/gujr:sha": "\u0AB6", + "/gujr:shadda": "\u0AFB", + "/gujr:six": "\u0AEC", + "/gujr:ssa": "\u0AB7", + "/gujr:sukun": "\u0AFA", + "/gujr:ta": "\u0AA4", + "/gujr:tha": "\u0AA5", + "/gujr:three": "\u0AE9", + "/gujr:three-dotnuktaabove": "\u0AFD", + "/gujr:tta": "\u0A9F", + "/gujr:ttha": "\u0AA0", + "/gujr:two": "\u0AE8", + "/gujr:two-circlenuktaabove": "\u0AFF", + "/gujr:u": "\u0A89", + "/gujr:usign": "\u0AC1", + "/gujr:uu": "\u0A8A", + "/gujr:uusign": "\u0AC2", + "/gujr:va": "\u0AB5", + "/gujr:virama": "\u0ACD", + "/gujr:visarga": "\u0A83", + "/gujr:ya": "\u0AAF", + "/gujr:zero": "\u0AE6", + "/gujr:zha": "\u0AF9", + "/gukatakana": "\u30B0", + "/guramusquare": "\u3318", + "/guramutonsquare": "\u3319", + "/guru:a": "\u0A05", + "/guru:aa": "\u0A06", + "/guru:aasign": "\u0A3E", + "/guru:adakbindisign": "\u0A01", + "/guru:addak": "\u0A71", + "/guru:ai": "\u0A10", + "/guru:aisign": "\u0A48", + "/guru:au": "\u0A14", + "/guru:ausign": "\u0A4C", + "/guru:ba": "\u0A2C", + "/guru:bha": "\u0A2D", + "/guru:bindisign": "\u0A02", + "/guru:ca": "\u0A1A", + "/guru:cha": "\u0A1B", + "/guru:da": "\u0A26", + "/guru:dda": "\u0A21", + "/guru:ddha": "\u0A22", + "/guru:dha": "\u0A27", + "/guru:ee": "\u0A0F", + "/guru:eesign": "\u0A47", + "/guru:eight": "\u0A6E", + "/guru:ekonkar": "\u0A74", + "/guru:fa": "\u0A5E", + "/guru:five": "\u0A6B", + "/guru:four": "\u0A6A", + "/guru:ga": "\u0A17", + "/guru:gha": "\u0A18", + "/guru:ghha": "\u0A5A", + "/guru:ha": "\u0A39", + "/guru:i": "\u0A07", + "/guru:ii": "\u0A08", + "/guru:iisign": "\u0A40", + "/guru:iri": "\u0A72", + "/guru:isign": "\u0A3F", + "/guru:ja": "\u0A1C", + "/guru:jha": "\u0A1D", + "/guru:ka": "\u0A15", + "/guru:kha": "\u0A16", + "/guru:khha": "\u0A59", + "/guru:la": "\u0A32", + "/guru:lla": "\u0A33", + "/guru:ma": "\u0A2E", + "/guru:na": "\u0A28", + "/guru:nga": "\u0A19", + "/guru:nine": "\u0A6F", + "/guru:nna": "\u0A23", + "/guru:nukta": "\u0A3C", + "/guru:nya": "\u0A1E", + "/guru:one": "\u0A67", + "/guru:oo": "\u0A13", + "/guru:oosign": "\u0A4B", + "/guru:pa": "\u0A2A", + "/guru:pha": "\u0A2B", + "/guru:ra": "\u0A30", + "/guru:rra": "\u0A5C", + "/guru:sa": "\u0A38", + "/guru:seven": "\u0A6D", + "/guru:sha": "\u0A36", + "/guru:six": "\u0A6C", + "/guru:ta": "\u0A24", + "/guru:tha": "\u0A25", + "/guru:three": "\u0A69", + "/guru:tippi": "\u0A70", + "/guru:tta": "\u0A1F", + "/guru:ttha": "\u0A20", + "/guru:two": "\u0A68", + "/guru:u": "\u0A09", + "/guru:udaatsign": "\u0A51", + "/guru:ura": "\u0A73", + "/guru:usign": "\u0A41", + "/guru:uu": "\u0A0A", + "/guru:uusign": "\u0A42", + "/guru:va": "\u0A35", + "/guru:virama": "\u0A4D", + "/guru:visarga": "\u0A03", + "/guru:ya": "\u0A2F", + "/guru:yakashsign": "\u0A75", + "/guru:za": "\u0A5B", + "/guru:zero": "\u0A66", + "/gyfullwidth": "\u33C9", + "/gysquare": "\u33C9", + "/h": "\u0068", + "/h.inferior": "\u2095", + "/haabkhasiancyrillic": "\u04A9", + "/haabkhcyr": "\u04A9", + "/haaltonearabic": "\u06C1", + "/habengali": "\u09B9", + "/hacirclekatakana": "\u32E9", + "/hacyr": "\u0445", + "/hadescendercyrillic": "\u04B3", + "/hadeva": "\u0939", + "/hafullwidth": "\u33CA", + "/hagujarati": "\u0AB9", + "/hagurmukhi": "\u0A39", + "/hah": "\u062D", + "/hah.fina": "\uFEA2", + "/hah.init": "\uFEA3", + "/hah.init_alefmaksura.fina": "\uFCFF", + "/hah.init_jeem.fina": "\uFC17", + "/hah.init_jeem.medi": "\uFCA9", + "/hah.init_meem.fina": "\uFC18", + "/hah.init_meem.medi": "\uFCAA", + "/hah.init_yeh.fina": "\uFD00", + "/hah.isol": "\uFEA1", + "/hah.medi": "\uFEA4", + "/hah.medi_alefmaksura.fina": "\uFD1B", + "/hah.medi_jeem.medi_yeh.fina": "\uFDBF", + "/hah.medi_meem.medi_alefmaksura.fina": "\uFD5B", + "/hah.medi_meem.medi_yeh.fina": "\uFD5A", + "/hah.medi_yeh.fina": "\uFD1C", + "/hahDigitFourBelow": "\u077C", + "/hahSmallTahAbove": "\u0772", + "/hahSmallTahBelow": "\u076E", + "/hahSmallTahTwoDots": "\u076F", + "/hahThreeDotsUpBelow": "\u0758", + "/hahTwoDotsAbove": "\u0757", + "/haharabic": "\u062D", + "/hahfinalarabic": "\uFEA2", + "/hahhamza": "\u0681", + "/hahinitialarabic": "\uFEA3", + "/hahiragana": "\u306F", + "/hahmedialarabic": "\uFEA4", + "/hahookcyr": "\u04FD", + "/hahthreedotsabove": "\u0685", + "/hahtwodotsvertical": "\u0682", + "/haircut": "\u1F487", + "/hairspace": "\u200A", + "/haitusquare": "\u332A", + "/hakatakana": "\u30CF", + "/hakatakanahalfwidth": "\uFF8A", + "/halantgurmukhi": "\u0A4D", + "/halfcircleleftblack": "\u25D6", + "/halfcirclerightblack": "\u25D7", + "/hamburger": "\u1F354", + "/hammer": "\u1F528", + "/hammerAndWrench": "\u1F6E0", + "/hammerpick": "\u2692", + "/hammersickle": "\u262D", + "/hamsterFace": "\u1F439", + "/hamza": "\u0621", + "/hamzaIsol": "\uFE80", + "/hamzaabove": "\u0654", + "/hamzaarabic": "\u0621", + "/hamzabelow": "\u0655", + "/hamzadammaarabic": "\u0621", + "/hamzadammatanarabic": "\u0621", + "/hamzafathaarabic": "\u0621", + "/hamzafathatanarabic": "\u0621", + "/hamzalowarabic": "\u0621", + "/hamzalowkasraarabic": "\u0621", + "/hamzalowkasratanarabic": "\u0621", + "/hamzasukunarabic": "\u0621", + "/handbag": "\u1F45C", + "/handtailfishhookturned": "\u02AF", + "/hangulchieuchaparen": "\u3217", + "/hangulchieuchparen": "\u3209", + "/hangulcieucaparen": "\u3216", + "/hangulcieucparen": "\u3208", + "/hangulcieucuparen": "\u321C", + "/hanguldottonemarkdbl": "\u302F", + "/hangulfiller": "\u3164", + "/hangulhieuhaparen": "\u321B", + "/hangulhieuhparen": "\u320D", + "/hangulieungaparen": "\u3215", + "/hangulieungparen": "\u3207", + "/hangulkhieukhaparen": "\u3218", + "/hangulkhieukhparen": "\u320A", + "/hangulkiyeokaparen": "\u320E", + "/hangulkiyeokparen": "\u3200", + "/hangulmieumaparen": "\u3212", + "/hangulmieumparen": "\u3204", + "/hangulnieunaparen": "\u320F", + "/hangulnieunparen": "\u3201", + "/hangulphieuphaparen": "\u321A", + "/hangulphieuphparen": "\u320C", + "/hangulpieupaparen": "\u3213", + "/hangulpieupparen": "\u3205", + "/hangulrieulaparen": "\u3211", + "/hangulrieulparen": "\u3203", + "/hangulsingledottonemark": "\u302E", + "/hangulsiosaparen": "\u3214", + "/hangulsiosparen": "\u3206", + "/hangulthieuthaparen": "\u3219", + "/hangulthieuthparen": "\u320B", + "/hangultikeutaparen": "\u3210", + "/hangultikeutparen": "\u3202", + "/happyPersonRaisingOneHand": "\u1F64B", + "/hardDisk": "\u1F5B4", + "/hardcyr": "\u044A", + "/hardsigncyrillic": "\u044A", + "/harpoondownbarbleft": "\u21C3", + "/harpoondownbarbright": "\u21C2", + "/harpoonleftbarbdown": "\u21BD", + "/harpoonleftbarbup": "\u21BC", + "/harpoonrightbarbdown": "\u21C1", + "/harpoonrightbarbup": "\u21C0", + "/harpoonupbarbleft": "\u21BF", + "/harpoonupbarbright": "\u21BE", + "/hasquare": "\u33CA", + "/hastrokecyr": "\u04FF", + "/hatafPatah:hb": "\u05B2", + "/hatafQamats:hb": "\u05B3", + "/hatafSegol:hb": "\u05B1", + "/hatafpatah": "\u05B2", + "/hatafpatah16": "\u05B2", + "/hatafpatah23": "\u05B2", + "/hatafpatah2f": "\u05B2", + "/hatafpatahhebrew": "\u05B2", + "/hatafpatahnarrowhebrew": "\u05B2", + "/hatafpatahquarterhebrew": "\u05B2", + "/hatafpatahwidehebrew": "\u05B2", + "/hatafqamats": "\u05B3", + "/hatafqamats1b": "\u05B3", + "/hatafqamats28": "\u05B3", + "/hatafqamats34": "\u05B3", + "/hatafqamatshebrew": "\u05B3", + "/hatafqamatsnarrowhebrew": "\u05B3", + "/hatafqamatsquarterhebrew": "\u05B3", + "/hatafqamatswidehebrew": "\u05B3", + "/hatafsegol": "\u05B1", + "/hatafsegol17": "\u05B1", + "/hatafsegol24": "\u05B1", + "/hatafsegol30": "\u05B1", + "/hatafsegolhebrew": "\u05B1", + "/hatafsegolnarrowhebrew": "\u05B1", + "/hatafsegolquarterhebrew": "\u05B1", + "/hatafsegolwidehebrew": "\u05B1", + "/hatchingChick": "\u1F423", + "/haveideographiccircled": "\u3292", + "/haveideographicparen": "\u3232", + "/hbar": "\u0127", + "/hbopomofo": "\u310F", + "/hbrevebelow": "\u1E2B", + "/hcaron": "\u021F", + "/hcedilla": "\u1E29", + "/hcircle": "\u24D7", + "/hcircumflex": "\u0125", + "/hcsquare": "\u1F1A6", + "/hdescender": "\u2C68", + "/hdieresis": "\u1E27", + "/hdot": "\u1E23", + "/hdotaccent": "\u1E23", + "/hdotbelow": "\u1E25", + "/hdrsquare": "\u1F1A7", + "/he": "\u05D4", + "/he:hb": "\u05D4", + "/headphone": "\u1F3A7", + "/headstonegraveyard": "\u26FC", + "/hearNoEvilMonkey": "\u1F649", + "/heart": "\u2665", + "/heartArrow": "\u1F498", + "/heartDecoration": "\u1F49F", + "/heartRibbon": "\u1F49D", + "/heartTipOnTheLeft": "\u1F394", + "/heartblack": "\u2665", + "/heartsuitblack": "\u2665", + "/heartsuitwhite": "\u2661", + "/heartwhite": "\u2661", + "/heavyDollarSign": "\u1F4B2", + "/heavyLatinCross": "\u1F547", + "/heavydbldashhorz": "\u254D", + "/heavydbldashvert": "\u254F", + "/heavydn": "\u257B", + "/heavydnhorz": "\u2533", + "/heavydnleft": "\u2513", + "/heavydnright": "\u250F", + "/heavyhorz": "\u2501", + "/heavyleft": "\u2578", + "/heavyleftlightright": "\u257E", + "/heavyquaddashhorz": "\u2509", + "/heavyquaddashvert": "\u250B", + "/heavyright": "\u257A", + "/heavytrpldashhorz": "\u2505", + "/heavytrpldashvert": "\u2507", + "/heavyup": "\u2579", + "/heavyuphorz": "\u253B", + "/heavyupleft": "\u251B", + "/heavyuplightdn": "\u257F", + "/heavyupright": "\u2517", + "/heavyvert": "\u2503", + "/heavyverthorz": "\u254B", + "/heavyvertleft": "\u252B", + "/heavyvertright": "\u2523", + "/hecirclekatakana": "\u32EC", + "/hedagesh": "\uFB34", + "/hedageshhebrew": "\uFB34", + "/hedinterlacedpentagramleft": "\u26E6", + "/hedinterlacedpentagramright": "\u26E5", + "/heh": "\u0647", + "/heh.fina": "\uFEEA", + "/heh.init": "\uFEEB", + "/heh.init_alefmaksura.fina": "\uFC53", + "/heh.init_jeem.fina": "\uFC51", + "/heh.init_jeem.medi": "\uFCD7", + "/heh.init_meem.fina": "\uFC52", + "/heh.init_meem.medi": "\uFCD8", + "/heh.init_meem.medi_jeem.medi": "\uFD93", + "/heh.init_meem.medi_meem.medi": "\uFD94", + "/heh.init_superscriptalef.medi": "\uFCD9", + "/heh.init_yeh.fina": "\uFC54", + "/heh.isol": "\uFEE9", + "/heh.medi": "\uFEEC", + "/hehaltonearabic": "\u06C1", + "/heharabic": "\u0647", + "/hehdoachashmee": "\u06BE", + "/hehdoachashmee.fina": "\uFBAB", + "/hehdoachashmee.init": "\uFBAC", + "/hehdoachashmee.isol": "\uFBAA", + "/hehdoachashmee.medi": "\uFBAD", + "/hehebrew": "\u05D4", + "/hehfinalaltonearabic": "\uFBA7", + "/hehfinalalttwoarabic": "\uFEEA", + "/hehfinalarabic": "\uFEEA", + "/hehgoal": "\u06C1", + "/hehgoal.fina": "\uFBA7", + "/hehgoal.init": "\uFBA8", + "/hehgoal.isol": "\uFBA6", + "/hehgoal.medi": "\uFBA9", + "/hehgoalhamza": "\u06C2", + "/hehhamzaabovefinalarabic": "\uFBA5", + "/hehhamzaaboveisolatedarabic": "\uFBA4", + "/hehinitialaltonearabic": "\uFBA8", + "/hehinitialarabic": "\uFEEB", + "/hehinvertedV": "\u06FF", + "/hehiragana": "\u3078", + "/hehmedialaltonearabic": "\uFBA9", + "/hehmedialarabic": "\uFEEC", + "/hehyeh": "\u06C0", + "/hehyeh.fina": "\uFBA5", + "/hehyeh.isol": "\uFBA4", + "/heiseierasquare": "\u337B", + "/hekatakana": "\u30D8", + "/hekatakanahalfwidth": "\uFF8D", + "/hekutaarusquare": "\u3336", + "/helicopter": "\u1F681", + "/helm": "\u2388", + "/helmetcrosswhite": "\u26D1", + "/heng": "\uA727", + "/henghook": "\u0267", + "/herb": "\u1F33F", + "/hermitianconjugatematrix": "\u22B9", + "/herutusquare": "\u3339", + "/het": "\u05D7", + "/het:hb": "\u05D7", + "/heta": "\u0371", + "/hethebrew": "\u05D7", + "/hewide:hb": "\uFB23", + "/hewithmapiq:hb": "\uFB34", + "/hfishhookturned": "\u02AE", + "/hhalf": "\u2C76", + "/hhook": "\u0266", + "/hhooksuperior": "\u02B1", + "/hhooksupmod": "\u02B1", + "/hi-ressquare": "\u1F1A8", + "/hibiscus": "\u1F33A", + "/hicirclekatakana": "\u32EA", + "/hieuhacirclekorean": "\u327B", + "/hieuhaparenkorean": "\u321B", + "/hieuhcirclekorean": "\u326D", + "/hieuhkorean": "\u314E", + "/hieuhparenkorean": "\u320D", + "/high-heeledShoe": "\u1F460", + "/highBrightness": "\u1F506", + "/highSpeedTrain": "\u1F684", + "/highSpeedTrainWithBulletNose": "\u1F685", + "/highhamza": "\u0674", + "/highideographiccircled": "\u32A4", + "/highvoltage": "\u26A1", + "/hihiragana": "\u3072", + "/hikatakana": "\u30D2", + "/hikatakanahalfwidth": "\uFF8B", + "/hira:a": "\u3042", + "/hira:asmall": "\u3041", + "/hira:ba": "\u3070", + "/hira:be": "\u3079", + "/hira:bi": "\u3073", + "/hira:bo": "\u307C", + "/hira:bu": "\u3076", + "/hira:da": "\u3060", + "/hira:de": "\u3067", + "/hira:di": "\u3062", + "/hira:digraphyori": "\u309F", + "/hira:do": "\u3069", + "/hira:du": "\u3065", + "/hira:e": "\u3048", + "/hira:esmall": "\u3047", + "/hira:ga": "\u304C", + "/hira:ge": "\u3052", + "/hira:gi": "\u304E", + "/hira:go": "\u3054", + "/hira:gu": "\u3050", + "/hira:ha": "\u306F", + "/hira:he": "\u3078", + "/hira:hi": "\u3072", + "/hira:ho": "\u307B", + "/hira:hu": "\u3075", + "/hira:i": "\u3044", + "/hira:ismall": "\u3043", + "/hira:iterationhiragana": "\u309D", + "/hira:ka": "\u304B", + "/hira:kasmall": "\u3095", + "/hira:ke": "\u3051", + "/hira:kesmall": "\u3096", + "/hira:ki": "\u304D", + "/hira:ko": "\u3053", + "/hira:ku": "\u304F", + "/hira:ma": "\u307E", + "/hira:me": "\u3081", + "/hira:mi": "\u307F", + "/hira:mo": "\u3082", + "/hira:mu": "\u3080", + "/hira:n": "\u3093", + "/hira:na": "\u306A", + "/hira:ne": "\u306D", + "/hira:ni": "\u306B", + "/hira:no": "\u306E", + "/hira:nu": "\u306C", + "/hira:o": "\u304A", + "/hira:osmall": "\u3049", + "/hira:pa": "\u3071", + "/hira:pe": "\u307A", + "/hira:pi": "\u3074", + "/hira:po": "\u307D", + "/hira:pu": "\u3077", + "/hira:ra": "\u3089", + "/hira:re": "\u308C", + "/hira:ri": "\u308A", + "/hira:ro": "\u308D", + "/hira:ru": "\u308B", + "/hira:sa": "\u3055", + "/hira:se": "\u305B", + "/hira:semivoicedmarkkana": "\u309C", + "/hira:semivoicedmarkkanacmb": "\u309A", + "/hira:si": "\u3057", + "/hira:so": "\u305D", + "/hira:su": "\u3059", + "/hira:ta": "\u305F", + "/hira:te": "\u3066", + "/hira:ti": "\u3061", + "/hira:to": "\u3068", + "/hira:tu": "\u3064", + "/hira:tusmall": "\u3063", + "/hira:u": "\u3046", + "/hira:usmall": "\u3045", + "/hira:voicediterationhiragana": "\u309E", + "/hira:voicedmarkkana": "\u309B", + "/hira:voicedmarkkanacmb": "\u3099", + "/hira:vu": "\u3094", + "/hira:wa": "\u308F", + "/hira:wasmall": "\u308E", + "/hira:we": "\u3091", + "/hira:wi": "\u3090", + "/hira:wo": "\u3092", + "/hira:ya": "\u3084", + "/hira:yasmall": "\u3083", + "/hira:yo": "\u3088", + "/hira:yosmall": "\u3087", + "/hira:yu": "\u3086", + "/hira:yusmall": "\u3085", + "/hira:za": "\u3056", + "/hira:ze": "\u305C", + "/hira:zi": "\u3058", + "/hira:zo": "\u305E", + "/hira:zu": "\u305A", + "/hiriq": "\u05B4", + "/hiriq14": "\u05B4", + "/hiriq21": "\u05B4", + "/hiriq2d": "\u05B4", + "/hiriq:hb": "\u05B4", + "/hiriqhebrew": "\u05B4", + "/hiriqnarrowhebrew": "\u05B4", + "/hiriqquarterhebrew": "\u05B4", + "/hiriqwidehebrew": "\u05B4", + "/historicsite": "\u26EC", + "/hlinebelow": "\u1E96", + "/hmonospace": "\uFF48", + "/hoarmenian": "\u0570", + "/hocho": "\u1F52A", + "/hocirclekatakana": "\u32ED", + "/hohipthai": "\u0E2B", + "/hohiragana": "\u307B", + "/hokatakana": "\u30DB", + "/hokatakanahalfwidth": "\uFF8E", + "/holam": "\u05B9", + "/holam19": "\u05B9", + "/holam26": "\u05B9", + "/holam32": "\u05B9", + "/holam:hb": "\u05B9", + "/holamHaser:hb": "\u05BA", + "/holamhebrew": "\u05B9", + "/holamnarrowhebrew": "\u05B9", + "/holamquarterhebrew": "\u05B9", + "/holamwidehebrew": "\u05B9", + "/hole": "\u1F573", + "/homotic": "\u223B", + "/honeyPot": "\u1F36F", + "/honeybee": "\u1F41D", + "/honokhukthai": "\u0E2E", + "/honsquare": "\u333F", + "/hook": "\u2440", + "/hookabovecomb": "\u0309", + "/hookcmb": "\u0309", + "/hookpalatalizedbelowcmb": "\u0321", + "/hookretroflexbelowcmb": "\u0322", + "/hoonsquare": "\u3342", + "/hoorusquare": "\u3341", + "/horicoptic": "\u03E9", + "/horizontalTrafficLight": "\u1F6A5", + "/horizontalbar": "\u2015", + "/horizontalbarwhitearrowonpedestalup": "\u21EC", + "/horizontalmalestroke": "\u26A9", + "/horncmb": "\u031B", + "/horse": "\u1F40E", + "/horseFace": "\u1F434", + "/horseRacing": "\u1F3C7", + "/hospital": "\u1F3E5", + "/hotDog": "\u1F32D", + "/hotPepper": "\u1F336", + "/hotbeverage": "\u2615", + "/hotel": "\u1F3E8", + "/hotsprings": "\u2668", + "/hourglass": "\u231B", + "/hourglassflowings": "\u23F3", + "/house": "\u2302", + "/houseBuilding": "\u1F3E0", + "/houseBuildings": "\u1F3D8", + "/houseGarden": "\u1F3E1", + "/hpafullwidth": "\u3371", + "/hpalatalhook": "\uA795", + "/hparen": "\u24A3", + "/hparenthesized": "\u24A3", + "/hpfullwidth": "\u33CB", + "/hryvnia": "\u20B4", + "/hsuperior": "\u02B0", + "/hsupmod": "\u02B0", + "/hturned": "\u0265", + "/htypeopencircuit": "\u238F", + "/huaraddosquare": "\u3332", + "/hucirclekatakana": "\u32EB", + "/huhiragana": "\u3075", + "/huiitosquare": "\u3333", + "/hukatakana": "\u30D5", + "/hukatakanahalfwidth": "\uFF8C", + "/hundredPoints": "\u1F4AF", + "/hundredthousandscmbcyr": "\u0488", + "/hungarumlaut": "\u02DD", + "/hungarumlautcmb": "\u030B", + "/huransquare": "\u3335", + "/hushedFace": "\u1F62F", + "/hv": "\u0195", + "/hwd:a": "\uFFC2", + "/hwd:ae": "\uFFC3", + "/hwd:blacksquare": "\uFFED", + "/hwd:chieuch": "\uFFBA", + "/hwd:cieuc": "\uFFB8", + "/hwd:downwardsarrow": "\uFFEC", + "/hwd:e": "\uFFC7", + "/hwd:eo": "\uFFC6", + "/hwd:eu": "\uFFDA", + "/hwd:formslightvertical": "\uFFE8", + "/hwd:hangulfiller": "\uFFA0", + "/hwd:hieuh": "\uFFBE", + "/hwd:i": "\uFFDC", + "/hwd:ideographiccomma": "\uFF64", + "/hwd:ideographicfullstop": "\uFF61", + "/hwd:ieung": "\uFFB7", + "/hwd:kata:a": "\uFF71", + "/hwd:kata:asmall": "\uFF67", + "/hwd:kata:e": "\uFF74", + "/hwd:kata:esmall": "\uFF6A", + "/hwd:kata:ha": "\uFF8A", + "/hwd:kata:he": "\uFF8D", + "/hwd:kata:hi": "\uFF8B", + "/hwd:kata:ho": "\uFF8E", + "/hwd:kata:hu": "\uFF8C", + "/hwd:kata:i": "\uFF72", + "/hwd:kata:ismall": "\uFF68", + "/hwd:kata:ka": "\uFF76", + "/hwd:kata:ke": "\uFF79", + "/hwd:kata:ki": "\uFF77", + "/hwd:kata:ko": "\uFF7A", + "/hwd:kata:ku": "\uFF78", + "/hwd:kata:ma": "\uFF8F", + "/hwd:kata:me": "\uFF92", + "/hwd:kata:mi": "\uFF90", + "/hwd:kata:middledot": "\uFF65", + "/hwd:kata:mo": "\uFF93", + "/hwd:kata:mu": "\uFF91", + "/hwd:kata:n": "\uFF9D", + "/hwd:kata:na": "\uFF85", + "/hwd:kata:ne": "\uFF88", + "/hwd:kata:ni": "\uFF86", + "/hwd:kata:no": "\uFF89", + "/hwd:kata:nu": "\uFF87", + "/hwd:kata:o": "\uFF75", + "/hwd:kata:osmall": "\uFF6B", + "/hwd:kata:prolongedkana": "\uFF70", + "/hwd:kata:ra": "\uFF97", + "/hwd:kata:re": "\uFF9A", + "/hwd:kata:ri": "\uFF98", + "/hwd:kata:ro": "\uFF9B", + "/hwd:kata:ru": "\uFF99", + "/hwd:kata:sa": "\uFF7B", + "/hwd:kata:se": "\uFF7E", + "/hwd:kata:semi-voiced": "\uFF9F", + "/hwd:kata:si": "\uFF7C", + "/hwd:kata:so": "\uFF7F", + "/hwd:kata:su": "\uFF7D", + "/hwd:kata:ta": "\uFF80", + "/hwd:kata:te": "\uFF83", + "/hwd:kata:ti": "\uFF81", + "/hwd:kata:to": "\uFF84", + "/hwd:kata:tu": "\uFF82", + "/hwd:kata:tusmall": "\uFF6F", + "/hwd:kata:u": "\uFF73", + "/hwd:kata:usmall": "\uFF69", + "/hwd:kata:voiced": "\uFF9E", + "/hwd:kata:wa": "\uFF9C", + "/hwd:kata:wo": "\uFF66", + "/hwd:kata:ya": "\uFF94", + "/hwd:kata:yasmall": "\uFF6C", + "/hwd:kata:yo": "\uFF96", + "/hwd:kata:yosmall": "\uFF6E", + "/hwd:kata:yu": "\uFF95", + "/hwd:kata:yusmall": "\uFF6D", + "/hwd:khieukh": "\uFFBB", + "/hwd:kiyeok": "\uFFA1", + "/hwd:kiyeoksios": "\uFFA3", + "/hwd:leftcornerbracket": "\uFF62", + "/hwd:leftwardsarrow": "\uFFE9", + "/hwd:mieum": "\uFFB1", + "/hwd:nieun": "\uFFA4", + "/hwd:nieuncieuc": "\uFFA5", + "/hwd:nieunhieuh": "\uFFA6", + "/hwd:o": "\uFFCC", + "/hwd:oe": "\uFFCF", + "/hwd:phieuph": "\uFFBD", + "/hwd:pieup": "\uFFB2", + "/hwd:pieupsios": "\uFFB4", + "/hwd:rieul": "\uFFA9", + "/hwd:rieulhieuh": "\uFFB0", + "/hwd:rieulkiyeok": "\uFFAA", + "/hwd:rieulmieum": "\uFFAB", + "/hwd:rieulphieuph": "\uFFAF", + "/hwd:rieulpieup": "\uFFAC", + "/hwd:rieulsios": "\uFFAD", + "/hwd:rieulthieuth": "\uFFAE", + "/hwd:rightcornerbracket": "\uFF63", + "/hwd:rightwardsarrow": "\uFFEB", + "/hwd:sios": "\uFFB5", + "/hwd:ssangcieuc": "\uFFB9", + "/hwd:ssangkiyeok": "\uFFA2", + "/hwd:ssangpieup": "\uFFB3", + "/hwd:ssangsios": "\uFFB6", + "/hwd:ssangtikeut": "\uFFA8", + "/hwd:thieuth": "\uFFBC", + "/hwd:tikeut": "\uFFA7", + "/hwd:u": "\uFFD3", + "/hwd:upwardsarrow": "\uFFEA", + "/hwd:wa": "\uFFCD", + "/hwd:wae": "\uFFCE", + "/hwd:we": "\uFFD5", + "/hwd:weo": "\uFFD4", + "/hwd:whitecircle": "\uFFEE", + "/hwd:wi": "\uFFD6", + "/hwd:ya": "\uFFC4", + "/hwd:yae": "\uFFC5", + "/hwd:ye": "\uFFCB", + "/hwd:yeo": "\uFFCA", + "/hwd:yi": "\uFFDB", + "/hwd:yo": "\uFFD2", + "/hwd:yu": "\uFFD7", + "/hyphen": "\u002D", + "/hyphenationpoint": "\u2027", + "/hyphenbullet": "\u2043", + "/hyphendbl": "\u2E40", + "/hyphendbloblique": "\u2E17", + "/hyphendieresis": "\u2E1A", + "/hypheninferior": "\uF6E5", + "/hyphenminus": "\u002D", + "/hyphenmonospace": "\uFF0D", + "/hyphensmall": "\uFE63", + "/hyphensoft": "\u00AD", + "/hyphensuperior": "\uF6E6", + "/hyphentwo": "\u2010", + "/hypodiastole": "\u2E12", + "/hysteresis": "\u238E", + "/hzfullwidth": "\u3390", + "/i": "\u0069", + "/i.superior": "\u2071", + "/iacute": "\u00ED", + "/iacyrillic": "\u044F", + "/iaepigraphic": "\uA7FE", + "/ibengali": "\u0987", + "/ibopomofo": "\u3127", + "/ibreve": "\u012D", + "/icaron": "\u01D0", + "/iceCream": "\u1F368", + "/iceHockeyStickAndPuck": "\u1F3D2", + "/iceskate": "\u26F8", + "/icircle": "\u24D8", + "/icirclekatakana": "\u32D1", + "/icircumflex": "\u00EE", + "/icyr": "\u0438", + "/icyrillic": "\u0456", + "/idblgrave": "\u0209", + "/idblstruckitalic": "\u2148", + "/ideographearthcircle": "\u328F", + "/ideographfirecircle": "\u328B", + "/ideographicallianceparen": "\u323F", + "/ideographiccallparen": "\u323A", + "/ideographiccentrecircle": "\u32A5", + "/ideographicclose": "\u3006", + "/ideographiccomma": "\u3001", + "/ideographiccommaleft": "\uFF64", + "/ideographiccongratulationparen": "\u3237", + "/ideographiccorrectcircle": "\u32A3", + "/ideographicdepartingtonemark": "\u302C", + "/ideographicearthparen": "\u322F", + "/ideographicenteringtonemark": "\u302D", + "/ideographicenterpriseparen": "\u323D", + "/ideographicexcellentcircle": "\u329D", + "/ideographicfestivalparen": "\u3240", + "/ideographicfinancialcircle": "\u3296", + "/ideographicfinancialparen": "\u3236", + "/ideographicfireparen": "\u322B", + "/ideographichalffillspace": "\u303F", + "/ideographichaveparen": "\u3232", + "/ideographichighcircle": "\u32A4", + "/ideographiciterationmark": "\u3005", + "/ideographiclaborcircle": "\u3298", + "/ideographiclaborparen": "\u3238", + "/ideographicleftcircle": "\u32A7", + "/ideographicleveltonemark": "\u302A", + "/ideographiclowcircle": "\u32A6", + "/ideographicmedicinecircle": "\u32A9", + "/ideographicmetalparen": "\u322E", + "/ideographicmoonparen": "\u322A", + "/ideographicnameparen": "\u3234", + "/ideographicperiod": "\u3002", + "/ideographicprintcircle": "\u329E", + "/ideographicreachparen": "\u3243", + "/ideographicrepresentparen": "\u3239", + "/ideographicresourceparen": "\u323E", + "/ideographicrightcircle": "\u32A8", + "/ideographicrisingtonemark": "\u302B", + "/ideographicsecretcircle": "\u3299", + "/ideographicselfparen": "\u3242", + "/ideographicsocietyparen": "\u3233", + "/ideographicspace": "\u3000", + "/ideographicspecialparen": "\u3235", + "/ideographicstockparen": "\u3231", + "/ideographicstudyparen": "\u323B", + "/ideographicsunparen": "\u3230", + "/ideographicsuperviseparen": "\u323C", + "/ideographictelegraphlinefeedseparatorsymbol": "\u3037", + "/ideographictelegraphsymbolforhoureight": "\u3360", + "/ideographictelegraphsymbolforhoureighteen": "\u336A", + "/ideographictelegraphsymbolforhoureleven": "\u3363", + "/ideographictelegraphsymbolforhourfifteen": "\u3367", + "/ideographictelegraphsymbolforhourfive": "\u335D", + "/ideographictelegraphsymbolforhourfour": "\u335C", + "/ideographictelegraphsymbolforhourfourteen": "\u3366", + "/ideographictelegraphsymbolforhournine": "\u3361", + "/ideographictelegraphsymbolforhournineteen": "\u336B", + "/ideographictelegraphsymbolforhourone": "\u3359", + "/ideographictelegraphsymbolforhourseven": "\u335F", + "/ideographictelegraphsymbolforhourseventeen": "\u3369", + "/ideographictelegraphsymbolforhoursix": "\u335E", + "/ideographictelegraphsymbolforhoursixteen": "\u3368", + "/ideographictelegraphsymbolforhourten": "\u3362", + "/ideographictelegraphsymbolforhourthirteen": "\u3365", + "/ideographictelegraphsymbolforhourthree": "\u335B", + "/ideographictelegraphsymbolforhourtwelve": "\u3364", + "/ideographictelegraphsymbolforhourtwenty": "\u336C", + "/ideographictelegraphsymbolforhourtwentyfour": "\u3370", + "/ideographictelegraphsymbolforhourtwentyone": "\u336D", + "/ideographictelegraphsymbolforhourtwentythree": "\u336F", + "/ideographictelegraphsymbolforhourtwentytwo": "\u336E", + "/ideographictelegraphsymbolforhourtwo": "\u335A", + "/ideographictelegraphsymbolforhourzero": "\u3358", + "/ideographicvariationindicator": "\u303E", + "/ideographicwaterparen": "\u322C", + "/ideographicwoodparen": "\u322D", + "/ideographiczero": "\u3007", + "/ideographmetalcircle": "\u328E", + "/ideographmooncircle": "\u328A", + "/ideographnamecircle": "\u3294", + "/ideographsuncircle": "\u3290", + "/ideographwatercircle": "\u328C", + "/ideographwoodcircle": "\u328D", + "/ideva": "\u0907", + "/idieresis": "\u00EF", + "/idieresisacute": "\u1E2F", + "/idieresiscyr": "\u04E5", + "/idieresiscyrillic": "\u04E5", + "/idotbelow": "\u1ECB", + "/idsquare": "\u1F194", + "/iebrevecyr": "\u04D7", + "/iebrevecyrillic": "\u04D7", + "/iecyr": "\u0435", + "/iecyrillic": "\u0435", + "/iegravecyr": "\u0450", + "/iepigraphicsideways": "\uA7F7", + "/ieungacirclekorean": "\u3275", + "/ieungaparenkorean": "\u3215", + "/ieungcirclekorean": "\u3267", + "/ieungkorean": "\u3147", + "/ieungparenkorean": "\u3207", + "/ieungucirclekorean": "\u327E", + "/igrave": "\u00EC", + "/igravecyr": "\u045D", + "/igravedbl": "\u0209", + "/igujarati": "\u0A87", + "/igurmukhi": "\u0A07", + "/ihiragana": "\u3044", + "/ihoi": "\u1EC9", + "/ihookabove": "\u1EC9", + "/iibengali": "\u0988", + "/iicyrillic": "\u0438", + "/iideva": "\u0908", + "/iigujarati": "\u0A88", + "/iigurmukhi": "\u0A08", + "/iimatragurmukhi": "\u0A40", + "/iinvertedbreve": "\u020B", + "/iishortcyrillic": "\u0439", + "/iivowelsignbengali": "\u09C0", + "/iivowelsigndeva": "\u0940", + "/iivowelsigngujarati": "\u0AC0", + "/ij": "\u0133", + "/ikatakana": "\u30A4", + "/ikatakanahalfwidth": "\uFF72", + "/ikawi": "\uA985", + "/ikorean": "\u3163", + "/ilde": "\u02DC", + "/iluy:hb": "\u05AC", + "/iluyhebrew": "\u05AC", + "/imacron": "\u012B", + "/imacroncyr": "\u04E3", + "/imacroncyrillic": "\u04E3", + "/image": "\u22B7", + "/imageorapproximatelyequal": "\u2253", + "/imatragurmukhi": "\u0A3F", + "/imonospace": "\uFF49", + "/imp": "\u1F47F", + "/inboxTray": "\u1F4E5", + "/incomingEnvelope": "\u1F4E8", + "/increaseFontSize": "\u1F5DA", + "/increment": "\u2206", + "/indianrupee": "\u20B9", + "/infinity": "\u221E", + "/information": "\u2139", + "/infullwidth": "\u33CC", + "/inhibitarabicformshaping": "\u206C", + "/inhibitsymmetricswapping": "\u206A", + "/iniarmenian": "\u056B", + "/iningusquare": "\u3304", + "/inmationDeskPerson": "\u1F481", + "/inputLatinCapitalLetters": "\u1F520", + "/inputLatinLetters": "\u1F524", + "/inputLatinSmallLetters": "\u1F521", + "/inputNumbers": "\u1F522", + "/inputS": "\u1F523", + "/insertion": "\u2380", + "/integral": "\u222B", + "/integralbottom": "\u2321", + "/integralbt": "\u2321", + "/integralclockwise": "\u2231", + "/integralcontour": "\u222E", + "/integralcontouranticlockwise": "\u2233", + "/integralcontourclockwise": "\u2232", + "/integraldbl": "\u222C", + "/integralex": "\uF8F5", + "/integralextension": "\u23AE", + "/integralsurface": "\u222F", + "/integraltop": "\u2320", + "/integraltp": "\u2320", + "/integraltpl": "\u222D", + "/integralvolume": "\u2230", + "/intercalate": "\u22BA", + "/interlinearanchor": "\uFFF9", + "/interlinearseparator": "\uFFFA", + "/interlinearterminator": "\uFFFB", + "/interlockedfemalemale": "\u26A4", + "/interrobang": "\u203D", + "/interrobanginverted": "\u2E18", + "/intersection": "\u2229", + "/intersectionarray": "\u22C2", + "/intersectiondbl": "\u22D2", + "/intisquare": "\u3305", + "/invbullet": "\u25D8", + "/invcircle": "\u25D9", + "/inverteddamma": "\u0657", + "/invertedfork": "\u2443", + "/invertedpentagram": "\u26E7", + "/invertedundertie": "\u2054", + "/invisibleplus": "\u2064", + "/invisibleseparator": "\u2063", + "/invisibletimes": "\u2062", + "/invsmileface": "\u263B", + "/iocyr": "\u0451", + "/iocyrillic": "\u0451", + "/iogonek": "\u012F", + "/iota": "\u03B9", + "/iotaacute": "\u1F77", + "/iotaadscript": "\u1FBE", + "/iotaasper": "\u1F31", + "/iotaasperacute": "\u1F35", + "/iotaaspergrave": "\u1F33", + "/iotaaspertilde": "\u1F37", + "/iotabreve": "\u1FD0", + "/iotadieresis": "\u03CA", + "/iotadieresisacute": "\u1FD3", + "/iotadieresisgrave": "\u1FD2", + "/iotadieresistilde": "\u1FD7", + "/iotadieresistonos": "\u0390", + "/iotafunc": "\u2373", + "/iotagrave": "\u1F76", + "/iotalatin": "\u0269", + "/iotalenis": "\u1F30", + "/iotalenisacute": "\u1F34", + "/iotalenisgrave": "\u1F32", + "/iotalenistilde": "\u1F36", + "/iotasub": "\u037A", + "/iotatilde": "\u1FD6", + "/iotatonos": "\u03AF", + "/iotaturned": "\u2129", + "/iotaunderlinefunc": "\u2378", + "/iotawithmacron": "\u1FD1", + "/ipa:Ismall": "\u026A", + "/ipa:alpha": "\u0251", + "/ipa:ereversed": "\u0258", + "/ipa:esh": "\u0283", + "/ipa:gamma": "\u0263", + "/ipa:glottalstop": "\u0294", + "/ipa:gscript": "\u0261", + "/ipa:iota": "\u0269", + "/ipa:phi": "\u0278", + "/ipa:rtail": "\u027D", + "/ipa:schwa": "\u0259", + "/ipa:upsilon": "\u028A", + "/iparen": "\u24A4", + "/iparenthesized": "\u24A4", + "/irigurmukhi": "\u0A72", + "/is": "\uA76D", + "/isen-isenpada": "\uA9DF", + "/ishortcyr": "\u0439", + "/ishortsharptailcyr": "\u048B", + "/ismallhiragana": "\u3043", + "/ismallkatakana": "\u30A3", + "/ismallkatakanahalfwidth": "\uFF68", + "/issharbengali": "\u09FA", + "/istroke": "\u0268", + "/isuperior": "\uF6ED", + "/itemideographiccircled": "\u32A0", + "/iterationhiragana": "\u309D", + "/iterationkatakana": "\u30FD", + "/itilde": "\u0129", + "/itildebelow": "\u1E2D", + "/iubopomofo": "\u3129", + "/iucyrillic": "\u044E", + "/iufullwidth": "\u337A", + "/iukrcyr": "\u0456", + "/ivowelsignbengali": "\u09BF", + "/ivowelsigndeva": "\u093F", + "/ivowelsigngujarati": "\u0ABF", + "/izakayaLantern": "\u1F3EE", + "/izhitsacyr": "\u0475", + "/izhitsacyrillic": "\u0475", + "/izhitsadblgravecyrillic": "\u0477", + "/izhitsagravedblcyr": "\u0477", + "/j": "\u006A", + "/j.inferior": "\u2C7C", + "/jaarmenian": "\u0571", + "/jabengali": "\u099C", + "/jackOLantern": "\u1F383", + "/jadeva": "\u091C", + "/jagujarati": "\u0A9C", + "/jagurmukhi": "\u0A1C", + "/jamahaprana": "\uA999", + "/januarytelegraph": "\u32C0", + "/japaneseBeginner": "\u1F530", + "/japaneseCastle": "\u1F3EF", + "/japaneseDolls": "\u1F38E", + "/japaneseGoblin": "\u1F47A", + "/japaneseOgre": "\u1F479", + "/japanesePostOffice": "\u1F3E3", + "/japanesebank": "\u26FB", + "/java:a": "\uA984", + "/java:ai": "\uA98D", + "/java:ba": "\uA9A7", + "/java:ca": "\uA995", + "/java:da": "\uA9A2", + "/java:dda": "\uA99D", + "/java:e": "\uA98C", + "/java:eight": "\uA9D8", + "/java:five": "\uA9D5", + "/java:four": "\uA9D4", + "/java:ga": "\uA992", + "/java:ha": "\uA9B2", + "/java:i": "\uA986", + "/java:ii": "\uA987", + "/java:ja": "\uA997", + "/java:ka": "\uA98F", + "/java:la": "\uA9AD", + "/java:ma": "\uA9A9", + "/java:na": "\uA9A4", + "/java:nga": "\uA994", + "/java:nine": "\uA9D9", + "/java:nya": "\uA99A", + "/java:o": "\uA98E", + "/java:one": "\uA9D1", + "/java:pa": "\uA9A5", + "/java:ra": "\uA9AB", + "/java:sa": "\uA9B1", + "/java:seven": "\uA9D7", + "/java:six": "\uA9D6", + "/java:ta": "\uA9A0", + "/java:three": "\uA9D3", + "/java:tta": "\uA99B", + "/java:two": "\uA9D2", + "/java:u": "\uA988", + "/java:wa": "\uA9AE", + "/java:ya": "\uA9AA", + "/java:zero": "\uA9D0", + "/jbopomofo": "\u3110", + "/jcaron": "\u01F0", + "/jcircle": "\u24D9", + "/jcircumflex": "\u0135", + "/jcrossedtail": "\u029D", + "/jdblstruckitalic": "\u2149", + "/jdotlessstroke": "\u025F", + "/jeans": "\u1F456", + "/jecyr": "\u0458", + "/jecyrillic": "\u0458", + "/jeem": "\u062C", + "/jeem.fina": "\uFE9E", + "/jeem.init": "\uFE9F", + "/jeem.init_alefmaksura.fina": "\uFD01", + "/jeem.init_hah.fina": "\uFC15", + "/jeem.init_hah.medi": "\uFCA7", + "/jeem.init_meem.fina": "\uFC16", + "/jeem.init_meem.medi": "\uFCA8", + "/jeem.init_meem.medi_hah.medi": "\uFD59", + "/jeem.init_yeh.fina": "\uFD02", + "/jeem.isol": "\uFE9D", + "/jeem.medi": "\uFEA0", + "/jeem.medi_alefmaksura.fina": "\uFD1D", + "/jeem.medi_hah.medi_alefmaksura.fina": "\uFDA6", + "/jeem.medi_hah.medi_yeh.fina": "\uFDBE", + "/jeem.medi_meem.medi_alefmaksura.fina": "\uFDA7", + "/jeem.medi_meem.medi_hah.fina": "\uFD58", + "/jeem.medi_meem.medi_yeh.fina": "\uFDA5", + "/jeem.medi_yeh.fina": "\uFD1E", + "/jeemabove": "\u06DA", + "/jeemarabic": "\u062C", + "/jeemfinalarabic": "\uFE9E", + "/jeeminitialarabic": "\uFE9F", + "/jeemmedialarabic": "\uFEA0", + "/jeh": "\u0698", + "/jeh.fina": "\uFB8B", + "/jeh.isol": "\uFB8A", + "/jeharabic": "\u0698", + "/jehfinalarabic": "\uFB8B", + "/jhabengali": "\u099D", + "/jhadeva": "\u091D", + "/jhagujarati": "\u0A9D", + "/jhagurmukhi": "\u0A1D", + "/jheharmenian": "\u057B", + "/jis": "\u3004", + "/jiterup": "\u2643", + "/jmonospace": "\uFF4A", + "/jotdiaeresisfunc": "\u2364", + "/jotunderlinefunc": "\u235B", + "/joystick": "\u1F579", + "/jparen": "\u24A5", + "/jparenthesized": "\u24A5", + "/jstroke": "\u0249", + "/jsuperior": "\u02B2", + "/jsupmod": "\u02B2", + "/jueuicircle": "\u327D", + "/julytelegraph": "\u32C6", + "/junetelegraph": "\u32C5", + "/juno": "\u26B5", + "/k": "\u006B", + "/k.inferior": "\u2096", + "/kaaba": "\u1F54B", + "/kaaleutcyr": "\u051F", + "/kabashkcyr": "\u04A1", + "/kabashkircyrillic": "\u04A1", + "/kabengali": "\u0995", + "/kacirclekatakana": "\u32D5", + "/kacute": "\u1E31", + "/kacyr": "\u043A", + "/kacyrillic": "\u043A", + "/kadescendercyrillic": "\u049B", + "/kadeva": "\u0915", + "/kaf": "\u05DB", + "/kaf.fina": "\uFEDA", + "/kaf.init": "\uFEDB", + "/kaf.init_alef.fina": "\uFC37", + "/kaf.init_alefmaksura.fina": "\uFC3D", + "/kaf.init_hah.fina": "\uFC39", + "/kaf.init_hah.medi": "\uFCC5", + "/kaf.init_jeem.fina": "\uFC38", + "/kaf.init_jeem.medi": "\uFCC4", + "/kaf.init_khah.fina": "\uFC3A", + "/kaf.init_khah.medi": "\uFCC6", + "/kaf.init_lam.fina": "\uFC3B", + "/kaf.init_lam.medi": "\uFCC7", + "/kaf.init_meem.fina": "\uFC3C", + "/kaf.init_meem.medi": "\uFCC8", + "/kaf.init_meem.medi_meem.medi": "\uFDC3", + "/kaf.init_yeh.fina": "\uFC3E", + "/kaf.isol": "\uFED9", + "/kaf.medi": "\uFEDC", + "/kaf.medi_alef.fina": "\uFC80", + "/kaf.medi_alefmaksura.fina": "\uFC83", + "/kaf.medi_lam.fina": "\uFC81", + "/kaf.medi_lam.medi": "\uFCEB", + "/kaf.medi_meem.fina": "\uFC82", + "/kaf.medi_meem.medi": "\uFCEC", + "/kaf.medi_meem.medi_meem.fina": "\uFDBB", + "/kaf.medi_meem.medi_yeh.fina": "\uFDB7", + "/kaf.medi_yeh.fina": "\uFC84", + "/kaf:hb": "\u05DB", + "/kafTwoDotsAbove": "\u077F", + "/kafarabic": "\u0643", + "/kafdagesh": "\uFB3B", + "/kafdageshhebrew": "\uFB3B", + "/kafdotabove": "\u06AC", + "/kaffinalarabic": "\uFEDA", + "/kafhebrew": "\u05DB", + "/kafinitialarabic": "\uFEDB", + "/kafmedialarabic": "\uFEDC", + "/kafrafehebrew": "\uFB4D", + "/kafring": "\u06AB", + "/kafswash": "\u06AA", + "/kafthreedotsbelow": "\u06AE", + "/kafullwidth": "\u3384", + "/kafwide:hb": "\uFB24", + "/kafwithdagesh:hb": "\uFB3B", + "/kafwithrafe:hb": "\uFB4D", + "/kagujarati": "\u0A95", + "/kagurmukhi": "\u0A15", + "/kahiragana": "\u304B", + "/kahookcyr": "\u04C4", + "/kahookcyrillic": "\u04C4", + "/kairisquare": "\u330B", + "/kaisymbol": "\u03D7", + "/kakatakana": "\u30AB", + "/kakatakanahalfwidth": "\uFF76", + "/kamurda": "\uA991", + "/kappa": "\u03BA", + "/kappa.math": "\u03F0", + "/kappasymbolgreek": "\u03F0", + "/kapyeounmieumkorean": "\u3171", + "/kapyeounphieuphkorean": "\u3184", + "/kapyeounpieupkorean": "\u3178", + "/kapyeounssangpieupkorean": "\u3179", + "/karattosquare": "\u330C", + "/karoriisquare": "\u330D", + "/kasasak": "\uA990", + "/kashida": "\u0640", + "/kashidaFina": "\uFE73", + "/kashidaautoarabic": "\u0640", + "/kashidaautonosidebearingarabic": "\u0640", + "/kashmiriyeh": "\u0620", + "/kasmallkatakana": "\u30F5", + "/kasquare": "\u3384", + "/kasra": "\u0650", + "/kasraIsol": "\uFE7A", + "/kasraMedi": "\uFE7B", + "/kasraarabic": "\u0650", + "/kasrasmall": "\u061A", + "/kasratan": "\u064D", + "/kasratanIsol": "\uFE74", + "/kasratanarabic": "\u064D", + "/kastrokecyr": "\u049F", + "/kastrokecyrillic": "\u049F", + "/kata:a": "\u30A2", + "/kata:asmall": "\u30A1", + "/kata:ba": "\u30D0", + "/kata:be": "\u30D9", + "/kata:bi": "\u30D3", + "/kata:bo": "\u30DC", + "/kata:bu": "\u30D6", + "/kata:da": "\u30C0", + "/kata:de": "\u30C7", + "/kata:di": "\u30C2", + "/kata:digraphkoto": "\u30FF", + "/kata:do": "\u30C9", + "/kata:doublehyphenkana": "\u30A0", + "/kata:du": "\u30C5", + "/kata:e": "\u30A8", + "/kata:esmall": "\u30A7", + "/kata:ga": "\u30AC", + "/kata:ge": "\u30B2", + "/kata:gi": "\u30AE", + "/kata:go": "\u30B4", + "/kata:gu": "\u30B0", + "/kata:ha": "\u30CF", + "/kata:he": "\u30D8", + "/kata:hi": "\u30D2", + "/kata:ho": "\u30DB", + "/kata:hu": "\u30D5", + "/kata:i": "\u30A4", + "/kata:ismall": "\u30A3", + "/kata:iteration": "\u30FD", + "/kata:ka": "\u30AB", + "/kata:kasmall": "\u30F5", + "/kata:ke": "\u30B1", + "/kata:kesmall": "\u30F6", + "/kata:ki": "\u30AD", + "/kata:ko": "\u30B3", + "/kata:ku": "\u30AF", + "/kata:ma": "\u30DE", + "/kata:me": "\u30E1", + "/kata:mi": "\u30DF", + "/kata:middledot": "\u30FB", + "/kata:mo": "\u30E2", + "/kata:mu": "\u30E0", + "/kata:n": "\u30F3", + "/kata:na": "\u30CA", + "/kata:ne": "\u30CD", + "/kata:ni": "\u30CB", + "/kata:no": "\u30CE", + "/kata:nu": "\u30CC", + "/kata:o": "\u30AA", + "/kata:osmall": "\u30A9", + "/kata:pa": "\u30D1", + "/kata:pe": "\u30DA", + "/kata:pi": "\u30D4", + "/kata:po": "\u30DD", + "/kata:prolongedkana": "\u30FC", + "/kata:pu": "\u30D7", + "/kata:ra": "\u30E9", + "/kata:re": "\u30EC", + "/kata:ri": "\u30EA", + "/kata:ro": "\u30ED", + "/kata:ru": "\u30EB", + "/kata:sa": "\u30B5", + "/kata:se": "\u30BB", + "/kata:si": "\u30B7", + "/kata:so": "\u30BD", + "/kata:su": "\u30B9", + "/kata:ta": "\u30BF", + "/kata:te": "\u30C6", + "/kata:ti": "\u30C1", + "/kata:to": "\u30C8", + "/kata:tu": "\u30C4", + "/kata:tusmall": "\u30C3", + "/kata:u": "\u30A6", + "/kata:usmall": "\u30A5", + "/kata:va": "\u30F7", + "/kata:ve": "\u30F9", + "/kata:vi": "\u30F8", + "/kata:vo": "\u30FA", + "/kata:voicediteration": "\u30FE", + "/kata:vu": "\u30F4", + "/kata:wa": "\u30EF", + "/kata:wasmall": "\u30EE", + "/kata:we": "\u30F1", + "/kata:wi": "\u30F0", + "/kata:wo": "\u30F2", + "/kata:ya": "\u30E4", + "/kata:yasmall": "\u30E3", + "/kata:yo": "\u30E8", + "/kata:yosmall": "\u30E7", + "/kata:yu": "\u30E6", + "/kata:yusmall": "\u30E5", + "/kata:za": "\u30B6", + "/kata:ze": "\u30BC", + "/kata:zi": "\u30B8", + "/kata:zo": "\u30BE", + "/kata:zu": "\u30BA", + "/katahiraprolongmarkhalfwidth": "\uFF70", + "/katailcyr": "\u049B", + "/kaverticalstrokecyr": "\u049D", + "/kaverticalstrokecyrillic": "\u049D", + "/kavykainvertedlow": "\u2E45", + "/kavykalow": "\u2E47", + "/kavykawithdotlow": "\u2E48", + "/kavykawithkavykaaboveinvertedlow": "\u2E46", + "/kbfullwidth": "\u3385", + "/kbopomofo": "\u310E", + "/kcalfullwidth": "\u3389", + "/kcalsquare": "\u3389", + "/kcaron": "\u01E9", + "/kcedilla": "\u0137", + "/kcircle": "\u24DA", + "/kcommaaccent": "\u0137", + "/kdescender": "\u2C6A", + "/kdiagonalstroke": "\uA743", + "/kdotbelow": "\u1E33", + "/kecirclekatakana": "\u32D8", + "/keesusquare": "\u331C", + "/keharmenian": "\u0584", + "/keheh": "\u06A9", + "/keheh.fina": "\uFB8F", + "/keheh.init": "\uFB90", + "/keheh.isol": "\uFB8E", + "/keheh.medi": "\uFB91", + "/kehehDotAbove": "\u0762", + "/kehehThreeDotsAbove": "\u0763", + "/kehehThreeDotsUpBelow": "\u0764", + "/kehehthreedotsbelow": "\u063C", + "/kehehtwodotsabove": "\u063B", + "/kehiragana": "\u3051", + "/kekatakana": "\u30B1", + "/kekatakanahalfwidth": "\uFF79", + "/kelvin": "\u212A", + "/kenarmenian": "\u056F", + "/keretconsonant": "\uA9BD", + "/kesmallkatakana": "\u30F6", + "/key": "\u1F511", + "/keyboardAndMouse": "\u1F5A6", + "/keycapTen": "\u1F51F", + "/kgfullwidth": "\u338F", + "/kgreenlandic": "\u0138", + "/khabengali": "\u0996", + "/khacyrillic": "\u0445", + "/khadeva": "\u0916", + "/khagujarati": "\u0A96", + "/khagurmukhi": "\u0A16", + "/khah": "\u062E", + "/khah.fina": "\uFEA6", + "/khah.init": "\uFEA7", + "/khah.init_alefmaksura.fina": "\uFD03", + "/khah.init_hah.fina": "\uFC1A", + "/khah.init_jeem.fina": "\uFC19", + "/khah.init_jeem.medi": "\uFCAB", + "/khah.init_meem.fina": "\uFC1B", + "/khah.init_meem.medi": "\uFCAC", + "/khah.init_yeh.fina": "\uFD04", + "/khah.isol": "\uFEA5", + "/khah.medi": "\uFEA8", + "/khah.medi_alefmaksura.fina": "\uFD1F", + "/khah.medi_yeh.fina": "\uFD20", + "/khaharabic": "\u062E", + "/khahfinalarabic": "\uFEA6", + "/khahinitialarabic": "\uFEA7", + "/khahmedialarabic": "\uFEA8", + "/kheicoptic": "\u03E7", + "/khhadeva": "\u0959", + "/khhagurmukhi": "\u0A59", + "/khieukhacirclekorean": "\u3278", + "/khieukhaparenkorean": "\u3218", + "/khieukhcirclekorean": "\u326A", + "/khieukhkorean": "\u314B", + "/khieukhparenkorean": "\u320A", + "/khokhaithai": "\u0E02", + "/khokhonthai": "\u0E05", + "/khokhuatthai": "\u0E03", + "/khokhwaithai": "\u0E04", + "/khomutthai": "\u0E5B", + "/khook": "\u0199", + "/khorakhangthai": "\u0E06", + "/khzfullwidth": "\u3391", + "/khzsquare": "\u3391", + "/kicirclekatakana": "\u32D6", + "/kihiragana": "\u304D", + "/kikatakana": "\u30AD", + "/kikatakanahalfwidth": "\uFF77", + "/kimono": "\u1F458", + "/kindergartenideographiccircled": "\u3245", + "/kingblack": "\u265A", + "/kingwhite": "\u2654", + "/kip": "\u20AD", + "/kiroguramusquare": "\u3315", + "/kiromeetorusquare": "\u3316", + "/kirosquare": "\u3314", + "/kirowattosquare": "\u3317", + "/kiss": "\u1F48F", + "/kissMark": "\u1F48B", + "/kissingCatFaceWithClosedEyes": "\u1F63D", + "/kissingFace": "\u1F617", + "/kissingFaceWithClosedEyes": "\u1F61A", + "/kissingFaceWithSmilingEyes": "\u1F619", + "/kiyeokacirclekorean": "\u326E", + "/kiyeokaparenkorean": "\u320E", + "/kiyeokcirclekorean": "\u3260", + "/kiyeokkorean": "\u3131", + "/kiyeokparenkorean": "\u3200", + "/kiyeoksioskorean": "\u3133", + "/kjecyr": "\u045C", + "/kjecyrillic": "\u045C", + "/kkfullwidth": "\u33CD", + "/klfullwidth": "\u3398", + "/klinebelow": "\u1E35", + "/klsquare": "\u3398", + "/km2fullwidth": "\u33A2", + "/km3fullwidth": "\u33A6", + "/kmcapitalfullwidth": "\u33CE", + "/kmcubedsquare": "\u33A6", + "/kmfullwidth": "\u339E", + "/kmonospace": "\uFF4B", + "/kmsquaredsquare": "\u33A2", + "/knda:a": "\u0C85", + "/knda:aa": "\u0C86", + "/knda:aasign": "\u0CBE", + "/knda:ai": "\u0C90", + "/knda:ailength": "\u0CD6", + "/knda:aisign": "\u0CC8", + "/knda:anusvara": "\u0C82", + "/knda:au": "\u0C94", + "/knda:ausign": "\u0CCC", + "/knda:avagraha": "\u0CBD", + "/knda:ba": "\u0CAC", + "/knda:bha": "\u0CAD", + "/knda:ca": "\u0C9A", + "/knda:cha": "\u0C9B", + "/knda:da": "\u0CA6", + "/knda:dda": "\u0CA1", + "/knda:ddha": "\u0CA2", + "/knda:dha": "\u0CA7", + "/knda:e": "\u0C8E", + "/knda:ee": "\u0C8F", + "/knda:eesign": "\u0CC7", + "/knda:eight": "\u0CEE", + "/knda:esign": "\u0CC6", + "/knda:fa": "\u0CDE", + "/knda:five": "\u0CEB", + "/knda:four": "\u0CEA", + "/knda:ga": "\u0C97", + "/knda:gha": "\u0C98", + "/knda:ha": "\u0CB9", + "/knda:i": "\u0C87", + "/knda:ii": "\u0C88", + "/knda:iisign": "\u0CC0", + "/knda:isign": "\u0CBF", + "/knda:ja": "\u0C9C", + "/knda:jha": "\u0C9D", + "/knda:jihvamuliya": "\u0CF1", + "/knda:ka": "\u0C95", + "/knda:kha": "\u0C96", + "/knda:la": "\u0CB2", + "/knda:length": "\u0CD5", + "/knda:lla": "\u0CB3", + "/knda:llvocal": "\u0CE1", + "/knda:llvocalsign": "\u0CE3", + "/knda:lvocal": "\u0C8C", + "/knda:lvocalsign": "\u0CE2", + "/knda:ma": "\u0CAE", + "/knda:na": "\u0CA8", + "/knda:nga": "\u0C99", + "/knda:nine": "\u0CEF", + "/knda:nna": "\u0CA3", + "/knda:nukta": "\u0CBC", + "/knda:nya": "\u0C9E", + "/knda:o": "\u0C92", + "/knda:one": "\u0CE7", + "/knda:oo": "\u0C93", + "/knda:oosign": "\u0CCB", + "/knda:osign": "\u0CCA", + "/knda:pa": "\u0CAA", + "/knda:pha": "\u0CAB", + "/knda:ra": "\u0CB0", + "/knda:rra": "\u0CB1", + "/knda:rrvocal": "\u0CE0", + "/knda:rrvocalsign": "\u0CC4", + "/knda:rvocal": "\u0C8B", + "/knda:rvocalsign": "\u0CC3", + "/knda:sa": "\u0CB8", + "/knda:seven": "\u0CED", + "/knda:sha": "\u0CB6", + "/knda:signcandrabindu": "\u0C81", + "/knda:signspacingcandrabindu": "\u0C80", + "/knda:six": "\u0CEC", + "/knda:ssa": "\u0CB7", + "/knda:ta": "\u0CA4", + "/knda:tha": "\u0CA5", + "/knda:three": "\u0CE9", + "/knda:tta": "\u0C9F", + "/knda:ttha": "\u0CA0", + "/knda:two": "\u0CE8", + "/knda:u": "\u0C89", + "/knda:upadhmaniya": "\u0CF2", + "/knda:usign": "\u0CC1", + "/knda:uu": "\u0C8A", + "/knda:uusign": "\u0CC2", + "/knda:va": "\u0CB5", + "/knda:virama": "\u0CCD", + "/knda:visarga": "\u0C83", + "/knda:ya": "\u0CAF", + "/knda:zero": "\u0CE6", + "/knightblack": "\u265E", + "/knightwhite": "\u2658", + "/ko:a": "\u314F", + "/ko:ae": "\u3150", + "/ko:aejungseong": "\u1162", + "/ko:aeujungseong": "\u11A3", + "/ko:ajungseong": "\u1161", + "/ko:aojungseong": "\u1176", + "/ko:araea": "\u318D", + "/ko:araeae": "\u318E", + "/ko:araeaeojungseong": "\u119F", + "/ko:araeaijungseong": "\u11A1", + "/ko:araeajungseong": "\u119E", + "/ko:araeaujungseong": "\u11A0", + "/ko:aujungseong": "\u1177", + "/ko:ceongchieumchieuchchoseong": "\u1155", + "/ko:ceongchieumcieucchoseong": "\u1150", + "/ko:ceongchieumsioschoseong": "\u113E", + "/ko:ceongchieumssangcieucchoseong": "\u1151", + "/ko:ceongchieumssangsioschoseong": "\u113F", + "/ko:chieuch": "\u314A", + "/ko:chieuchchoseong": "\u110E", + "/ko:chieuchhieuhchoseong": "\u1153", + "/ko:chieuchjongseong": "\u11BE", + "/ko:chieuchkhieukhchoseong": "\u1152", + "/ko:chitueumchieuchchoseong": "\u1154", + "/ko:chitueumcieucchoseong": "\u114E", + "/ko:chitueumsioschoseong": "\u113C", + "/ko:chitueumssangcieucchoseong": "\u114F", + "/ko:chitueumssangsioschoseong": "\u113D", + "/ko:cieuc": "\u3148", + "/ko:cieucchoseong": "\u110C", + "/ko:cieucieungchoseong": "\u114D", + "/ko:cieucjongseong": "\u11BD", + "/ko:e": "\u3154", + "/ko:ejungseong": "\u1166", + "/ko:eo": "\u3153", + "/ko:eo_eujungseong": "\u117C", + "/ko:eojungseong": "\u1165", + "/ko:eoojungseong": "\u117A", + "/ko:eoujungseong": "\u117B", + "/ko:eu": "\u3161", + "/ko:eueujungseong": "\u1196", + "/ko:eujungseong": "\u1173", + "/ko:euujungseong": "\u1195", + "/ko:filler": "\u3164", + "/ko:fillerchoseong": "\u115F", + "/ko:fillerjungseong": "\u1160", + "/ko:hieuh": "\u314E", + "/ko:hieuhchoseong": "\u1112", + "/ko:hieuhjongseong": "\u11C2", + "/ko:hieuhmieumjongseong": "\u11F7", + "/ko:hieuhnieunjongseong": "\u11F5", + "/ko:hieuhpieupjongseong": "\u11F8", + "/ko:hieuhrieuljongseong": "\u11F6", + "/ko:i": "\u3163", + "/ko:iajungseong": "\u1198", + "/ko:iaraeajungseong": "\u119D", + "/ko:ieujungseong": "\u119C", + "/ko:ieung": "\u3147", + "/ko:ieungchieuchchoseong": "\u1149", + "/ko:ieungchoseong": "\u110B", + "/ko:ieungcieucchoseong": "\u1148", + "/ko:ieungjongseong": "\u11BC", + "/ko:ieungkhieukhjongseong": "\u11EF", + "/ko:ieungkiyeokchoseong": "\u1141", + "/ko:ieungkiyeokjongseong": "\u11EC", + "/ko:ieungmieumchoseong": "\u1143", + "/ko:ieungpansioschoseong": "\u1146", + "/ko:ieungphieuphchoseong": "\u114B", + "/ko:ieungpieupchoseong": "\u1144", + "/ko:ieungsioschoseong": "\u1145", + "/ko:ieungssangkiyeokjongseong": "\u11ED", + "/ko:ieungthieuthchoseong": "\u114A", + "/ko:ieungtikeutchoseong": "\u1142", + "/ko:ijungseong": "\u1175", + "/ko:iojungseong": "\u119A", + "/ko:iujungseong": "\u119B", + "/ko:iyajungseong": "\u1199", + "/ko:kapyeounmieum": "\u3171", + "/ko:kapyeounmieumchoseong": "\u111D", + "/ko:kapyeounmieumjongseong": "\u11E2", + "/ko:kapyeounphieuph": "\u3184", + "/ko:kapyeounphieuphchoseong": "\u1157", + "/ko:kapyeounphieuphjongseong": "\u11F4", + "/ko:kapyeounpieup": "\u3178", + "/ko:kapyeounpieupchoseong": "\u112B", + "/ko:kapyeounpieupjongseong": "\u11E6", + "/ko:kapyeounrieulchoseong": "\u111B", + "/ko:kapyeounssangpieup": "\u3179", + "/ko:kapyeounssangpieupchoseong": "\u112C", + "/ko:khieukh": "\u314B", + "/ko:khieukhchoseong": "\u110F", + "/ko:khieukhjongseong": "\u11BF", + "/ko:kiyeok": "\u3131", + "/ko:kiyeokchieuchjongseong": "\u11FC", + "/ko:kiyeokchoseong": "\u1100", + "/ko:kiyeokhieuhjongseong": "\u11FE", + "/ko:kiyeokjongseong": "\u11A8", + "/ko:kiyeokkhieukhjongseong": "\u11FD", + "/ko:kiyeoknieunjongseong": "\u11FA", + "/ko:kiyeokpieupjongseong": "\u11FB", + "/ko:kiyeokrieuljongseong": "\u11C3", + "/ko:kiyeoksios": "\u3133", + "/ko:kiyeoksiosjongseong": "\u11AA", + "/ko:kiyeoksioskiyeokjongseong": "\u11C4", + "/ko:kiyeoktikeutchoseong": "\u115A", + "/ko:mieum": "\u3141", + "/ko:mieumchieuchjongseong": "\u11E0", + "/ko:mieumchoseong": "\u1106", + "/ko:mieumhieuhjongseong": "\u11E1", + "/ko:mieumjongseong": "\u11B7", + "/ko:mieumkiyeokjongseong": "\u11DA", + "/ko:mieumpansios": "\u3170", + "/ko:mieumpansiosjongseong": "\u11DF", + "/ko:mieumpieup": "\u316E", + "/ko:mieumpieupchoseong": "\u111C", + "/ko:mieumpieupjongseong": "\u11DC", + "/ko:mieumrieuljongseong": "\u11DB", + "/ko:mieumsios": "\u316F", + "/ko:mieumsiosjongseong": "\u11DD", + "/ko:mieumssangsiosjongseong": "\u11DE", + "/ko:nieun": "\u3134", + "/ko:nieunchoseong": "\u1102", + "/ko:nieuncieuc": "\u3135", + "/ko:nieuncieucchoseong": "\u115C", + "/ko:nieuncieucjongseong": "\u11AC", + "/ko:nieunhieuh": "\u3136", + "/ko:nieunhieuhchoseong": "\u115D", + "/ko:nieunhieuhjongseong": "\u11AD", + "/ko:nieunjongseong": "\u11AB", + "/ko:nieunkiyeokchoseong": "\u1113", + "/ko:nieunkiyeokjongseong": "\u11C5", + "/ko:nieunpansios": "\u3168", + "/ko:nieunpansiosjongseong": "\u11C8", + "/ko:nieunpieupchoseong": "\u1116", + "/ko:nieunsios": "\u3167", + "/ko:nieunsioschoseong": "\u115B", + "/ko:nieunsiosjongseong": "\u11C7", + "/ko:nieunthieuthjongseong": "\u11C9", + "/ko:nieuntikeut": "\u3166", + "/ko:nieuntikeutchoseong": "\u1115", + "/ko:nieuntikeutjongseong": "\u11C6", + "/ko:o": "\u3157", + "/ko:o_ejungseong": "\u1180", + "/ko:o_eojungseong": "\u117F", + "/ko:oe": "\u315A", + "/ko:oejungseong": "\u116C", + "/ko:ojungseong": "\u1169", + "/ko:oojungseong": "\u1182", + "/ko:oujungseong": "\u1183", + "/ko:oyaejungseong": "\u11A7", + "/ko:oyajungseong": "\u11A6", + "/ko:oyejungseong": "\u1181", + "/ko:pansios": "\u317F", + "/ko:pansioschoseong": "\u1140", + "/ko:pansiosjongseong": "\u11EB", + "/ko:phieuph": "\u314D", + "/ko:phieuphchoseong": "\u1111", + "/ko:phieuphjongseong": "\u11C1", + "/ko:phieuphpieupchoseong": "\u1156", + "/ko:phieuphpieupjongseong": "\u11F3", + "/ko:pieup": "\u3142", + "/ko:pieupchieuchchoseong": "\u1128", + "/ko:pieupchoseong": "\u1107", + "/ko:pieupcieuc": "\u3176", + "/ko:pieupcieucchoseong": "\u1127", + "/ko:pieuphieuhjongseong": "\u11E5", + "/ko:pieupjongseong": "\u11B8", + "/ko:pieupkiyeok": "\u3172", + "/ko:pieupkiyeokchoseong": "\u111E", + "/ko:pieupnieunchoseong": "\u111F", + "/ko:pieupphieuphchoseong": "\u112A", + "/ko:pieupphieuphjongseong": "\u11E4", + "/ko:pieuprieuljongseong": "\u11E3", + "/ko:pieupsios": "\u3144", + "/ko:pieupsioschoseong": "\u1121", + "/ko:pieupsioscieucchoseong": "\u1126", + "/ko:pieupsiosjongseong": "\u11B9", + "/ko:pieupsioskiyeok": "\u3174", + "/ko:pieupsioskiyeokchoseong": "\u1122", + "/ko:pieupsiospieupchoseong": "\u1124", + "/ko:pieupsiostikeut": "\u3175", + "/ko:pieupsiostikeutchoseong": "\u1123", + "/ko:pieupssangsioschoseong": "\u1125", + "/ko:pieupthieuth": "\u3177", + "/ko:pieupthieuthchoseong": "\u1129", + "/ko:pieuptikeut": "\u3173", + "/ko:pieuptikeutchoseong": "\u1120", + "/ko:rieul": "\u3139", + "/ko:rieulchoseong": "\u1105", + "/ko:rieulhieuh": "\u3140", + "/ko:rieulhieuhchoseong": "\u111A", + "/ko:rieulhieuhjongseong": "\u11B6", + "/ko:rieuljongseong": "\u11AF", + "/ko:rieulkapyeounpieupjongseong": "\u11D5", + "/ko:rieulkhieukhjongseong": "\u11D8", + "/ko:rieulkiyeok": "\u313A", + "/ko:rieulkiyeokjongseong": "\u11B0", + "/ko:rieulkiyeoksios": "\u3169", + "/ko:rieulkiyeoksiosjongseong": "\u11CC", + "/ko:rieulmieum": "\u313B", + "/ko:rieulmieumjongseong": "\u11B1", + "/ko:rieulmieumkiyeokjongseong": "\u11D1", + "/ko:rieulmieumsiosjongseong": "\u11D2", + "/ko:rieulnieunchoseong": "\u1118", + "/ko:rieulnieunjongseong": "\u11CD", + "/ko:rieulpansios": "\u316C", + "/ko:rieulpansiosjongseong": "\u11D7", + "/ko:rieulphieuph": "\u313F", + "/ko:rieulphieuphjongseong": "\u11B5", + "/ko:rieulpieup": "\u313C", + "/ko:rieulpieuphieuhjongseong": "\u11D4", + "/ko:rieulpieupjongseong": "\u11B2", + "/ko:rieulpieupsios": "\u316B", + "/ko:rieulpieupsiosjongseong": "\u11D3", + "/ko:rieulsios": "\u313D", + "/ko:rieulsiosjongseong": "\u11B3", + "/ko:rieulssangsiosjongseong": "\u11D6", + "/ko:rieulthieuth": "\u313E", + "/ko:rieulthieuthjongseong": "\u11B4", + "/ko:rieultikeut": "\u316A", + "/ko:rieultikeuthieuhjongseong": "\u11CF", + "/ko:rieultikeutjongseong": "\u11CE", + "/ko:rieulyeorinhieuh": "\u316D", + "/ko:rieulyeorinhieuhjongseong": "\u11D9", + "/ko:sios": "\u3145", + "/ko:sioschieuchchoseong": "\u1137", + "/ko:sioschoseong": "\u1109", + "/ko:sioscieuc": "\u317E", + "/ko:sioscieucchoseong": "\u1136", + "/ko:sioshieuhchoseong": "\u113B", + "/ko:siosieungchoseong": "\u1135", + "/ko:siosjongseong": "\u11BA", + "/ko:sioskhieukhchoseong": "\u1138", + "/ko:sioskiyeok": "\u317A", + "/ko:sioskiyeokchoseong": "\u112D", + "/ko:sioskiyeokjongseong": "\u11E7", + "/ko:siosmieumchoseong": "\u1131", + "/ko:siosnieun": "\u317B", + "/ko:siosnieunchoseong": "\u112E", + "/ko:siosphieuphchoseong": "\u113A", + "/ko:siospieup": "\u317D", + "/ko:siospieupchoseong": "\u1132", + "/ko:siospieupjongseong": "\u11EA", + "/ko:siospieupkiyeokchoseong": "\u1133", + "/ko:siosrieulchoseong": "\u1130", + "/ko:siosrieuljongseong": "\u11E9", + "/ko:siosssangsioschoseong": "\u1134", + "/ko:siosthieuthchoseong": "\u1139", + "/ko:siostikeut": "\u317C", + "/ko:siostikeutchoseong": "\u112F", + "/ko:siostikeutjongseong": "\u11E8", + "/ko:ssangaraeajungseong": "\u11A2", + "/ko:ssangcieuc": "\u3149", + "/ko:ssangcieucchoseong": "\u110D", + "/ko:ssanghieuh": "\u3185", + "/ko:ssanghieuhchoseong": "\u1158", + "/ko:ssangieung": "\u3180", + "/ko:ssangieungchoseong": "\u1147", + "/ko:ssangieungjongseong": "\u11EE", + "/ko:ssangkiyeok": "\u3132", + "/ko:ssangkiyeokchoseong": "\u1101", + "/ko:ssangkiyeokjongseong": "\u11A9", + "/ko:ssangnieun": "\u3165", + "/ko:ssangnieunchoseong": "\u1114", + "/ko:ssangnieunjongseong": "\u11FF", + "/ko:ssangpieup": "\u3143", + "/ko:ssangpieupchoseong": "\u1108", + "/ko:ssangrieulchoseong": "\u1119", + "/ko:ssangrieuljongseong": "\u11D0", + "/ko:ssangsios": "\u3146", + "/ko:ssangsioschoseong": "\u110A", + "/ko:ssangsiosjongseong": "\u11BB", + "/ko:ssangtikeut": "\u3138", + "/ko:ssangtikeutchoseong": "\u1104", + "/ko:thieuth": "\u314C", + "/ko:thieuthchoseong": "\u1110", + "/ko:thieuthjongseong": "\u11C0", + "/ko:tikeut": "\u3137", + "/ko:tikeutchoseong": "\u1103", + "/ko:tikeutjongseong": "\u11AE", + "/ko:tikeutkiyeokchoseong": "\u1117", + "/ko:tikeutkiyeokjongseong": "\u11CA", + "/ko:tikeutrieulchoseong": "\u115E", + "/ko:tikeutrieuljongseong": "\u11CB", + "/ko:u": "\u315C", + "/ko:uaejungseong": "\u118A", + "/ko:uajungseong": "\u1189", + "/ko:ueo_eujungseong": "\u118B", + "/ko:ujungseong": "\u116E", + "/ko:uujungseong": "\u118D", + "/ko:uyejungseong": "\u118C", + "/ko:wa": "\u3158", + "/ko:wae": "\u3159", + "/ko:waejungseong": "\u116B", + "/ko:wajungseong": "\u116A", + "/ko:we": "\u315E", + "/ko:wejungseong": "\u1170", + "/ko:weo": "\u315D", + "/ko:weojungseong": "\u116F", + "/ko:wi": "\u315F", + "/ko:wijungseong": "\u1171", + "/ko:ya": "\u3151", + "/ko:yae": "\u3152", + "/ko:yaejungseong": "\u1164", + "/ko:yajungseong": "\u1163", + "/ko:yaojungseong": "\u1178", + "/ko:yaujungseong": "\u11A4", + "/ko:yayojungseong": "\u1179", + "/ko:ye": "\u3156", + "/ko:yejungseong": "\u1168", + "/ko:yeo": "\u3155", + "/ko:yeojungseong": "\u1167", + "/ko:yeoojungseong": "\u117D", + "/ko:yeorinhieuh": "\u3186", + "/ko:yeorinhieuhchoseong": "\u1159", + "/ko:yeorinhieuhjongseong": "\u11F9", + "/ko:yeoujungseong": "\u117E", + "/ko:yeoyajungseong": "\u11A5", + "/ko:yesieung": "\u3181", + "/ko:yesieungchoseong": "\u114C", + "/ko:yesieungjongseong": "\u11F0", + "/ko:yesieungpansios": "\u3183", + "/ko:yesieungpansiosjongseong": "\u11F2", + "/ko:yesieungsios": "\u3182", + "/ko:yesieungsiosjongseong": "\u11F1", + "/ko:yi": "\u3162", + "/ko:yijungseong": "\u1174", + "/ko:yiujungseong": "\u1197", + "/ko:yo": "\u315B", + "/ko:yoi": "\u3189", + "/ko:yoijungseong": "\u1188", + "/ko:yojungseong": "\u116D", + "/ko:yoojungseong": "\u1187", + "/ko:yoya": "\u3187", + "/ko:yoyae": "\u3188", + "/ko:yoyaejungseong": "\u1185", + "/ko:yoyajungseong": "\u1184", + "/ko:yoyeojungseong": "\u1186", + "/ko:yu": "\u3160", + "/ko:yuajungseong": "\u118E", + "/ko:yuejungseong": "\u1190", + "/ko:yueojungseong": "\u118F", + "/ko:yui": "\u318C", + "/ko:yuijungseong": "\u1194", + "/ko:yujungseong": "\u1172", + "/ko:yuujungseong": "\u1193", + "/ko:yuye": "\u318B", + "/ko:yuyejungseong": "\u1192", + "/ko:yuyeo": "\u318A", + "/ko:yuyeojungseong": "\u1191", + "/koala": "\u1F428", + "/kobliquestroke": "\uA7A3", + "/kocirclekatakana": "\u32D9", + "/kohiragana": "\u3053", + "/kohmfullwidth": "\u33C0", + "/kohmsquare": "\u33C0", + "/kokaithai": "\u0E01", + "/kokatakana": "\u30B3", + "/kokatakanahalfwidth": "\uFF7A", + "/kooposquare": "\u331E", + "/koppa": "\u03DF", + "/koppaarchaic": "\u03D9", + "/koppacyr": "\u0481", + "/koppacyrillic": "\u0481", + "/koreanstandardsymbol": "\u327F", + "/koroniscmb": "\u0343", + "/korunasquare": "\u331D", + "/kotoideographiccircled": "\u3247", + "/kpafullwidth": "\u33AA", + "/kparen": "\u24A6", + "/kparenthesized": "\u24A6", + "/kpasquare": "\u33AA", + "/kra": "\u0138", + "/ksicyr": "\u046F", + "/ksicyrillic": "\u046F", + "/kstroke": "\uA741", + "/kstrokediagonalstroke": "\uA745", + "/ktfullwidth": "\u33CF", + "/ktsquare": "\u33CF", + "/kturned": "\u029E", + "/kucirclekatakana": "\u32D7", + "/kuhiragana": "\u304F", + "/kukatakana": "\u30AF", + "/kukatakanahalfwidth": "\uFF78", + "/kuroonesquare": "\u331B", + "/kuruzeirosquare": "\u331A", + "/kvfullwidth": "\u33B8", + "/kvsquare": "\u33B8", + "/kwfullwidth": "\u33BE", + "/kwsquare": "\u33BE", + "/kyuriisquare": "\u3312", + "/l": "\u006C", + "/l.inferior": "\u2097", + "/label": "\u1F3F7", + "/labengali": "\u09B2", + "/laborideographiccircled": "\u3298", + "/laborideographicparen": "\u3238", + "/lacute": "\u013A", + "/ladeva": "\u0932", + "/ladyBeetle": "\u1F41E", + "/lagujarati": "\u0AB2", + "/lagurmukhi": "\u0A32", + "/lakkhangyaothai": "\u0E45", + "/lam": "\u0644", + "/lam.fina": "\uFEDE", + "/lam.init": "\uFEDF", + "/lam.init_alef.fina": "\uFEFB", + "/lam.init_alef.medi_hamzaabove.fina": "\uFEF7", + "/lam.init_alef.medi_hamzabelow.fina": "\uFEF9", + "/lam.init_alef.medi_maddaabove.fina": "\uFEF5", + "/lam.init_alefmaksura.fina": "\uFC43", + "/lam.init_hah.fina": "\uFC40", + "/lam.init_hah.medi": "\uFCCA", + "/lam.init_hah.medi_meem.medi": "\uFDB5", + "/lam.init_heh.medi": "\uFCCD", + "/lam.init_jeem.fina": "\uFC3F", + "/lam.init_jeem.medi": "\uFCC9", + "/lam.init_jeem.medi_jeem.medi": "\uFD83", + "/lam.init_jeem.medi_meem.medi": "\uFDBA", + "/lam.init_khah.fina": "\uFC41", + "/lam.init_khah.medi": "\uFCCB", + "/lam.init_khah.medi_meem.medi": "\uFD86", + "/lam.init_meem.fina": "\uFC42", + "/lam.init_meem.medi": "\uFCCC", + "/lam.init_meem.medi_hah.medi": "\uFD88", + "/lam.init_yeh.fina": "\uFC44", + "/lam.isol": "\uFEDD", + "/lam.medi": "\uFEE0", + "/lam.medi_alef.fina": "\uFEFC", + "/lam.medi_alef.medi_hamzaabove.fina": "\uFEF8", + "/lam.medi_alef.medi_hamzabelow.fina": "\uFEFA", + "/lam.medi_alef.medi_maddaabove.fina": "\uFEF6", + "/lam.medi_alefmaksura.fina": "\uFC86", + "/lam.medi_hah.medi_alefmaksura.fina": "\uFD82", + "/lam.medi_hah.medi_meem.fina": "\uFD80", + "/lam.medi_hah.medi_yeh.fina": "\uFD81", + "/lam.medi_jeem.medi_jeem.fina": "\uFD84", + "/lam.medi_jeem.medi_meem.fina": "\uFDBC", + "/lam.medi_jeem.medi_yeh.fina": "\uFDAC", + "/lam.medi_khah.medi_meem.fina": "\uFD85", + "/lam.medi_meem.fina": "\uFC85", + "/lam.medi_meem.medi": "\uFCED", + "/lam.medi_meem.medi_hah.fina": "\uFD87", + "/lam.medi_meem.medi_yeh.fina": "\uFDAD", + "/lam.medi_yeh.fina": "\uFC87", + "/lamBar": "\u076A", + "/lamVabove": "\u06B5", + "/lamalefabove": "\u06D9", + "/lamaleffinalarabic": "\uFEFC", + "/lamalefhamzaabovefinalarabic": "\uFEF8", + "/lamalefhamzaaboveisolatedarabic": "\uFEF7", + "/lamalefhamzabelowfinalarabic": "\uFEFA", + "/lamalefhamzabelowisolatedarabic": "\uFEF9", + "/lamalefisolatedarabic": "\uFEFB", + "/lamalefmaddaabovefinalarabic": "\uFEF6", + "/lamalefmaddaaboveisolatedarabic": "\uFEF5", + "/lamarabic": "\u0644", + "/lambda": "\u03BB", + "/lambdastroke": "\u019B", + "/lamdotabove": "\u06B6", + "/lamed": "\u05DC", + "/lamed:hb": "\u05DC", + "/lameddagesh": "\uFB3C", + "/lameddageshhebrew": "\uFB3C", + "/lamedhebrew": "\u05DC", + "/lamedholam": "\u05DC", + "/lamedholamdagesh": "\u05DC", + "/lamedholamdageshhebrew": "\u05DC", + "/lamedholamhebrew": "\u05DC", + "/lamedwide:hb": "\uFB25", + "/lamedwithdagesh:hb": "\uFB3C", + "/lamfinalarabic": "\uFEDE", + "/lamhahinitialarabic": "\uFCCA", + "/laminitialarabic": "\uFEDF", + "/lamjeeminitialarabic": "\uFCC9", + "/lamkhahinitialarabic": "\uFCCB", + "/lamlamhehisolatedarabic": "\uFDF2", + "/lammedialarabic": "\uFEE0", + "/lammeemhahinitialarabic": "\uFD88", + "/lammeeminitialarabic": "\uFCCC", + "/lammeemjeeminitialarabic": "\uFEDF", + "/lammeemkhahinitialarabic": "\uFEDF", + "/lamthreedotsabove": "\u06B7", + "/lamthreedotsbelow": "\u06B8", + "/lanemergeleftblack": "\u26D8", + "/lanemergeleftwhite": "\u26D9", + "/largeBlueCircle": "\u1F535", + "/largeBlueDiamond": "\u1F537", + "/largeOrangeDiamond": "\u1F536", + "/largeRedCircle": "\u1F534", + "/largecircle": "\u25EF", + "/largetackdown": "\u27D9", + "/largetackup": "\u27D8", + "/lari": "\u20BE", + "/lastQuarterMoon": "\u1F317", + "/lastQuarterMoonFace": "\u1F31C", + "/lastquartermoon": "\u263E", + "/layar": "\uA982", + "/lazysinverted": "\u223E", + "/lbar": "\u019A", + "/lbbar": "\u2114", + "/lbelt": "\u026C", + "/lbeltretroflex": "\uA78E", + "/lbopomofo": "\u310C", + "/lbroken": "\uA747", + "/lcaron": "\u013E", + "/lcedilla": "\u013C", + "/lcircle": "\u24DB", + "/lcircumflexbelow": "\u1E3D", + "/lcommaaccent": "\u013C", + "/lcurl": "\u0234", + "/ldblbar": "\u2C61", + "/ldot": "\u0140", + "/ldotaccent": "\u0140", + "/ldotbelow": "\u1E37", + "/ldotbelowmacron": "\u1E39", + "/leafFlutteringInWind": "\u1F343", + "/ledger": "\u1F4D2", + "/left-pointingMagnifyingGlass": "\u1F50D", + "/leftAngerBubble": "\u1F5EE", + "/leftFiveEighthsBlock": "\u258B", + "/leftHalfBlock": "\u258C", + "/leftHandTelephoneReceiver": "\u1F57B", + "/leftLuggage": "\u1F6C5", + "/leftOneEighthBlock": "\u258F", + "/leftOneQuarterBlock": "\u258E", + "/leftSevenEighthsBlock": "\u2589", + "/leftSpeechBubble": "\u1F5E8", + "/leftThoughtBubble": "\u1F5EC", + "/leftThreeEighthsBlock": "\u258D", + "/leftThreeQuartersBlock": "\u258A", + "/leftWritingHand": "\u1F58E", + "/leftangleabovecmb": "\u031A", + "/leftarrowoverrightarrow": "\u21C6", + "/leftdnheavyrightuplight": "\u2545", + "/leftharpoonoverrightharpoon": "\u21CB", + "/leftheavyrightdnlight": "\u252D", + "/leftheavyrightuplight": "\u2535", + "/leftheavyrightvertlight": "\u253D", + "/leftideographiccircled": "\u32A7", + "/leftlightrightdnheavy": "\u2532", + "/leftlightrightupheavy": "\u253A", + "/leftlightrightvertheavy": "\u254A", + "/lefttackbelowcmb": "\u0318", + "/lefttorightembed": "\u202A", + "/lefttorightisolate": "\u2066", + "/lefttorightmark": "\u200E", + "/lefttorightoverride": "\u202D", + "/leftupheavyrightdnlight": "\u2543", + "/lemon": "\u1F34B", + "/lenis": "\u1FBF", + "/lenisacute": "\u1FCE", + "/lenisgrave": "\u1FCD", + "/lenistilde": "\u1FCF", + "/leo": "\u264C", + "/leopard": "\u1F406", + "/less": "\u003C", + "/lessbutnotequal": "\u2268", + "/lessbutnotequivalent": "\u22E6", + "/lessdot": "\u22D6", + "/lessequal": "\u2264", + "/lessequalorgreater": "\u22DA", + "/lessmonospace": "\uFF1C", + "/lessorequivalent": "\u2272", + "/lessorgreater": "\u2276", + "/lessoverequal": "\u2266", + "/lesssmall": "\uFE64", + "/levelSlider": "\u1F39A", + "/lezh": "\u026E", + "/lfblock": "\u258C", + "/lhacyr": "\u0515", + "/lhookretroflex": "\u026D", + "/libra": "\u264E", + "/ligaturealeflamed:hb": "\uFB4F", + "/ligatureoemod": "\uA7F9", + "/lightCheckMark": "\u1F5F8", + "/lightRail": "\u1F688", + "/lightShade": "\u2591", + "/lightarcdnleft": "\u256E", + "/lightarcdnright": "\u256D", + "/lightarcupleft": "\u256F", + "/lightarcupright": "\u2570", + "/lightdbldashhorz": "\u254C", + "/lightdbldashvert": "\u254E", + "/lightdiagcross": "\u2573", + "/lightdiagupleftdnright": "\u2572", + "/lightdiaguprightdnleft": "\u2571", + "/lightdn": "\u2577", + "/lightdnhorz": "\u252C", + "/lightdnleft": "\u2510", + "/lightdnright": "\u250C", + "/lighthorz": "\u2500", + "/lightleft": "\u2574", + "/lightleftheavyright": "\u257C", + "/lightning": "\u2607", + "/lightningMood": "\u1F5F2", + "/lightningMoodBubble": "\u1F5F1", + "/lightquaddashhorz": "\u2508", + "/lightquaddashvert": "\u250A", + "/lightright": "\u2576", + "/lighttrpldashhorz": "\u2504", + "/lighttrpldashvert": "\u2506", + "/lightup": "\u2575", + "/lightupheavydn": "\u257D", + "/lightuphorz": "\u2534", + "/lightupleft": "\u2518", + "/lightupright": "\u2514", + "/lightvert": "\u2502", + "/lightverthorz": "\u253C", + "/lightvertleft": "\u2524", + "/lightvertright": "\u251C", + "/lineextensionhorizontal": "\u23AF", + "/lineextensionvertical": "\u23D0", + "/linemiddledotvertical": "\u237F", + "/lineseparator": "\u2028", + "/lingsapada": "\uA9C8", + "/link": "\u1F517", + "/linkedPaperclips": "\u1F587", + "/lips": "\u1F5E2", + "/lipstick": "\u1F484", + "/lira": "\u20A4", + "/litre": "\u2113", + "/livretournois": "\u20B6", + "/liwnarmenian": "\u056C", + "/lj": "\u01C9", + "/ljecyr": "\u0459", + "/ljecyrillic": "\u0459", + "/ljekomicyr": "\u0509", + "/ll": "\uF6C0", + "/lladeva": "\u0933", + "/llagujarati": "\u0AB3", + "/llinebelow": "\u1E3B", + "/llladeva": "\u0934", + "/llvocalicbengali": "\u09E1", + "/llvocalicdeva": "\u0961", + "/llvocalicvowelsignbengali": "\u09E3", + "/llvocalicvowelsigndeva": "\u0963", + "/llwelsh": "\u1EFB", + "/lmacrondot": "\u1E39", + "/lmfullwidth": "\u33D0", + "/lmiddletilde": "\u026B", + "/lmonospace": "\uFF4C", + "/lmsquare": "\u33D0", + "/lnfullwidth": "\u33D1", + "/lochulathai": "\u0E2C", + "/lock": "\u1F512", + "/lockInkPen": "\u1F50F", + "/logfullwidth": "\u33D2", + "/logicaland": "\u2227", + "/logicalandarray": "\u22C0", + "/logicalnot": "\u00AC", + "/logicalnotreversed": "\u2310", + "/logicalor": "\u2228", + "/logicalorarray": "\u22C1", + "/lolingthai": "\u0E25", + "/lollipop": "\u1F36D", + "/longdivision": "\u27CC", + "/longovershortmetrical": "\u23D2", + "/longovertwoshortsmetrical": "\u23D4", + "/longs": "\u017F", + "/longs_t": "\uFB05", + "/longsdot": "\u1E9B", + "/longswithdiagonalstroke": "\u1E9C", + "/longswithhighstroke": "\u1E9D", + "/longtackleft": "\u27DE", + "/longtackright": "\u27DD", + "/losslesssquare": "\u1F1A9", + "/loudlyCryingFace": "\u1F62D", + "/loveHotel": "\u1F3E9", + "/loveLetter": "\u1F48C", + "/lowBrightness": "\u1F505", + "/lowasterisk": "\u204E", + "/lowerFiveEighthsBlock": "\u2585", + "/lowerHalfBlock": "\u2584", + "/lowerLeftBallpointPen": "\u1F58A", + "/lowerLeftCrayon": "\u1F58D", + "/lowerLeftFountainPen": "\u1F58B", + "/lowerLeftPaintbrush": "\u1F58C", + "/lowerLeftPencil": "\u1F589", + "/lowerOneEighthBlock": "\u2581", + "/lowerOneQuarterBlock": "\u2582", + "/lowerRightShadowedWhiteCircle": "\u1F53E", + "/lowerSevenEighthsBlock": "\u2587", + "/lowerThreeEighthsBlock": "\u2583", + "/lowerThreeQuartersBlock": "\u2586", + "/lowercornerdotright": "\u27D3", + "/lowerhalfcircle": "\u25E1", + "/lowerhalfcircleinversewhite": "\u25DB", + "/lowerquadrantcirculararcleft": "\u25DF", + "/lowerquadrantcirculararcright": "\u25DE", + "/lowertriangleleft": "\u25FA", + "/lowertriangleleftblack": "\u25E3", + "/lowertriangleright": "\u25FF", + "/lowertrianglerightblack": "\u25E2", + "/lowideographiccircled": "\u32A6", + "/lowlinecenterline": "\uFE4E", + "/lowlinecmb": "\u0332", + "/lowlinedashed": "\uFE4D", + "/lownumeralsign": "\u0375", + "/lowquotedblprime": "\u301F", + "/lozenge": "\u25CA", + "/lozengedividedbyrulehorizontal": "\u27E0", + "/lozengesquare": "\u2311", + "/lparen": "\u24A7", + "/lparenthesized": "\u24A7", + "/lretroflex": "\u026D", + "/ls": "\u02AA", + "/lslash": "\u0142", + "/lsquare": "\u2113", + "/lstroke": "\uA749", + "/lsuperior": "\uF6EE", + "/lsupmod": "\u02E1", + "/lt:Alpha": "\u2C6D", + "/lt:Alphaturned": "\u2C70", + "/lt:Beta": "\uA7B4", + "/lt:Chi": "\uA7B3", + "/lt:Gamma": "\u0194", + "/lt:Iota": "\u0196", + "/lt:Omega": "\uA7B6", + "/lt:Upsilon": "\u01B1", + "/lt:beta": "\uA7B5", + "/lt:delta": "\u1E9F", + "/lt:omega": "\uA7B7", + "/ltshade": "\u2591", + "/lttr:bet": "\u2136", + "/lttr:dalet": "\u2138", + "/lttr:gimel": "\u2137", + "/lttr:gscript": "\u210A", + "/lturned": "\uA781", + "/ltypeopencircuit": "\u2390", + "/luhurpada": "\uA9C5", + "/lum": "\uA772", + "/lungsipada": "\uA9C9", + "/luthai": "\u0E26", + "/lvocalicbengali": "\u098C", + "/lvocalicdeva": "\u090C", + "/lvocalicvowelsignbengali": "\u09E2", + "/lvocalicvowelsigndeva": "\u0962", + "/lxfullwidth": "\u33D3", + "/lxsquare": "\u33D3", + "/lzed": "\u02AB", + "/m": "\u006D", + "/m.inferior": "\u2098", + "/m2fullwidth": "\u33A1", + "/m3fullwidth": "\u33A5", + "/mabengali": "\u09AE", + "/macirclekatakana": "\u32EE", + "/macron": "\u00AF", + "/macronbelowcmb": "\u0331", + "/macroncmb": "\u0304", + "/macronlowmod": "\u02CD", + "/macronmod": "\u02C9", + "/macronmonospace": "\uFFE3", + "/macute": "\u1E3F", + "/madda": "\u0653", + "/maddaabove": "\u06E4", + "/madeva": "\u092E", + "/madyapada": "\uA9C4", + "/mafullwidth": "\u3383", + "/magujarati": "\u0AAE", + "/magurmukhi": "\u0A2E", + "/mahapakhhebrew": "\u05A4", + "/mahapakhlefthebrew": "\u05A4", + "/mahhasquare": "\u3345", + "/mahiragana": "\u307E", + "/mahpach:hb": "\u05A4", + "/maichattawalowleftthai": "\uF895", + "/maichattawalowrightthai": "\uF894", + "/maichattawathai": "\u0E4B", + "/maichattawaupperleftthai": "\uF893", + "/maieklowleftthai": "\uF88C", + "/maieklowrightthai": "\uF88B", + "/maiekthai": "\u0E48", + "/maiekupperleftthai": "\uF88A", + "/maihanakatleftthai": "\uF884", + "/maihanakatthai": "\u0E31", + "/maikurosquare": "\u3343", + "/mairusquare": "\u3344", + "/maitaikhuleftthai": "\uF889", + "/maitaikhuthai": "\u0E47", + "/maitholowleftthai": "\uF88F", + "/maitholowrightthai": "\uF88E", + "/maithothai": "\u0E49", + "/maithoupperleftthai": "\uF88D", + "/maitrilowleftthai": "\uF892", + "/maitrilowrightthai": "\uF891", + "/maitrithai": "\u0E4A", + "/maitriupperleftthai": "\uF890", + "/maiyamokthai": "\u0E46", + "/makatakana": "\u30DE", + "/makatakanahalfwidth": "\uFF8F", + "/male": "\u2642", + "/malefemale": "\u26A5", + "/maleideographiccircled": "\u329A", + "/malestroke": "\u26A6", + "/malestrokemalefemale": "\u26A7", + "/man": "\u1F468", + "/manAndWomanHoldingHands": "\u1F46B", + "/manDancing": "\u1F57A", + "/manGuaPiMao": "\u1F472", + "/manInBusinessSuitLevitating": "\u1F574", + "/manTurban": "\u1F473", + "/manat": "\u20BC", + "/mansShoe": "\u1F45E", + "/mansyonsquare": "\u3347", + "/mantelpieceClock": "\u1F570", + "/mapleLeaf": "\u1F341", + "/maplighthouse": "\u26EF", + "/maqaf:hb": "\u05BE", + "/maqafhebrew": "\u05BE", + "/marchtelegraph": "\u32C2", + "/mark": "\u061C", + "/markerdottedraisedinterpolation": "\u2E07", + "/markerdottedtransposition": "\u2E08", + "/markerraisedinterpolation": "\u2E06", + "/marknoonghunna": "\u0658", + "/marksChapter": "\u1F545", + "/marriage": "\u26AD", + "/mars": "\u2642", + "/marukusquare": "\u3346", + "/masoraCircle:hb": "\u05AF", + "/masoracirclehebrew": "\u05AF", + "/masquare": "\u3383", + "/masumark": "\u303C", + "/math:bowtie": "\u22C8", + "/math:cuberoot": "\u221B", + "/math:fourthroot": "\u221C", + "/maximize": "\u1F5D6", + "/maytelegraph": "\u32C4", + "/mbfullwidth": "\u3386", + "/mbopomofo": "\u3107", + "/mbsmallfullwidth": "\u33D4", + "/mbsquare": "\u33D4", + "/mcircle": "\u24DC", + "/mcubedsquare": "\u33A5", + "/mdot": "\u1E41", + "/mdotaccent": "\u1E41", + "/mdotbelow": "\u1E43", + "/measuredangle": "\u2221", + "/measuredby": "\u225E", + "/meatOnBone": "\u1F356", + "/mecirclekatakana": "\u32F1", + "/medicineideographiccircled": "\u32A9", + "/mediumShade": "\u2592", + "/mediumcircleblack": "\u26AB", + "/mediumcirclewhite": "\u26AA", + "/mediummathematicalspace": "\u205F", + "/mediumsmallcirclewhite": "\u26AC", + "/meem": "\u0645", + "/meem.fina": "\uFEE2", + "/meem.init": "\uFEE3", + "/meem.init_alefmaksura.fina": "\uFC49", + "/meem.init_hah.fina": "\uFC46", + "/meem.init_hah.medi": "\uFCCF", + "/meem.init_hah.medi_jeem.medi": "\uFD89", + "/meem.init_hah.medi_meem.medi": "\uFD8A", + "/meem.init_jeem.fina": "\uFC45", + "/meem.init_jeem.medi": "\uFCCE", + "/meem.init_jeem.medi_hah.medi": "\uFD8C", + "/meem.init_jeem.medi_khah.medi": "\uFD92", + "/meem.init_jeem.medi_meem.medi": "\uFD8D", + "/meem.init_khah.fina": "\uFC47", + "/meem.init_khah.medi": "\uFCD0", + "/meem.init_khah.medi_jeem.medi": "\uFD8E", + "/meem.init_khah.medi_meem.medi": "\uFD8F", + "/meem.init_meem.fina": "\uFC48", + "/meem.init_meem.medi": "\uFCD1", + "/meem.init_yeh.fina": "\uFC4A", + "/meem.isol": "\uFEE1", + "/meem.medi": "\uFEE4", + "/meem.medi_alef.fina": "\uFC88", + "/meem.medi_hah.medi_yeh.fina": "\uFD8B", + "/meem.medi_jeem.medi_yeh.fina": "\uFDC0", + "/meem.medi_khah.medi_yeh.fina": "\uFDB9", + "/meem.medi_meem.fina": "\uFC89", + "/meem.medi_meem.medi_yeh.fina": "\uFDB1", + "/meemDotAbove": "\u0765", + "/meemDotBelow": "\u0766", + "/meemabove": "\u06E2", + "/meemabove.init": "\u06D8", + "/meemarabic": "\u0645", + "/meembelow": "\u06ED", + "/meemfinalarabic": "\uFEE2", + "/meeminitialarabic": "\uFEE3", + "/meemmedialarabic": "\uFEE4", + "/meemmeeminitialarabic": "\uFCD1", + "/meemmeemisolatedarabic": "\uFC48", + "/meetorusquare": "\u334D", + "/megasquare": "\u334B", + "/megatonsquare": "\u334C", + "/mehiragana": "\u3081", + "/meizierasquare": "\u337E", + "/mekatakana": "\u30E1", + "/mekatakanahalfwidth": "\uFF92", + "/melon": "\u1F348", + "/mem": "\u05DE", + "/mem:hb": "\u05DE", + "/memdagesh": "\uFB3E", + "/memdageshhebrew": "\uFB3E", + "/memhebrew": "\u05DE", + "/memo": "\u1F4DD", + "/memwithdagesh:hb": "\uFB3E", + "/menarmenian": "\u0574", + "/menorahNineBranches": "\u1F54E", + "/menpostSindhi": "\u06FE", + "/mens": "\u1F6B9", + "/mepigraphicinverted": "\uA7FD", + "/mercha:hb": "\u05A5", + "/merchaKefulah:hb": "\u05A6", + "/mercury": "\u263F", + "/merkhahebrew": "\u05A5", + "/merkhakefulahebrew": "\u05A6", + "/merkhakefulalefthebrew": "\u05A6", + "/merkhalefthebrew": "\u05A5", + "/metalideographiccircled": "\u328E", + "/metalideographicparen": "\u322E", + "/meteg:hb": "\u05BD", + "/metro": "\u1F687", + "/mgfullwidth": "\u338E", + "/mhook": "\u0271", + "/mhzfullwidth": "\u3392", + "/mhzsquare": "\u3392", + "/micirclekatakana": "\u32EF", + "/microphone": "\u1F3A4", + "/microscope": "\u1F52C", + "/middledotkatakanahalfwidth": "\uFF65", + "/middot": "\u00B7", + "/mieumacirclekorean": "\u3272", + "/mieumaparenkorean": "\u3212", + "/mieumcirclekorean": "\u3264", + "/mieumkorean": "\u3141", + "/mieumpansioskorean": "\u3170", + "/mieumparenkorean": "\u3204", + "/mieumpieupkorean": "\u316E", + "/mieumsioskorean": "\u316F", + "/mihiragana": "\u307F", + "/mikatakana": "\u30DF", + "/mikatakanahalfwidth": "\uFF90", + "/mikuronsquare": "\u3348", + "/milfullwidth": "\u33D5", + "/militaryMedal": "\u1F396", + "/milkyWay": "\u1F30C", + "/mill": "\u20A5", + "/millionscmbcyr": "\u0489", + "/millisecond": "\u2034", + "/millisecondreversed": "\u2037", + "/minibus": "\u1F690", + "/minidisc": "\u1F4BD", + "/minimize": "\u1F5D5", + "/minus": "\u2212", + "/minus.inferior": "\u208B", + "/minus.superior": "\u207B", + "/minusbelowcmb": "\u0320", + "/minuscircle": "\u2296", + "/minusmod": "\u02D7", + "/minusplus": "\u2213", + "/minussignmod": "\u02D7", + "/minustilde": "\u2242", + "/minute": "\u2032", + "/minutereversed": "\u2035", + "/miribaarusquare": "\u334A", + "/mirisquare": "\u3349", + "/misc:baby": "\u1F476", + "/misc:bell": "\u1F514", + "/misc:dash": "\u1F4A8", + "/misc:decimalseparator": "\u2396", + "/misc:diamondblack": "\u2666", + "/misc:diamondwhite": "\u2662", + "/misc:ear": "\u1F442", + "/misc:om": "\u1F549", + "/misc:ring": "\u1F48D", + "/misra": "\u060F", + "/mlfullwidth": "\u3396", + "/mlonglegturned": "\u0270", + "/mlsquare": "\u3396", + "/mlym:a": "\u0D05", + "/mlym:aa": "\u0D06", + "/mlym:aasign": "\u0D3E", + "/mlym:ai": "\u0D10", + "/mlym:aisign": "\u0D48", + "/mlym:anusvarasign": "\u0D02", + "/mlym:archaicii": "\u0D5F", + "/mlym:au": "\u0D14", + "/mlym:aulength": "\u0D57", + "/mlym:ausign": "\u0D4C", + "/mlym:avagrahasign": "\u0D3D", + "/mlym:ba": "\u0D2C", + "/mlym:bha": "\u0D2D", + "/mlym:ca": "\u0D1A", + "/mlym:candrabindusign": "\u0D01", + "/mlym:cha": "\u0D1B", + "/mlym:circularviramasign": "\u0D3C", + "/mlym:combininganusvaraabovesign": "\u0D00", + "/mlym:da": "\u0D26", + "/mlym:date": "\u0D79", + "/mlym:dda": "\u0D21", + "/mlym:ddha": "\u0D22", + "/mlym:dha": "\u0D27", + "/mlym:dotreph": "\u0D4E", + "/mlym:e": "\u0D0E", + "/mlym:ee": "\u0D0F", + "/mlym:eesign": "\u0D47", + "/mlym:eight": "\u0D6E", + "/mlym:esign": "\u0D46", + "/mlym:five": "\u0D6B", + "/mlym:four": "\u0D6A", + "/mlym:ga": "\u0D17", + "/mlym:gha": "\u0D18", + "/mlym:ha": "\u0D39", + "/mlym:i": "\u0D07", + "/mlym:ii": "\u0D08", + "/mlym:iisign": "\u0D40", + "/mlym:isign": "\u0D3F", + "/mlym:ja": "\u0D1C", + "/mlym:jha": "\u0D1D", + "/mlym:ka": "\u0D15", + "/mlym:kchillu": "\u0D7F", + "/mlym:kha": "\u0D16", + "/mlym:la": "\u0D32", + "/mlym:lchillu": "\u0D7D", + "/mlym:lla": "\u0D33", + "/mlym:llchillu": "\u0D7E", + "/mlym:llla": "\u0D34", + "/mlym:lllchillu": "\u0D56", + "/mlym:llvocal": "\u0D61", + "/mlym:llvocalsign": "\u0D63", + "/mlym:lvocal": "\u0D0C", + "/mlym:lvocalsign": "\u0D62", + "/mlym:ma": "\u0D2E", + "/mlym:mchillu": "\u0D54", + "/mlym:na": "\u0D28", + "/mlym:nchillu": "\u0D7B", + "/mlym:nga": "\u0D19", + "/mlym:nine": "\u0D6F", + "/mlym:nna": "\u0D23", + "/mlym:nnchillu": "\u0D7A", + "/mlym:nnna": "\u0D29", + "/mlym:nya": "\u0D1E", + "/mlym:o": "\u0D12", + "/mlym:one": "\u0D67", + "/mlym:oneeighth": "\u0D77", + "/mlym:onefifth": "\u0D5E", + "/mlym:onefortieth": "\u0D59", + "/mlym:onehalf": "\u0D74", + "/mlym:onehundred": "\u0D71", + "/mlym:oneone-hundred-and-sixtieth": "\u0D58", + "/mlym:onequarter": "\u0D73", + "/mlym:onesixteenth": "\u0D76", + "/mlym:onetenth": "\u0D5C", + "/mlym:onethousand": "\u0D72", + "/mlym:onetwentieth": "\u0D5B", + "/mlym:oo": "\u0D13", + "/mlym:oosign": "\u0D4B", + "/mlym:osign": "\u0D4A", + "/mlym:pa": "\u0D2A", + "/mlym:parasign": "\u0D4F", + "/mlym:pha": "\u0D2B", + "/mlym:ra": "\u0D30", + "/mlym:rra": "\u0D31", + "/mlym:rrchillu": "\u0D7C", + "/mlym:rrvocal": "\u0D60", + "/mlym:rrvocalsign": "\u0D44", + "/mlym:rvocal": "\u0D0B", + "/mlym:rvocalsign": "\u0D43", + "/mlym:sa": "\u0D38", + "/mlym:seven": "\u0D6D", + "/mlym:sha": "\u0D36", + "/mlym:six": "\u0D6C", + "/mlym:ssa": "\u0D37", + "/mlym:ta": "\u0D24", + "/mlym:ten": "\u0D70", + "/mlym:tha": "\u0D25", + "/mlym:three": "\u0D69", + "/mlym:threeeightieths": "\u0D5A", + "/mlym:threequarters": "\u0D75", + "/mlym:threesixteenths": "\u0D78", + "/mlym:threetwentieths": "\u0D5D", + "/mlym:tta": "\u0D1F", + "/mlym:ttha": "\u0D20", + "/mlym:ttta": "\u0D3A", + "/mlym:two": "\u0D68", + "/mlym:u": "\u0D09", + "/mlym:usign": "\u0D41", + "/mlym:uu": "\u0D0A", + "/mlym:uusign": "\u0D42", + "/mlym:va": "\u0D35", + "/mlym:verticalbarviramasign": "\u0D3B", + "/mlym:viramasign": "\u0D4D", + "/mlym:visargasign": "\u0D03", + "/mlym:ya": "\u0D2F", + "/mlym:ychillu": "\u0D55", + "/mlym:zero": "\u0D66", + "/mm2fullwidth": "\u339F", + "/mm3fullwidth": "\u33A3", + "/mmcubedsquare": "\u33A3", + "/mmfullwidth": "\u339C", + "/mmonospace": "\uFF4D", + "/mmsquaredsquare": "\u339F", + "/mobilePhone": "\u1F4F1", + "/mobilePhoneOff": "\u1F4F4", + "/mobilePhoneRightwardsArrowAtLeft": "\u1F4F2", + "/mocirclekatakana": "\u32F2", + "/models": "\u22A7", + "/mohiragana": "\u3082", + "/mohmfullwidth": "\u33C1", + "/mohmsquare": "\u33C1", + "/mokatakana": "\u30E2", + "/mokatakanahalfwidth": "\uFF93", + "/molfullwidth": "\u33D6", + "/molsquare": "\u33D6", + "/momathai": "\u0E21", + "/moneyBag": "\u1F4B0", + "/moneyWings": "\u1F4B8", + "/mong:a": "\u1820", + "/mong:aaligali": "\u1887", + "/mong:ahaligali": "\u1897", + "/mong:ang": "\u1829", + "/mong:angsibe": "\u1862", + "/mong:angtodo": "\u184A", + "/mong:anusvaraonealigali": "\u1880", + "/mong:ba": "\u182A", + "/mong:baludaaligali": "\u1885", + "/mong:baludaaligalithree": "\u1886", + "/mong:batodo": "\u184B", + "/mong:bhamanchualigali": "\u18A8", + "/mong:birga": "\u1800", + "/mong:caaligali": "\u188B", + "/mong:camanchualigali": "\u189C", + "/mong:cha": "\u1834", + "/mong:chasibe": "\u1871", + "/mong:chatodo": "\u1852", + "/mong:chi": "\u1842", + "/mong:colon": "\u1804", + "/mong:comma": "\u1802", + "/mong:commamanchu": "\u1808", + "/mong:cyamanchualigali": "\u18A3", + "/mong:da": "\u1833", + "/mong:daaligali": "\u1891", + "/mong:dagalgaaligali": "\u18A9", + "/mong:damarualigali": "\u1882", + "/mong:dasibe": "\u1869", + "/mong:datodo": "\u1851", + "/mong:ddaaligali": "\u188E", + "/mong:ddhamanchualigali": "\u189F", + "/mong:dhamanchualigali": "\u18A1", + "/mong:dzatodo": "\u185C", + "/mong:e": "\u1821", + "/mong:ee": "\u1827", + "/mong:eight": "\u1818", + "/mong:ellipsis": "\u1801", + "/mong:esibe": "\u185D", + "/mong:etodo": "\u1844", + "/mong:fa": "\u1839", + "/mong:famanchu": "\u1876", + "/mong:fasibe": "\u186B", + "/mong:five": "\u1815", + "/mong:four": "\u1814", + "/mong:fourdots": "\u1805", + "/mong:freevariationselectorone": "\u180B", + "/mong:freevariationselectorthree": "\u180D", + "/mong:freevariationselectortwo": "\u180C", + "/mong:ga": "\u182D", + "/mong:gaasibe": "\u186C", + "/mong:gaatodo": "\u1858", + "/mong:gasibe": "\u1864", + "/mong:gatodo": "\u184E", + "/mong:ghamanchualigali": "\u189A", + "/mong:haa": "\u183E", + "/mong:haasibe": "\u186D", + "/mong:haatodo": "\u1859", + "/mong:hasibe": "\u1865", + "/mong:i": "\u1822", + "/mong:ialigali": "\u1888", + "/mong:imanchu": "\u1873", + "/mong:isibe": "\u185E", + "/mong:itodo": "\u1845", + "/mong:iysibe": "\u185F", + "/mong:ja": "\u1835", + "/mong:jasibe": "\u186A", + "/mong:jatodo": "\u1853", + "/mong:jhamanchualigali": "\u189D", + "/mong:jiatodo": "\u185A", + "/mong:ka": "\u183A", + "/mong:kaaligali": "\u1889", + "/mong:kamanchu": "\u1874", + "/mong:kasibe": "\u1863", + "/mong:katodo": "\u1857", + "/mong:kha": "\u183B", + "/mong:la": "\u182F", + "/mong:lha": "\u1840", + "/mong:lhamanchualigali": "\u18AA", + "/mong:longvowelsigntodo": "\u1843", + "/mong:ma": "\u182E", + "/mong:matodo": "\u184F", + "/mong:na": "\u1828", + "/mong:ngaaligali": "\u188A", + "/mong:ngamanchualigali": "\u189B", + "/mong:niatodo": "\u185B", + "/mong:nine": "\u1819", + "/mong:nirugu": "\u180A", + "/mong:nnaaligali": "\u188F", + "/mong:o": "\u1823", + "/mong:oe": "\u1825", + "/mong:oetodo": "\u1848", + "/mong:one": "\u1811", + "/mong:otodo": "\u1846", + "/mong:pa": "\u182B", + "/mong:paaligali": "\u1892", + "/mong:pasibe": "\u1866", + "/mong:patodo": "\u184C", + "/mong:period": "\u1803", + "/mong:periodmanchu": "\u1809", + "/mong:phaaligali": "\u1893", + "/mong:qa": "\u182C", + "/mong:qatodo": "\u184D", + "/mong:ra": "\u1837", + "/mong:raasibe": "\u1870", + "/mong:ramanchu": "\u1875", + "/mong:sa": "\u1830", + "/mong:seven": "\u1817", + "/mong:sha": "\u1831", + "/mong:shasibe": "\u1867", + "/mong:six": "\u1816", + "/mong:softhyphentodo": "\u1806", + "/mong:ssaaligali": "\u1894", + "/mong:ssamanchualigali": "\u18A2", + "/mong:syllableboundarymarkersibe": "\u1807", + "/mong:ta": "\u1832", + "/mong:taaligali": "\u1890", + "/mong:tamanchualigali": "\u18A0", + "/mong:tasibe": "\u1868", + "/mong:tatodo": "\u1850", + "/mong:tatodoaligali": "\u1898", + "/mong:three": "\u1813", + "/mong:tsa": "\u183C", + "/mong:tsasibe": "\u186E", + "/mong:tsatodo": "\u1854", + "/mong:ttaaligali": "\u188C", + "/mong:ttamanchualigali": "\u189E", + "/mong:tthaaligali": "\u188D", + "/mong:two": "\u1812", + "/mong:u": "\u1824", + "/mong:ualigalihalf": "\u18A6", + "/mong:ubadamaaligali": "\u1883", + "/mong:ubadamaaligaliinverted": "\u1884", + "/mong:ue": "\u1826", + "/mong:uesibe": "\u1860", + "/mong:uetodo": "\u1849", + "/mong:usibe": "\u1861", + "/mong:utodo": "\u1847", + "/mong:visargaonealigali": "\u1881", + "/mong:vowelseparator": "\u180E", + "/mong:wa": "\u1838", + "/mong:watodo": "\u1856", + "/mong:ya": "\u1836", + "/mong:yaaligalihalf": "\u18A7", + "/mong:yatodo": "\u1855", + "/mong:za": "\u183D", + "/mong:zaaligali": "\u1896", + "/mong:zamanchualigali": "\u18A5", + "/mong:zasibe": "\u186F", + "/mong:zero": "\u1810", + "/mong:zhaaligali": "\u1895", + "/mong:zhamanchu": "\u1877", + "/mong:zhamanchualigali": "\u18A4", + "/mong:zhasibe": "\u1872", + "/mong:zhatodoaligali": "\u1899", + "/mong:zhi": "\u1841", + "/mong:zra": "\u183F", + "/monkey": "\u1F412", + "/monkeyFace": "\u1F435", + "/monogramyang": "\u268A", + "/monogramyin": "\u268B", + "/monorail": "\u1F69D", + "/monostable": "\u238D", + "/moodBubble": "\u1F5F0", + "/moonViewingCeremony": "\u1F391", + "/moonideographiccircled": "\u328A", + "/moonideographicparen": "\u322A", + "/moonlilithblack": "\u26B8", + "/mosque": "\u1F54C", + "/motorBoat": "\u1F6E5", + "/motorScooter": "\u1F6F5", + "/motorway": "\u1F6E3", + "/mountFuji": "\u1F5FB", + "/mountain": "\u26F0", + "/mountainBicyclist": "\u1F6B5", + "/mountainCableway": "\u1F6A0", + "/mountainRailway": "\u1F69E", + "/mouse": "\u1F401", + "/mouseFace": "\u1F42D", + "/mouth": "\u1F444", + "/movers2fullwidth": "\u33A8", + "/moversfullwidth": "\u33A7", + "/moverssquare": "\u33A7", + "/moverssquaredsquare": "\u33A8", + "/movieCamera": "\u1F3A5", + "/moyai": "\u1F5FF", + "/mpafullwidth": "\u33AB", + "/mparen": "\u24A8", + "/mparenthesized": "\u24A8", + "/mpasquare": "\u33AB", + "/msfullwidth": "\u33B3", + "/mssquare": "\u33B3", + "/msuperior": "\uF6EF", + "/mturned": "\u026F", + "/mu": "\u00B5", + "/mu.math": "\u00B5", + "/mu1": "\u00B5", + "/muafullwidth": "\u3382", + "/muasquare": "\u3382", + "/muchgreater": "\u226B", + "/muchless": "\u226A", + "/mucirclekatakana": "\u32F0", + "/muffullwidth": "\u338C", + "/mufsquare": "\u338C", + "/mugfullwidth": "\u338D", + "/mugreek": "\u03BC", + "/mugsquare": "\u338D", + "/muhiragana": "\u3080", + "/mukatakana": "\u30E0", + "/mukatakanahalfwidth": "\uFF91", + "/mulfullwidth": "\u3395", + "/mulsquare": "\u3395", + "/multimap": "\u22B8", + "/multimapleft": "\u27DC", + "/multipleMusicalNotes": "\u1F3B6", + "/multiply": "\u00D7", + "/multiset": "\u228C", + "/multisetmultiplication": "\u228D", + "/multisetunion": "\u228E", + "/mum": "\uA773", + "/mumfullwidth": "\u339B", + "/mumsquare": "\u339B", + "/munach:hb": "\u05A3", + "/munahhebrew": "\u05A3", + "/munahlefthebrew": "\u05A3", + "/musfullwidth": "\u33B2", + "/mushroom": "\u1F344", + "/musicalKeyboard": "\u1F3B9", + "/musicalKeyboardJacks": "\u1F398", + "/musicalNote": "\u1F3B5", + "/musicalScore": "\u1F3BC", + "/musicalnote": "\u266A", + "/musicalnotedbl": "\u266B", + "/musicflat": "\u266D", + "/musicflatsign": "\u266D", + "/musicnatural": "\u266E", + "/musicsharp": "\u266F", + "/musicsharpsign": "\u266F", + "/mussquare": "\u33B2", + "/muvfullwidth": "\u33B6", + "/muvsquare": "\u33B6", + "/muwfullwidth": "\u33BC", + "/muwsquare": "\u33BC", + "/mvfullwidth": "\u33B7", + "/mvmegafullwidth": "\u33B9", + "/mvmegasquare": "\u33B9", + "/mvsquare": "\u33B7", + "/mwfullwidth": "\u33BD", + "/mwmegafullwidth": "\u33BF", + "/mwmegasquare": "\u33BF", + "/mwsquare": "\u33BD", + "/n": "\u006E", + "/n.inferior": "\u2099", + "/n.superior": "\u207F", + "/nabengali": "\u09A8", + "/nabla": "\u2207", + "/nacirclekatakana": "\u32E4", + "/nacute": "\u0144", + "/nadeva": "\u0928", + "/nafullwidth": "\u3381", + "/nagujarati": "\u0AA8", + "/nagurmukhi": "\u0A28", + "/nahiragana": "\u306A", + "/nailPolish": "\u1F485", + "/naira": "\u20A6", + "/nakatakana": "\u30CA", + "/nakatakanahalfwidth": "\uFF85", + "/nameBadge": "\u1F4DB", + "/nameideographiccircled": "\u3294", + "/nameideographicparen": "\u3234", + "/namurda": "\uA99F", + "/nand": "\u22BC", + "/nanosquare": "\u3328", + "/napostrophe": "\u0149", + "/narrownobreakspace": "\u202F", + "/nasquare": "\u3381", + "/nationalPark": "\u1F3DE", + "/nationaldigitshapes": "\u206E", + "/nbopomofo": "\u310B", + "/nbspace": "\u00A0", + "/ncaron": "\u0148", + "/ncedilla": "\u0146", + "/ncircle": "\u24DD", + "/ncircumflexbelow": "\u1E4B", + "/ncommaaccent": "\u0146", + "/ncurl": "\u0235", + "/ndescender": "\uA791", + "/ndot": "\u1E45", + "/ndotaccent": "\u1E45", + "/ndotbelow": "\u1E47", + "/necirclekatakana": "\u32E7", + "/necktie": "\u1F454", + "/negatedturnstiledblverticalbarright": "\u22AF", + "/nehiragana": "\u306D", + "/neirapproximatelynoractuallyequal": "\u2247", + "/neirasersetnorequalup": "\u2289", + "/neirasubsetnorequal": "\u2288", + "/neirgreaternorequal": "\u2271", + "/neirgreaternorequivalent": "\u2275", + "/neirgreaternorless": "\u2279", + "/neirlessnorequal": "\u2270", + "/neirlessnorequivalent": "\u2274", + "/neirlessnorgreater": "\u2278", + "/nekatakana": "\u30CD", + "/nekatakanahalfwidth": "\uFF88", + "/neptune": "\u2646", + "/neuter": "\u26B2", + "/neutralFace": "\u1F610", + "/newMoon": "\u1F311", + "/newMoonFace": "\u1F31A", + "/newsheqel": "\u20AA", + "/newsheqelsign": "\u20AA", + "/newspaper": "\u1F4F0", + "/newsquare": "\u1F195", + "/nextpage": "\u2398", + "/nffullwidth": "\u338B", + "/nfsquare": "\u338B", + "/ng.fina": "\uFBD4", + "/ng.init": "\uFBD5", + "/ng.isol": "\uFBD3", + "/ng.medi": "\uFBD6", + "/ngabengali": "\u0999", + "/ngadeva": "\u0919", + "/ngagujarati": "\u0A99", + "/ngagurmukhi": "\u0A19", + "/ngalelet": "\uA98A", + "/ngaleletraswadi": "\uA98B", + "/ngoeh": "\u06B1", + "/ngoeh.fina": "\uFB9B", + "/ngoeh.init": "\uFB9C", + "/ngoeh.isol": "\uFB9A", + "/ngoeh.medi": "\uFB9D", + "/ngonguthai": "\u0E07", + "/ngrave": "\u01F9", + "/ngsquare": "\u1F196", + "/nhiragana": "\u3093", + "/nhookleft": "\u0272", + "/nhookretroflex": "\u0273", + "/nicirclekatakana": "\u32E5", + "/nieunacirclekorean": "\u326F", + "/nieunaparenkorean": "\u320F", + "/nieuncieuckorean": "\u3135", + "/nieuncirclekorean": "\u3261", + "/nieunhieuhkorean": "\u3136", + "/nieunkorean": "\u3134", + "/nieunpansioskorean": "\u3168", + "/nieunparenkorean": "\u3201", + "/nieunsioskorean": "\u3167", + "/nieuntikeutkorean": "\u3166", + "/nightStars": "\u1F303", + "/nightideographiccircled": "\u32B0", + "/nihiragana": "\u306B", + "/nikatakana": "\u30CB", + "/nikatakanahalfwidth": "\uFF86", + "/nikhahitleftthai": "\uF899", + "/nikhahitthai": "\u0E4D", + "/nine": "\u0039", + "/nine.inferior": "\u2089", + "/nine.roman": "\u2168", + "/nine.romansmall": "\u2178", + "/nine.superior": "\u2079", + "/ninearabic": "\u0669", + "/ninebengali": "\u09EF", + "/ninecircle": "\u2468", + "/ninecircledbl": "\u24FD", + "/ninecircleinversesansserif": "\u2792", + "/ninecomma": "\u1F10A", + "/ninedeva": "\u096F", + "/ninefar": "\u06F9", + "/ninegujarati": "\u0AEF", + "/ninegurmukhi": "\u0A6F", + "/ninehackarabic": "\u0669", + "/ninehangzhou": "\u3029", + "/nineideographiccircled": "\u3288", + "/nineideographicparen": "\u3228", + "/nineinferior": "\u2089", + "/ninemonospace": "\uFF19", + "/nineoldstyle": "\uF739", + "/nineparen": "\u247C", + "/nineparenthesized": "\u247C", + "/nineperiod": "\u2490", + "/ninepersian": "\u06F9", + "/nineroman": "\u2178", + "/ninesuperior": "\u2079", + "/nineteencircle": "\u2472", + "/nineteencircleblack": "\u24F3", + "/nineteenparen": "\u2486", + "/nineteenparenthesized": "\u2486", + "/nineteenperiod": "\u249A", + "/ninethai": "\u0E59", + "/nj": "\u01CC", + "/njecyr": "\u045A", + "/njecyrillic": "\u045A", + "/njekomicyr": "\u050B", + "/nkatakana": "\u30F3", + "/nkatakanahalfwidth": "\uFF9D", + "/nlegrightlong": "\u019E", + "/nlinebelow": "\u1E49", + "/nlongrightleg": "\u019E", + "/nmbr:oneeighth": "\u215B", + "/nmbr:onefifth": "\u2155", + "/nmbr:onetenth": "\u2152", + "/nmfullwidth": "\u339A", + "/nmonospace": "\uFF4E", + "/nmsquare": "\u339A", + "/nnabengali": "\u09A3", + "/nnadeva": "\u0923", + "/nnagujarati": "\u0AA3", + "/nnagurmukhi": "\u0A23", + "/nnnadeva": "\u0929", + "/noBicycles": "\u1F6B3", + "/noEntrySign": "\u1F6AB", + "/noMobilePhones": "\u1F4F5", + "/noOneUnderEighteen": "\u1F51E", + "/noPedestrians": "\u1F6B7", + "/noPiracy": "\u1F572", + "/noSmoking": "\u1F6AD", + "/nobliquestroke": "\uA7A5", + "/nocirclekatakana": "\u32E8", + "/nodeascending": "\u260A", + "/nodedescending": "\u260B", + "/noentry": "\u26D4", + "/nohiragana": "\u306E", + "/nokatakana": "\u30CE", + "/nokatakanahalfwidth": "\uFF89", + "/nominaldigitshapes": "\u206F", + "/nonPotableWater": "\u1F6B1", + "/nonbreakinghyphen": "\u2011", + "/nonbreakingspace": "\u00A0", + "/nonenthai": "\u0E13", + "/nonuthai": "\u0E19", + "/noon": "\u0646", + "/noon.fina": "\uFEE6", + "/noon.init": "\uFEE7", + "/noon.init_alefmaksura.fina": "\uFC4F", + "/noon.init_hah.fina": "\uFC4C", + "/noon.init_hah.medi": "\uFCD3", + "/noon.init_hah.medi_meem.medi": "\uFD95", + "/noon.init_heh.medi": "\uFCD6", + "/noon.init_jeem.fina": "\uFC4B", + "/noon.init_jeem.medi": "\uFCD2", + "/noon.init_jeem.medi_hah.medi": "\uFDB8", + "/noon.init_jeem.medi_meem.medi": "\uFD98", + "/noon.init_khah.fina": "\uFC4D", + "/noon.init_khah.medi": "\uFCD4", + "/noon.init_meem.fina": "\uFC4E", + "/noon.init_meem.medi": "\uFCD5", + "/noon.init_yeh.fina": "\uFC50", + "/noon.isol": "\uFEE5", + "/noon.medi": "\uFEE8", + "/noon.medi_alefmaksura.fina": "\uFC8E", + "/noon.medi_hah.medi_alefmaksura.fina": "\uFD96", + "/noon.medi_hah.medi_yeh.fina": "\uFDB3", + "/noon.medi_heh.medi": "\uFCEF", + "/noon.medi_jeem.medi_alefmaksura.fina": "\uFD99", + "/noon.medi_jeem.medi_hah.fina": "\uFDBD", + "/noon.medi_jeem.medi_meem.fina": "\uFD97", + "/noon.medi_jeem.medi_yeh.fina": "\uFDC7", + "/noon.medi_meem.fina": "\uFC8C", + "/noon.medi_meem.medi": "\uFCEE", + "/noon.medi_meem.medi_alefmaksura.fina": "\uFD9B", + "/noon.medi_meem.medi_yeh.fina": "\uFD9A", + "/noon.medi_noon.fina": "\uFC8D", + "/noon.medi_reh.fina": "\uFC8A", + "/noon.medi_yeh.fina": "\uFC8F", + "/noon.medi_zain.fina": "\uFC8B", + "/noonSmallTah": "\u0768", + "/noonSmallV": "\u0769", + "/noonTwoDotsBelow": "\u0767", + "/noonabove": "\u06E8", + "/noonarabic": "\u0646", + "/noondotbelow": "\u06B9", + "/noonfinalarabic": "\uFEE6", + "/noonghunna": "\u06BA", + "/noonghunna.fina": "\uFB9F", + "/noonghunna.isol": "\uFB9E", + "/noonghunnaarabic": "\u06BA", + "/noonghunnafinalarabic": "\uFB9F", + "/noonhehinitialarabic": "\uFEE7", + "/nooninitialarabic": "\uFEE7", + "/noonjeeminitialarabic": "\uFCD2", + "/noonjeemisolatedarabic": "\uFC4B", + "/noonmedialarabic": "\uFEE8", + "/noonmeeminitialarabic": "\uFCD5", + "/noonmeemisolatedarabic": "\uFC4E", + "/noonnoonfinalarabic": "\uFC8D", + "/noonring": "\u06BC", + "/noonthreedotsabove": "\u06BD", + "/nor": "\u22BD", + "/nordicmark": "\u20BB", + "/normalfacrsemidirectproductleft": "\u22C9", + "/normalfacrsemidirectproductright": "\u22CA", + "/normalsubgroorequalup": "\u22B4", + "/normalsubgroup": "\u22B2", + "/northeastPointingAirplane": "\u1F6EA", + "/nose": "\u1F443", + "/notalmostequal": "\u2249", + "/notasersetup": "\u2285", + "/notasympticallyequal": "\u2244", + "/notcheckmark": "\u237B", + "/notchedLeftSemicircleThreeDots": "\u1F543", + "/notchedRightSemicircleThreeDots": "\u1F544", + "/notcontains": "\u220C", + "/note": "\u1F5C8", + "/notePad": "\u1F5CA", + "/notePage": "\u1F5C9", + "/notebook": "\u1F4D3", + "/notebookDecorativeCover": "\u1F4D4", + "/notelement": "\u2209", + "/notelementof": "\u2209", + "/notequal": "\u2260", + "/notequivalent": "\u226D", + "/notexistential": "\u2204", + "/notgreater": "\u226F", + "/notgreaternorequal": "\u2271", + "/notgreaternorless": "\u2279", + "/notidentical": "\u2262", + "/notless": "\u226E", + "/notlessnorequal": "\u2270", + "/notnormalsubgroorequalup": "\u22EC", + "/notnormalsubgroup": "\u22EA", + "/notparallel": "\u2226", + "/notprecedes": "\u2280", + "/notsignturned": "\u2319", + "/notsquareimageorequal": "\u22E2", + "/notsquareoriginalorequal": "\u22E3", + "/notsubset": "\u2284", + "/notsucceeds": "\u2281", + "/notsuperset": "\u2285", + "/nottilde": "\u2241", + "/nottosquare": "\u3329", + "/nottrue": "\u22AD", + "/novembertelegraph": "\u32CA", + "/nowarmenian": "\u0576", + "/nparen": "\u24A9", + "/nparenthesized": "\u24A9", + "/nretroflex": "\u0273", + "/nsfullwidth": "\u33B1", + "/nssquare": "\u33B1", + "/nsuperior": "\u207F", + "/ntilde": "\u00F1", + "/nu": "\u03BD", + "/nucirclekatakana": "\u32E6", + "/nuhiragana": "\u306C", + "/nukatakana": "\u30CC", + "/nukatakanahalfwidth": "\uFF87", + "/nuktabengali": "\u09BC", + "/nuktadeva": "\u093C", + "/nuktagujarati": "\u0ABC", + "/nuktagurmukhi": "\u0A3C", + "/num": "\uA774", + "/numbermarkabove": "\u0605", + "/numbersign": "\u0023", + "/numbersignmonospace": "\uFF03", + "/numbersignsmall": "\uFE5F", + "/numeralsign": "\u0374", + "/numeralsigngreek": "\u0374", + "/numeralsignlowergreek": "\u0375", + "/numero": "\u2116", + "/nun": "\u05E0", + "/nun:hb": "\u05E0", + "/nunHafukha:hb": "\u05C6", + "/nundagesh": "\uFB40", + "/nundageshhebrew": "\uFB40", + "/nunhebrew": "\u05E0", + "/nunwithdagesh:hb": "\uFB40", + "/nutAndBolt": "\u1F529", + "/nvfullwidth": "\u33B5", + "/nvsquare": "\u33B5", + "/nwfullwidth": "\u33BB", + "/nwsquare": "\u33BB", + "/nyabengali": "\u099E", + "/nyadeva": "\u091E", + "/nyagujarati": "\u0A9E", + "/nyagurmukhi": "\u0A1E", + "/nyamurda": "\uA998", + "/nyeh": "\u0683", + "/nyeh.fina": "\uFB77", + "/nyeh.init": "\uFB78", + "/nyeh.isol": "\uFB76", + "/nyeh.medi": "\uFB79", + "/o": "\u006F", + "/o.inferior": "\u2092", + "/oacute": "\u00F3", + "/oangthai": "\u0E2D", + "/obarcyr": "\u04E9", + "/obardieresiscyr": "\u04EB", + "/obarred": "\u0275", + "/obarredcyrillic": "\u04E9", + "/obarreddieresiscyrillic": "\u04EB", + "/obelosdotted": "\u2E13", + "/obengali": "\u0993", + "/obopomofo": "\u311B", + "/obreve": "\u014F", + "/observereye": "\u23FF", + "/ocandradeva": "\u0911", + "/ocandragujarati": "\u0A91", + "/ocandravowelsigndeva": "\u0949", + "/ocandravowelsigngujarati": "\u0AC9", + "/ocaron": "\u01D2", + "/ocircle": "\u24DE", + "/ocirclekatakana": "\u32D4", + "/ocircumflex": "\u00F4", + "/ocircumflexacute": "\u1ED1", + "/ocircumflexdotbelow": "\u1ED9", + "/ocircumflexgrave": "\u1ED3", + "/ocircumflexhoi": "\u1ED5", + "/ocircumflexhookabove": "\u1ED5", + "/ocircumflextilde": "\u1ED7", + "/ocr:bowtie": "\u2445", + "/ocr:dash": "\u2448", + "/octagonalSign": "\u1F6D1", + "/octobertelegraph": "\u32C9", + "/octopus": "\u1F419", + "/ocyr": "\u043E", + "/ocyrillic": "\u043E", + "/odblacute": "\u0151", + "/odblgrave": "\u020D", + "/oden": "\u1F362", + "/odeva": "\u0913", + "/odieresis": "\u00F6", + "/odieresiscyr": "\u04E7", + "/odieresiscyrillic": "\u04E7", + "/odieresismacron": "\u022B", + "/odot": "\u022F", + "/odotbelow": "\u1ECD", + "/odotmacron": "\u0231", + "/oe": "\u0153", + "/oe.fina": "\uFBDA", + "/oe.isol": "\uFBD9", + "/oekirghiz": "\u06C5", + "/oekirghiz.fina": "\uFBE1", + "/oekirghiz.isol": "\uFBE0", + "/oekorean": "\u315A", + "/officeBuilding": "\u1F3E2", + "/ogonek": "\u02DB", + "/ogonekcmb": "\u0328", + "/ograve": "\u00F2", + "/ogravedbl": "\u020D", + "/ogujarati": "\u0A93", + "/oharmenian": "\u0585", + "/ohiragana": "\u304A", + "/ohm": "\u2126", + "/ohminverted": "\u2127", + "/ohoi": "\u1ECF", + "/ohookabove": "\u1ECF", + "/ohorn": "\u01A1", + "/ohornacute": "\u1EDB", + "/ohorndotbelow": "\u1EE3", + "/ohorngrave": "\u1EDD", + "/ohornhoi": "\u1EDF", + "/ohornhookabove": "\u1EDF", + "/ohorntilde": "\u1EE1", + "/ohungarumlaut": "\u0151", + "/ohuparen": "\u321E", + "/oi": "\u01A3", + "/oilDrum": "\u1F6E2", + "/oinvertedbreve": "\u020F", + "/ojeonparen": "\u321D", + "/okHandSign": "\u1F44C", + "/okatakana": "\u30AA", + "/okatakanahalfwidth": "\uFF75", + "/okorean": "\u3157", + "/oksquare": "\u1F197", + "/oldKey": "\u1F5DD", + "/oldPersonalComputer": "\u1F5B3", + "/olderMan": "\u1F474", + "/olderWoman": "\u1F475", + "/ole:hb": "\u05AB", + "/olehebrew": "\u05AB", + "/oloop": "\uA74D", + "/olowringinside": "\u2C7A", + "/omacron": "\u014D", + "/omacronacute": "\u1E53", + "/omacrongrave": "\u1E51", + "/omdeva": "\u0950", + "/omega": "\u03C9", + "/omega1": "\u03D6", + "/omegaacute": "\u1F7D", + "/omegaacuteiotasub": "\u1FF4", + "/omegaasper": "\u1F61", + "/omegaasperacute": "\u1F65", + "/omegaasperacuteiotasub": "\u1FA5", + "/omegaaspergrave": "\u1F63", + "/omegaaspergraveiotasub": "\u1FA3", + "/omegaasperiotasub": "\u1FA1", + "/omegaaspertilde": "\u1F67", + "/omegaaspertildeiotasub": "\u1FA7", + "/omegaclosed": "\u0277", + "/omegacyr": "\u0461", + "/omegacyrillic": "\u0461", + "/omegafunc": "\u2375", + "/omegagrave": "\u1F7C", + "/omegagraveiotasub": "\u1FF2", + "/omegaiotasub": "\u1FF3", + "/omegalatinclosed": "\u0277", + "/omegalenis": "\u1F60", + "/omegalenisacute": "\u1F64", + "/omegalenisacuteiotasub": "\u1FA4", + "/omegalenisgrave": "\u1F62", + "/omegalenisgraveiotasub": "\u1FA2", + "/omegalenisiotasub": "\u1FA0", + "/omegalenistilde": "\u1F66", + "/omegalenistildeiotasub": "\u1FA6", + "/omegaroundcyr": "\u047B", + "/omegaroundcyrillic": "\u047B", + "/omegatilde": "\u1FF6", + "/omegatildeiotasub": "\u1FF7", + "/omegatitlocyr": "\u047D", + "/omegatitlocyrillic": "\u047D", + "/omegatonos": "\u03CE", + "/omegaunderlinefunc": "\u2379", + "/omgujarati": "\u0AD0", + "/omicron": "\u03BF", + "/omicronacute": "\u1F79", + "/omicronasper": "\u1F41", + "/omicronasperacute": "\u1F45", + "/omicronaspergrave": "\u1F43", + "/omicrongrave": "\u1F78", + "/omicronlenis": "\u1F40", + "/omicronlenisacute": "\u1F44", + "/omicronlenisgrave": "\u1F42", + "/omicrontonos": "\u03CC", + "/omonospace": "\uFF4F", + "/onExclamationMarkLeftRightArrowAbove": "\u1F51B", + "/oncomingAutomobile": "\u1F698", + "/oncomingBus": "\u1F68D", + "/oncomingFireEngine": "\u1F6F1", + "/oncomingPoliceCar": "\u1F694", + "/oncomingTaxi": "\u1F696", + "/one": "\u0031", + "/one.inferior": "\u2081", + "/one.roman": "\u2160", + "/one.romansmall": "\u2170", + "/oneButtonMouse": "\u1F5AF", + "/onearabic": "\u0661", + "/onebengali": "\u09E7", + "/onecircle": "\u2460", + "/onecircledbl": "\u24F5", + "/onecircleinversesansserif": "\u278A", + "/onecomma": "\u1F102", + "/onedeva": "\u0967", + "/onedotenleader": "\u2024", + "/onedotovertwodots": "\u2E2B", + "/oneeighth": "\u215B", + "/onefar": "\u06F1", + "/onefitted": "\uF6DC", + "/onefraction": "\u215F", + "/onegujarati": "\u0AE7", + "/onegurmukhi": "\u0A67", + "/onehackarabic": "\u0661", + "/onehalf": "\u00BD", + "/onehangzhou": "\u3021", + "/onehundred.roman": "\u216D", + "/onehundred.romansmall": "\u217D", + "/onehundredthousand.roman": "\u2188", + "/onehundredtwentypsquare": "\u1F1A4", + "/oneideographiccircled": "\u3280", + "/oneideographicparen": "\u3220", + "/oneinferior": "\u2081", + "/onemonospace": "\uFF11", + "/oneninth": "\u2151", + "/onenumeratorbengali": "\u09F4", + "/oneoldstyle": "\uF731", + "/oneparen": "\u2474", + "/oneparenthesized": "\u2474", + "/oneperiod": "\u2488", + "/onepersian": "\u06F1", + "/onequarter": "\u00BC", + "/oneroman": "\u2170", + "/oneseventh": "\u2150", + "/onesixth": "\u2159", + "/onesuperior": "\u00B9", + "/onethai": "\u0E51", + "/onethird": "\u2153", + "/onethousand.roman": "\u216F", + "/onethousand.romansmall": "\u217F", + "/onethousandcd.roman": "\u2180", + "/onsusquare": "\u3309", + "/oo": "\uA74F", + "/oogonek": "\u01EB", + "/oogonekmacron": "\u01ED", + "/oogurmukhi": "\u0A13", + "/oomatragurmukhi": "\u0A4B", + "/oomusquare": "\u330A", + "/oopen": "\u0254", + "/oparen": "\u24AA", + "/oparenthesized": "\u24AA", + "/openBook": "\u1F4D6", + "/openFileFolder": "\u1F4C2", + "/openFolder": "\u1F5C1", + "/openHandsSign": "\u1F450", + "/openLock": "\u1F513", + "/openMailboxLoweredFlag": "\u1F4ED", + "/openMailboxRaisedFlag": "\u1F4EC", + "/openbullet": "\u25E6", + "/openheadarrowleft": "\u21FD", + "/openheadarrowleftright": "\u21FF", + "/openheadarrowright": "\u21FE", + "/opensubset": "\u27C3", + "/opensuperset": "\u27C4", + "/ophiuchus": "\u26CE", + "/opposition": "\u260D", + "/opticalDisc": "\u1F4BF", + "/opticalDiscIcon": "\u1F5B8", + "/option": "\u2325", + "/orangeBook": "\u1F4D9", + "/ordfeminine": "\u00AA", + "/ordmasculine": "\u00BA", + "/ordotinside": "\u27C7", + "/original": "\u22B6", + "/ornateleftparenthesis": "\uFD3E", + "/ornaterightparenthesis": "\uFD3F", + "/orthodoxcross": "\u2626", + "/orthogonal": "\u221F", + "/orya:a": "\u0B05", + "/orya:aa": "\u0B06", + "/orya:aasign": "\u0B3E", + "/orya:ai": "\u0B10", + "/orya:ailengthmark": "\u0B56", + "/orya:aisign": "\u0B48", + "/orya:anusvara": "\u0B02", + "/orya:au": "\u0B14", + "/orya:aulengthmark": "\u0B57", + "/orya:ausign": "\u0B4C", + "/orya:avagraha": "\u0B3D", + "/orya:ba": "\u0B2C", + "/orya:bha": "\u0B2D", + "/orya:ca": "\u0B1A", + "/orya:candrabindu": "\u0B01", + "/orya:cha": "\u0B1B", + "/orya:da": "\u0B26", + "/orya:dda": "\u0B21", + "/orya:ddha": "\u0B22", + "/orya:dha": "\u0B27", + "/orya:e": "\u0B0F", + "/orya:eight": "\u0B6E", + "/orya:esign": "\u0B47", + "/orya:five": "\u0B6B", + "/orya:four": "\u0B6A", + "/orya:fractiononeeighth": "\u0B76", + "/orya:fractiononehalf": "\u0B73", + "/orya:fractiononequarter": "\u0B72", + "/orya:fractiononesixteenth": "\u0B75", + "/orya:fractionthreequarters": "\u0B74", + "/orya:fractionthreesixteenths": "\u0B77", + "/orya:ga": "\u0B17", + "/orya:gha": "\u0B18", + "/orya:ha": "\u0B39", + "/orya:i": "\u0B07", + "/orya:ii": "\u0B08", + "/orya:iisign": "\u0B40", + "/orya:isign": "\u0B3F", + "/orya:isshar": "\u0B70", + "/orya:ja": "\u0B1C", + "/orya:jha": "\u0B1D", + "/orya:ka": "\u0B15", + "/orya:kha": "\u0B16", + "/orya:la": "\u0B32", + "/orya:lla": "\u0B33", + "/orya:llvocal": "\u0B61", + "/orya:llvocalsign": "\u0B63", + "/orya:lvocal": "\u0B0C", + "/orya:lvocalsign": "\u0B62", + "/orya:ma": "\u0B2E", + "/orya:na": "\u0B28", + "/orya:nga": "\u0B19", + "/orya:nine": "\u0B6F", + "/orya:nna": "\u0B23", + "/orya:nukta": "\u0B3C", + "/orya:nya": "\u0B1E", + "/orya:o": "\u0B13", + "/orya:one": "\u0B67", + "/orya:osign": "\u0B4B", + "/orya:pa": "\u0B2A", + "/orya:pha": "\u0B2B", + "/orya:ra": "\u0B30", + "/orya:rha": "\u0B5D", + "/orya:rra": "\u0B5C", + "/orya:rrvocal": "\u0B60", + "/orya:rrvocalsign": "\u0B44", + "/orya:rvocal": "\u0B0B", + "/orya:rvocalsign": "\u0B43", + "/orya:sa": "\u0B38", + "/orya:seven": "\u0B6D", + "/orya:sha": "\u0B36", + "/orya:six": "\u0B6C", + "/orya:ssa": "\u0B37", + "/orya:ta": "\u0B24", + "/orya:tha": "\u0B25", + "/orya:three": "\u0B69", + "/orya:tta": "\u0B1F", + "/orya:ttha": "\u0B20", + "/orya:two": "\u0B68", + "/orya:u": "\u0B09", + "/orya:usign": "\u0B41", + "/orya:uu": "\u0B0A", + "/orya:uusign": "\u0B42", + "/orya:va": "\u0B35", + "/orya:virama": "\u0B4D", + "/orya:visarga": "\u0B03", + "/orya:wa": "\u0B71", + "/orya:ya": "\u0B2F", + "/orya:yya": "\u0B5F", + "/orya:zero": "\u0B66", + "/oscript": "\u2134", + "/oshortdeva": "\u0912", + "/oshortvowelsigndeva": "\u094A", + "/oslash": "\u00F8", + "/oslashacute": "\u01FF", + "/osmallhiragana": "\u3049", + "/osmallkatakana": "\u30A9", + "/osmallkatakanahalfwidth": "\uFF6B", + "/ostroke": "\uA74B", + "/ostrokeacute": "\u01FF", + "/osuperior": "\uF6F0", + "/otcyr": "\u047F", + "/otcyrillic": "\u047F", + "/otilde": "\u00F5", + "/otildeacute": "\u1E4D", + "/otildedieresis": "\u1E4F", + "/otildemacron": "\u022D", + "/ou": "\u0223", + "/oubopomofo": "\u3121", + "/ounce": "\u2125", + "/outboxTray": "\u1F4E4", + "/outerjoinfull": "\u27D7", + "/outerjoinleft": "\u27D5", + "/outerjoinright": "\u27D6", + "/outputpassiveup": "\u2392", + "/overlap": "\u1F5D7", + "/overline": "\u203E", + "/overlinecenterline": "\uFE4A", + "/overlinecmb": "\u0305", + "/overlinedashed": "\uFE49", + "/overlinedblwavy": "\uFE4C", + "/overlinewavy": "\uFE4B", + "/overscore": "\u00AF", + "/ovfullwidth": "\u3375", + "/ovowelsignbengali": "\u09CB", + "/ovowelsigndeva": "\u094B", + "/ovowelsigngujarati": "\u0ACB", + "/ox": "\u1F402", + "/p": "\u0070", + "/p.inferior": "\u209A", + "/paampsfullwidth": "\u3380", + "/paampssquare": "\u3380", + "/paasentosquare": "\u332B", + "/paatusquare": "\u332C", + "/pabengali": "\u09AA", + "/pacerek": "\uA989", + "/package": "\u1F4E6", + "/pacute": "\u1E55", + "/padeva": "\u092A", + "/pafullwidth": "\u33A9", + "/page": "\u1F5CF", + "/pageCircledText": "\u1F5DF", + "/pageCurl": "\u1F4C3", + "/pageFacingUp": "\u1F4C4", + "/pagedown": "\u21DF", + "/pager": "\u1F4DF", + "/pages": "\u1F5D0", + "/pageup": "\u21DE", + "/pagoda": "\u1F6D4", + "/pagujarati": "\u0AAA", + "/pagurmukhi": "\u0A2A", + "/pahiragana": "\u3071", + "/paiyannoithai": "\u0E2F", + "/pakatakana": "\u30D1", + "/palatalizationcyrilliccmb": "\u0484", + "/palatcmbcyr": "\u0484", + "/pallas": "\u26B4", + "/palmTree": "\u1F334", + "/palmbranch": "\u2E19", + "/palochkacyr": "\u04CF", + "/palochkacyrillic": "\u04C0", + "/pamurda": "\uA9A6", + "/pandaFace": "\u1F43C", + "/pangkatpada": "\uA9C7", + "/pangkon": "\uA9C0", + "/pangrangkep": "\uA9CF", + "/pansioskorean": "\u317F", + "/panyangga": "\uA980", + "/paperclip": "\u1F4CE", + "/paragraph": "\u00B6", + "/paragraphos": "\u2E0F", + "/paragraphosforked": "\u2E10", + "/paragraphosforkedreversed": "\u2E11", + "/paragraphseparator": "\u2029", + "/parallel": "\u2225", + "/parallelogramblack": "\u25B0", + "/parallelogramwhite": "\u25B1", + "/parenbottom": "\u23DD", + "/parendblleft": "\u2E28", + "/parendblright": "\u2E29", + "/parenextensionleft": "\u239C", + "/parenextensionright": "\u239F", + "/parenflatleft": "\u27EE", + "/parenflatright": "\u27EF", + "/parenhookupleft": "\u239B", + "/parenhookupright": "\u239E", + "/parenleft": "\u0028", + "/parenleft.inferior": "\u208D", + "/parenleft.superior": "\u207D", + "/parenleftaltonearabic": "\uFD3E", + "/parenleftbt": "\uF8ED", + "/parenleftex": "\uF8EC", + "/parenleftinferior": "\u208D", + "/parenleftmonospace": "\uFF08", + "/parenleftsmall": "\uFE59", + "/parenleftsuperior": "\u207D", + "/parenlefttp": "\uF8EB", + "/parenleftvertical": "\uFE35", + "/parenlowerhookleft": "\u239D", + "/parenlowerhookright": "\u23A0", + "/parenright": "\u0029", + "/parenright.inferior": "\u208E", + "/parenright.superior": "\u207E", + "/parenrightaltonearabic": "\uFD3F", + "/parenrightbt": "\uF8F8", + "/parenrightex": "\uF8F7", + "/parenrightinferior": "\u208E", + "/parenrightmonospace": "\uFF09", + "/parenrightsmall": "\uFE5A", + "/parenrightsuperior": "\u207E", + "/parenrighttp": "\uF8F6", + "/parenrightvertical": "\uFE36", + "/parentop": "\u23DC", + "/partalternationmark": "\u303D", + "/partialdiff": "\u2202", + "/partnership": "\u3250", + "/partyPopper": "\u1F389", + "/paseq:hb": "\u05C0", + "/paseqhebrew": "\u05C0", + "/pashta:hb": "\u0599", + "/pashtahebrew": "\u0599", + "/pasquare": "\u33A9", + "/passengerShip": "\u1F6F3", + "/passivedown": "\u2391", + "/passportControl": "\u1F6C2", + "/patah": "\u05B7", + "/patah11": "\u05B7", + "/patah1d": "\u05B7", + "/patah2a": "\u05B7", + "/patah:hb": "\u05B7", + "/patahhebrew": "\u05B7", + "/patahnarrowhebrew": "\u05B7", + "/patahquarterhebrew": "\u05B7", + "/patahwidehebrew": "\u05B7", + "/pawPrints": "\u1F43E", + "/pawnblack": "\u265F", + "/pawnwhite": "\u2659", + "/pazer:hb": "\u05A1", + "/pazerhebrew": "\u05A1", + "/pbopomofo": "\u3106", + "/pcfullwidth": "\u3376", + "/pcircle": "\u24DF", + "/pdot": "\u1E57", + "/pdotaccent": "\u1E57", + "/pe": "\u05E4", + "/pe:hb": "\u05E4", + "/peace": "\u262E", + "/peach": "\u1F351", + "/pear": "\u1F350", + "/pecyr": "\u043F", + "/pecyrillic": "\u043F", + "/pedagesh": "\uFB44", + "/pedageshhebrew": "\uFB44", + "/pedestrian": "\u1F6B6", + "/peezisquare": "\u333B", + "/pefinaldageshhebrew": "\uFB43", + "/peh.fina": "\uFB57", + "/peh.init": "\uFB58", + "/peh.isol": "\uFB56", + "/peh.medi": "\uFB59", + "/peharabic": "\u067E", + "/peharmenian": "\u057A", + "/pehebrew": "\u05E4", + "/peheh": "\u06A6", + "/peheh.fina": "\uFB6F", + "/peheh.init": "\uFB70", + "/peheh.isol": "\uFB6E", + "/peheh.medi": "\uFB71", + "/pehfinalarabic": "\uFB57", + "/pehinitialarabic": "\uFB58", + "/pehiragana": "\u307A", + "/pehmedialarabic": "\uFB59", + "/pehookcyr": "\u04A7", + "/pekatakana": "\u30DA", + "/pemiddlehookcyrillic": "\u04A7", + "/penOverStampedEnvelope": "\u1F586", + "/pengkalconsonant": "\uA9BE", + "/penguin": "\u1F427", + "/penihisquare": "\u3338", + "/pensiveFace": "\u1F614", + "/pensusquare": "\u333A", + "/pentagram": "\u26E4", + "/pentasememetrical": "\u23D9", + "/pepetvowel": "\uA9BC", + "/per": "\u214C", + "/perafehebrew": "\uFB4E", + "/percent": "\u0025", + "/percentarabic": "\u066A", + "/percentmonospace": "\uFF05", + "/percentsmall": "\uFE6A", + "/percussivebidental": "\u02AD", + "/percussivebilabial": "\u02AC", + "/performingArts": "\u1F3AD", + "/period": "\u002E", + "/periodarmenian": "\u0589", + "/periodcentered": "\u00B7", + "/periodhalfwidth": "\uFF61", + "/periodinferior": "\uF6E7", + "/periodmonospace": "\uFF0E", + "/periodsmall": "\uFE52", + "/periodsuperior": "\uF6E8", + "/periodurdu": "\u06D4", + "/perispomenigreekcmb": "\u0342", + "/permanentpaper": "\u267E", + "/permille": "\u0609", + "/perpendicular": "\u22A5", + "/perseveringFace": "\u1F623", + "/personBlondHair": "\u1F471", + "/personBowingDeeply": "\u1F647", + "/personFrowning": "\u1F64D", + "/personRaisingBothHandsInCelebration": "\u1F64C", + "/personWithFoldedHands": "\u1F64F", + "/personWithPoutingFace": "\u1F64E", + "/personalComputer": "\u1F4BB", + "/personball": "\u26F9", + "/perspective": "\u2306", + "/pertenthousandsign": "\u2031", + "/perthousand": "\u2030", + "/peseta": "\u20A7", + "/peso": "\u20B1", + "/pesosquare": "\u3337", + "/petailcyr": "\u0525", + "/pewithdagesh:hb": "\uFB44", + "/pewithrafe:hb": "\uFB4E", + "/pffullwidth": "\u338A", + "/pflourish": "\uA753", + "/pfsquare": "\u338A", + "/phabengali": "\u09AB", + "/phadeva": "\u092B", + "/phagujarati": "\u0AAB", + "/phagurmukhi": "\u0A2B", + "/pharyngealvoicedfricative": "\u0295", + "/phfullwidth": "\u33D7", + "/phi": "\u03C6", + "/phi.math": "\u03D5", + "/phi1": "\u03D5", + "/phieuphacirclekorean": "\u327A", + "/phieuphaparenkorean": "\u321A", + "/phieuphcirclekorean": "\u326C", + "/phieuphkorean": "\u314D", + "/phieuphparenkorean": "\u320C", + "/philatin": "\u0278", + "/phinthuthai": "\u0E3A", + "/phisymbolgreek": "\u03D5", + "/phitailless": "\u2C77", + "/phon:AEsmall": "\u1D01", + "/phon:Aemod": "\u1D2D", + "/phon:Amod": "\u1D2C", + "/phon:Asmall": "\u1D00", + "/phon:Bbarmod": "\u1D2F", + "/phon:Bbarsmall": "\u1D03", + "/phon:Bmod": "\u1D2E", + "/phon:Csmall": "\u1D04", + "/phon:Dmod": "\u1D30", + "/phon:Dsmall": "\u1D05", + "/phon:ENcyrmod": "\u1D78", + "/phon:Elsmallcyr": "\u1D2B", + "/phon:Emod": "\u1D31", + "/phon:Ereversedmod": "\u1D32", + "/phon:Esmall": "\u1D07", + "/phon:Ethsmall": "\u1D06", + "/phon:Ezhsmall": "\u1D23", + "/phon:Gmod": "\u1D33", + "/phon:Hmod": "\u1D34", + "/phon:Imod": "\u1D35", + "/phon:Ismallmod": "\u1DA6", + "/phon:Ismallstroke": "\u1D7B", + "/phon:Istrokesmallmod": "\u1DA7", + "/phon:Jmod": "\u1D36", + "/phon:Jsmall": "\u1D0A", + "/phon:Kmod": "\u1D37", + "/phon:Ksmall": "\u1D0B", + "/phon:Lmod": "\u1D38", + "/phon:Lsmallmod": "\u1DAB", + "/phon:Lsmallstroke": "\u1D0C", + "/phon:Mmod": "\u1D39", + "/phon:Msmall": "\u1D0D", + "/phon:Nmod": "\u1D3A", + "/phon:Nreversedmod": "\u1D3B", + "/phon:Nsmallmod": "\u1DB0", + "/phon:Nsmallreversed": "\u1D0E", + "/phon:OUsmall": "\u1D15", + "/phon:Omod": "\u1D3C", + "/phon:Oopensmall": "\u1D10", + "/phon:Osmall": "\u1D0F", + "/phon:Oumod": "\u1D3D", + "/phon:Pmod": "\u1D3E", + "/phon:Psmall": "\u1D18", + "/phon:Rmod": "\u1D3F", + "/phon:Rsmallreversed": "\u1D19", + "/phon:Rsmallturned": "\u1D1A", + "/phon:Tmod": "\u1D40", + "/phon:Tsmall": "\u1D1B", + "/phon:Umod": "\u1D41", + "/phon:Usmall": "\u1D1C", + "/phon:Usmallmod": "\u1DB8", + "/phon:Usmallstroke": "\u1D7E", + "/phon:Vsmall": "\u1D20", + "/phon:Wmod": "\u1D42", + "/phon:Wsmall": "\u1D21", + "/phon:Zsmall": "\u1D22", + "/phon:aeturned": "\u1D02", + "/phon:aeturnedmod": "\u1D46", + "/phon:ain": "\u1D25", + "/phon:ainmod": "\u1D5C", + "/phon:alphamod": "\u1D45", + "/phon:alpharetroflexhook": "\u1D90", + "/phon:alphaturnedmod": "\u1D9B", + "/phon:amod": "\u1D43", + "/phon:aretroflexhook": "\u1D8F", + "/phon:aturnedmod": "\u1D44", + "/phon:betamod": "\u1D5D", + "/phon:bmiddletilde": "\u1D6C", + "/phon:bmod": "\u1D47", + "/phon:bpalatalhook": "\u1D80", + "/phon:ccurlmod": "\u1D9D", + "/phon:chimod": "\u1D61", + "/phon:cmod": "\u1D9C", + "/phon:deltamod": "\u1D5F", + "/phon:dhooktail": "\u1D91", + "/phon:dmiddletilde": "\u1D6D", + "/phon:dmod": "\u1D48", + "/phon:dotlessjstrokemod": "\u1DA1", + "/phon:dpalatalhook": "\u1D81", + "/phon:emod": "\u1D49", + "/phon:engmod": "\u1D51", + "/phon:eopenmod": "\u1D4B", + "/phon:eopenretroflexhook": "\u1D93", + "/phon:eopenreversedmod": "\u1D9F", + "/phon:eopenreversedretroflexhook": "\u1D94", + "/phon:eopenturned": "\u1D08", + "/phon:eopenturnedmod": "\u1D4C", + "/phon:eretroflexhook": "\u1D92", + "/phon:eshmod": "\u1DB4", + "/phon:eshpalatalhook": "\u1D8B", + "/phon:eshretroflexhook": "\u1D98", + "/phon:ethmod": "\u1D9E", + "/phon:ezhmod": "\u1DBE", + "/phon:ezhretroflexhook": "\u1D9A", + "/phon:fmiddletilde": "\u1D6E", + "/phon:fmod": "\u1DA0", + "/phon:fpalatalhook": "\u1D82", + "/phon:ginsular": "\u1D79", + "/phon:gmod": "\u1D4D", + "/phon:gpalatalhook": "\u1D83", + "/phon:gr:Gammasmall": "\u1D26", + "/phon:gr:Lambdasmall": "\u1D27", + "/phon:gr:Pismall": "\u1D28", + "/phon:gr:Psismall": "\u1D2A", + "/phon:gr:RsmallHO": "\u1D29", + "/phon:gr:betasubscript": "\u1D66", + "/phon:gr:chisubscript": "\u1D6A", + "/phon:gr:gammamod": "\u1D5E", + "/phon:gr:gammasubscript": "\u1D67", + "/phon:gr:phimod": "\u1D60", + "/phon:gr:phisubscript": "\u1D69", + "/phon:gr:rhosubscript": "\u1D68", + "/phon:gscriptmod": "\u1DA2", + "/phon:gturned": "\u1D77", + "/phon:hturnedmod": "\u1DA3", + "/phon:iotamod": "\u1DA5", + "/phon:iotastroke": "\u1D7C", + "/phon:iretroflexhook": "\u1D96", + "/phon:istrokemod": "\u1DA4", + "/phon:isubscript": "\u1D62", + "/phon:iturned": "\u1D09", + "/phon:iturnedmod": "\u1D4E", + "/phon:jcrossedtailmod": "\u1DA8", + "/phon:kmod": "\u1D4F", + "/phon:kpalatalhook": "\u1D84", + "/phon:lpalatalhook": "\u1D85", + "/phon:lpalatalhookmod": "\u1DAA", + "/phon:lretroflexhookmod": "\u1DA9", + "/phon:mhookmod": "\u1DAC", + "/phon:mlonglegturnedmod": "\u1DAD", + "/phon:mmiddletilde": "\u1D6F", + "/phon:mmod": "\u1D50", + "/phon:mpalatalhook": "\u1D86", + "/phon:mturnedmod": "\u1D5A", + "/phon:mturnedsideways": "\u1D1F", + "/phon:nlefthookmod": "\u1DAE", + "/phon:nmiddletilde": "\u1D70", + "/phon:npalatalhook": "\u1D87", + "/phon:nretroflexhookmod": "\u1DAF", + "/phon:obarmod": "\u1DB1", + "/phon:obottomhalf": "\u1D17", + "/phon:obottomhalfmod": "\u1D55", + "/phon:oeturned": "\u1D14", + "/phon:omod": "\u1D52", + "/phon:oopenmod": "\u1D53", + "/phon:oopenretroflexhook": "\u1D97", + "/phon:oopensideways": "\u1D12", + "/phon:osideways": "\u1D11", + "/phon:ostrokesideways": "\u1D13", + "/phon:otophalf": "\u1D16", + "/phon:otophalfmod": "\u1D54", + "/phon:phimod": "\u1DB2", + "/phon:pmiddletilde": "\u1D71", + "/phon:pmod": "\u1D56", + "/phon:ppalatalhook": "\u1D88", + "/phon:pstroke": "\u1D7D", + "/phon:rfishmiddletilde": "\u1D73", + "/phon:rmiddletilde": "\u1D72", + "/phon:rpalatalhook": "\u1D89", + "/phon:rsubscript": "\u1D63", + "/phon:schwamod": "\u1D4A", + "/phon:schwaretroflexhook": "\u1D95", + "/phon:shookmod": "\u1DB3", + "/phon:smiddletilde": "\u1D74", + "/phon:spalatalhook": "\u1D8A", + "/phon:spirantvoicedlaryngeal": "\u1D24", + "/phon:thetamod": "\u1DBF", + "/phon:thstrike": "\u1D7A", + "/phon:tmiddletilde": "\u1D75", + "/phon:tmod": "\u1D57", + "/phon:tpalatalhookmod": "\u1DB5", + "/phon:ubarmod": "\u1DB6", + "/phon:ue": "\u1D6B", + "/phon:umod": "\u1D58", + "/phon:upsilonmod": "\u1DB7", + "/phon:upsilonstroke": "\u1D7F", + "/phon:uretroflexhook": "\u1D99", + "/phon:usideways": "\u1D1D", + "/phon:usidewaysdieresised": "\u1D1E", + "/phon:usidewaysmod": "\u1D59", + "/phon:usubscript": "\u1D64", + "/phon:vhookmod": "\u1DB9", + "/phon:vmod": "\u1D5B", + "/phon:vpalatalhook": "\u1D8C", + "/phon:vsubscript": "\u1D65", + "/phon:vturnedmod": "\u1DBA", + "/phon:xpalatalhook": "\u1D8D", + "/phon:zcurlmod": "\u1DBD", + "/phon:zmiddletilde": "\u1D76", + "/phon:zmod": "\u1DBB", + "/phon:zpalatalhook": "\u1D8E", + "/phon:zretroflexhookmod": "\u1DBC", + "/phook": "\u01A5", + "/phophanthai": "\u0E1E", + "/phophungthai": "\u0E1C", + "/phosamphaothai": "\u0E20", + "/pi": "\u03C0", + "/pi.math": "\u03D6", + "/piasutorusquare": "\u332E", + "/pick": "\u26CF", + "/pidblstruck": "\u213C", + "/pieupacirclekorean": "\u3273", + "/pieupaparenkorean": "\u3213", + "/pieupcieuckorean": "\u3176", + "/pieupcirclekorean": "\u3265", + "/pieupkiyeokkorean": "\u3172", + "/pieupkorean": "\u3142", + "/pieupparenkorean": "\u3205", + "/pieupsioskiyeokkorean": "\u3174", + "/pieupsioskorean": "\u3144", + "/pieupsiostikeutkorean": "\u3175", + "/pieupthieuthkorean": "\u3177", + "/pieuptikeutkorean": "\u3173", + "/pig": "\u1F416", + "/pigFace": "\u1F437", + "/pigNose": "\u1F43D", + "/pihiragana": "\u3074", + "/pikatakana": "\u30D4", + "/pikosquare": "\u3330", + "/pikurusquare": "\u332F", + "/pilcrowsignreversed": "\u204B", + "/pileOfPoo": "\u1F4A9", + "/pill": "\u1F48A", + "/pineDecoration": "\u1F38D", + "/pineapple": "\u1F34D", + "/pisces": "\u2653", + "/piselehpada": "\uA9CC", + "/pistol": "\u1F52B", + "/pisymbolgreek": "\u03D6", + "/pitchfork": "\u22D4", + "/piwrarmenian": "\u0583", + "/placeOfWorship": "\u1F6D0", + "/placeofinterestsign": "\u2318", + "/planck": "\u210E", + "/plancktwopi": "\u210F", + "/plus": "\u002B", + "/plus.inferior": "\u208A", + "/plus.superior": "\u207A", + "/plusbelowcmb": "\u031F", + "/pluscircle": "\u2295", + "/plusminus": "\u00B1", + "/plusmod": "\u02D6", + "/plusmonospace": "\uFF0B", + "/plussignalt:hb": "\uFB29", + "/plussignmod": "\u02D6", + "/plussmall": "\uFE62", + "/plussuperior": "\u207A", + "/pluto": "\u2647", + "/pmfullwidth": "\u33D8", + "/pmonospace": "\uFF50", + "/pmsquare": "\u33D8", + "/pocketCalculator": "\u1F5A9", + "/poeticverse": "\u060E", + "/pohiragana": "\u307D", + "/pointerleftblack": "\u25C4", + "/pointerleftwhite": "\u25C5", + "/pointerrightblack": "\u25BA", + "/pointerrightwhite": "\u25BB", + "/pointingindexdownwhite": "\u261F", + "/pointingindexleftblack": "\u261A", + "/pointingindexleftwhite": "\u261C", + "/pointingindexrightblack": "\u261B", + "/pointingindexrightwhite": "\u261E", + "/pointingindexupwhite": "\u261D", + "/pointingtriangledownheavywhite": "\u26DB", + "/pointosquare": "\u333D", + "/pointring": "\u2E30", + "/pokatakana": "\u30DD", + "/pokrytiecmbcyr": "\u0487", + "/policeCar": "\u1F693", + "/policeCarsRevolvingLight": "\u1F6A8", + "/policeOfficer": "\u1F46E", + "/pondosquare": "\u3340", + "/poodle": "\u1F429", + "/popcorn": "\u1F37F", + "/popdirectionalformatting": "\u202C", + "/popdirectionalisolate": "\u2069", + "/poplathai": "\u0E1B", + "/portableStereo": "\u1F4FE", + "/positionindicator": "\u2316", + "/postalHorn": "\u1F4EF", + "/postalmark": "\u3012", + "/postalmarkface": "\u3020", + "/postbox": "\u1F4EE", + "/potOfFood": "\u1F372", + "/potableWater": "\u1F6B0", + "/pouch": "\u1F45D", + "/poultryLeg": "\u1F357", + "/poutingCatFace": "\u1F63E", + "/poutingFace": "\u1F621", + "/power": "\u23FB", + "/poweron": "\u23FD", + "/poweronoff": "\u23FC", + "/powersleep": "\u23FE", + "/pparen": "\u24AB", + "/pparenthesized": "\u24AB", + "/ppmfullwidth": "\u33D9", + "/prayerBeads": "\u1F4FF", + "/precedes": "\u227A", + "/precedesbutnotequivalent": "\u22E8", + "/precedesorequal": "\u227C", + "/precedesorequivalent": "\u227E", + "/precedesunderrelation": "\u22B0", + "/prescription": "\u211E", + "/preversedepigraphic": "\uA7FC", + "/previouspage": "\u2397", + "/prfullwidth": "\u33DA", + "/primedblmod": "\u02BA", + "/primemod": "\u02B9", + "/primereversed": "\u2035", + "/princess": "\u1F478", + "/printer": "\u1F5A8", + "/printerIcon": "\u1F5B6", + "/printideographiccircled": "\u329E", + "/printscreen": "\u2399", + "/product": "\u220F", + "/prohibitedSign": "\u1F6C7", + "/projective": "\u2305", + "/prolongedkana": "\u30FC", + "/propellor": "\u2318", + "/propersubset": "\u2282", + "/propersuperset": "\u2283", + "/propertyline": "\u214A", + "/proportion": "\u2237", + "/proportional": "\u221D", + "/psfullwidth": "\u33B0", + "/psi": "\u03C8", + "/psicyr": "\u0471", + "/psicyrillic": "\u0471", + "/psilicmbcyr": "\u0486", + "/psilipneumatacyrilliccmb": "\u0486", + "/pssquare": "\u33B0", + "/pstrokedescender": "\uA751", + "/ptail": "\uA755", + "/publicAddressLoudspeaker": "\u1F4E2", + "/puhiragana": "\u3077", + "/pukatakana": "\u30D7", + "/punctuationspace": "\u2008", + "/purpleHeart": "\u1F49C", + "/purse": "\u1F45B", + "/pushpin": "\u1F4CC", + "/putLitterInItsPlace": "\u1F6AE", + "/pvfullwidth": "\u33B4", + "/pvsquare": "\u33B4", + "/pwfullwidth": "\u33BA", + "/pwsquare": "\u33BA", + "/q": "\u0071", + "/qacyr": "\u051B", + "/qadeva": "\u0958", + "/qadma:hb": "\u05A8", + "/qadmahebrew": "\u05A8", + "/qaf": "\u0642", + "/qaf.fina": "\uFED6", + "/qaf.init": "\uFED7", + "/qaf.init_alefmaksura.fina": "\uFC35", + "/qaf.init_hah.fina": "\uFC33", + "/qaf.init_hah.medi": "\uFCC2", + "/qaf.init_meem.fina": "\uFC34", + "/qaf.init_meem.medi": "\uFCC3", + "/qaf.init_meem.medi_hah.medi": "\uFDB4", + "/qaf.init_yeh.fina": "\uFC36", + "/qaf.isol": "\uFED5", + "/qaf.medi": "\uFED8", + "/qaf.medi_alefmaksura.fina": "\uFC7E", + "/qaf.medi_meem.medi_hah.fina": "\uFD7E", + "/qaf.medi_meem.medi_meem.fina": "\uFD7F", + "/qaf.medi_meem.medi_yeh.fina": "\uFDB2", + "/qaf.medi_yeh.fina": "\uFC7F", + "/qaf_lam_alefmaksuraabove": "\u06D7", + "/qafarabic": "\u0642", + "/qafdotabove": "\u06A7", + "/qaffinalarabic": "\uFED6", + "/qafinitialarabic": "\uFED7", + "/qafmedialarabic": "\uFED8", + "/qafthreedotsabove": "\u06A8", + "/qamats": "\u05B8", + "/qamats10": "\u05B8", + "/qamats1a": "\u05B8", + "/qamats1c": "\u05B8", + "/qamats27": "\u05B8", + "/qamats29": "\u05B8", + "/qamats33": "\u05B8", + "/qamats:hb": "\u05B8", + "/qamatsQatan:hb": "\u05C7", + "/qamatsde": "\u05B8", + "/qamatshebrew": "\u05B8", + "/qamatsnarrowhebrew": "\u05B8", + "/qamatsqatanhebrew": "\u05B8", + "/qamatsqatannarrowhebrew": "\u05B8", + "/qamatsqatanquarterhebrew": "\u05B8", + "/qamatsqatanwidehebrew": "\u05B8", + "/qamatsquarterhebrew": "\u05B8", + "/qamatswidehebrew": "\u05B8", + "/qarneFarah:hb": "\u059F", + "/qarneyparahebrew": "\u059F", + "/qbopomofo": "\u3111", + "/qcircle": "\u24E0", + "/qdiagonalstroke": "\uA759", + "/qhook": "\u02A0", + "/qhooktail": "\u024B", + "/qmonospace": "\uFF51", + "/qof": "\u05E7", + "/qof:hb": "\u05E7", + "/qofdagesh": "\uFB47", + "/qofdageshhebrew": "\uFB47", + "/qofhatafpatah": "\u05E7", + "/qofhatafpatahhebrew": "\u05E7", + "/qofhatafsegol": "\u05E7", + "/qofhatafsegolhebrew": "\u05E7", + "/qofhebrew": "\u05E7", + "/qofhiriq": "\u05E7", + "/qofhiriqhebrew": "\u05E7", + "/qofholam": "\u05E7", + "/qofholamhebrew": "\u05E7", + "/qofpatah": "\u05E7", + "/qofpatahhebrew": "\u05E7", + "/qofqamats": "\u05E7", + "/qofqamatshebrew": "\u05E7", + "/qofqubuts": "\u05E7", + "/qofqubutshebrew": "\u05E7", + "/qofsegol": "\u05E7", + "/qofsegolhebrew": "\u05E7", + "/qofsheva": "\u05E7", + "/qofshevahebrew": "\u05E7", + "/qoftsere": "\u05E7", + "/qoftserehebrew": "\u05E7", + "/qofwithdagesh:hb": "\uFB47", + "/qparen": "\u24AC", + "/qparenthesized": "\u24AC", + "/qpdigraph": "\u0239", + "/qstrokedescender": "\uA757", + "/quadarrowdownfunc": "\u2357", + "/quadarrowleftfunc": "\u2347", + "/quadarrowrightfunc": "\u2348", + "/quadarrowupfunc": "\u2350", + "/quadbackslashfunc": "\u2342", + "/quadcaretdownfunc": "\u234C", + "/quadcaretupfunc": "\u2353", + "/quadcirclefunc": "\u233C", + "/quadcolonfunc": "\u2360", + "/quaddelfunc": "\u2354", + "/quaddeltafunc": "\u234D", + "/quaddiamondfunc": "\u233A", + "/quaddividefunc": "\u2339", + "/quadequalfunc": "\u2338", + "/quadfunc": "\u2395", + "/quadgreaterfunc": "\u2344", + "/quadjotfunc": "\u233B", + "/quadlessfunc": "\u2343", + "/quadnotequalfunc": "\u236F", + "/quadquestionfunc": "\u2370", + "/quadrantLowerLeft": "\u2596", + "/quadrantLowerRight": "\u2597", + "/quadrantUpperLeft": "\u2598", + "/quadrantUpperLeftAndLowerLeftAndLowerRight": "\u2599", + "/quadrantUpperLeftAndLowerRight": "\u259A", + "/quadrantUpperLeftAndUpperRightAndLowerLeft": "\u259B", + "/quadrantUpperLeftAndUpperRightAndLowerRight": "\u259C", + "/quadrantUpperRight": "\u259D", + "/quadrantUpperRightAndLowerLeft": "\u259E", + "/quadrantUpperRightAndLowerLeftAndLowerRight": "\u259F", + "/quadrupleminute": "\u2057", + "/quadslashfunc": "\u2341", + "/quarternote": "\u2669", + "/qubuts": "\u05BB", + "/qubuts18": "\u05BB", + "/qubuts25": "\u05BB", + "/qubuts31": "\u05BB", + "/qubuts:hb": "\u05BB", + "/qubutshebrew": "\u05BB", + "/qubutsnarrowhebrew": "\u05BB", + "/qubutsquarterhebrew": "\u05BB", + "/qubutswidehebrew": "\u05BB", + "/queenblack": "\u265B", + "/queenwhite": "\u2655", + "/question": "\u003F", + "/questionarabic": "\u061F", + "/questionarmenian": "\u055E", + "/questiondbl": "\u2047", + "/questiondown": "\u00BF", + "/questiondownsmall": "\uF7BF", + "/questionedequal": "\u225F", + "/questionexclamationmark": "\u2048", + "/questiongreek": "\u037E", + "/questionideographiccircled": "\u3244", + "/questionmonospace": "\uFF1F", + "/questionreversed": "\u2E2E", + "/questionsmall": "\uF73F", + "/quincunx": "\u26BB", + "/quotedbl": "\u0022", + "/quotedblbase": "\u201E", + "/quotedblleft": "\u201C", + "/quotedbllowreversed": "\u2E42", + "/quotedblmonospace": "\uFF02", + "/quotedblprime": "\u301E", + "/quotedblprimereversed": "\u301D", + "/quotedblreversed": "\u201F", + "/quotedblright": "\u201D", + "/quoteleft": "\u2018", + "/quoteleftreversed": "\u201B", + "/quotequadfunc": "\u235E", + "/quotereversed": "\u201B", + "/quoteright": "\u2019", + "/quoterightn": "\u0149", + "/quotesinglbase": "\u201A", + "/quotesingle": "\u0027", + "/quotesinglemonospace": "\uFF07", + "/quoteunderlinefunc": "\u2358", + "/r": "\u0072", + "/raagung": "\uA9AC", + "/raarmenian": "\u057C", + "/rabbit": "\u1F407", + "/rabbitFace": "\u1F430", + "/rabengali": "\u09B0", + "/racingCar": "\u1F3CE", + "/racingMotorcycle": "\u1F3CD", + "/racirclekatakana": "\u32F6", + "/racute": "\u0155", + "/radeva": "\u0930", + "/radfullwidth": "\u33AD", + "/radical": "\u221A", + "/radicalbottom": "\u23B7", + "/radicalex": "\uF8E5", + "/radio": "\u1F4FB", + "/radioButton": "\u1F518", + "/radioactive": "\u2622", + "/radovers2fullwidth": "\u33AF", + "/radoversfullwidth": "\u33AE", + "/radoverssquare": "\u33AE", + "/radoverssquaredsquare": "\u33AF", + "/radsquare": "\u33AD", + "/rafe": "\u05BF", + "/rafe:hb": "\u05BF", + "/rafehebrew": "\u05BF", + "/ragujarati": "\u0AB0", + "/ragurmukhi": "\u0A30", + "/rahiragana": "\u3089", + "/railwayCar": "\u1F683", + "/railwayTrack": "\u1F6E4", + "/rain": "\u26C6", + "/rainbow": "\u1F308", + "/raisedHandFingersSplayed": "\u1F590", + "/raisedHandPartBetweenMiddleAndRingFingers": "\u1F596", + "/raisedmcsign": "\u1F16A", + "/raisedmdsign": "\u1F16B", + "/rakatakana": "\u30E9", + "/rakatakanahalfwidth": "\uFF97", + "/ralowerdiagonalbengali": "\u09F1", + "/ram": "\u1F40F", + "/ramiddlediagonalbengali": "\u09F0", + "/ramshorn": "\u0264", + "/rat": "\u1F400", + "/ratio": "\u2236", + "/ray": "\u0608", + "/rbopomofo": "\u3116", + "/rcaron": "\u0159", + "/rcedilla": "\u0157", + "/rcircle": "\u24E1", + "/rcommaaccent": "\u0157", + "/rdblgrave": "\u0211", + "/rdot": "\u1E59", + "/rdotaccent": "\u1E59", + "/rdotbelow": "\u1E5B", + "/rdotbelowmacron": "\u1E5D", + "/reachideographicparen": "\u3243", + "/recirclekatakana": "\u32F9", + "/recreationalVehicle": "\u1F699", + "/rectangleblack": "\u25AC", + "/rectangleverticalblack": "\u25AE", + "/rectangleverticalwhite": "\u25AF", + "/rectanglewhite": "\u25AD", + "/recycledpaper": "\u267C", + "/recyclefiveplastics": "\u2677", + "/recyclefourplastics": "\u2676", + "/recyclegeneric": "\u267A", + "/recycleoneplastics": "\u2673", + "/recyclepartiallypaper": "\u267D", + "/recyclesevenplastics": "\u2679", + "/recyclesixplastics": "\u2678", + "/recyclethreeplastics": "\u2675", + "/recycletwoplastics": "\u2674", + "/recycleuniversal": "\u2672", + "/recycleuniversalblack": "\u267B", + "/redApple": "\u1F34E", + "/redTriangleDOwn": "\u1F53B", + "/redTriangleUp": "\u1F53A", + "/referencemark": "\u203B", + "/reflexsubset": "\u2286", + "/reflexsuperset": "\u2287", + "/regionalindicatorsymbollettera": "\u1F1E6", + "/regionalindicatorsymbolletterb": "\u1F1E7", + "/regionalindicatorsymbolletterc": "\u1F1E8", + "/regionalindicatorsymbolletterd": "\u1F1E9", + "/regionalindicatorsymbollettere": "\u1F1EA", + "/regionalindicatorsymbolletterf": "\u1F1EB", + "/regionalindicatorsymbolletterg": "\u1F1EC", + "/regionalindicatorsymbolletterh": "\u1F1ED", + "/regionalindicatorsymbolletteri": "\u1F1EE", + "/regionalindicatorsymbolletterj": "\u1F1EF", + "/regionalindicatorsymbolletterk": "\u1F1F0", + "/regionalindicatorsymbolletterl": "\u1F1F1", + "/regionalindicatorsymbolletterm": "\u1F1F2", + "/regionalindicatorsymbollettern": "\u1F1F3", + "/regionalindicatorsymbollettero": "\u1F1F4", + "/regionalindicatorsymbolletterp": "\u1F1F5", + "/regionalindicatorsymbolletterq": "\u1F1F6", + "/regionalindicatorsymbolletterr": "\u1F1F7", + "/regionalindicatorsymbolletters": "\u1F1F8", + "/regionalindicatorsymbollettert": "\u1F1F9", + "/regionalindicatorsymbolletteru": "\u1F1FA", + "/regionalindicatorsymbolletterv": "\u1F1FB", + "/regionalindicatorsymbolletterw": "\u1F1FC", + "/regionalindicatorsymbolletterx": "\u1F1FD", + "/regionalindicatorsymbollettery": "\u1F1FE", + "/regionalindicatorsymbolletterz": "\u1F1FF", + "/registered": "\u00AE", + "/registersans": "\uF8E8", + "/registerserif": "\uF6DA", + "/reh.fina": "\uFEAE", + "/reh.init_superscriptalef.fina": "\uFC5C", + "/reh.isol": "\uFEAD", + "/rehHamzaAbove": "\u076C", + "/rehSmallTahTwoDots": "\u0771", + "/rehStroke": "\u075B", + "/rehTwoDotsVerticallyAbove": "\u076B", + "/rehVabove": "\u0692", + "/rehVbelow": "\u0695", + "/reharabic": "\u0631", + "/reharmenian": "\u0580", + "/rehdotbelow": "\u0694", + "/rehdotbelowdotabove": "\u0696", + "/rehfinalarabic": "\uFEAE", + "/rehfourdotsabove": "\u0699", + "/rehinvertedV": "\u06EF", + "/rehiragana": "\u308C", + "/rehring": "\u0693", + "/rehtwodotsabove": "\u0697", + "/rehyehaleflamarabic": "\u0631", + "/rekatakana": "\u30EC", + "/rekatakanahalfwidth": "\uFF9A", + "/relievedFace": "\u1F60C", + "/religionideographiccircled": "\u32AA", + "/reminderRibbon": "\u1F397", + "/remusquare": "\u3355", + "/rentogensquare": "\u3356", + "/replacementchar": "\uFFFD", + "/replacementcharobj": "\uFFFC", + "/representideographicparen": "\u3239", + "/rerengganleft": "\uA9C1", + "/rerengganright": "\uA9C2", + "/resh": "\u05E8", + "/resh:hb": "\u05E8", + "/reshdageshhebrew": "\uFB48", + "/reshhatafpatah": "\u05E8", + "/reshhatafpatahhebrew": "\u05E8", + "/reshhatafsegol": "\u05E8", + "/reshhatafsegolhebrew": "\u05E8", + "/reshhebrew": "\u05E8", + "/reshhiriq": "\u05E8", + "/reshhiriqhebrew": "\u05E8", + "/reshholam": "\u05E8", + "/reshholamhebrew": "\u05E8", + "/reshpatah": "\u05E8", + "/reshpatahhebrew": "\u05E8", + "/reshqamats": "\u05E8", + "/reshqamatshebrew": "\u05E8", + "/reshqubuts": "\u05E8", + "/reshqubutshebrew": "\u05E8", + "/reshsegol": "\u05E8", + "/reshsegolhebrew": "\u05E8", + "/reshsheva": "\u05E8", + "/reshshevahebrew": "\u05E8", + "/reshtsere": "\u05E8", + "/reshtserehebrew": "\u05E8", + "/reshwide:hb": "\uFB27", + "/reshwithdagesh:hb": "\uFB48", + "/resourceideographiccircled": "\u32AE", + "/resourceideographicparen": "\u323E", + "/response": "\u211F", + "/restideographiccircled": "\u32A1", + "/restideographicparen": "\u3241", + "/restrictedentryoneleft": "\u26E0", + "/restrictedentrytwoleft": "\u26E1", + "/restroom": "\u1F6BB", + "/return": "\u23CE", + "/reversedHandMiddleFingerExtended": "\u1F595", + "/reversedRaisedHandFingersSplayed": "\u1F591", + "/reversedThumbsDownSign": "\u1F593", + "/reversedThumbsUpSign": "\u1F592", + "/reversedVictoryHand": "\u1F594", + "/reversedonehundred.roman": "\u2183", + "/reversedtilde": "\u223D", + "/reversedzecyr": "\u0511", + "/revia:hb": "\u0597", + "/reviahebrew": "\u0597", + "/reviamugrashhebrew": "\u0597", + "/revlogicalnot": "\u2310", + "/revolvingHearts": "\u1F49E", + "/rfishhook": "\u027E", + "/rfishhookreversed": "\u027F", + "/rgravedbl": "\u0211", + "/rhabengali": "\u09DD", + "/rhacyr": "\u0517", + "/rhadeva": "\u095D", + "/rho": "\u03C1", + "/rhoasper": "\u1FE5", + "/rhofunc": "\u2374", + "/rholenis": "\u1FE4", + "/rhook": "\u027D", + "/rhookturned": "\u027B", + "/rhookturnedsuperior": "\u02B5", + "/rhookturnedsupmod": "\u02B5", + "/rhostrokesymbol": "\u03FC", + "/rhosymbol": "\u03F1", + "/rhosymbolgreek": "\u03F1", + "/rhotichookmod": "\u02DE", + "/rial": "\uFDFC", + "/ribbon": "\u1F380", + "/riceBall": "\u1F359", + "/riceCracker": "\u1F358", + "/ricirclekatakana": "\u32F7", + "/rieulacirclekorean": "\u3271", + "/rieulaparenkorean": "\u3211", + "/rieulcirclekorean": "\u3263", + "/rieulhieuhkorean": "\u3140", + "/rieulkiyeokkorean": "\u313A", + "/rieulkiyeoksioskorean": "\u3169", + "/rieulkorean": "\u3139", + "/rieulmieumkorean": "\u313B", + "/rieulpansioskorean": "\u316C", + "/rieulparenkorean": "\u3203", + "/rieulphieuphkorean": "\u313F", + "/rieulpieupkorean": "\u313C", + "/rieulpieupsioskorean": "\u316B", + "/rieulsioskorean": "\u313D", + "/rieulthieuthkorean": "\u313E", + "/rieultikeutkorean": "\u316A", + "/rieulyeorinhieuhkorean": "\u316D", + "/right-pointingMagnifyingGlass": "\u1F50E", + "/rightAngerBubble": "\u1F5EF", + "/rightHalfBlock": "\u2590", + "/rightHandTelephoneReceiver": "\u1F57D", + "/rightOneEighthBlock": "\u2595", + "/rightSpeaker": "\u1F568", + "/rightSpeakerOneSoundWave": "\u1F569", + "/rightSpeakerThreeSoundWaves": "\u1F56A", + "/rightSpeechBubble": "\u1F5E9", + "/rightThoughtBubble": "\u1F5ED", + "/rightangle": "\u221F", + "/rightarrowoverleftarrow": "\u21C4", + "/rightdnheavyleftuplight": "\u2546", + "/rightharpoonoverleftharpoon": "\u21CC", + "/rightheavyleftdnlight": "\u252E", + "/rightheavyleftuplight": "\u2536", + "/rightheavyleftvertlight": "\u253E", + "/rightideographiccircled": "\u32A8", + "/rightlightleftdnheavy": "\u2531", + "/rightlightleftupheavy": "\u2539", + "/rightlightleftvertheavy": "\u2549", + "/righttackbelowcmb": "\u0319", + "/righttoleftembed": "\u202B", + "/righttoleftisolate": "\u2067", + "/righttoleftmark": "\u200F", + "/righttoleftoverride": "\u202E", + "/righttriangle": "\u22BF", + "/rightupheavyleftdnlight": "\u2544", + "/rihiragana": "\u308A", + "/rikatakana": "\u30EA", + "/rikatakanahalfwidth": "\uFF98", + "/ring": "\u02DA", + "/ringbelowcmb": "\u0325", + "/ringcmb": "\u030A", + "/ringequal": "\u2257", + "/ringhalfleft": "\u02BF", + "/ringhalfleftarmenian": "\u0559", + "/ringhalfleftbelowcmb": "\u031C", + "/ringhalfleftcentered": "\u02D3", + "/ringhalfleftcentredmod": "\u02D3", + "/ringhalfleftmod": "\u02BF", + "/ringhalfright": "\u02BE", + "/ringhalfrightbelowcmb": "\u0339", + "/ringhalfrightcentered": "\u02D2", + "/ringhalfrightcentredmod": "\u02D2", + "/ringhalfrightmod": "\u02BE", + "/ringinequal": "\u2256", + "/ringingBell": "\u1F56D", + "/ringlowmod": "\u02F3", + "/ringoperator": "\u2218", + "/rinsular": "\uA783", + "/rinvertedbreve": "\u0213", + "/rirasquare": "\u3352", + "/risingdiagonal": "\u27CB", + "/rittorusquare": "\u3351", + "/rlinebelow": "\u1E5F", + "/rlongleg": "\u027C", + "/rlonglegturned": "\u027A", + "/rmacrondot": "\u1E5D", + "/rmonospace": "\uFF52", + "/rnoon": "\u06BB", + "/rnoon.fina": "\uFBA1", + "/rnoon.init": "\uFBA2", + "/rnoon.isol": "\uFBA0", + "/rnoon.medi": "\uFBA3", + "/roastedSweetPotato": "\u1F360", + "/robliquestroke": "\uA7A7", + "/rocirclekatakana": "\u32FA", + "/rocket": "\u1F680", + "/rohiragana": "\u308D", + "/rokatakana": "\u30ED", + "/rokatakanahalfwidth": "\uFF9B", + "/rolled-upNewspaper": "\u1F5DE", + "/rollerCoaster": "\u1F3A2", + "/rookblack": "\u265C", + "/rookwhite": "\u2656", + "/rooster": "\u1F413", + "/roruathai": "\u0E23", + "/rose": "\u1F339", + "/rosette": "\u1F3F5", + "/roundPushpin": "\u1F4CD", + "/roundedzeroabove": "\u06DF", + "/rowboat": "\u1F6A3", + "/rparen": "\u24AD", + "/rparenthesized": "\u24AD", + "/rrabengali": "\u09DC", + "/rradeva": "\u0931", + "/rragurmukhi": "\u0A5C", + "/rreh": "\u0691", + "/rreh.fina": "\uFB8D", + "/rreh.isol": "\uFB8C", + "/rreharabic": "\u0691", + "/rrehfinalarabic": "\uFB8D", + "/rrotunda": "\uA75B", + "/rrvocalicbengali": "\u09E0", + "/rrvocalicdeva": "\u0960", + "/rrvocalicgujarati": "\u0AE0", + "/rrvocalicvowelsignbengali": "\u09C4", + "/rrvocalicvowelsigndeva": "\u0944", + "/rrvocalicvowelsigngujarati": "\u0AC4", + "/rstroke": "\u024D", + "/rsuperior": "\uF6F1", + "/rsupmod": "\u02B3", + "/rtailturned": "\u2C79", + "/rtblock": "\u2590", + "/rturned": "\u0279", + "/rturnedsuperior": "\u02B4", + "/rturnedsupmod": "\u02B4", + "/ruble": "\u20BD", + "/rucirclekatakana": "\u32F8", + "/rugbyFootball": "\u1F3C9", + "/ruhiragana": "\u308B", + "/rukatakana": "\u30EB", + "/rukatakanahalfwidth": "\uFF99", + "/rum": "\uA775", + "/rumrotunda": "\uA75D", + "/runner": "\u1F3C3", + "/runningShirtSash": "\u1F3BD", + "/rupeemarkbengali": "\u09F2", + "/rupeesignbengali": "\u09F3", + "/rupiah": "\uF6DD", + "/rupiisquare": "\u3353", + "/ruthai": "\u0E24", + "/ruuburusquare": "\u3354", + "/rvocalicbengali": "\u098B", + "/rvocalicdeva": "\u090B", + "/rvocalicgujarati": "\u0A8B", + "/rvocalicvowelsignbengali": "\u09C3", + "/rvocalicvowelsigndeva": "\u0943", + "/rvocalicvowelsigngujarati": "\u0AC3", + "/s": "\u0073", + "/s.inferior": "\u209B", + "/s_t": "\uFB06", + "/sabengali": "\u09B8", + "/sacirclekatakana": "\u32DA", + "/sacute": "\u015B", + "/sacutedotaccent": "\u1E65", + "/sad": "\u0635", + "/sad.fina": "\uFEBA", + "/sad.init": "\uFEBB", + "/sad.init_alefmaksura.fina": "\uFD05", + "/sad.init_hah.fina": "\uFC20", + "/sad.init_hah.medi": "\uFCB1", + "/sad.init_hah.medi_hah.medi": "\uFD65", + "/sad.init_khah.medi": "\uFCB2", + "/sad.init_meem.fina": "\uFC21", + "/sad.init_meem.medi": "\uFCB3", + "/sad.init_meem.medi_meem.medi": "\uFDC5", + "/sad.init_reh.fina": "\uFD0F", + "/sad.init_yeh.fina": "\uFD06", + "/sad.isol": "\uFEB9", + "/sad.medi": "\uFEBC", + "/sad.medi_alefmaksura.fina": "\uFD21", + "/sad.medi_hah.medi_hah.fina": "\uFD64", + "/sad.medi_hah.medi_yeh.fina": "\uFDA9", + "/sad.medi_meem.medi_meem.fina": "\uFD66", + "/sad.medi_reh.fina": "\uFD2B", + "/sad.medi_yeh.fina": "\uFD22", + "/sad_lam_alefmaksuraabove": "\u06D6", + "/sadarabic": "\u0635", + "/sadeva": "\u0938", + "/sadfinalarabic": "\uFEBA", + "/sadinitialarabic": "\uFEBB", + "/sadmedialarabic": "\uFEBC", + "/sadthreedotsabove": "\u069E", + "/sadtwodotsbelow": "\u069D", + "/sagittarius": "\u2650", + "/sagujarati": "\u0AB8", + "/sagurmukhi": "\u0A38", + "/sahiragana": "\u3055", + "/saikurusquare": "\u331F", + "/sailboat": "\u26F5", + "/sakatakana": "\u30B5", + "/sakatakanahalfwidth": "\uFF7B", + "/sakeBottleAndCup": "\u1F376", + "/sallallahoualayhewasallamarabic": "\uFDFA", + "/saltillo": "\uA78C", + "/saltire": "\u2613", + "/samahaprana": "\uA9B0", + "/samekh": "\u05E1", + "/samekh:hb": "\u05E1", + "/samekhdagesh": "\uFB41", + "/samekhdageshhebrew": "\uFB41", + "/samekhhebrew": "\u05E1", + "/samekhwithdagesh:hb": "\uFB41", + "/sampi": "\u03E1", + "/sampiarchaic": "\u0373", + "/samurda": "\uA9AF", + "/samvat": "\u0604", + "/san": "\u03FB", + "/santiimusquare": "\u3320", + "/saraaathai": "\u0E32", + "/saraaethai": "\u0E41", + "/saraaimaimalaithai": "\u0E44", + "/saraaimaimuanthai": "\u0E43", + "/saraamthai": "\u0E33", + "/saraathai": "\u0E30", + "/saraethai": "\u0E40", + "/saraiileftthai": "\uF886", + "/saraiithai": "\u0E35", + "/saraileftthai": "\uF885", + "/saraithai": "\u0E34", + "/saraothai": "\u0E42", + "/saraueeleftthai": "\uF888", + "/saraueethai": "\u0E37", + "/saraueleftthai": "\uF887", + "/sarauethai": "\u0E36", + "/sarauthai": "\u0E38", + "/sarauuthai": "\u0E39", + "/satellite": "\u1F6F0", + "/satelliteAntenna": "\u1F4E1", + "/saturn": "\u2644", + "/saxophone": "\u1F3B7", + "/sbopomofo": "\u3119", + "/scales": "\u2696", + "/scanninehorizontal": "\u23BD", + "/scanonehorizontal": "\u23BA", + "/scansevenhorizontal": "\u23BC", + "/scanthreehorizontal": "\u23BB", + "/scaron": "\u0161", + "/scarondot": "\u1E67", + "/scarondotaccent": "\u1E67", + "/scedilla": "\u015F", + "/school": "\u1F3EB", + "/schoolSatchel": "\u1F392", + "/schoolideographiccircled": "\u3246", + "/schwa": "\u0259", + "/schwa.inferior": "\u2094", + "/schwacyr": "\u04D9", + "/schwacyrillic": "\u04D9", + "/schwadieresiscyr": "\u04DB", + "/schwadieresiscyrillic": "\u04DB", + "/schwahook": "\u025A", + "/scircle": "\u24E2", + "/scircumflex": "\u015D", + "/scommaaccent": "\u0219", + "/scooter": "\u1F6F4", + "/scorpius": "\u264F", + "/screen": "\u1F5B5", + "/scroll": "\u1F4DC", + "/scruple": "\u2108", + "/sdot": "\u1E61", + "/sdotaccent": "\u1E61", + "/sdotbelow": "\u1E63", + "/sdotbelowdotabove": "\u1E69", + "/sdotbelowdotaccent": "\u1E69", + "/seagullbelowcmb": "\u033C", + "/seat": "\u1F4BA", + "/secirclekatakana": "\u32DD", + "/second": "\u2033", + "/secondreversed": "\u2036", + "/secondscreensquare": "\u1F19C", + "/secondtonechinese": "\u02CA", + "/secretideographiccircled": "\u3299", + "/section": "\u00A7", + "/sectionsignhalftop": "\u2E39", + "/sector": "\u2314", + "/seeNoEvilMonkey": "\u1F648", + "/seedling": "\u1F331", + "/seen": "\u0633", + "/seen.fina": "\uFEB2", + "/seen.init": "\uFEB3", + "/seen.init_alefmaksura.fina": "\uFCFB", + "/seen.init_hah.fina": "\uFC1D", + "/seen.init_hah.medi": "\uFCAE", + "/seen.init_hah.medi_jeem.medi": "\uFD5C", + "/seen.init_heh.medi": "\uFD31", + "/seen.init_jeem.fina": "\uFC1C", + "/seen.init_jeem.medi": "\uFCAD", + "/seen.init_jeem.medi_hah.medi": "\uFD5D", + "/seen.init_khah.fina": "\uFC1E", + "/seen.init_khah.medi": "\uFCAF", + "/seen.init_meem.fina": "\uFC1F", + "/seen.init_meem.medi": "\uFCB0", + "/seen.init_meem.medi_hah.medi": "\uFD60", + "/seen.init_meem.medi_jeem.medi": "\uFD61", + "/seen.init_meem.medi_meem.medi": "\uFD63", + "/seen.init_reh.fina": "\uFD0E", + "/seen.init_yeh.fina": "\uFCFC", + "/seen.isol": "\uFEB1", + "/seen.medi": "\uFEB4", + "/seen.medi_alefmaksura.fina": "\uFD17", + "/seen.medi_hah.medi": "\uFD35", + "/seen.medi_heh.medi": "\uFCE8", + "/seen.medi_jeem.medi": "\uFD34", + "/seen.medi_jeem.medi_alefmaksura.fina": "\uFD5E", + "/seen.medi_khah.medi": "\uFD36", + "/seen.medi_khah.medi_alefmaksura.fina": "\uFDA8", + "/seen.medi_khah.medi_yeh.fina": "\uFDC6", + "/seen.medi_meem.medi": "\uFCE7", + "/seen.medi_meem.medi_hah.fina": "\uFD5F", + "/seen.medi_meem.medi_meem.fina": "\uFD62", + "/seen.medi_reh.fina": "\uFD2A", + "/seen.medi_yeh.fina": "\uFD18", + "/seenDigitFourAbove": "\u077D", + "/seenFourDotsAbove": "\u075C", + "/seenInvertedV": "\u077E", + "/seenSmallTahTwoDots": "\u0770", + "/seenTwoDotsVerticallyAbove": "\u076D", + "/seenabove": "\u06DC", + "/seenarabic": "\u0633", + "/seendotbelowdotabove": "\u069A", + "/seenfinalarabic": "\uFEB2", + "/seeninitialarabic": "\uFEB3", + "/seenlow": "\u06E3", + "/seenmedialarabic": "\uFEB4", + "/seenthreedotsbelow": "\u069B", + "/seenthreedotsbelowthreedotsabove": "\u069C", + "/segment": "\u2313", + "/segol": "\u05B6", + "/segol13": "\u05B6", + "/segol1f": "\u05B6", + "/segol2c": "\u05B6", + "/segol:hb": "\u05B6", + "/segolhebrew": "\u05B6", + "/segolnarrowhebrew": "\u05B6", + "/segolquarterhebrew": "\u05B6", + "/segolta:hb": "\u0592", + "/segoltahebrew": "\u0592", + "/segolwidehebrew": "\u05B6", + "/seharmenian": "\u057D", + "/sehiragana": "\u305B", + "/sekatakana": "\u30BB", + "/sekatakanahalfwidth": "\uFF7E", + "/selfideographicparen": "\u3242", + "/semicolon": "\u003B", + "/semicolonarabic": "\u061B", + "/semicolonmonospace": "\uFF1B", + "/semicolonreversed": "\u204F", + "/semicolonsmall": "\uFE54", + "/semicolonunderlinefunc": "\u236E", + "/semidirectproductleft": "\u22CB", + "/semidirectproductright": "\u22CC", + "/semisextile": "\u26BA", + "/semisoftcyr": "\u048D", + "/semivoicedmarkkana": "\u309C", + "/semivoicedmarkkanahalfwidth": "\uFF9F", + "/sentisquare": "\u3322", + "/sentosquare": "\u3323", + "/septembertelegraph": "\u32C8", + "/sersetdblup": "\u22D1", + "/sersetnotequalup": "\u228B", + "/servicemark": "\u2120", + "/sesamedot": "\uFE45", + "/sesquiquadrate": "\u26BC", + "/setminus": "\u2216", + "/seven": "\u0037", + "/seven.inferior": "\u2087", + "/seven.roman": "\u2166", + "/seven.romansmall": "\u2176", + "/seven.superior": "\u2077", + "/sevenarabic": "\u0667", + "/sevenbengali": "\u09ED", + "/sevencircle": "\u2466", + "/sevencircledbl": "\u24FB", + "/sevencircleinversesansserif": "\u2790", + "/sevencomma": "\u1F108", + "/sevendeva": "\u096D", + "/seveneighths": "\u215E", + "/sevenfar": "\u06F7", + "/sevengujarati": "\u0AED", + "/sevengurmukhi": "\u0A6D", + "/sevenhackarabic": "\u0667", + "/sevenhangzhou": "\u3027", + "/sevenideographiccircled": "\u3286", + "/sevenideographicparen": "\u3226", + "/seveninferior": "\u2087", + "/sevenmonospace": "\uFF17", + "/sevenoldstyle": "\uF737", + "/sevenparen": "\u247A", + "/sevenparenthesized": "\u247A", + "/sevenperiod": "\u248E", + "/sevenpersian": "\u06F7", + "/sevenpointonesquare": "\u1F1A1", + "/sevenroman": "\u2176", + "/sevensuperior": "\u2077", + "/seventeencircle": "\u2470", + "/seventeencircleblack": "\u24F1", + "/seventeenparen": "\u2484", + "/seventeenparenthesized": "\u2484", + "/seventeenperiod": "\u2498", + "/seventhai": "\u0E57", + "/seventycirclesquare": "\u324E", + "/sextile": "\u26B9", + "/sfthyphen": "\u00AD", + "/shaarmenian": "\u0577", + "/shabengali": "\u09B6", + "/shacyr": "\u0448", + "/shacyrillic": "\u0448", + "/shaddaAlefIsol": "\uFC63", + "/shaddaDammaIsol": "\uFC61", + "/shaddaDammaMedi": "\uFCF3", + "/shaddaDammatanIsol": "\uFC5E", + "/shaddaFathaIsol": "\uFC60", + "/shaddaFathaMedi": "\uFCF2", + "/shaddaIsol": "\uFE7C", + "/shaddaKasraIsol": "\uFC62", + "/shaddaKasraMedi": "\uFCF4", + "/shaddaKasratanIsol": "\uFC5F", + "/shaddaMedi": "\uFE7D", + "/shaddaarabic": "\u0651", + "/shaddadammaarabic": "\uFC61", + "/shaddadammatanarabic": "\uFC5E", + "/shaddafathaarabic": "\uFC60", + "/shaddafathatanarabic": "\u0651", + "/shaddakasraarabic": "\uFC62", + "/shaddakasratanarabic": "\uFC5F", + "/shade": "\u2592", + "/shadedark": "\u2593", + "/shadelight": "\u2591", + "/shademedium": "\u2592", + "/shadeva": "\u0936", + "/shagujarati": "\u0AB6", + "/shagurmukhi": "\u0A36", + "/shalshelet:hb": "\u0593", + "/shalshelethebrew": "\u0593", + "/shamrock": "\u2618", + "/shavedIce": "\u1F367", + "/shbopomofo": "\u3115", + "/shchacyr": "\u0449", + "/shchacyrillic": "\u0449", + "/sheen": "\u0634", + "/sheen.fina": "\uFEB6", + "/sheen.init": "\uFEB7", + "/sheen.init_alefmaksura.fina": "\uFCFD", + "/sheen.init_hah.fina": "\uFD0A", + "/sheen.init_hah.medi": "\uFD2E", + "/sheen.init_hah.medi_meem.medi": "\uFD68", + "/sheen.init_heh.medi": "\uFD32", + "/sheen.init_jeem.fina": "\uFD09", + "/sheen.init_jeem.medi": "\uFD2D", + "/sheen.init_khah.fina": "\uFD0B", + "/sheen.init_khah.medi": "\uFD2F", + "/sheen.init_meem.fina": "\uFD0C", + "/sheen.init_meem.medi": "\uFD30", + "/sheen.init_meem.medi_khah.medi": "\uFD6B", + "/sheen.init_meem.medi_meem.medi": "\uFD6D", + "/sheen.init_reh.fina": "\uFD0D", + "/sheen.init_yeh.fina": "\uFCFE", + "/sheen.isol": "\uFEB5", + "/sheen.medi": "\uFEB8", + "/sheen.medi_alefmaksura.fina": "\uFD19", + "/sheen.medi_hah.fina": "\uFD26", + "/sheen.medi_hah.medi": "\uFD38", + "/sheen.medi_hah.medi_meem.fina": "\uFD67", + "/sheen.medi_hah.medi_yeh.fina": "\uFDAA", + "/sheen.medi_heh.medi": "\uFCEA", + "/sheen.medi_jeem.fina": "\uFD25", + "/sheen.medi_jeem.medi": "\uFD37", + "/sheen.medi_jeem.medi_yeh.fina": "\uFD69", + "/sheen.medi_khah.fina": "\uFD27", + "/sheen.medi_khah.medi": "\uFD39", + "/sheen.medi_meem.fina": "\uFD28", + "/sheen.medi_meem.medi": "\uFCE9", + "/sheen.medi_meem.medi_khah.fina": "\uFD6A", + "/sheen.medi_meem.medi_meem.fina": "\uFD6C", + "/sheen.medi_reh.fina": "\uFD29", + "/sheen.medi_yeh.fina": "\uFD1A", + "/sheenarabic": "\u0634", + "/sheendotbelow": "\u06FA", + "/sheenfinalarabic": "\uFEB6", + "/sheeninitialarabic": "\uFEB7", + "/sheenmedialarabic": "\uFEB8", + "/sheep": "\u1F411", + "/sheicoptic": "\u03E3", + "/shelfmod": "\u02FD", + "/shelfopenmod": "\u02FE", + "/sheqel": "\u20AA", + "/sheqelhebrew": "\u20AA", + "/sheva": "\u05B0", + "/sheva115": "\u05B0", + "/sheva15": "\u05B0", + "/sheva22": "\u05B0", + "/sheva2e": "\u05B0", + "/sheva:hb": "\u05B0", + "/shevahebrew": "\u05B0", + "/shevanarrowhebrew": "\u05B0", + "/shevaquarterhebrew": "\u05B0", + "/shevawidehebrew": "\u05B0", + "/shhacyr": "\u04BB", + "/shhacyrillic": "\u04BB", + "/shhatailcyr": "\u0527", + "/shield": "\u1F6E1", + "/shimacoptic": "\u03ED", + "/shin": "\u05E9", + "/shin:hb": "\u05E9", + "/shinDot:hb": "\u05C1", + "/shindagesh": "\uFB49", + "/shindageshhebrew": "\uFB49", + "/shindageshshindot": "\uFB2C", + "/shindageshshindothebrew": "\uFB2C", + "/shindageshsindot": "\uFB2D", + "/shindageshsindothebrew": "\uFB2D", + "/shindothebrew": "\u05C1", + "/shinhebrew": "\u05E9", + "/shinshindot": "\uFB2A", + "/shinshindothebrew": "\uFB2A", + "/shinsindot": "\uFB2B", + "/shinsindothebrew": "\uFB2B", + "/shintoshrine": "\u26E9", + "/shinwithdagesh:hb": "\uFB49", + "/shinwithdageshandshinDot:hb": "\uFB2C", + "/shinwithdageshandsinDot:hb": "\uFB2D", + "/shinwithshinDot:hb": "\uFB2A", + "/shinwithsinDot:hb": "\uFB2B", + "/ship": "\u1F6A2", + "/sho": "\u03F8", + "/shoejotupfunc": "\u235D", + "/shoestiledownfunc": "\u2366", + "/shoestileleftfunc": "\u2367", + "/shogipieceblack": "\u2617", + "/shogipiecewhite": "\u2616", + "/shook": "\u0282", + "/shootingStar": "\u1F320", + "/shoppingBags": "\u1F6CD", + "/shoppingTrolley": "\u1F6D2", + "/shortcake": "\u1F370", + "/shortequalsmod": "\uA78A", + "/shortoverlongmetrical": "\u23D3", + "/shoulderedopenbox": "\u237D", + "/shower": "\u1F6BF", + "/shvsquare": "\u1F1AA", + "/sicirclekatakana": "\u32DB", + "/sidewaysBlackDownPointingIndex": "\u1F5A1", + "/sidewaysBlackLeftPointingIndex": "\u1F59A", + "/sidewaysBlackRightPointingIndex": "\u1F59B", + "/sidewaysBlackUpPointingIndex": "\u1F5A0", + "/sidewaysWhiteDownPointingIndex": "\u1F59F", + "/sidewaysWhiteLeftPointingIndex": "\u1F598", + "/sidewaysWhiteRightPointingIndex": "\u1F599", + "/sidewaysWhiteUpPointingIndex": "\u1F59E", + "/sigma": "\u03C3", + "/sigma1": "\u03C2", + "/sigmafinal": "\u03C2", + "/sigmalunatedottedreversedsymbol": "\u037D", + "/sigmalunatedottedsymbol": "\u037C", + "/sigmalunatereversedsymbol": "\u037B", + "/sigmalunatesymbol": "\u03F2", + "/sigmalunatesymbolgreek": "\u03F2", + "/sihiragana": "\u3057", + "/sikatakana": "\u30B7", + "/sikatakanahalfwidth": "\uFF7C", + "/silhouetteOfJapan": "\u1F5FE", + "/siluqhebrew": "\u05BD", + "/siluqlefthebrew": "\u05BD", + "/similar": "\u223C", + "/sinDot:hb": "\u05C2", + "/sindothebrew": "\u05C2", + "/sinewave": "\u223F", + "/sinh:a": "\u0D85", + "/sinh:aa": "\u0D86", + "/sinh:aae": "\u0D88", + "/sinh:aaesign": "\u0DD1", + "/sinh:aasign": "\u0DCF", + "/sinh:ae": "\u0D87", + "/sinh:aesign": "\u0DD0", + "/sinh:ai": "\u0D93", + "/sinh:aisign": "\u0DDB", + "/sinh:anusvara": "\u0D82", + "/sinh:au": "\u0D96", + "/sinh:ausign": "\u0DDE", + "/sinh:ba": "\u0DB6", + "/sinh:bha": "\u0DB7", + "/sinh:ca": "\u0DA0", + "/sinh:cha": "\u0DA1", + "/sinh:da": "\u0DAF", + "/sinh:dda": "\u0DA9", + "/sinh:ddha": "\u0DAA", + "/sinh:dha": "\u0DB0", + "/sinh:e": "\u0D91", + "/sinh:ee": "\u0D92", + "/sinh:eesign": "\u0DDA", + "/sinh:esign": "\u0DD9", + "/sinh:fa": "\u0DC6", + "/sinh:ga": "\u0D9C", + "/sinh:gha": "\u0D9D", + "/sinh:ha": "\u0DC4", + "/sinh:i": "\u0D89", + "/sinh:ii": "\u0D8A", + "/sinh:iisign": "\u0DD3", + "/sinh:isign": "\u0DD2", + "/sinh:ja": "\u0DA2", + "/sinh:jha": "\u0DA3", + "/sinh:jnya": "\u0DA5", + "/sinh:ka": "\u0D9A", + "/sinh:kha": "\u0D9B", + "/sinh:kunddaliya": "\u0DF4", + "/sinh:la": "\u0DBD", + "/sinh:litheight": "\u0DEE", + "/sinh:lithfive": "\u0DEB", + "/sinh:lithfour": "\u0DEA", + "/sinh:lithnine": "\u0DEF", + "/sinh:lithone": "\u0DE7", + "/sinh:lithseven": "\u0DED", + "/sinh:lithsix": "\u0DEC", + "/sinh:liththree": "\u0DE9", + "/sinh:lithtwo": "\u0DE8", + "/sinh:lithzero": "\u0DE6", + "/sinh:lla": "\u0DC5", + "/sinh:llvocal": "\u0D90", + "/sinh:llvocalsign": "\u0DF3", + "/sinh:lvocal": "\u0D8F", + "/sinh:lvocalsign": "\u0DDF", + "/sinh:ma": "\u0DB8", + "/sinh:mba": "\u0DB9", + "/sinh:na": "\u0DB1", + "/sinh:nda": "\u0DB3", + "/sinh:nga": "\u0D9E", + "/sinh:nna": "\u0DAB", + "/sinh:nndda": "\u0DAC", + "/sinh:nnga": "\u0D9F", + "/sinh:nya": "\u0DA4", + "/sinh:nyja": "\u0DA6", + "/sinh:o": "\u0D94", + "/sinh:oo": "\u0D95", + "/sinh:oosign": "\u0DDD", + "/sinh:osign": "\u0DDC", + "/sinh:pa": "\u0DB4", + "/sinh:pha": "\u0DB5", + "/sinh:ra": "\u0DBB", + "/sinh:rrvocal": "\u0D8E", + "/sinh:rrvocalsign": "\u0DF2", + "/sinh:rvocal": "\u0D8D", + "/sinh:rvocalsign": "\u0DD8", + "/sinh:sa": "\u0DC3", + "/sinh:sha": "\u0DC1", + "/sinh:ssa": "\u0DC2", + "/sinh:ta": "\u0DAD", + "/sinh:tha": "\u0DAE", + "/sinh:tta": "\u0DA7", + "/sinh:ttha": "\u0DA8", + "/sinh:u": "\u0D8B", + "/sinh:usign": "\u0DD4", + "/sinh:uu": "\u0D8C", + "/sinh:uusign": "\u0DD6", + "/sinh:va": "\u0DC0", + "/sinh:virama": "\u0DCA", + "/sinh:visarga": "\u0D83", + "/sinh:ya": "\u0DBA", + "/sinologicaldot": "\uA78F", + "/sinsular": "\uA785", + "/siosacirclekorean": "\u3274", + "/siosaparenkorean": "\u3214", + "/sioscieuckorean": "\u317E", + "/sioscirclekorean": "\u3266", + "/sioskiyeokkorean": "\u317A", + "/sioskorean": "\u3145", + "/siosnieunkorean": "\u317B", + "/siosparenkorean": "\u3206", + "/siospieupkorean": "\u317D", + "/siostikeutkorean": "\u317C", + "/siringusquare": "\u3321", + "/six": "\u0036", + "/six.inferior": "\u2086", + "/six.roman": "\u2165", + "/six.romansmall": "\u2175", + "/six.superior": "\u2076", + "/sixPointedStarMiddleDot": "\u1F52F", + "/sixarabic": "\u0666", + "/sixbengali": "\u09EC", + "/sixcircle": "\u2465", + "/sixcircledbl": "\u24FA", + "/sixcircleinversesansserif": "\u278F", + "/sixcomma": "\u1F107", + "/sixdeva": "\u096C", + "/sixdotsvertical": "\u2E3D", + "/sixfar": "\u06F6", + "/sixgujarati": "\u0AEC", + "/sixgurmukhi": "\u0A6C", + "/sixhackarabic": "\u0666", + "/sixhangzhou": "\u3026", + "/sixideographiccircled": "\u3285", + "/sixideographicparen": "\u3225", + "/sixinferior": "\u2086", + "/sixlateform.roman": "\u2185", + "/sixmonospace": "\uFF16", + "/sixoldstyle": "\uF736", + "/sixparen": "\u2479", + "/sixparenthesized": "\u2479", + "/sixperemspace": "\u2006", + "/sixperiod": "\u248D", + "/sixpersian": "\u06F6", + "/sixroman": "\u2175", + "/sixsuperior": "\u2076", + "/sixteencircle": "\u246F", + "/sixteencircleblack": "\u24F0", + "/sixteencurrencydenominatorbengali": "\u09F9", + "/sixteenparen": "\u2483", + "/sixteenparenthesized": "\u2483", + "/sixteenperiod": "\u2497", + "/sixthai": "\u0E56", + "/sixtycirclesquare": "\u324D", + "/sixtypsquare": "\u1F1A3", + "/sjekomicyr": "\u050D", + "/skiAndSkiBoot": "\u1F3BF", + "/skier": "\u26F7", + "/skull": "\u1F480", + "/skullcrossbones": "\u2620", + "/slash": "\u002F", + "/slashbarfunc": "\u233F", + "/slashmonospace": "\uFF0F", + "/sled": "\u1F6F7", + "/sleeping": "\u1F4A4", + "/sleepingAccommodation": "\u1F6CC", + "/sleepingFace": "\u1F634", + "/sleepyFace": "\u1F62A", + "/sleuthOrSpy": "\u1F575", + "/sliceOfPizza": "\u1F355", + "/slightlyFrowningFace": "\u1F641", + "/slightlySmilingFace": "\u1F642", + "/slong": "\u017F", + "/slongdotaccent": "\u1E9B", + "/slope": "\u2333", + "/slotMachine": "\u1F3B0", + "/smallAirplane": "\u1F6E9", + "/smallBlueDiamond": "\u1F539", + "/smallOrangeDiamond": "\u1F538", + "/smallRedTriangleDOwn": "\u1F53D", + "/smallRedTriangleUp": "\u1F53C", + "/smile": "\u2323", + "/smileface": "\u263A", + "/smilingCatFaceWithHeartShapedEyes": "\u1F63B", + "/smilingCatFaceWithOpenMouth": "\u1F63A", + "/smilingFaceWithHalo": "\u1F607", + "/smilingFaceWithHeartShapedEyes": "\u1F60D", + "/smilingFaceWithHorns": "\u1F608", + "/smilingFaceWithOpenMouth": "\u1F603", + "/smilingFaceWithOpenMouthAndColdSweat": "\u1F605", + "/smilingFaceWithOpenMouthAndSmilingEyes": "\u1F604", + "/smilingFaceWithOpenMouthAndTightlyClosedEyes": "\u1F606", + "/smilingFaceWithSmilingEyes": "\u1F60A", + "/smilingFaceWithSunglasses": "\u1F60E", + "/smilingfaceblack": "\u263B", + "/smilingfacewhite": "\u263A", + "/smirkingFace": "\u1F60F", + "/smll:ampersand": "\uFE60", + "/smll:asterisk": "\uFE61", + "/smll:backslash": "\uFE68", + "/smll:braceleft": "\uFE5B", + "/smll:braceright": "\uFE5C", + "/smll:colon": "\uFE55", + "/smll:comma": "\uFE50", + "/smll:dollar": "\uFE69", + "/smll:emdash": "\uFE58", + "/smll:equal": "\uFE66", + "/smll:exclam": "\uFE57", + "/smll:greater": "\uFE65", + "/smll:hyphen": "\uFE63", + "/smll:ideographiccomma": "\uFE51", + "/smll:less": "\uFE64", + "/smll:numbersign": "\uFE5F", + "/smll:parenthesisleft": "\uFE59", + "/smll:parenthesisright": "\uFE5A", + "/smll:percent": "\uFE6A", + "/smll:period": "\uFE52", + "/smll:plus": "\uFE62", + "/smll:question": "\uFE56", + "/smll:semicolon": "\uFE54", + "/smll:tortoiseshellbracketleft": "\uFE5D", + "/smll:tortoiseshellbracketright": "\uFE5E", + "/smoking": "\u1F6AC", + "/smonospace": "\uFF53", + "/snail": "\u1F40C", + "/snake": "\u1F40D", + "/snowboarder": "\u1F3C2", + "/snowcappedMountain": "\u1F3D4", + "/snowman": "\u2603", + "/snowmanblack": "\u26C7", + "/snowmanoutsnow": "\u26C4", + "/sobliquestroke": "\uA7A9", + "/soccerball": "\u26BD", + "/societyideographiccircled": "\u3293", + "/societyideographicparen": "\u3233", + "/socirclekatakana": "\u32DE", + "/sofPasuq:hb": "\u05C3", + "/sofpasuqhebrew": "\u05C3", + "/softIceCream": "\u1F366", + "/softShellFloppyDisk": "\u1F5AC", + "/softcyr": "\u044C", + "/softhyphen": "\u00AD", + "/softsigncyrillic": "\u044C", + "/softwarefunction": "\u2394", + "/sohiragana": "\u305D", + "/sokatakana": "\u30BD", + "/sokatakanahalfwidth": "\uFF7F", + "/soliduslongoverlaycmb": "\u0338", + "/solidusshortoverlaycmb": "\u0337", + "/solidussubsetreversepreceding": "\u27C8", + "/solidussupersetpreceding": "\u27C9", + "/soonRightwardsArrowAbove": "\u1F51C", + "/sorusithai": "\u0E29", + "/sosalathai": "\u0E28", + "/sosothai": "\u0E0B", + "/sossquare": "\u1F198", + "/sosuathai": "\u0E2A", + "/soundcopyright": "\u2117", + "/space": "\u0020", + "/spacehackarabic": "\u0020", + "/spade": "\u2660", + "/spadeblack": "\u2660", + "/spadesuitblack": "\u2660", + "/spadesuitwhite": "\u2664", + "/spadewhite": "\u2664", + "/spaghetti": "\u1F35D", + "/sparen": "\u24AE", + "/sparenthesized": "\u24AE", + "/sparklingHeart": "\u1F496", + "/speakNoEvilMonkey": "\u1F64A", + "/speaker": "\u1F508", + "/speakerCancellationStroke": "\u1F507", + "/speakerOneSoundWave": "\u1F509", + "/speakerThreeSoundWaves": "\u1F50A", + "/speakingHeadInSilhouette": "\u1F5E3", + "/specialideographiccircled": "\u3295", + "/specialideographicparen": "\u3235", + "/speechBalloon": "\u1F4AC", + "/speedboat": "\u1F6A4", + "/spesmilo": "\u20B7", + "/sphericalangle": "\u2222", + "/spider": "\u1F577", + "/spiderWeb": "\u1F578", + "/spiralCalendarPad": "\u1F5D3", + "/spiralNotePad": "\u1F5D2", + "/spiralShell": "\u1F41A", + "/splashingSweat": "\u1F4A6", + "/sportsMedal": "\u1F3C5", + "/spoutingWhale": "\u1F433", + "/sppl:tildevertical": "\u2E2F", + "/squarebelowcmb": "\u033B", + "/squareblack": "\u25A0", + "/squarebracketleftvertical": "\uFE47", + "/squarebracketrightvertical": "\uFE48", + "/squarecap": "\u2293", + "/squarecc": "\u33C4", + "/squarecm": "\u339D", + "/squarecup": "\u2294", + "/squareddotoperator": "\u22A1", + "/squarediagonalcrosshatchfill": "\u25A9", + "/squaredj": "\u1F190", + "/squaredkey": "\u26BF", + "/squaredminus": "\u229F", + "/squaredplus": "\u229E", + "/squaredsaltire": "\u26DD", + "/squaredtimes": "\u22A0", + "/squarefourcorners": "\u26F6", + "/squarehalfleftblack": "\u25E7", + "/squarehalfrightblack": "\u25E8", + "/squarehorizontalfill": "\u25A4", + "/squareimage": "\u228F", + "/squareimageorequal": "\u2291", + "/squareimageornotequal": "\u22E4", + "/squarekg": "\u338F", + "/squarekm": "\u339E", + "/squarekmcapital": "\u33CE", + "/squareln": "\u33D1", + "/squarelog": "\u33D2", + "/squarelowerdiagonalhalfrightblack": "\u25EA", + "/squaremediumblack": "\u25FC", + "/squaremediumwhite": "\u25FB", + "/squaremg": "\u338E", + "/squaremil": "\u33D5", + "/squaremm": "\u339C", + "/squaremsquared": "\u33A1", + "/squareoriginal": "\u2290", + "/squareoriginalorequal": "\u2292", + "/squareoriginalornotequal": "\u22E5", + "/squareorthogonalcrosshatchfill": "\u25A6", + "/squareraised": "\u2E0B", + "/squaresmallblack": "\u25AA", + "/squaresmallmediumblack": "\u25FE", + "/squaresmallmediumwhite": "\u25FD", + "/squaresmallwhite": "\u25AB", + "/squareupperdiagonalhalfleftblack": "\u25E9", + "/squareupperlefttolowerrightfill": "\u25A7", + "/squareupperrighttolowerleftfill": "\u25A8", + "/squareverticalfill": "\u25A5", + "/squarewhite": "\u25A1", + "/squarewhitebisectinglinevertical": "\u25EB", + "/squarewhitelowerquadrantleft": "\u25F1", + "/squarewhitelowerquadrantright": "\u25F2", + "/squarewhiteround": "\u25A2", + "/squarewhiteupperquadrantleft": "\u25F0", + "/squarewhiteupperquadrantright": "\u25F3", + "/squarewhitewithsmallblack": "\u25A3", + "/squarewhitewithsquaresmallblack": "\u25A3", + "/squishquadfunc": "\u2337", + "/srfullwidth": "\u33DB", + "/srsquare": "\u33DB", + "/ssabengali": "\u09B7", + "/ssadeva": "\u0937", + "/ssagujarati": "\u0AB7", + "/ssangcieuckorean": "\u3149", + "/ssanghieuhkorean": "\u3185", + "/ssangieungkorean": "\u3180", + "/ssangkiyeokkorean": "\u3132", + "/ssangnieunkorean": "\u3165", + "/ssangpieupkorean": "\u3143", + "/ssangsioskorean": "\u3146", + "/ssangtikeutkorean": "\u3138", + "/ssuperior": "\uF6F2", + "/ssupmod": "\u02E2", + "/sswashtail": "\u023F", + "/stackedcommadbl": "\u2E49", + "/stadium": "\u1F3DF", + "/staffofaesculapius": "\u2695", + "/staffofhermes": "\u269A", + "/stampedEnvelope": "\u1F583", + "/star": "\u22C6", + "/starblack": "\u2605", + "/starcrescent": "\u262A", + "/stardiaeresisfunc": "\u2363", + "/starequals": "\u225B", + "/staroperator": "\u22C6", + "/staroutlinedwhite": "\u269D", + "/starwhite": "\u2606", + "/station": "\u1F689", + "/statueOfLiberty": "\u1F5FD", + "/steamLocomotive": "\u1F682", + "/steamingBowl": "\u1F35C", + "/stenographicfullstop": "\u2E3C", + "/sterling": "\u00A3", + "/sterlingmonospace": "\uFFE1", + "/stigma": "\u03DB", + "/stiletildefunc": "\u236D", + "/stockChart": "\u1F5E0", + "/stockideographiccircled": "\u3291", + "/stockideographicparen": "\u3231", + "/stopabove": "\u06EB", + "/stopbelow": "\u06EA", + "/straightRuler": "\u1F4CF", + "/straightness": "\u23E4", + "/strawberry": "\u1F353", + "/stresslowtonemod": "\uA721", + "/stresstonemod": "\uA720", + "/strictlyequivalent": "\u2263", + "/strokelongoverlaycmb": "\u0336", + "/strokeshortoverlaycmb": "\u0335", + "/studioMicrophone": "\u1F399", + "/studyideographiccircled": "\u32AB", + "/studyideographicparen": "\u323B", + "/stupa": "\u1F6D3", + "/subscriptalef": "\u0656", + "/subset": "\u2282", + "/subsetdbl": "\u22D0", + "/subsetnotequal": "\u228A", + "/subsetorequal": "\u2286", + "/succeeds": "\u227B", + "/succeedsbutnotequivalent": "\u22E9", + "/succeedsorequal": "\u227D", + "/succeedsorequivalent": "\u227F", + "/succeedsunderrelation": "\u22B1", + "/suchthat": "\u220B", + "/sucirclekatakana": "\u32DC", + "/suhiragana": "\u3059", + "/suitableideographiccircled": "\u329C", + "/sukatakana": "\u30B9", + "/sukatakanahalfwidth": "\uFF7D", + "/sukumendutvowel": "\uA9B9", + "/sukunIsol": "\uFE7E", + "/sukunMedi": "\uFE7F", + "/sukunarabic": "\u0652", + "/sukuvowel": "\uA9B8", + "/summation": "\u2211", + "/summationbottom": "\u23B3", + "/summationdblstruck": "\u2140", + "/summationtop": "\u23B2", + "/sun": "\u263C", + "/sunFace": "\u1F31E", + "/sunbehindcloud": "\u26C5", + "/sunflower": "\u1F33B", + "/sunideographiccircled": "\u3290", + "/sunideographicparen": "\u3230", + "/sunraysblack": "\u2600", + "/sunrayswhite": "\u263C", + "/sunrise": "\u1F305", + "/sunriseOverMountains": "\u1F304", + "/sunsetOverBuildings": "\u1F307", + "/superset": "\u2283", + "/supersetnotequal": "\u228B", + "/supersetorequal": "\u2287", + "/superviseideographiccircled": "\u32AC", + "/superviseideographicparen": "\u323C", + "/surfer": "\u1F3C4", + "/sushi": "\u1F363", + "/suspensionRailway": "\u1F69F", + "/suspensiondbl": "\u2E44", + "/svfullwidth": "\u33DC", + "/svsquare": "\u33DC", + "/swatchtop": "\u23F1", + "/swimmer": "\u1F3CA", + "/swungdash": "\u2053", + "/symbolabovethreedotsabove": "\uFBB6", + "/symbolbelowthreedotsabove": "\uFBB7", + "/symboldotabove": "\uFBB2", + "/symboldotbelow": "\uFBB3", + "/symboldoubleverticalbarbelow": "\uFBBC", + "/symbolfourdotsabove": "\uFBBA", + "/symbolfourdotsbelow": "\uFBBB", + "/symbolpointingabovedownthreedotsabove": "\uFBB8", + "/symbolpointingbelowdownthreedotsabove": "\uFBB9", + "/symbolring": "\uFBBF", + "/symboltahabovesmall": "\uFBC0", + "/symboltahbelowsmall": "\uFBC1", + "/symboltwodotsabove": "\uFBB4", + "/symboltwodotsbelow": "\uFBB5", + "/symboltwodotsverticallyabove": "\uFBBD", + "/symboltwodotsverticallybelow": "\uFBBE", + "/symmetry": "\u232F", + "/synagogue": "\u1F54D", + "/syouwaerasquare": "\u337C", + "/syringe": "\u1F489", + "/t": "\u0074", + "/t-shirt": "\u1F455", + "/t.inferior": "\u209C", + "/tabengali": "\u09A4", + "/tableTennisPaddleAndBall": "\u1F3D3", + "/tacirclekatakana": "\u32DF", + "/tackcircleaboveup": "\u27DF", + "/tackdiaeresisupfunc": "\u2361", + "/tackdown": "\u22A4", + "/tackdownmod": "\u02D5", + "/tackjotdownfunc": "\u234E", + "/tackjotupfunc": "\u2355", + "/tackleft": "\u22A3", + "/tackleftright": "\u27DB", + "/tackoverbarupfunc": "\u2351", + "/tackright": "\u22A2", + "/tackunderlinedownfunc": "\u234A", + "/tackup": "\u22A5", + "/tackupmod": "\u02D4", + "/taco": "\u1F32E", + "/tadeva": "\u0924", + "/tagujarati": "\u0AA4", + "/tagurmukhi": "\u0A24", + "/tah": "\u0637", + "/tah.fina": "\uFEC2", + "/tah.init": "\uFEC3", + "/tah.init_alefmaksura.fina": "\uFCF5", + "/tah.init_hah.fina": "\uFC26", + "/tah.init_hah.medi": "\uFCB8", + "/tah.init_meem.fina": "\uFC27", + "/tah.init_meem.medi": "\uFD33", + "/tah.init_meem.medi_hah.medi": "\uFD72", + "/tah.init_meem.medi_meem.medi": "\uFD73", + "/tah.init_yeh.fina": "\uFCF6", + "/tah.isol": "\uFEC1", + "/tah.medi": "\uFEC4", + "/tah.medi_alefmaksura.fina": "\uFD11", + "/tah.medi_meem.medi": "\uFD3A", + "/tah.medi_meem.medi_hah.fina": "\uFD71", + "/tah.medi_meem.medi_yeh.fina": "\uFD74", + "/tah.medi_yeh.fina": "\uFD12", + "/tahabove": "\u0615", + "/taharabic": "\u0637", + "/tahfinalarabic": "\uFEC2", + "/tahinitialarabic": "\uFEC3", + "/tahiragana": "\u305F", + "/tahmedialarabic": "\uFEC4", + "/tahthreedotsabove": "\u069F", + "/taisyouerasquare": "\u337D", + "/takatakana": "\u30BF", + "/takatakanahalfwidth": "\uFF80", + "/takhallus": "\u0614", + "/talingvowel": "\uA9BA", + "/taml:a": "\u0B85", + "/taml:aa": "\u0B86", + "/taml:aasign": "\u0BBE", + "/taml:ai": "\u0B90", + "/taml:aisign": "\u0BC8", + "/taml:anusvarasign": "\u0B82", + "/taml:asabovesign": "\u0BF8", + "/taml:au": "\u0B94", + "/taml:aulengthmark": "\u0BD7", + "/taml:ausign": "\u0BCC", + "/taml:ca": "\u0B9A", + "/taml:creditsign": "\u0BF7", + "/taml:daysign": "\u0BF3", + "/taml:debitsign": "\u0BF6", + "/taml:e": "\u0B8E", + "/taml:ee": "\u0B8F", + "/taml:eesign": "\u0BC7", + "/taml:eight": "\u0BEE", + "/taml:esign": "\u0BC6", + "/taml:five": "\u0BEB", + "/taml:four": "\u0BEA", + "/taml:ha": "\u0BB9", + "/taml:i": "\u0B87", + "/taml:ii": "\u0B88", + "/taml:iisign": "\u0BC0", + "/taml:isign": "\u0BBF", + "/taml:ja": "\u0B9C", + "/taml:ka": "\u0B95", + "/taml:la": "\u0BB2", + "/taml:lla": "\u0BB3", + "/taml:llla": "\u0BB4", + "/taml:ma": "\u0BAE", + "/taml:monthsign": "\u0BF4", + "/taml:na": "\u0BA8", + "/taml:nga": "\u0B99", + "/taml:nine": "\u0BEF", + "/taml:nna": "\u0BA3", + "/taml:nnna": "\u0BA9", + "/taml:nya": "\u0B9E", + "/taml:o": "\u0B92", + "/taml:om": "\u0BD0", + "/taml:one": "\u0BE7", + "/taml:onehundred": "\u0BF1", + "/taml:onethousand": "\u0BF2", + "/taml:oo": "\u0B93", + "/taml:oosign": "\u0BCB", + "/taml:osign": "\u0BCA", + "/taml:pa": "\u0BAA", + "/taml:ra": "\u0BB0", + "/taml:rra": "\u0BB1", + "/taml:rupeesign": "\u0BF9", + "/taml:sa": "\u0BB8", + "/taml:seven": "\u0BED", + "/taml:sha": "\u0BB6", + "/taml:sign": "\u0BFA", + "/taml:six": "\u0BEC", + "/taml:ssa": "\u0BB7", + "/taml:ta": "\u0BA4", + "/taml:ten": "\u0BF0", + "/taml:three": "\u0BE9", + "/taml:tta": "\u0B9F", + "/taml:two": "\u0BE8", + "/taml:u": "\u0B89", + "/taml:usign": "\u0BC1", + "/taml:uu": "\u0B8A", + "/taml:uusign": "\u0BC2", + "/taml:va": "\u0BB5", + "/taml:viramasign": "\u0BCD", + "/taml:visargasign": "\u0B83", + "/taml:ya": "\u0BAF", + "/taml:yearsign": "\u0BF5", + "/taml:zero": "\u0BE6", + "/tamurda": "\uA9A1", + "/tanabataTree": "\u1F38B", + "/tangerine": "\u1F34A", + "/tapeCartridge": "\u1F5AD", + "/tarungvowel": "\uA9B4", + "/tatweelFathatanAbove": "\uFE71", + "/tatweelarabic": "\u0640", + "/tau": "\u03C4", + "/taurus": "\u2649", + "/tav": "\u05EA", + "/tav:hb": "\u05EA", + "/tavdages": "\uFB4A", + "/tavdagesh": "\uFB4A", + "/tavdageshhebrew": "\uFB4A", + "/tavhebrew": "\u05EA", + "/tavwide:hb": "\uFB28", + "/tavwithdagesh:hb": "\uFB4A", + "/taxi": "\u1F695", + "/tbar": "\u0167", + "/tbopomofo": "\u310A", + "/tcaron": "\u0165", + "/tccurl": "\u02A8", + "/tcedilla": "\u0163", + "/tcheh": "\u0686", + "/tcheh.fina": "\uFB7B", + "/tcheh.init": "\uFB7C", + "/tcheh.isol": "\uFB7A", + "/tcheh.medi": "\uFB7D", + "/tcheharabic": "\u0686", + "/tchehdotabove": "\u06BF", + "/tcheheh": "\u0687", + "/tcheheh.fina": "\uFB7F", + "/tcheheh.init": "\uFB80", + "/tcheheh.isol": "\uFB7E", + "/tcheheh.medi": "\uFB81", + "/tchehfinalarabic": "\uFB7B", + "/tchehinitialarabic": "\uFB7C", + "/tchehmedialarabic": "\uFB7D", + "/tchehmeeminitialarabic": "\uFB7C", + "/tcircle": "\u24E3", + "/tcircumflexbelow": "\u1E71", + "/tcommaaccent": "\u0163", + "/tcurl": "\u0236", + "/tdieresis": "\u1E97", + "/tdot": "\u1E6B", + "/tdotaccent": "\u1E6B", + "/tdotbelow": "\u1E6D", + "/teacupOutHandle": "\u1F375", + "/tear-offCalendar": "\u1F4C6", + "/tecirclekatakana": "\u32E2", + "/tecyr": "\u0442", + "/tecyrillic": "\u0442", + "/tedescendercyrillic": "\u04AD", + "/teh": "\u062A", + "/teh.fina": "\uFE96", + "/teh.init": "\uFE97", + "/teh.init_alefmaksura.fina": "\uFC0F", + "/teh.init_hah.fina": "\uFC0C", + "/teh.init_hah.medi": "\uFCA2", + "/teh.init_hah.medi_jeem.medi": "\uFD52", + "/teh.init_hah.medi_meem.medi": "\uFD53", + "/teh.init_heh.medi": "\uFCA5", + "/teh.init_jeem.fina": "\uFC0B", + "/teh.init_jeem.medi": "\uFCA1", + "/teh.init_jeem.medi_meem.medi": "\uFD50", + "/teh.init_khah.fina": "\uFC0D", + "/teh.init_khah.medi": "\uFCA3", + "/teh.init_khah.medi_meem.medi": "\uFD54", + "/teh.init_meem.fina": "\uFC0E", + "/teh.init_meem.medi": "\uFCA4", + "/teh.init_meem.medi_hah.medi": "\uFD56", + "/teh.init_meem.medi_jeem.medi": "\uFD55", + "/teh.init_meem.medi_khah.medi": "\uFD57", + "/teh.init_yeh.fina": "\uFC10", + "/teh.isol": "\uFE95", + "/teh.medi": "\uFE98", + "/teh.medi_alefmaksura.fina": "\uFC74", + "/teh.medi_hah.medi_jeem.fina": "\uFD51", + "/teh.medi_heh.medi": "\uFCE4", + "/teh.medi_jeem.medi_alefmaksura.fina": "\uFDA0", + "/teh.medi_jeem.medi_yeh.fina": "\uFD9F", + "/teh.medi_khah.medi_alefmaksura.fina": "\uFDA2", + "/teh.medi_khah.medi_yeh.fina": "\uFDA1", + "/teh.medi_meem.fina": "\uFC72", + "/teh.medi_meem.medi": "\uFCE3", + "/teh.medi_meem.medi_alefmaksura.fina": "\uFDA4", + "/teh.medi_meem.medi_yeh.fina": "\uFDA3", + "/teh.medi_noon.fina": "\uFC73", + "/teh.medi_reh.fina": "\uFC70", + "/teh.medi_yeh.fina": "\uFC75", + "/teh.medi_zain.fina": "\uFC71", + "/teharabic": "\u062A", + "/tehdownthreedotsabove": "\u067D", + "/teheh": "\u067F", + "/teheh.fina": "\uFB63", + "/teheh.init": "\uFB64", + "/teheh.isol": "\uFB62", + "/teheh.medi": "\uFB65", + "/tehfinalarabic": "\uFE96", + "/tehhahinitialarabic": "\uFCA2", + "/tehhahisolatedarabic": "\uFC0C", + "/tehinitialarabic": "\uFE97", + "/tehiragana": "\u3066", + "/tehjeeminitialarabic": "\uFCA1", + "/tehjeemisolatedarabic": "\uFC0B", + "/tehmarbuta": "\u0629", + "/tehmarbuta.fina": "\uFE94", + "/tehmarbuta.isol": "\uFE93", + "/tehmarbutaarabic": "\u0629", + "/tehmarbutafinalarabic": "\uFE94", + "/tehmarbutagoal": "\u06C3", + "/tehmedialarabic": "\uFE98", + "/tehmeeminitialarabic": "\uFCA4", + "/tehmeemisolatedarabic": "\uFC0E", + "/tehnoonfinalarabic": "\uFC73", + "/tehring": "\u067C", + "/tekatakana": "\u30C6", + "/tekatakanahalfwidth": "\uFF83", + "/telephone": "\u2121", + "/telephoneOnTopOfModem": "\u1F580", + "/telephoneReceiver": "\u1F4DE", + "/telephoneReceiverPage": "\u1F57C", + "/telephoneblack": "\u260E", + "/telephonerecorder": "\u2315", + "/telephonewhite": "\u260F", + "/telescope": "\u1F52D", + "/television": "\u1F4FA", + "/telishaGedolah:hb": "\u05A0", + "/telishaQetannah:hb": "\u05A9", + "/telishagedolahebrew": "\u05A0", + "/telishaqetanahebrew": "\u05A9", + "/telu:a": "\u0C05", + "/telu:aa": "\u0C06", + "/telu:aasign": "\u0C3E", + "/telu:ai": "\u0C10", + "/telu:ailengthmark": "\u0C56", + "/telu:aisign": "\u0C48", + "/telu:anusvarasign": "\u0C02", + "/telu:au": "\u0C14", + "/telu:ausign": "\u0C4C", + "/telu:avagrahasign": "\u0C3D", + "/telu:ba": "\u0C2C", + "/telu:bha": "\u0C2D", + "/telu:bindusigncandra": "\u0C01", + "/telu:ca": "\u0C1A", + "/telu:cha": "\u0C1B", + "/telu:combiningbinduabovesigncandra": "\u0C00", + "/telu:da": "\u0C26", + "/telu:dda": "\u0C21", + "/telu:ddha": "\u0C22", + "/telu:dha": "\u0C27", + "/telu:dza": "\u0C59", + "/telu:e": "\u0C0E", + "/telu:ee": "\u0C0F", + "/telu:eesign": "\u0C47", + "/telu:eight": "\u0C6E", + "/telu:esign": "\u0C46", + "/telu:five": "\u0C6B", + "/telu:four": "\u0C6A", + "/telu:fractiononeforevenpowersoffour": "\u0C7C", + "/telu:fractiononeforoddpowersoffour": "\u0C79", + "/telu:fractionthreeforevenpowersoffour": "\u0C7E", + "/telu:fractionthreeforoddpowersoffour": "\u0C7B", + "/telu:fractiontwoforevenpowersoffour": "\u0C7D", + "/telu:fractiontwoforoddpowersoffour": "\u0C7A", + "/telu:fractionzeroforoddpowersoffour": "\u0C78", + "/telu:ga": "\u0C17", + "/telu:gha": "\u0C18", + "/telu:ha": "\u0C39", + "/telu:i": "\u0C07", + "/telu:ii": "\u0C08", + "/telu:iisign": "\u0C40", + "/telu:isign": "\u0C3F", + "/telu:ja": "\u0C1C", + "/telu:jha": "\u0C1D", + "/telu:ka": "\u0C15", + "/telu:kha": "\u0C16", + "/telu:la": "\u0C32", + "/telu:lengthmark": "\u0C55", + "/telu:lla": "\u0C33", + "/telu:llla": "\u0C34", + "/telu:llsignvocal": "\u0C63", + "/telu:llvocal": "\u0C61", + "/telu:lsignvocal": "\u0C62", + "/telu:lvocal": "\u0C0C", + "/telu:ma": "\u0C2E", + "/telu:na": "\u0C28", + "/telu:nga": "\u0C19", + "/telu:nine": "\u0C6F", + "/telu:nna": "\u0C23", + "/telu:nya": "\u0C1E", + "/telu:o": "\u0C12", + "/telu:one": "\u0C67", + "/telu:oo": "\u0C13", + "/telu:oosign": "\u0C4B", + "/telu:osign": "\u0C4A", + "/telu:pa": "\u0C2A", + "/telu:pha": "\u0C2B", + "/telu:ra": "\u0C30", + "/telu:rra": "\u0C31", + "/telu:rrra": "\u0C5A", + "/telu:rrsignvocal": "\u0C44", + "/telu:rrvocal": "\u0C60", + "/telu:rsignvocal": "\u0C43", + "/telu:rvocal": "\u0C0B", + "/telu:sa": "\u0C38", + "/telu:seven": "\u0C6D", + "/telu:sha": "\u0C36", + "/telu:six": "\u0C6C", + "/telu:ssa": "\u0C37", + "/telu:ta": "\u0C24", + "/telu:tha": "\u0C25", + "/telu:three": "\u0C69", + "/telu:tsa": "\u0C58", + "/telu:tta": "\u0C1F", + "/telu:ttha": "\u0C20", + "/telu:tuumusign": "\u0C7F", + "/telu:two": "\u0C68", + "/telu:u": "\u0C09", + "/telu:usign": "\u0C41", + "/telu:uu": "\u0C0A", + "/telu:uusign": "\u0C42", + "/telu:va": "\u0C35", + "/telu:viramasign": "\u0C4D", + "/telu:visargasign": "\u0C03", + "/telu:ya": "\u0C2F", + "/telu:zero": "\u0C66", + "/ten.roman": "\u2169", + "/ten.romansmall": "\u2179", + "/tencircle": "\u2469", + "/tencircledbl": "\u24FE", + "/tencirclesquare": "\u3248", + "/tenge": "\u20B8", + "/tenhangzhou": "\u3038", + "/tenideographiccircled": "\u3289", + "/tenideographicparen": "\u3229", + "/tennisRacquetAndBall": "\u1F3BE", + "/tenparen": "\u247D", + "/tenparenthesized": "\u247D", + "/tenperiod": "\u2491", + "/tenroman": "\u2179", + "/tent": "\u26FA", + "/tenthousand.roman": "\u2182", + "/tesh": "\u02A7", + "/tet": "\u05D8", + "/tet:hb": "\u05D8", + "/tetailcyr": "\u04AD", + "/tetdagesh": "\uFB38", + "/tetdageshhebrew": "\uFB38", + "/tethebrew": "\u05D8", + "/tetrasememetrical": "\u23D8", + "/tetsecyr": "\u04B5", + "/tetsecyrillic": "\u04B5", + "/tetwithdagesh:hb": "\uFB38", + "/tevir:hb": "\u059B", + "/tevirhebrew": "\u059B", + "/tevirlefthebrew": "\u059B", + "/thabengali": "\u09A5", + "/thadeva": "\u0925", + "/thagujarati": "\u0AA5", + "/thagurmukhi": "\u0A25", + "/thai:angkhankhu": "\u0E5A", + "/thai:baht": "\u0E3F", + "/thai:bobaimai": "\u0E1A", + "/thai:chochan": "\u0E08", + "/thai:chochang": "\u0E0A", + "/thai:choching": "\u0E09", + "/thai:chochoe": "\u0E0C", + "/thai:dochada": "\u0E0E", + "/thai:dodek": "\u0E14", + "/thai:eight": "\u0E58", + "/thai:five": "\u0E55", + "/thai:fofa": "\u0E1D", + "/thai:fofan": "\u0E1F", + "/thai:fongman": "\u0E4F", + "/thai:four": "\u0E54", + "/thai:hohip": "\u0E2B", + "/thai:honokhuk": "\u0E2E", + "/thai:khokhai": "\u0E02", + "/thai:khokhon": "\u0E05", + "/thai:khokhuat": "\u0E03", + "/thai:khokhwai": "\u0E04", + "/thai:khomut": "\u0E5B", + "/thai:khorakhang": "\u0E06", + "/thai:kokai": "\u0E01", + "/thai:lakkhangyao": "\u0E45", + "/thai:lochula": "\u0E2C", + "/thai:loling": "\u0E25", + "/thai:lu": "\u0E26", + "/thai:maichattawa": "\u0E4B", + "/thai:maiek": "\u0E48", + "/thai:maihan-akat": "\u0E31", + "/thai:maitaikhu": "\u0E47", + "/thai:maitho": "\u0E49", + "/thai:maitri": "\u0E4A", + "/thai:maiyamok": "\u0E46", + "/thai:moma": "\u0E21", + "/thai:ngongu": "\u0E07", + "/thai:nikhahit": "\u0E4D", + "/thai:nine": "\u0E59", + "/thai:nonen": "\u0E13", + "/thai:nonu": "\u0E19", + "/thai:oang": "\u0E2D", + "/thai:one": "\u0E51", + "/thai:paiyannoi": "\u0E2F", + "/thai:phinthu": "\u0E3A", + "/thai:phophan": "\u0E1E", + "/thai:phophung": "\u0E1C", + "/thai:phosamphao": "\u0E20", + "/thai:popla": "\u0E1B", + "/thai:rorua": "\u0E23", + "/thai:ru": "\u0E24", + "/thai:saraa": "\u0E30", + "/thai:saraaa": "\u0E32", + "/thai:saraae": "\u0E41", + "/thai:saraaimaimalai": "\u0E44", + "/thai:saraaimaimuan": "\u0E43", + "/thai:saraam": "\u0E33", + "/thai:sarae": "\u0E40", + "/thai:sarai": "\u0E34", + "/thai:saraii": "\u0E35", + "/thai:sarao": "\u0E42", + "/thai:sarau": "\u0E38", + "/thai:saraue": "\u0E36", + "/thai:sarauee": "\u0E37", + "/thai:sarauu": "\u0E39", + "/thai:seven": "\u0E57", + "/thai:six": "\u0E56", + "/thai:sorusi": "\u0E29", + "/thai:sosala": "\u0E28", + "/thai:soso": "\u0E0B", + "/thai:sosua": "\u0E2A", + "/thai:thanthakhat": "\u0E4C", + "/thai:thonangmontho": "\u0E11", + "/thai:thophuthao": "\u0E12", + "/thai:thothahan": "\u0E17", + "/thai:thothan": "\u0E10", + "/thai:thothong": "\u0E18", + "/thai:thothung": "\u0E16", + "/thai:three": "\u0E53", + "/thai:topatak": "\u0E0F", + "/thai:totao": "\u0E15", + "/thai:two": "\u0E52", + "/thai:wowaen": "\u0E27", + "/thai:yamakkan": "\u0E4E", + "/thai:yoyak": "\u0E22", + "/thai:yoying": "\u0E0D", + "/thai:zero": "\u0E50", + "/thal": "\u0630", + "/thal.fina": "\uFEAC", + "/thal.init_superscriptalef.fina": "\uFC5B", + "/thal.isol": "\uFEAB", + "/thalarabic": "\u0630", + "/thalfinalarabic": "\uFEAC", + "/thanthakhatlowleftthai": "\uF898", + "/thanthakhatlowrightthai": "\uF897", + "/thanthakhatthai": "\u0E4C", + "/thanthakhatupperleftthai": "\uF896", + "/theh": "\u062B", + "/theh.fina": "\uFE9A", + "/theh.init": "\uFE9B", + "/theh.init_alefmaksura.fina": "\uFC13", + "/theh.init_jeem.fina": "\uFC11", + "/theh.init_meem.fina": "\uFC12", + "/theh.init_meem.medi": "\uFCA6", + "/theh.init_yeh.fina": "\uFC14", + "/theh.isol": "\uFE99", + "/theh.medi": "\uFE9C", + "/theh.medi_alefmaksura.fina": "\uFC7A", + "/theh.medi_heh.medi": "\uFCE6", + "/theh.medi_meem.fina": "\uFC78", + "/theh.medi_meem.medi": "\uFCE5", + "/theh.medi_noon.fina": "\uFC79", + "/theh.medi_reh.fina": "\uFC76", + "/theh.medi_yeh.fina": "\uFC7B", + "/theh.medi_zain.fina": "\uFC77", + "/theharabic": "\u062B", + "/thehfinalarabic": "\uFE9A", + "/thehinitialarabic": "\uFE9B", + "/thehmedialarabic": "\uFE9C", + "/thereexists": "\u2203", + "/therefore": "\u2234", + "/thermometer": "\u1F321", + "/theta": "\u03B8", + "/theta.math": "\u03D1", + "/theta1": "\u03D1", + "/thetasymbolgreek": "\u03D1", + "/thieuthacirclekorean": "\u3279", + "/thieuthaparenkorean": "\u3219", + "/thieuthcirclekorean": "\u326B", + "/thieuthkorean": "\u314C", + "/thieuthparenkorean": "\u320B", + "/thinspace": "\u2009", + "/thirteencircle": "\u246C", + "/thirteencircleblack": "\u24ED", + "/thirteenparen": "\u2480", + "/thirteenparenthesized": "\u2480", + "/thirteenperiod": "\u2494", + "/thirtycircle": "\u325A", + "/thirtycirclesquare": "\u324A", + "/thirtyeightcircle": "\u32B3", + "/thirtyfivecircle": "\u325F", + "/thirtyfourcircle": "\u325E", + "/thirtyhangzhou": "\u303A", + "/thirtyninecircle": "\u32B4", + "/thirtyonecircle": "\u325B", + "/thirtysevencircle": "\u32B2", + "/thirtysixcircle": "\u32B1", + "/thirtythreecircle": "\u325D", + "/thirtytwocircle": "\u325C", + "/thonangmonthothai": "\u0E11", + "/thook": "\u01AD", + "/thophuthaothai": "\u0E12", + "/thorn": "\u00FE", + "/thornstroke": "\uA765", + "/thornstrokedescender": "\uA767", + "/thothahanthai": "\u0E17", + "/thothanthai": "\u0E10", + "/thothongthai": "\u0E18", + "/thothungthai": "\u0E16", + "/thoughtBalloon": "\u1F4AD", + "/thousandcyrillic": "\u0482", + "/thousandscyr": "\u0482", + "/thousandsseparator": "\u066C", + "/thousandsseparatorarabic": "\u066C", + "/thousandsseparatorpersian": "\u066C", + "/three": "\u0033", + "/three.inferior": "\u2083", + "/three.roman": "\u2162", + "/three.romansmall": "\u2172", + "/threeButtonMouse": "\u1F5B1", + "/threeNetworkedComputers": "\u1F5A7", + "/threeRaysAbove": "\u1F5E4", + "/threeRaysBelow": "\u1F5E5", + "/threeRaysLeft": "\u1F5E6", + "/threeRaysRight": "\u1F5E7", + "/threeSpeechBubbles": "\u1F5EB", + "/threearabic": "\u0663", + "/threebengali": "\u09E9", + "/threecircle": "\u2462", + "/threecircledbl": "\u24F7", + "/threecircleinversesansserif": "\u278C", + "/threecomma": "\u1F104", + "/threedeva": "\u0969", + "/threedimensionalangle": "\u27C0", + "/threedotpunctuation": "\u2056", + "/threedotsaboveabove": "\u06DB", + "/threedsquare": "\u1F19B", + "/threeeighths": "\u215C", + "/threefar": "\u06F3", + "/threefifths": "\u2157", + "/threegujarati": "\u0AE9", + "/threegurmukhi": "\u0A69", + "/threehackarabic": "\u0663", + "/threehangzhou": "\u3023", + "/threeideographiccircled": "\u3282", + "/threeideographicparen": "\u3222", + "/threeinferior": "\u2083", + "/threelinesconvergingleft": "\u269F", + "/threelinesconvergingright": "\u269E", + "/threemonospace": "\uFF13", + "/threenumeratorbengali": "\u09F6", + "/threeoldstyle": "\uF733", + "/threeparen": "\u2476", + "/threeparenthesized": "\u2476", + "/threeperemspace": "\u2004", + "/threeperiod": "\u248A", + "/threepersian": "\u06F3", + "/threequarters": "\u00BE", + "/threequartersemdash": "\uF6DE", + "/threerightarrows": "\u21F6", + "/threeroman": "\u2172", + "/threesuperior": "\u00B3", + "/threethai": "\u0E53", + "/thumbsDownSign": "\u1F44E", + "/thumbsUpSign": "\u1F44D", + "/thundercloudrain": "\u26C8", + "/thunderstorm": "\u2608", + "/thzfullwidth": "\u3394", + "/thzsquare": "\u3394", + "/tibt:AA": "\u0F60", + "/tibt:a": "\u0F68", + "/tibt:aavowelsign": "\u0F71", + "/tibt:angkhanggyasmark": "\u0F3D", + "/tibt:angkhanggyonmark": "\u0F3C", + "/tibt:astrologicalkhyudpasign": "\u0F18", + "/tibt:astrologicalsdongtshugssign": "\u0F19", + "/tibt:astrologicalsgragcancharrtagssign": "\u0F17", + "/tibt:asubjoined": "\u0FB8", + "/tibt:ba": "\u0F56", + "/tibt:basubjoined": "\u0FA6", + "/tibt:bha": "\u0F57", + "/tibt:bhasubjoined": "\u0FA7", + "/tibt:bkashogyigmgomark": "\u0F0A", + "/tibt:brdarnyingyigmgomdunmainitialmark": "\u0FD3", + "/tibt:brdarnyingyigmgosgabmaclosingmark": "\u0FD4", + "/tibt:bsdusrtagsmark": "\u0F34", + "/tibt:bskashoggimgorgyanmark": "\u0FD0", + "/tibt:bskuryigmgomark": "\u0F09", + "/tibt:ca": "\u0F45", + "/tibt:cangteucantillationsign": "\u0FC2", + "/tibt:caretdzudrtagsbzhimigcanmark": "\u0F36", + "/tibt:caretdzudrtagsmelongcanmark": "\u0F13", + "/tibt:caretyigmgophurshadmamark": "\u0F06", + "/tibt:casubjoined": "\u0F95", + "/tibt:cha": "\u0F46", + "/tibt:chadrtagslogotypesign": "\u0F15", + "/tibt:chasubjoined": "\u0F96", + "/tibt:chemgomark": "\u0F38", + "/tibt:da": "\u0F51", + "/tibt:dasubjoined": "\u0FA1", + "/tibt:dda": "\u0F4C", + "/tibt:ddasubjoined": "\u0F9C", + "/tibt:ddha": "\u0F4D", + "/tibt:ddhasubjoined": "\u0F9D", + "/tibt:delimitertshegbstarmark": "\u0F0C", + "/tibt:dha": "\u0F52", + "/tibt:dhasubjoined": "\u0FA2", + "/tibt:drilbusymbol": "\u0FC4", + "/tibt:dza": "\u0F5B", + "/tibt:dzasubjoined": "\u0FAB", + "/tibt:dzha": "\u0F5C", + "/tibt:dzhasubjoined": "\u0FAC", + "/tibt:eevowelsign": "\u0F7B", + "/tibt:eight": "\u0F28", + "/tibt:evowelsign": "\u0F7A", + "/tibt:five": "\u0F25", + "/tibt:four": "\u0F24", + "/tibt:ga": "\u0F42", + "/tibt:gasubjoined": "\u0F92", + "/tibt:gha": "\u0F43", + "/tibt:ghasubjoined": "\u0F93", + "/tibt:grucanrgyingssign": "\u0F8A", + "/tibt:grumedrgyingssign": "\u0F8B", + "/tibt:gtertshegmark": "\u0F14", + "/tibt:gteryigmgotruncatedamark": "\u0F01", + "/tibt:gteryigmgoumgtertshegmamark": "\u0F03", + "/tibt:gteryigmgoumrnambcadmamark": "\u0F02", + "/tibt:gugrtagsgyasmark": "\u0F3B", + "/tibt:gugrtagsgyonmark": "\u0F3A", + "/tibt:ha": "\u0F67", + "/tibt:halantamark": "\u0F84", + "/tibt:halfeight": "\u0F31", + "/tibt:halffive": "\u0F2E", + "/tibt:halffour": "\u0F2D", + "/tibt:halfnine": "\u0F32", + "/tibt:halfone": "\u0F2A", + "/tibt:halfseven": "\u0F30", + "/tibt:halfsix": "\u0F2F", + "/tibt:halfthree": "\u0F2C", + "/tibt:halftwo": "\u0F2B", + "/tibt:halfzero": "\u0F33", + "/tibt:hasubjoined": "\u0FB7", + "/tibt:heavybeatcantillationsign": "\u0FC0", + "/tibt:iivowelsign": "\u0F73", + "/tibt:intersyllabictshegmark": "\u0F0B", + "/tibt:invertedmchucansign": "\u0F8C", + "/tibt:invertedmchucansubjoinedsign": "\u0F8F", + "/tibt:ivowelsign": "\u0F72", + "/tibt:ja": "\u0F47", + "/tibt:jasubjoined": "\u0F97", + "/tibt:ka": "\u0F40", + "/tibt:kasubjoined": "\u0F90", + "/tibt:kha": "\u0F41", + "/tibt:khasubjoined": "\u0F91", + "/tibt:kka": "\u0F6B", + "/tibt:kssa": "\u0F69", + "/tibt:kssasubjoined": "\u0FB9", + "/tibt:kurukha": "\u0FBE", + "/tibt:kurukhabzhimigcan": "\u0FBF", + "/tibt:la": "\u0F63", + "/tibt:lasubjoined": "\u0FB3", + "/tibt:lcetsacansign": "\u0F88", + "/tibt:lcetsacansubjoinedsign": "\u0F8D", + "/tibt:lcirtagssign": "\u0F86", + "/tibt:leadingmchanrtagsmark": "\u0FD9", + "/tibt:lhagrtagslogotypesign": "\u0F16", + "/tibt:lightbeatcantillationsign": "\u0FC1", + "/tibt:llvocalicvowelsign": "\u0F79", + "/tibt:lvocalicvowelsign": "\u0F78", + "/tibt:ma": "\u0F58", + "/tibt:martshessign": "\u0F3F", + "/tibt:masubjoined": "\u0FA8", + "/tibt:mchucansign": "\u0F89", + "/tibt:mchucansubjoinedsign": "\u0F8E", + "/tibt:mnyamyiggimgorgyanmark": "\u0FD1", + "/tibt:na": "\u0F53", + "/tibt:nasubjoined": "\u0FA3", + "/tibt:nga": "\u0F44", + "/tibt:ngasbzungnyizlamark": "\u0F35", + "/tibt:ngasbzungsgorrtagsmark": "\u0F37", + "/tibt:ngasubjoined": "\u0F94", + "/tibt:nine": "\u0F29", + "/tibt:nna": "\u0F4E", + "/tibt:nnasubjoined": "\u0F9E", + "/tibt:norbubzhikhyilsymbol": "\u0FCC", + "/tibt:norbugsumkhyilsymbol": "\u0FCB", + "/tibt:norbunyiskhyilsymbol": "\u0FCA", + "/tibt:norbusymbol": "\u0FC9", + "/tibt:nya": "\u0F49", + "/tibt:nyasubjoined": "\u0F99", + "/tibt:nyisshadmark": "\u0F0E", + "/tibt:nyistshegmark": "\u0FD2", + "/tibt:nyistshegshadmark": "\u0F10", + "/tibt:nyizlanaadasign": "\u0F82", + "/tibt:omsyllable": "\u0F00", + "/tibt:one": "\u0F21", + "/tibt:oovowelsign": "\u0F7D", + "/tibt:ovowelsign": "\u0F7C", + "/tibt:pa": "\u0F54", + "/tibt:padmagdansymbol": "\u0FC6", + "/tibt:palutamark": "\u0F85", + "/tibt:pasubjoined": "\u0FA4", + "/tibt:pha": "\u0F55", + "/tibt:phasubjoined": "\u0FA5", + "/tibt:phurpasymbol": "\u0FC8", + "/tibt:ra": "\u0F62", + "/tibt:rafixed": "\u0F6A", + "/tibt:rasubjoined": "\u0FB2", + "/tibt:rasubjoinedfixed": "\u0FBC", + "/tibt:rdeldkargcigsign": "\u0F1A", + "/tibt:rdeldkargnyissign": "\u0F1B", + "/tibt:rdeldkargsumsign": "\u0F1C", + "/tibt:rdeldkarrdelnagsign": "\u0F1F", + "/tibt:rdelnaggcigsign": "\u0F1D", + "/tibt:rdelnaggnyissign": "\u0F1E", + "/tibt:rdelnaggsumsign": "\u0FCF", + "/tibt:rdelnagrdeldkarsign": "\u0FCE", + "/tibt:rdorjergyagramsymbol": "\u0FC7", + "/tibt:rdorjesymbol": "\u0FC5", + "/tibt:reversediivowelsign": "\u0F81", + "/tibt:reversedivowelsign": "\u0F80", + "/tibt:rgyagramshadmark": "\u0F12", + "/tibt:rinchenspungsshadmark": "\u0F11", + "/tibt:rjessungarosign": "\u0F7E", + "/tibt:rnambcadsign": "\u0F7F", + "/tibt:rra": "\u0F6C", + "/tibt:rrvocalicvowelsign": "\u0F77", + "/tibt:rvocalicvowelsign": "\u0F76", + "/tibt:sa": "\u0F66", + "/tibt:sasubjoined": "\u0FB6", + "/tibt:sbrulshadmark": "\u0F08", + "/tibt:sbubchalcantillationsign": "\u0FC3", + "/tibt:seven": "\u0F27", + "/tibt:sha": "\u0F64", + "/tibt:shadmark": "\u0F0D", + "/tibt:shasubjoined": "\u0FB4", + "/tibt:six": "\u0F26", + "/tibt:snaldansign": "\u0F83", + "/tibt:ssa": "\u0F65", + "/tibt:ssasubjoined": "\u0FB5", + "/tibt:subjoinedAA": "\u0FB0", + "/tibt:svastileft": "\u0FD6", + "/tibt:svastileftdot": "\u0FD8", + "/tibt:svastiright": "\u0FD5", + "/tibt:svastirightdot": "\u0FD7", + "/tibt:ta": "\u0F4F", + "/tibt:tasubjoined": "\u0F9F", + "/tibt:tha": "\u0F50", + "/tibt:thasubjoined": "\u0FA0", + "/tibt:three": "\u0F23", + "/tibt:trailingmchanrtagsmark": "\u0FDA", + "/tibt:tsa": "\u0F59", + "/tibt:tsaphrumark": "\u0F39", + "/tibt:tsasubjoined": "\u0FA9", + "/tibt:tsha": "\u0F5A", + "/tibt:tshasubjoined": "\u0FAA", + "/tibt:tshegshadmark": "\u0F0F", + "/tibt:tta": "\u0F4A", + "/tibt:ttasubjoined": "\u0F9A", + "/tibt:ttha": "\u0F4B", + "/tibt:tthasubjoined": "\u0F9B", + "/tibt:two": "\u0F22", + "/tibt:uuvowelsign": "\u0F75", + "/tibt:uvowelsign": "\u0F74", + "/tibt:wa": "\u0F5D", + "/tibt:wasubjoined": "\u0FAD", + "/tibt:wasubjoinedfixed": "\u0FBA", + "/tibt:ya": "\u0F61", + "/tibt:yangrtagssign": "\u0F87", + "/tibt:yartshessign": "\u0F3E", + "/tibt:yasubjoined": "\u0FB1", + "/tibt:yasubjoinedfixed": "\u0FBB", + "/tibt:yigmgomdunmainitialmark": "\u0F04", + "/tibt:yigmgosgabmaclosingmark": "\u0F05", + "/tibt:yigmgotshegshadmamark": "\u0F07", + "/tibt:za": "\u0F5F", + "/tibt:zasubjoined": "\u0FAF", + "/tibt:zero": "\u0F20", + "/tibt:zha": "\u0F5E", + "/tibt:zhasubjoined": "\u0FAE", + "/ticirclekatakana": "\u32E0", + "/tickconvavediamondleftwhite": "\u27E2", + "/tickconvavediamondrightwhite": "\u27E3", + "/ticket": "\u1F3AB", + "/tickleftwhitesquare": "\u27E4", + "/tickrightwhitesquare": "\u27E5", + "/tifcha:hb": "\u0596", + "/tiger": "\u1F405", + "/tigerFace": "\u1F42F", + "/tihiragana": "\u3061", + "/tikatakana": "\u30C1", + "/tikatakanahalfwidth": "\uFF81", + "/tikeutacirclekorean": "\u3270", + "/tikeutaparenkorean": "\u3210", + "/tikeutcirclekorean": "\u3262", + "/tikeutkorean": "\u3137", + "/tikeutparenkorean": "\u3202", + "/tilde": "\u02DC", + "/tildebelowcmb": "\u0330", + "/tildecmb": "\u0303", + "/tildecomb": "\u0303", + "/tildediaeresisfunc": "\u2368", + "/tildedotaccent": "\u2E1E", + "/tildedotbelow": "\u2E1F", + "/tildedoublecmb": "\u0360", + "/tildeequalsreversed": "\u22CD", + "/tildelowmod": "\u02F7", + "/tildeoperator": "\u223C", + "/tildeoverlaycmb": "\u0334", + "/tildereversed": "\u223D", + "/tildering": "\u2E1B", + "/tildetpl": "\u224B", + "/tildeverticalcmb": "\u033E", + "/timerclock": "\u23F2", + "/timescircle": "\u2297", + "/tinsular": "\uA787", + "/tipehahebrew": "\u0596", + "/tipehalefthebrew": "\u0596", + "/tippigurmukhi": "\u0A70", + "/tiredFace": "\u1F62B", + "/tironiansignet": "\u204A", + "/tirtatumetespada": "\uA9DE", + "/titlocmbcyr": "\u0483", + "/titlocyrilliccmb": "\u0483", + "/tiwnarmenian": "\u057F", + "/tjekomicyr": "\u050F", + "/tlinebelow": "\u1E6F", + "/tmonospace": "\uFF54", + "/toarmenian": "\u0569", + "/tocirclekatakana": "\u32E3", + "/tocornerarrowNW": "\u21F1", + "/tocornerarrowSE": "\u21F2", + "/tohiragana": "\u3068", + "/toilet": "\u1F6BD", + "/tokatakana": "\u30C8", + "/tokatakanahalfwidth": "\uFF84", + "/tokyoTower": "\u1F5FC", + "/tolongvowel": "\uA9B5", + "/tomato": "\u1F345", + "/tonebarextrahighmod": "\u02E5", + "/tonebarextralowmod": "\u02E9", + "/tonebarhighmod": "\u02E6", + "/tonebarlowmod": "\u02E8", + "/tonebarmidmod": "\u02E7", + "/tonefive": "\u01BD", + "/tonehighbeginmod": "\u02F9", + "/tonehighendmod": "\u02FA", + "/tonelowbeginmod": "\u02FB", + "/tonelowendmod": "\u02FC", + "/tonesix": "\u0185", + "/tonetwo": "\u01A8", + "/tongue": "\u1F445", + "/tonos": "\u0384", + "/tonsquare": "\u3327", + "/topHat": "\u1F3A9", + "/topUpwardsArrowAbove": "\u1F51D", + "/topatakthai": "\u0E0F", + "/tortoiseshellbracketleft": "\u3014", + "/tortoiseshellbracketleftsmall": "\uFE5D", + "/tortoiseshellbracketleftvertical": "\uFE39", + "/tortoiseshellbracketright": "\u3015", + "/tortoiseshellbracketrightsmall": "\uFE5E", + "/tortoiseshellbracketrightvertical": "\uFE3A", + "/totalrunout": "\u2330", + "/totaothai": "\u0E15", + "/tpalatalhook": "\u01AB", + "/tparen": "\u24AF", + "/tparenthesized": "\u24AF", + "/trackball": "\u1F5B2", + "/tractor": "\u1F69C", + "/trademark": "\u2122", + "/trademarksans": "\uF8EA", + "/trademarkserif": "\uF6DB", + "/train": "\u1F686", + "/tram": "\u1F68A", + "/tramCar": "\u1F68B", + "/trapeziumwhite": "\u23E2", + "/tresillo": "\uA72B", + "/tretroflex": "\u0288", + "/tretroflexhook": "\u0288", + "/triagdn": "\u25BC", + "/triaglf": "\u25C4", + "/triagrt": "\u25BA", + "/triagup": "\u25B2", + "/triangleWithRoundedCorners": "\u1F6C6", + "/triangledotupwhite": "\u25EC", + "/triangledownblack": "\u25BC", + "/triangledownsmallblack": "\u25BE", + "/triangledownsmallwhite": "\u25BF", + "/triangledownwhite": "\u25BD", + "/trianglehalfupleftblack": "\u25ED", + "/trianglehalfuprightblack": "\u25EE", + "/triangleleftblack": "\u25C0", + "/triangleleftsmallblack": "\u25C2", + "/triangleleftsmallwhite": "\u25C3", + "/triangleleftwhite": "\u25C1", + "/triangleright": "\u22BF", + "/trianglerightblack": "\u25B6", + "/trianglerightsmallblack": "\u25B8", + "/trianglerightsmallwhite": "\u25B9", + "/trianglerightwhite": "\u25B7", + "/triangleupblack": "\u25B2", + "/triangleupsmallblack": "\u25B4", + "/triangleupsmallwhite": "\u25B5", + "/triangleupwhite": "\u25B3", + "/triangularFlagOnPost": "\u1F6A9", + "/triangularRuler": "\u1F4D0", + "/triangularbullet": "\u2023", + "/tricolon": "\u205D", + "/tricontainingtriwhiteanglesmall": "\u27C1", + "/tridentEmblem": "\u1F531", + "/trigramearth": "\u2637", + "/trigramfire": "\u2632", + "/trigramheaven": "\u2630", + "/trigramlake": "\u2631", + "/trigrammountain": "\u2636", + "/trigramthunder": "\u2633", + "/trigramwater": "\u2635", + "/trigramwind": "\u2634", + "/triplearrowleft": "\u21DA", + "/triplearrowright": "\u21DB", + "/tripledot": "\u061E", + "/trisememetrical": "\u23D7", + "/trns:baby": "\u1F6BC", + "/trolleybus": "\u1F68E", + "/trophy": "\u1F3C6", + "/tropicalDrink": "\u1F379", + "/tropicalFish": "\u1F420", + "/truckblack": "\u26DF", + "/true": "\u22A8", + "/trumpet": "\u1F3BA", + "/ts": "\u02A6", + "/tsadi": "\u05E6", + "/tsadi:hb": "\u05E6", + "/tsadidagesh": "\uFB46", + "/tsadidageshhebrew": "\uFB46", + "/tsadihebrew": "\u05E6", + "/tsadiwithdagesh:hb": "\uFB46", + "/tsecyr": "\u0446", + "/tsecyrillic": "\u0446", + "/tsere": "\u05B5", + "/tsere12": "\u05B5", + "/tsere1e": "\u05B5", + "/tsere2b": "\u05B5", + "/tsere:hb": "\u05B5", + "/tserehebrew": "\u05B5", + "/tserenarrowhebrew": "\u05B5", + "/tserequarterhebrew": "\u05B5", + "/tserewidehebrew": "\u05B5", + "/tshecyr": "\u045B", + "/tshecyrillic": "\u045B", + "/tsinnorit:hb": "\u05AE", + "/tstroke": "\u2C66", + "/tsuperior": "\uF6F3", + "/ttabengali": "\u099F", + "/ttadeva": "\u091F", + "/ttagujarati": "\u0A9F", + "/ttagurmukhi": "\u0A1F", + "/ttamahaprana": "\uA99C", + "/tteh": "\u0679", + "/tteh.fina": "\uFB67", + "/tteh.init": "\uFB68", + "/tteh.isol": "\uFB66", + "/tteh.medi": "\uFB69", + "/tteharabic": "\u0679", + "/tteheh": "\u067A", + "/tteheh.fina": "\uFB5F", + "/tteheh.init": "\uFB60", + "/tteheh.isol": "\uFB5E", + "/tteheh.medi": "\uFB61", + "/ttehfinalarabic": "\uFB67", + "/ttehinitialarabic": "\uFB68", + "/ttehmedialarabic": "\uFB69", + "/tthabengali": "\u09A0", + "/tthadeva": "\u0920", + "/tthagujarati": "\u0AA0", + "/tthagurmukhi": "\u0A20", + "/tturned": "\u0287", + "/tucirclekatakana": "\u32E1", + "/tugrik": "\u20AE", + "/tuhiragana": "\u3064", + "/tukatakana": "\u30C4", + "/tukatakanahalfwidth": "\uFF82", + "/tulip": "\u1F337", + "/tum": "\uA777", + "/turkishlira": "\u20BA", + "/turnedOkHandSign": "\u1F58F", + "/turnedcomma": "\u2E32", + "/turneddagger": "\u2E38", + "/turneddigitthree": "\u218B", + "/turneddigittwo": "\u218A", + "/turnedpiselehpada": "\uA9CD", + "/turnedsemicolon": "\u2E35", + "/turnedshogipieceblack": "\u26CA", + "/turnedshogipiecewhite": "\u26C9", + "/turnstiledblverticalbarright": "\u22AB", + "/turnstileleftrightdbl": "\u27DA", + "/turnstiletplverticalbarright": "\u22AA", + "/turtle": "\u1F422", + "/tusmallhiragana": "\u3063", + "/tusmallkatakana": "\u30C3", + "/tusmallkatakanahalfwidth": "\uFF6F", + "/twelve.roman": "\u216B", + "/twelve.romansmall": "\u217B", + "/twelvecircle": "\u246B", + "/twelvecircleblack": "\u24EC", + "/twelveparen": "\u247F", + "/twelveparenthesized": "\u247F", + "/twelveperiod": "\u2493", + "/twelveroman": "\u217B", + "/twenty-twopointtwosquare": "\u1F1A2", + "/twentycircle": "\u2473", + "/twentycircleblack": "\u24F4", + "/twentycirclesquare": "\u3249", + "/twentyeightcircle": "\u3258", + "/twentyfivecircle": "\u3255", + "/twentyfourcircle": "\u3254", + "/twentyhangzhou": "\u5344", + "/twentyninecircle": "\u3259", + "/twentyonecircle": "\u3251", + "/twentyparen": "\u2487", + "/twentyparenthesized": "\u2487", + "/twentyperiod": "\u249B", + "/twentysevencircle": "\u3257", + "/twentysixcircle": "\u3256", + "/twentythreecircle": "\u3253", + "/twentytwocircle": "\u3252", + "/twistedRightwardsArrows": "\u1F500", + "/two": "\u0032", + "/two.inferior": "\u2082", + "/two.roman": "\u2161", + "/two.romansmall": "\u2171", + "/twoButtonMouse": "\u1F5B0", + "/twoHearts": "\u1F495", + "/twoMenHoldingHands": "\u1F46C", + "/twoSpeechBubbles": "\u1F5EA", + "/twoWomenHoldingHands": "\u1F46D", + "/twoarabic": "\u0662", + "/twoasterisksalignedvertically": "\u2051", + "/twobengali": "\u09E8", + "/twocircle": "\u2461", + "/twocircledbl": "\u24F6", + "/twocircleinversesansserif": "\u278B", + "/twocomma": "\u1F103", + "/twodeva": "\u0968", + "/twodotenleader": "\u2025", + "/twodotleader": "\u2025", + "/twodotleadervertical": "\uFE30", + "/twodotpunctuation": "\u205A", + "/twodotsoveronedot": "\u2E2A", + "/twofar": "\u06F2", + "/twofifths": "\u2156", + "/twogujarati": "\u0AE8", + "/twogurmukhi": "\u0A68", + "/twohackarabic": "\u0662", + "/twohangzhou": "\u3022", + "/twoideographiccircled": "\u3281", + "/twoideographicparen": "\u3221", + "/twoinferior": "\u2082", + "/twoksquare": "\u1F19D", + "/twomonospace": "\uFF12", + "/twonumeratorbengali": "\u09F5", + "/twooldstyle": "\uF732", + "/twoparen": "\u2475", + "/twoparenthesized": "\u2475", + "/twoperiod": "\u2489", + "/twopersian": "\u06F2", + "/tworoman": "\u2171", + "/twoshortsjoinedmetrical": "\u23D6", + "/twoshortsoverlongmetrical": "\u23D5", + "/twostroke": "\u01BB", + "/twosuperior": "\u00B2", + "/twothai": "\u0E52", + "/twothirds": "\u2154", + "/twowayleftwaytrafficblack": "\u26D6", + "/twowayleftwaytrafficwhite": "\u26D7", + "/tz": "\uA729", + "/u": "\u0075", + "/u.fina": "\uFBD8", + "/u.isol": "\uFBD7", + "/uacute": "\u00FA", + "/uacutedblcyr": "\u04F3", + "/ubar": "\u0289", + "/ubengali": "\u0989", + "/ubopomofo": "\u3128", + "/ubracketleft": "\u2E26", + "/ubracketright": "\u2E27", + "/ubreve": "\u016D", + "/ucaron": "\u01D4", + "/ucircle": "\u24E4", + "/ucirclekatakana": "\u32D2", + "/ucircumflex": "\u00FB", + "/ucircumflexbelow": "\u1E77", + "/ucyr": "\u0443", + "/ucyrillic": "\u0443", + "/udattadeva": "\u0951", + "/udblacute": "\u0171", + "/udblgrave": "\u0215", + "/udeva": "\u0909", + "/udieresis": "\u00FC", + "/udieresisacute": "\u01D8", + "/udieresisbelow": "\u1E73", + "/udieresiscaron": "\u01DA", + "/udieresiscyr": "\u04F1", + "/udieresiscyrillic": "\u04F1", + "/udieresisgrave": "\u01DC", + "/udieresismacron": "\u01D6", + "/udotbelow": "\u1EE5", + "/ugrave": "\u00F9", + "/ugravedbl": "\u0215", + "/ugujarati": "\u0A89", + "/ugurmukhi": "\u0A09", + "/uhamza": "\u0677", + "/uhamza.isol": "\uFBDD", + "/uhdsquare": "\u1F1AB", + "/uhiragana": "\u3046", + "/uhoi": "\u1EE7", + "/uhookabove": "\u1EE7", + "/uhorn": "\u01B0", + "/uhornacute": "\u1EE9", + "/uhorndotbelow": "\u1EF1", + "/uhorngrave": "\u1EEB", + "/uhornhoi": "\u1EED", + "/uhornhookabove": "\u1EED", + "/uhorntilde": "\u1EEF", + "/uhungarumlaut": "\u0171", + "/uhungarumlautcyrillic": "\u04F3", + "/uighurkazakhkirghizalefmaksura.init": "\uFBE8", + "/uighurkazakhkirghizalefmaksura.medi": "\uFBE9", + "/uighurkirghizyeh.init_hamzaabove.medi_alefmaksura.fina": "\uFBF9", + "/uighurkirghizyeh.init_hamzaabove.medi_alefmaksura.medi": "\uFBFB", + "/uighurkirghizyeh.medi_hamzaabove.medi_alefmaksura.fina": "\uFBFA", + "/uinvertedbreve": "\u0217", + "/ukatakana": "\u30A6", + "/ukatakanahalfwidth": "\uFF73", + "/ukcyr": "\u0479", + "/ukcyrillic": "\u0479", + "/ukorean": "\u315C", + "/um": "\uA778", + "/umacron": "\u016B", + "/umacroncyr": "\u04EF", + "/umacroncyrillic": "\u04EF", + "/umacrondieresis": "\u1E7B", + "/umatragurmukhi": "\u0A41", + "/umbrella": "\u2602", + "/umbrellaonground": "\u26F1", + "/umbrellaraindrops": "\u2614", + "/umonospace": "\uFF55", + "/unamusedFace": "\u1F612", + "/unaspiratedmod": "\u02ED", + "/underscore": "\u005F", + "/underscorecenterline": "\uFE4E", + "/underscoredashed": "\uFE4D", + "/underscoredbl": "\u2017", + "/underscoremonospace": "\uFF3F", + "/underscorevertical": "\uFE33", + "/underscorewavy": "\uFE4F", + "/underscorewavyvertical": "\uFE34", + "/undertie": "\u203F", + "/undo": "\u238C", + "/union": "\u222A", + "/unionarray": "\u22C3", + "/uniondbl": "\u22D3", + "/universal": "\u2200", + "/unmarriedpartnership": "\u26AF", + "/uogonek": "\u0173", + "/uonsquare": "\u3306", + "/upPointingAirplane": "\u1F6E7", + "/upPointingMilitaryAirplane": "\u1F6E6", + "/upPointingSmallAirplane": "\u1F6E8", + "/uparen": "\u24B0", + "/uparenthesized": "\u24B0", + "/uparrowleftofdownarrow": "\u21C5", + "/upblock": "\u2580", + "/updblhorzsng": "\u2568", + "/updblleftsng": "\u255C", + "/updblrightsng": "\u2559", + "/upheavydnhorzlight": "\u2540", + "/upheavyhorzlight": "\u2538", + "/upheavyleftdnlight": "\u2526", + "/upheavyleftlight": "\u251A", + "/upheavyrightdnlight": "\u251E", + "/upheavyrightlight": "\u2516", + "/uplightdnhorzheavy": "\u2548", + "/uplighthorzheavy": "\u2537", + "/uplightleftdnheavy": "\u252A", + "/uplightleftheavy": "\u2519", + "/uplightrightdnheavy": "\u2522", + "/uplightrightheavy": "\u2515", + "/upperHalfBlock": "\u2580", + "/upperOneEighthBlock": "\u2594", + "/upperRightShadowedWhiteCircle": "\u1F53F", + "/upperdothebrew": "\u05C4", + "/upperhalfcircle": "\u25E0", + "/upperhalfcircleinversewhite": "\u25DA", + "/upperquadrantcirculararcleft": "\u25DC", + "/upperquadrantcirculararcright": "\u25DD", + "/uppertriangleleft": "\u25F8", + "/uppertriangleleftblack": "\u25E4", + "/uppertriangleright": "\u25F9", + "/uppertrianglerightblack": "\u25E5", + "/upsideDownFace": "\u1F643", + "/upsilon": "\u03C5", + "/upsilonacute": "\u1F7B", + "/upsilonasper": "\u1F51", + "/upsilonasperacute": "\u1F55", + "/upsilonaspergrave": "\u1F53", + "/upsilonaspertilde": "\u1F57", + "/upsilonbreve": "\u1FE0", + "/upsilondieresis": "\u03CB", + "/upsilondieresisacute": "\u1FE3", + "/upsilondieresisgrave": "\u1FE2", + "/upsilondieresistilde": "\u1FE7", + "/upsilondieresistonos": "\u03B0", + "/upsilongrave": "\u1F7A", + "/upsilonlatin": "\u028A", + "/upsilonlenis": "\u1F50", + "/upsilonlenisacute": "\u1F54", + "/upsilonlenisgrave": "\u1F52", + "/upsilonlenistilde": "\u1F56", + "/upsilontilde": "\u1FE6", + "/upsilontonos": "\u03CD", + "/upsilonwithmacron": "\u1FE1", + "/upsnghorzdbl": "\u2567", + "/upsngleftdbl": "\u255B", + "/upsngrightdbl": "\u2558", + "/uptackbelowcmb": "\u031D", + "/uptackmod": "\u02D4", + "/upwithexclamationmarksquare": "\u1F199", + "/uragurmukhi": "\u0A73", + "/uranus": "\u2645", + "/uring": "\u016F", + "/ushortcyr": "\u045E", + "/ushortcyrillic": "\u045E", + "/usmallhiragana": "\u3045", + "/usmallkatakana": "\u30A5", + "/usmallkatakanahalfwidth": "\uFF69", + "/usmod": "\uA770", + "/ustraightcyr": "\u04AF", + "/ustraightcyrillic": "\u04AF", + "/ustraightstrokecyr": "\u04B1", + "/ustraightstrokecyrillic": "\u04B1", + "/utilde": "\u0169", + "/utildeacute": "\u1E79", + "/utildebelow": "\u1E75", + "/uubengali": "\u098A", + "/uudeva": "\u090A", + "/uugujarati": "\u0A8A", + "/uugurmukhi": "\u0A0A", + "/uumatragurmukhi": "\u0A42", + "/uuvowelsignbengali": "\u09C2", + "/uuvowelsigndeva": "\u0942", + "/uuvowelsigngujarati": "\u0AC2", + "/uvowelsignbengali": "\u09C1", + "/uvowelsigndeva": "\u0941", + "/uvowelsigngujarati": "\u0AC1", + "/v": "\u0076", + "/vadeva": "\u0935", + "/vagujarati": "\u0AB5", + "/vagurmukhi": "\u0A35", + "/vakatakana": "\u30F7", + "/vanedownfunc": "\u2356", + "/vaneleftfunc": "\u2345", + "/vanerightfunc": "\u2346", + "/vaneupfunc": "\u234F", + "/varikajudeospanish:hb": "\uFB1E", + "/vav": "\u05D5", + "/vav:hb": "\u05D5", + "/vav_vav:hb": "\u05F0", + "/vav_yod:hb": "\u05F1", + "/vavdagesh": "\uFB35", + "/vavdagesh65": "\uFB35", + "/vavdageshhebrew": "\uFB35", + "/vavhebrew": "\u05D5", + "/vavholam": "\uFB4B", + "/vavholamhebrew": "\uFB4B", + "/vavvavhebrew": "\u05F0", + "/vavwithdagesh:hb": "\uFB35", + "/vavwithholam:hb": "\uFB4B", + "/vavyodhebrew": "\u05F1", + "/vcircle": "\u24E5", + "/vcurl": "\u2C74", + "/vdiagonalstroke": "\uA75F", + "/vdotbelow": "\u1E7F", + "/ve.fina": "\uFBDF", + "/ve.isol": "\uFBDE", + "/ve:abovetonecandra": "\u1CF4", + "/ve:anusvaraantargomukhasign": "\u1CE9", + "/ve:anusvarabahirgomukhasign": "\u1CEA", + "/ve:anusvarasignlong": "\u1CEF", + "/ve:anusvaraubhayatomukhasign": "\u1CF1", + "/ve:anusvaravamagomukhasign": "\u1CEB", + "/ve:anusvaravamagomukhawithtailsign": "\u1CEC", + "/ve:ardhavisargasign": "\u1CF2", + "/ve:atharvaindependentsvaritatone": "\u1CE1", + "/ve:atikramasign": "\u1CF7", + "/ve:belowtonecandra": "\u1CD8", + "/ve:dotbelowtone": "\u1CDD", + "/ve:hexiformanusvarasignlong": "\u1CEE", + "/ve:jihvamuliyasign": "\u1CF5", + "/ve:karshanatone": "\u1CD0", + "/ve:kathakaanudattatone": "\u1CDC", + "/ve:nihshvasasign": "\u1CD3", + "/ve:prenkhatone": "\u1CD2", + "/ve:rigkashmiriindependentsvaritatone": "\u1CE0", + "/ve:ringabovetone": "\u1CF8", + "/ve:ringabovetonedbl": "\u1CF9", + "/ve:rotatedardhavisargasign": "\u1CF3", + "/ve:rthanganusvarasignlong": "\u1CF0", + "/ve:sharatone": "\u1CD1", + "/ve:svaritatonedbl": "\u1CDA", + "/ve:svaritatonetpl": "\u1CDB", + "/ve:threedotsbelowtone": "\u1CDF", + "/ve:tiryaksign": "\u1CED", + "/ve:twodotsbelowtone": "\u1CDE", + "/ve:upadhmaniyasign": "\u1CF6", + "/ve:visargaanudattasign": "\u1CE5", + "/ve:visargaanudattasignreversed": "\u1CE6", + "/ve:visargaanudattawithtailsign": "\u1CE8", + "/ve:visargasvaritasign": "\u1CE2", + "/ve:visargaudattasign": "\u1CE3", + "/ve:visargaudattasignreversed": "\u1CE4", + "/ve:visargaudattawithtailsign": "\u1CE7", + "/ve:yajuraggravatedindependentsvaritatone": "\u1CD5", + "/ve:yajurindependentsvaritatone": "\u1CD6", + "/ve:yajurkathakaindependentsvaritaschroedertone": "\u1CD9", + "/ve:yajurkathakaindependentsvaritatone": "\u1CD7", + "/ve:yajurmidlinesvaritasign": "\u1CD4", + "/vecyr": "\u0432", + "/vecyrillic": "\u0432", + "/veh": "\u06A4", + "/veh.fina": "\uFB6B", + "/veh.init": "\uFB6C", + "/veh.isol": "\uFB6A", + "/veh.medi": "\uFB6D", + "/veharabic": "\u06A4", + "/vehfinalarabic": "\uFB6B", + "/vehinitialarabic": "\uFB6C", + "/vehmedialarabic": "\uFB6D", + "/vekatakana": "\u30F9", + "/vend": "\uA769", + "/venus": "\u2640", + "/versicle": "\u2123", + "/vert:bracketwhiteleft": "\uFE17", + "/vert:brakcetwhiteright": "\uFE18", + "/vert:colon": "\uFE13", + "/vert:comma": "\uFE10", + "/vert:ellipsishor": "\uFE19", + "/vert:exclam": "\uFE15", + "/vert:ideographiccomma": "\uFE11", + "/vert:ideographicfullstop": "\uFE12", + "/vert:question": "\uFE16", + "/vert:semicolon": "\uFE14", + "/vertdblhorzsng": "\u256B", + "/vertdblleftsng": "\u2562", + "/vertdblrightsng": "\u255F", + "/vertheavyhorzlight": "\u2542", + "/vertheavyleftlight": "\u2528", + "/vertheavyrightlight": "\u2520", + "/verticalTrafficLight": "\u1F6A6", + "/verticalbar": "\u007C", + "/verticalbardbl": "\u2016", + "/verticalbarhorizontalstroke": "\u27CA", + "/verticalbarwhitearrowonpedestalup": "\u21ED", + "/verticalfourdots": "\u205E", + "/verticalideographiciterationmark": "\u303B", + "/verticalkanarepeatmark": "\u3031", + "/verticalkanarepeatmarklowerhalf": "\u3035", + "/verticalkanarepeatmarkupperhalf": "\u3033", + "/verticalkanarepeatwithvoicedsoundmark": "\u3032", + "/verticalkanarepeatwithvoicedsoundmarkupperhalf": "\u3034", + "/verticallineabovecmb": "\u030D", + "/verticallinebelowcmb": "\u0329", + "/verticallinelowmod": "\u02CC", + "/verticallinemod": "\u02C8", + "/verticalmalestroke": "\u26A8", + "/verticalsdbltrokearrowleft": "\u21FA", + "/verticalsdbltrokearrowleftright": "\u21FC", + "/verticalsdbltrokearrowright": "\u21FB", + "/verticalstrokearrowleft": "\u21F7", + "/verticalstrokearrowleftright": "\u21F9", + "/verticalstrokearrowright": "\u21F8", + "/vertlighthorzheavy": "\u253F", + "/vertlightleftheavy": "\u2525", + "/vertlightrightheavy": "\u251D", + "/vertsnghorzdbl": "\u256A", + "/vertsngleftdbl": "\u2561", + "/vertsngrightdbl": "\u255E", + "/verymuchgreater": "\u22D9", + "/verymuchless": "\u22D8", + "/vesta": "\u26B6", + "/vewarmenian": "\u057E", + "/vhook": "\u028B", + "/vibrationMode": "\u1F4F3", + "/videoCamera": "\u1F4F9", + "/videoGame": "\u1F3AE", + "/videocassette": "\u1F4FC", + "/viewdatasquare": "\u2317", + "/vikatakana": "\u30F8", + "/violin": "\u1F3BB", + "/viramabengali": "\u09CD", + "/viramadeva": "\u094D", + "/viramagujarati": "\u0ACD", + "/virgo": "\u264D", + "/visargabengali": "\u0983", + "/visargadeva": "\u0903", + "/visargagujarati": "\u0A83", + "/visigothicz": "\uA763", + "/vmonospace": "\uFF56", + "/voarmenian": "\u0578", + "/vodsquare": "\u1F1AC", + "/voicediterationhiragana": "\u309E", + "/voicediterationkatakana": "\u30FE", + "/voicedmarkkana": "\u309B", + "/voicedmarkkanahalfwidth": "\uFF9E", + "/voicingmod": "\u02EC", + "/vokatakana": "\u30FA", + "/volapukae": "\uA79B", + "/volapukoe": "\uA79D", + "/volapukue": "\uA79F", + "/volcano": "\u1F30B", + "/volleyball": "\u1F3D0", + "/vovermfullwidth": "\u33DE", + "/vowelVabove": "\u065A", + "/voweldotbelow": "\u065C", + "/vowelinvertedVabove": "\u065B", + "/vparen": "\u24B1", + "/vparenthesized": "\u24B1", + "/vrighthook": "\u2C71", + "/vssquare": "\u1F19A", + "/vtilde": "\u1E7D", + "/vturned": "\u028C", + "/vuhiragana": "\u3094", + "/vukatakana": "\u30F4", + "/vwelsh": "\u1EFD", + "/vy": "\uA761", + "/w": "\u0077", + "/wacirclekatakana": "\u32FB", + "/wacute": "\u1E83", + "/waekorean": "\u3159", + "/wahiragana": "\u308F", + "/wakatakana": "\u30EF", + "/wakatakanahalfwidth": "\uFF9C", + "/wakorean": "\u3158", + "/waningCrescentMoon": "\u1F318", + "/waningGibbousMoon": "\u1F316", + "/warning": "\u26A0", + "/wasmallhiragana": "\u308E", + "/wasmallkatakana": "\u30EE", + "/wastebasket": "\u1F5D1", + "/watch": "\u231A", + "/waterBuffalo": "\u1F403", + "/waterCloset": "\u1F6BE", + "/waterWave": "\u1F30A", + "/waterideographiccircled": "\u328C", + "/waterideographicparen": "\u322C", + "/watermelon": "\u1F349", + "/wattosquare": "\u3357", + "/wavedash": "\u301C", + "/wavingBlackFlag": "\u1F3F4", + "/wavingHandSign": "\u1F44B", + "/wavingWhiteFlag": "\u1F3F3", + "/wavydash": "\u3030", + "/wavyhamzabelow": "\u065F", + "/wavyline": "\u2307", + "/wavyunderscorevertical": "\uFE34", + "/waw": "\u0648", + "/waw.fina": "\uFEEE", + "/waw.isol": "\uFEED", + "/wawDigitThreeAbove": "\u0779", + "/wawDigitTwoAbove": "\u0778", + "/wawarabic": "\u0648", + "/wawdotabove": "\u06CF", + "/wawfinalarabic": "\uFEEE", + "/wawhamza": "\u0624", + "/wawhamza.fina": "\uFE86", + "/wawhamza.isol": "\uFE85", + "/wawhamzaabovearabic": "\u0624", + "/wawhamzaabovefinalarabic": "\uFE86", + "/wawhighhamza": "\u0676", + "/wawring": "\u06C4", + "/wawsmall": "\u06E5", + "/wawtwodotsabove": "\u06CA", + "/waxingCrescentMoon": "\u1F312", + "/waxingGibbousMoon": "\u1F314", + "/wbfullwidth": "\u33DD", + "/wbsquare": "\u33DD", + "/wcircle": "\u24E6", + "/wcircumflex": "\u0175", + "/wcsquare": "\u1F14F", + "/wcsquareblack": "\u1F18F", + "/wdieresis": "\u1E85", + "/wdot": "\u1E87", + "/wdotaccent": "\u1E87", + "/wdotbelow": "\u1E89", + "/wearyCatFace": "\u1F640", + "/wearyFace": "\u1F629", + "/wecirclekatakana": "\u32FD", + "/wecyr": "\u051D", + "/wedding": "\u1F492", + "/wehiragana": "\u3091", + "/weierstrass": "\u2118", + "/weightLifter": "\u1F3CB", + "/wekatakana": "\u30F1", + "/wekorean": "\u315E", + "/weokorean": "\u315D", + "/westsyriaccross": "\u2670", + "/wgrave": "\u1E81", + "/whale": "\u1F40B", + "/wheelchair": "\u267F", + "/wheelofdharma": "\u2638", + "/whiteDownPointingBackhandIndex": "\u1F447", + "/whiteDownPointingLeftHandIndex": "\u1F597", + "/whiteFlower": "\u1F4AE", + "/whiteHardShellFloppyDisk": "\u1F5AB", + "/whiteLatinCross": "\u1F546", + "/whiteLeftPointingBackhandIndex": "\u1F448", + "/whitePennant": "\u1F3F1", + "/whiteRightPointingBackhandIndex": "\u1F449", + "/whiteSquareButton": "\u1F533", + "/whiteSun": "\u1F323", + "/whiteSunBehindCloud": "\u1F325", + "/whiteSunBehindCloudRain": "\u1F326", + "/whiteSunSmallCloud": "\u1F324", + "/whiteTouchtoneTelephone": "\u1F57E", + "/whiteUpPointingBackhandIndex": "\u1F446", + "/whitearrowdown": "\u21E9", + "/whitearrowfromwallright": "\u21F0", + "/whitearrowleft": "\u21E6", + "/whitearrowonpedestalup": "\u21EB", + "/whitearrowright": "\u21E8", + "/whitearrowup": "\u21E7", + "/whitearrowupdown": "\u21F3", + "/whitearrowupfrombar": "\u21EA", + "/whitebullet": "\u25E6", + "/whitecircle": "\u25CB", + "/whitecircleinverse": "\u25D9", + "/whitecornerbracketleft": "\u300E", + "/whitecornerbracketleftvertical": "\uFE43", + "/whitecornerbracketright": "\u300F", + "/whitecornerbracketrightvertical": "\uFE44", + "/whitedblarrowonpedestalup": "\u21EF", + "/whitedblarrowup": "\u21EE", + "/whitediamond": "\u25C7", + "/whitediamondcontainingblacksmalldiamond": "\u25C8", + "/whitedownpointingsmalltriangle": "\u25BF", + "/whitedownpointingtriangle": "\u25BD", + "/whiteleftpointingsmalltriangle": "\u25C3", + "/whiteleftpointingtriangle": "\u25C1", + "/whitelenticularbracketleft": "\u3016", + "/whitelenticularbracketright": "\u3017", + "/whiterightpointingsmalltriangle": "\u25B9", + "/whiterightpointingtriangle": "\u25B7", + "/whitesesamedot": "\uFE46", + "/whitesmallsquare": "\u25AB", + "/whitesmilingface": "\u263A", + "/whitesquare": "\u25A1", + "/whitesquarebracketleft": "\u301A", + "/whitesquarebracketright": "\u301B", + "/whitestar": "\u2606", + "/whitetelephone": "\u260F", + "/whitetortoiseshellbracketleft": "\u3018", + "/whitetortoiseshellbracketright": "\u3019", + "/whiteuppointingsmalltriangle": "\u25B5", + "/whiteuppointingtriangle": "\u25B3", + "/whook": "\u2C73", + "/wicirclekatakana": "\u32FC", + "/wigglylinevertical": "\u2E3E", + "/wignyan": "\uA983", + "/wihiragana": "\u3090", + "/wikatakana": "\u30F0", + "/wikorean": "\u315F", + "/windBlowingFace": "\u1F32C", + "/windChime": "\u1F390", + "/windupada": "\uA9C6", + "/wineGlass": "\u1F377", + "/winkingFace": "\u1F609", + "/wiredKeyboard": "\u1F5AE", + "/wmonospace": "\uFF57", + "/wocirclekatakana": "\u32FE", + "/wohiragana": "\u3092", + "/wokatakana": "\u30F2", + "/wokatakanahalfwidth": "\uFF66", + "/wolfFace": "\u1F43A", + "/woman": "\u1F469", + "/womanBunnyEars": "\u1F46F", + "/womansBoots": "\u1F462", + "/womansClothes": "\u1F45A", + "/womansHat": "\u1F452", + "/womansSandal": "\u1F461", + "/womens": "\u1F6BA", + "/won": "\u20A9", + "/wonmonospace": "\uFFE6", + "/woodideographiccircled": "\u328D", + "/woodideographicparen": "\u322D", + "/wordjoiner": "\u2060", + "/wordseparatormiddledot": "\u2E31", + "/worldMap": "\u1F5FA", + "/worriedFace": "\u1F61F", + "/wowaenthai": "\u0E27", + "/wparen": "\u24B2", + "/wparenthesized": "\u24B2", + "/wrappedPresent": "\u1F381", + "/wreathproduct": "\u2240", + "/wrench": "\u1F527", + "/wring": "\u1E98", + "/wsuperior": "\u02B7", + "/wsupmod": "\u02B7", + "/wturned": "\u028D", + "/wulumelikvowel": "\uA9B7", + "/wuluvowel": "\uA9B6", + "/wynn": "\u01BF", + "/x": "\u0078", + "/x.inferior": "\u2093", + "/xabovecmb": "\u033D", + "/xatailcyr": "\u04B3", + "/xbopomofo": "\u3112", + "/xcircle": "\u24E7", + "/xdieresis": "\u1E8D", + "/xdot": "\u1E8B", + "/xdotaccent": "\u1E8B", + "/xeharmenian": "\u056D", + "/xi": "\u03BE", + "/xmonospace": "\uFF58", + "/xor": "\u22BB", + "/xparen": "\u24B3", + "/xparenthesized": "\u24B3", + "/xsuperior": "\u02E3", + "/xsupmod": "\u02E3", + "/y": "\u0079", + "/yaadosquare": "\u334E", + "/yaarusquare": "\u334F", + "/yabengali": "\u09AF", + "/yacirclekatakana": "\u32F3", + "/yacute": "\u00FD", + "/yacyr": "\u044F", + "/yadeva": "\u092F", + "/yaecyr": "\u0519", + "/yaekorean": "\u3152", + "/yagujarati": "\u0AAF", + "/yagurmukhi": "\u0A2F", + "/yahiragana": "\u3084", + "/yakatakana": "\u30E4", + "/yakatakanahalfwidth": "\uFF94", + "/yakorean": "\u3151", + "/yamakkanthai": "\u0E4E", + "/yangtonemod": "\u02EB", + "/yasmallhiragana": "\u3083", + "/yasmallkatakana": "\u30E3", + "/yasmallkatakanahalfwidth": "\uFF6C", + "/yatcyr": "\u0463", + "/yatcyrillic": "\u0463", + "/ycircle": "\u24E8", + "/ycircumflex": "\u0177", + "/ydieresis": "\u00FF", + "/ydot": "\u1E8F", + "/ydotaccent": "\u1E8F", + "/ydotbelow": "\u1EF5", + "/yeh": "\u064A", + "/yeh.fina": "\uFEF2", + "/yeh.init": "\uFEF3", + "/yeh.init_alefmaksura.fina": "\uFC59", + "/yeh.init_hah.fina": "\uFC56", + "/yeh.init_hah.medi": "\uFCDB", + "/yeh.init_hamzaabove.medi_ae.fina": "\uFBEC", + "/yeh.init_hamzaabove.medi_alef.fina": "\uFBEA", + "/yeh.init_hamzaabove.medi_alefmaksura.fina": "\uFC03", + "/yeh.init_hamzaabove.medi_e.fina": "\uFBF6", + "/yeh.init_hamzaabove.medi_e.medi": "\uFBF8", + "/yeh.init_hamzaabove.medi_hah.fina": "\uFC01", + "/yeh.init_hamzaabove.medi_hah.medi": "\uFC98", + "/yeh.init_hamzaabove.medi_heh.medi": "\uFC9B", + "/yeh.init_hamzaabove.medi_jeem.fina": "\uFC00", + "/yeh.init_hamzaabove.medi_jeem.medi": "\uFC97", + "/yeh.init_hamzaabove.medi_khah.medi": "\uFC99", + "/yeh.init_hamzaabove.medi_meem.fina": "\uFC02", + "/yeh.init_hamzaabove.medi_meem.medi": "\uFC9A", + "/yeh.init_hamzaabove.medi_oe.fina": "\uFBF2", + "/yeh.init_hamzaabove.medi_u.fina": "\uFBF0", + "/yeh.init_hamzaabove.medi_waw.fina": "\uFBEE", + "/yeh.init_hamzaabove.medi_yeh.fina": "\uFC04", + "/yeh.init_hamzaabove.medi_yu.fina": "\uFBF4", + "/yeh.init_heh.medi": "\uFCDE", + "/yeh.init_jeem.fina": "\uFC55", + "/yeh.init_jeem.medi": "\uFCDA", + "/yeh.init_khah.fina": "\uFC57", + "/yeh.init_khah.medi": "\uFCDC", + "/yeh.init_meem.fina": "\uFC58", + "/yeh.init_meem.medi": "\uFCDD", + "/yeh.init_meem.medi_meem.medi": "\uFD9D", + "/yeh.init_yeh.fina": "\uFC5A", + "/yeh.isol": "\uFEF1", + "/yeh.medi": "\uFEF4", + "/yeh.medi_alefmaksura.fina": "\uFC95", + "/yeh.medi_hah.medi_yeh.fina": "\uFDAE", + "/yeh.medi_hamzaabove.medi_ae.fina": "\uFBED", + "/yeh.medi_hamzaabove.medi_alef.fina": "\uFBEB", + "/yeh.medi_hamzaabove.medi_alefmaksura.fina": "\uFC68", + "/yeh.medi_hamzaabove.medi_e.fina": "\uFBF7", + "/yeh.medi_hamzaabove.medi_heh.medi": "\uFCE0", + "/yeh.medi_hamzaabove.medi_meem.fina": "\uFC66", + "/yeh.medi_hamzaabove.medi_meem.medi": "\uFCDF", + "/yeh.medi_hamzaabove.medi_noon.fina": "\uFC67", + "/yeh.medi_hamzaabove.medi_oe.fina": "\uFBF3", + "/yeh.medi_hamzaabove.medi_reh.fina": "\uFC64", + "/yeh.medi_hamzaabove.medi_u.fina": "\uFBF1", + "/yeh.medi_hamzaabove.medi_waw.fina": "\uFBEF", + "/yeh.medi_hamzaabove.medi_yeh.fina": "\uFC69", + "/yeh.medi_hamzaabove.medi_yu.fina": "\uFBF5", + "/yeh.medi_hamzaabove.medi_zain.fina": "\uFC65", + "/yeh.medi_heh.medi": "\uFCF1", + "/yeh.medi_jeem.medi_yeh.fina": "\uFDAF", + "/yeh.medi_meem.fina": "\uFC93", + "/yeh.medi_meem.medi": "\uFCF0", + "/yeh.medi_meem.medi_meem.fina": "\uFD9C", + "/yeh.medi_meem.medi_yeh.fina": "\uFDB0", + "/yeh.medi_noon.fina": "\uFC94", + "/yeh.medi_reh.fina": "\uFC91", + "/yeh.medi_yeh.fina": "\uFC96", + "/yeh.medi_zain.fina": "\uFC92", + "/yehBarreeDigitThreeAbove": "\u077B", + "/yehBarreeDigitTwoAbove": "\u077A", + "/yehVabove": "\u06CE", + "/yehabove": "\u06E7", + "/yeharabic": "\u064A", + "/yehbarree": "\u06D2", + "/yehbarree.fina": "\uFBAF", + "/yehbarree.isol": "\uFBAE", + "/yehbarreearabic": "\u06D2", + "/yehbarreefinalarabic": "\uFBAF", + "/yehbarreehamza": "\u06D3", + "/yehbarreehamza.fina": "\uFBB1", + "/yehbarreehamza.isol": "\uFBB0", + "/yehfarsi": "\u06CC", + "/yehfarsi.fina": "\uFBFD", + "/yehfarsi.init": "\uFBFE", + "/yehfarsi.isol": "\uFBFC", + "/yehfarsi.medi": "\uFBFF", + "/yehfarsiinvertedV": "\u063D", + "/yehfarsithreedotsabove": "\u063F", + "/yehfarsitwodotsabove": "\u063E", + "/yehfinalarabic": "\uFEF2", + "/yehhamza": "\u0626", + "/yehhamza.fina": "\uFE8A", + "/yehhamza.init": "\uFE8B", + "/yehhamza.isol": "\uFE89", + "/yehhamza.medi": "\uFE8C", + "/yehhamzaabovearabic": "\u0626", + "/yehhamzaabovefinalarabic": "\uFE8A", + "/yehhamzaaboveinitialarabic": "\uFE8B", + "/yehhamzaabovemedialarabic": "\uFE8C", + "/yehhighhamza": "\u0678", + "/yehinitialarabic": "\uFEF3", + "/yehmedialarabic": "\uFEF4", + "/yehmeeminitialarabic": "\uFCDD", + "/yehmeemisolatedarabic": "\uFC58", + "/yehnoonfinalarabic": "\uFC94", + "/yehsmall": "\u06E6", + "/yehtail": "\u06CD", + "/yehthreedotsbelow": "\u06D1", + "/yehthreedotsbelowarabic": "\u06D1", + "/yekorean": "\u3156", + "/yellowHeart": "\u1F49B", + "/yen": "\u00A5", + "/yenmonospace": "\uFFE5", + "/yeokorean": "\u3155", + "/yeorinhieuhkorean": "\u3186", + "/yerachBenYomo:hb": "\u05AA", + "/yerahbenyomohebrew": "\u05AA", + "/yerahbenyomolefthebrew": "\u05AA", + "/yericyrillic": "\u044B", + "/yerudieresiscyrillic": "\u04F9", + "/yesieungkorean": "\u3181", + "/yesieungpansioskorean": "\u3183", + "/yesieungsioskorean": "\u3182", + "/yetiv:hb": "\u059A", + "/yetivhebrew": "\u059A", + "/ygrave": "\u1EF3", + "/yhoi": "\u1EF7", + "/yhook": "\u01B4", + "/yhookabove": "\u1EF7", + "/yiarmenian": "\u0575", + "/yicyrillic": "\u0457", + "/yikorean": "\u3162", + "/yintonemod": "\u02EA", + "/yinyang": "\u262F", + "/yiwnarmenian": "\u0582", + "/ylongcyr": "\u044B", + "/ylongdieresiscyr": "\u04F9", + "/yloop": "\u1EFF", + "/ymacron": "\u0233", + "/ymonospace": "\uFF59", + "/yocirclekatakana": "\u32F5", + "/yod": "\u05D9", + "/yod:hb": "\u05D9", + "/yod_yod:hb": "\u05F2", + "/yod_yod_patah:hb": "\uFB1F", + "/yoddagesh": "\uFB39", + "/yoddageshhebrew": "\uFB39", + "/yodhebrew": "\u05D9", + "/yodwithdagesh:hb": "\uFB39", + "/yodwithhiriq:hb": "\uFB1D", + "/yodyodhebrew": "\u05F2", + "/yodyodpatahhebrew": "\uFB1F", + "/yogh": "\u021D", + "/yohiragana": "\u3088", + "/yoikorean": "\u3189", + "/yokatakana": "\u30E8", + "/yokatakanahalfwidth": "\uFF96", + "/yokorean": "\u315B", + "/yosmallhiragana": "\u3087", + "/yosmallkatakana": "\u30E7", + "/yosmallkatakanahalfwidth": "\uFF6E", + "/yot": "\u03F3", + "/yotgreek": "\u03F3", + "/yoyaekorean": "\u3188", + "/yoyakorean": "\u3187", + "/yoyakthai": "\u0E22", + "/yoyingthai": "\u0E0D", + "/yparen": "\u24B4", + "/yparenthesized": "\u24B4", + "/ypogegrammeni": "\u037A", + "/ypogegrammenigreekcmb": "\u0345", + "/yr": "\u01A6", + "/yring": "\u1E99", + "/ystroke": "\u024F", + "/ysuperior": "\u02B8", + "/ysupmod": "\u02B8", + "/ytilde": "\u1EF9", + "/yturned": "\u028E", + "/yu.fina": "\uFBDC", + "/yu.isol": "\uFBDB", + "/yuansquare": "\u3350", + "/yucirclekatakana": "\u32F4", + "/yucyr": "\u044E", + "/yuhiragana": "\u3086", + "/yuikorean": "\u318C", + "/yukatakana": "\u30E6", + "/yukatakanahalfwidth": "\uFF95", + "/yukirghiz": "\u06C9", + "/yukirghiz.fina": "\uFBE3", + "/yukirghiz.isol": "\uFBE2", + "/yukorean": "\u3160", + "/yukrcyr": "\u0457", + "/yusbigcyr": "\u046B", + "/yusbigcyrillic": "\u046B", + "/yusbigiotifiedcyr": "\u046D", + "/yusbigiotifiedcyrillic": "\u046D", + "/yuslittlecyr": "\u0467", + "/yuslittlecyrillic": "\u0467", + "/yuslittleiotifiedcyr": "\u0469", + "/yuslittleiotifiedcyrillic": "\u0469", + "/yusmallhiragana": "\u3085", + "/yusmallkatakana": "\u30E5", + "/yusmallkatakanahalfwidth": "\uFF6D", + "/yuyekorean": "\u318B", + "/yuyeokorean": "\u318A", + "/yyabengali": "\u09DF", + "/yyadeva": "\u095F", + "/z": "\u007A", + "/zaarmenian": "\u0566", + "/zacute": "\u017A", + "/zadeva": "\u095B", + "/zagurmukhi": "\u0A5B", + "/zah": "\u0638", + "/zah.fina": "\uFEC6", + "/zah.init": "\uFEC7", + "/zah.init_meem.fina": "\uFC28", + "/zah.init_meem.medi": "\uFCB9", + "/zah.isol": "\uFEC5", + "/zah.medi": "\uFEC8", + "/zah.medi_meem.medi": "\uFD3B", + "/zaharabic": "\u0638", + "/zahfinalarabic": "\uFEC6", + "/zahinitialarabic": "\uFEC7", + "/zahiragana": "\u3056", + "/zahmedialarabic": "\uFEC8", + "/zain": "\u0632", + "/zain.fina": "\uFEB0", + "/zain.isol": "\uFEAF", + "/zainabove": "\u0617", + "/zainarabic": "\u0632", + "/zainfinalarabic": "\uFEB0", + "/zakatakana": "\u30B6", + "/zaqefGadol:hb": "\u0595", + "/zaqefQatan:hb": "\u0594", + "/zaqefgadolhebrew": "\u0595", + "/zaqefqatanhebrew": "\u0594", + "/zarqa:hb": "\u0598", + "/zarqahebrew": "\u0598", + "/zayin": "\u05D6", + "/zayin:hb": "\u05D6", + "/zayindagesh": "\uFB36", + "/zayindageshhebrew": "\uFB36", + "/zayinhebrew": "\u05D6", + "/zayinwithdagesh:hb": "\uFB36", + "/zbopomofo": "\u3117", + "/zcaron": "\u017E", + "/zcircle": "\u24E9", + "/zcircumflex": "\u1E91", + "/zcurl": "\u0291", + "/zdescender": "\u2C6C", + "/zdot": "\u017C", + "/zdotaccent": "\u017C", + "/zdotbelow": "\u1E93", + "/zecyr": "\u0437", + "/zecyrillic": "\u0437", + "/zedescendercyrillic": "\u0499", + "/zedieresiscyr": "\u04DF", + "/zedieresiscyrillic": "\u04DF", + "/zehiragana": "\u305C", + "/zekatakana": "\u30BC", + "/zero": "\u0030", + "/zero.inferior": "\u2080", + "/zero.superior": "\u2070", + "/zeroarabic": "\u0660", + "/zerobengali": "\u09E6", + "/zerocircle": "\u24EA", + "/zerocircleblack": "\u24FF", + "/zerocomma": "\u1F101", + "/zerodeva": "\u0966", + "/zerofar": "\u06F0", + "/zerofullstop": "\u1F100", + "/zerogujarati": "\u0AE6", + "/zerogurmukhi": "\u0A66", + "/zerohackarabic": "\u0660", + "/zeroinferior": "\u2080", + "/zeromonospace": "\uFF10", + "/zerooldstyle": "\uF730", + "/zeropersian": "\u06F0", + "/zerosquareabove": "\u06E0", + "/zerosuperior": "\u2070", + "/zerothai": "\u0E50", + "/zerothirds": "\u2189", + "/zerowidthjoiner": "\uFEFF", + "/zerowidthnobreakspace": "\uFEFF", + "/zerowidthnonjoiner": "\u200C", + "/zerowidthspace": "\u200B", + "/zeta": "\u03B6", + "/zetailcyr": "\u0499", + "/zhbopomofo": "\u3113", + "/zhearmenian": "\u056A", + "/zhebrevecyr": "\u04C2", + "/zhebrevecyrillic": "\u04C2", + "/zhecyr": "\u0436", + "/zhecyrillic": "\u0436", + "/zhedescendercyrillic": "\u0497", + "/zhedieresiscyr": "\u04DD", + "/zhedieresiscyrillic": "\u04DD", + "/zhetailcyr": "\u0497", + "/zhook": "\u0225", + "/zihiragana": "\u3058", + "/zikatakana": "\u30B8", + "/zildefunc": "\u236C", + "/zinorhebrew": "\u05AE", + "/zjekomicyr": "\u0505", + "/zlinebelow": "\u1E95", + "/zmonospace": "\uFF5A", + "/znotationbagmembership": "\u22FF", + "/zohiragana": "\u305E", + "/zokatakana": "\u30BE", + "/zparen": "\u24B5", + "/zparenthesized": "\u24B5", + "/zretroflex": "\u0290", + "/zretroflexhook": "\u0290", + "/zstroke": "\u01B6", + "/zswashtail": "\u0240", + "/zuhiragana": "\u305A", + "/zukatakana": "\u30BA", + "/zwarakay": "\u0659", + # manually added from + # https://github.com/serviceprototypinglab/latex-pdfa/blob/master/glyphtounicode-cmr.tex + "/angbracketleftBig": "\u28E8", + "/angbracketleftBigg": "\u27E8", + "/angbracketleftbig": "\u27E8", + "/angbracketleftbigg": "\u27E8", + "/angbracketrightBig": "\u27E9", + "/angbracketrightBigg": "\u27E9", + "/angbracketrightbig": "\u27E9", + "/angbracketrightbigg": "\u27E9", + "/arrowbt": "\u2193", + "/arrowdblbt": "\u21D3", + "/arrowdbltp": "\u21D1", + "/arrowhookleft": "\u21AA", + "/arrowhookright": "\u21A9", + "/arrowtp": "\u2191", + # diff : "/arrowvertex": "\u23D0", + "/arrowvertexdbl": "\uED12", + "/backslashBig": "\u005C", + "/backslashBigg": "\u005C", + "/backslashbig": "\u005C", + "/backslashbigg": "\u005C", + # diff : "/braceex": "\u23AA", + "/bracehtipdownleft": "\uED17", + "/bracehtipdownright": "\uED18", + "/bracehtipupleft": "\uED19", + "/bracehtipupright": "\uED1A", + "/braceleftBig": "\u007B", + "/braceleftBigg": "\u007B", + "/braceleftbig": "\u007B", + "/braceleftbigg": "\u007B", + # diff : "/braceleftbt": "\u23A9", + # diff : "/braceleftmid": "\u23A8", + # diff : "/bracelefttp": "\u23A7", + "/bracerightBig": "\u007D", + "/bracerightBigg": "\u007D", + "/bracerightbig": "\u007D", + "/bracerightbigg": "\u007D", + # diff : "/bracerightbt": "\u23AD", + # diff : "/bracerightmid": "\u23AC", + # diff : "/bracerighttp": "\u23AB", + "/bracketleftBig": "\u005B", + "/bracketleftBigg": "\u005B", + "/bracketleftbig": "\u005B", + "/bracketleftbigg": "\u005B", + # diff : "/bracketleftbt": "\u23A3", + # diff : "/bracketleftex": "\u23A2", + # diff : "/bracketlefttp": "\u23A1", + "/bracketrightBig": "\u005D", + "/bracketrightBigg": "\u005D", + "/bracketrightbig": "\u005D", + "/bracketrightbigg": "\u005D", + # diff : "/bracketrightbt": "\u23A6", + # diff : "/bracketrightex": "\u23A5", + # diff : "/bracketrighttp": "\u23A4", + "/ceilingleftBig": "\u2308", + "/ceilingleftBigg": "\u2308", + "/ceilingleftbig": "\u2308", + "/ceilingleftbigg": "\u2308", + "/ceilingrightBig": "\u2309", + "/ceilingrightBigg": "\u2309", + "/ceilingrightbig": "\u2309", + "/ceilingrightbigg": "\u2309", + "/circledotdisplay": "\u2A00", + "/circledottext": "\u2A00", + "/circlemultiplydisplay": "\u2A02", + "/circlemultiplytext": "\u2A02", + "/circleplusdisplay": "\u2A01", + "/circleplustext": "\u2A01", + "/contintegraldisplay": "\u222E", + "/contintegraltext": "\u222E", + "/coproductdisplay": "\u2210", + "/coproducttext": "\u2210", + "/floorleftBig": "\u230A", + "/floorleftBigg": "\u230A", + "/floorleftbig": "\u230A", + "/floorleftbigg": "\u230A", + "/floorrightBig": "\u230B", + "/floorrightBigg": "\u230B", + "/floorrightbig": "\u230B", + "/floorrightbigg": "\u230B", + "/hatwide": "\u02C6", + "/hatwider": "\u02C6", + "/hatwidest": "\u02C6", + "/integraldisplay": "\u222B", + "/integraltext": "\u222B", + "/intersectiondisplay": "\u22C2", + "/intersectiontext": "\u22C2", + "/logicalanddisplay": "\u22C0", + "/logicalandtext": "\u22C0", + "/logicalordisplay": "\u22C1", + "/logicalortext": "\u22C1", + "/mapsto": "\u21A6", + "/parenleftBig": "\u0028", + "/parenleftBigg": "\u0028", + "/parenleftbig": "\u0028", + "/parenleftbigg": "\u0028", + # diff : "/parenleftbt": "\u239D", + # diff : "/parenleftex": "\u239C", + # diff : "/parenlefttp": "\u239B", + "/parenrightBig": "\u0029", + "/parenrightBigg": "\u0029", + "/parenrightbig": "\u0029", + "/parenrightbigg": "\u0029", + # diff : "/parenrightbt": "\u23A0", + # diff : "/parenrightex": "\u239F", + # diff : "/parenrighttp": "\u239E", + "/productdisplay": "\u220F", + "/producttext": "\u220F", + "/radicalBig": "\u221A", + "/radicalBigg": "\u221A", + "/radicalbig": "\u221A", + "/radicalbigg": "\u221A", + "/radicalbt": "\u221A", + "/radicaltp": "\uED6A", + "/radicalvertex": "\uED6B", + "/slashBig": "\u002F", + "/slashBigg": "\u002F", + "/slashbig": "\u002F", + "/slashbigg": "\u002F", + "/summationdisplay": "\u2211", + "/summationtext": "\u2211", + "/tie": "\u2040", + "/tildewide": "\u02DC", + "/tildewider": "\u02DC", + "/tildewidest": "\u02DC", + "/uniondisplay": "\u22C3", + "/unionmultidisplay": "\u2A04", + "/unionmultitext": "\u2A04", + "/unionsqdisplay": "\u2A06", + "/unionsqtext": "\u2A06", + "/uniontext": "\u22C3", + "/vextenddouble": "\uED79", + "/vextendsingle": "\u23D0", + "/a1": "\u25C1", + "/a2": "\u22B4", + "/a3": "\u25B7", + "/a4": "\u22B5", + "/a40": "\u02C2", + "/a41": "\u02C3", + "/a42": "\u2303", + "/a43": "\u2304", + "/a48": "\u2127", + "/a49": "\u22C8", + "/a50": "\u25A1", + "/a51": "\u25C7", + "/a58": "\u2053", + "/a59": "\u219D", + "/a60": "\u228F", + "/a61": "\u2290", + "/d0": "\u2199", + "/d1": "\u2199", + "/d2": "\u2199", + "/d3": "\u2199", + "/d4": "\u2199", + "/d5": "\u2199", + "/d6": "\u2199", + "/d7": "\u2193", + "/d8": "\u2193", + "/d9": "\u2193", + "/d10": "\u2193", + "/d11": "\u2193", + "/d12": "\u2193", + "/d13": "\u2193", + "/d14": "\u2193", + "/d15": "\u2193", + "/d16": "\u2193", + "/d17": "\u2193", + "/d18": "\u2193", + "/d19": "\u2193", + "/d20": "\u2193", + "/d21": "\u2193", + "/d22": "\u2193", + "/d23": "\u2193", + "/d24": "\u2198", + "/d25": "\u2198", + "/d26": "\u2198", + "/d27": "\u2198", + "/d28": "\u2198", + "/d29": "\u2198", + "/d30": "\u2198", + "/d31": "\u2198", + "/d32": "\u2198", + "/d33": "\u2198", + "/d34": "\u2198", + "/d35": "\u2198", + "/d36": "\u2198", + "/d37": "\u2198", + "/d38": "\u2198", + "/d39": "\u2192", + "/d40": "\u2192", + "/d41": "\u2192", + "/d42": "\u2192", + "/d43": "\u2192", + "/d44": "\u2192", + "/d45": "\u2192", + "/d46": "\u2192", + "/d47": "\u2192", + "/d48": "\u2192", + "/d49": "\u2192", + "/d50": "\u2192", + "/d51": "\u2192", + "/d52": "\u2192", + "/d53": "\u2192", + "/d54": "\u2192", + "/d55": "\u2192", + "/d56": "\u2197", + "/d57": "\u2197", + "/d58": "\u2197", + "/d59": "\u2197", + "/d60": "\u2197", + "/d61": "\u2197", + "/d62": "\u2197", + "/d63": "\u2197", + "/d64": "\u2197", + "/d65": "\u2197", + "/d66": "\u2197", + "/d67": "\u2197", + "/d68": "\u2197", + "/d69": "\u2197", + "/d70": "\u2197", + "/d71": "\u2191", + "/d72": "\u2191", + "/d73": "\u2191", + "/d74": "\u2191", + "/d75": "\u2191", + "/d76": "\u2191", + "/d77": "\u2191", + "/d78": "\u2191", + "/d79": "\u2191", + "/d80": "\u2191", + "/d81": "\u2191", + "/d82": "\u2191", + "/d83": "\u2191", + "/d84": "\u2191", + "/d85": "\u2191", + "/d86": "\u2191", + "/d87": "\u2191", + "/d88": "\u2196", + "/d89": "\u2196", + "/d90": "\u2196", + "/d91": "\u2196", + "/d92": "\u2196", + "/d93": "\u2196", + "/d94": "\u2196", + "/d95": "\u2196", + "/d96": "\u2196", + "/d97": "\u2196", + "/d98": "\u2196", + "/d99": "\u2196", + "/d100": "\u2196", + "/d101": "\u2196", + "/d102": "\u2196", + "/d103": "\u2190", + "/d104": "\u2190", + "/d105": "\u2190", + "/d106": "\u2190", + "/d107": "\u2190", + "/d108": "\u2190", + "/d109": "\u2190", + "/d110": "\u2190", + "/d111": "\u2190", + "/d112": "\u2190", + "/d113": "\u2190", + "/d114": "\u2190", + "/d115": "\u2190", + "/d116": "\u2190", + "/d117": "\u2190", + "/d118": "\u2190", + "/d119": "\u2190", + "/d120": "\u2199", + "/d121": "\u2199", + "/d122": "\u2199", + "/d123": "\u2199", + "/d124": "\u2199", + "/d125": "\u2199", + "/d126": "\u2199", + "/d127": "\u2199", + # manually added from + # https://github.com/kohler/lcdf-typetools/blob/master/texglyphlist.txt + "/Ifractur": "\u2111", + "/FFsmall": "\uF766", + "/FFIsmall": "\uF766", + "/FFLsmall": "\uF766", + "/FIsmall": "\uF766", + "/FLsmall": "\uF766", + # diff : "/Germandbls": "\u0053", + "/Germandblssmall": "\uF773", + "/Ng": "\u014A", + "/Rfractur": "\u211C", + "/SS": "\u0053", + "/SSsmall": "\uF773", + "/altselector": "\uD802", + "/angbracketleft": "\u27E8", + "/angbracketright": "\u27E9", + "/arrowbothv": "\u2195", + "/arrowdblbothv": "\u21D5", + "/arrowleftbothalf": "\u21BD", + "/arrowlefttophalf": "\u21BC", + "/arrownortheast": "\u2197", + "/arrownorthwest": "\u2196", + "/arrowrightbothalf": "\u21C1", + "/arrowrighttophalf": "\u21C0", + "/arrowsoutheast": "\u2198", + "/arrowsouthwest": "\u2199", + "/ascendercompwordmark": "\uD80A", + "/asteriskcentered": "\u2217", + "/bardbl": "\u2225", + "/capitalcompwordmark": "\uD809", + "/circlecopyrt": "\u20DD", + "/circledivide": "\u2298", + "/circleminus": "\u2296", + "/coproduct": "\u2A3F", + "/ct": "\u0063", + "/cwm": "\u200C", + "/dblbracketleft": "\u27E6", + "/dblbracketright": "\u27E7", + # diff : "/diamond": "\u2662", + "/diamondmath": "\u22C4", + # diff : "/dotlessj": "\u0237", + "/emptyslot": "\uD801", + "/epsilon1": "\u03F5", + "/epsiloninv": "\u03F6", + "/equivasymptotic": "\u224D", + "/flat": "\u266D", + "/follows": "\u227B", + "/followsequal": "\u2AB0", + "/followsorcurly": "\u227D", + "/greatermuch": "\u226B", + # diff : "/heart": "\u2661", + "/interrobangdown": "\u2E18", + "/intersectionsq": "\u2293", + "/latticetop": "\u22A4", + "/lessmuch": "\u226A", + "/longdbls": "\u017F", + "/longsh": "\u017F", + "/longsi": "\u017F", + "/longsl": "\u017F", + "/longst": "\uFB05", + "/lscript": "\u2113", + "/natural": "\u266E", + "/negationslash": "\u0338", + "/ng": "\u014B", + "/owner": "\u220B", + "/pertenthousand": "\u2031", + # diff : "/phi": "\u03D5", + # diff : "/phi1": "\u03C6", + "/pi1": "\u03D6", + "/precedesequal": "\u2AAF", + "/precedesorcurly": "\u227C", + "/prime": "\u2032", + "/rho1": "\u03F1", + "/ringfitted": "\uD80D", + "/sharp": "\u266F", + "/similarequal": "\u2243", + "/slurabove": "\u2322", + "/slurbelow": "\u2323", + "/st": "\uFB06", + "/subsetsqequal": "\u2291", + "/supersetsqequal": "\u2292", + "/triangle": "\u25B3", + "/triangleinv": "\u25BD", + "/triangleleft": "\u25C1", + # diff : "/triangleright": "\u25B7", + "/turnstileleft": "\u22A2", + "/turnstileright": "\u22A3", + "/twelveudash": "\uD80C", + "/unionmulti": "\u228E", + "/unionsq": "\u2294", + "/vector": "\u20D7", + "/visualspace": "\u2423", + "/Dbar": "\u0110", + "/compwordmark": "\u200C", + "/dbar": "\u0111", + "/rangedash": "\u2013", + "/hyphenchar": "\u002D", + "/punctdash": "\u2014", + "/visiblespace": "\u2423", + "/Yen": "\u00A5", + "/anticlockwise": "\u27F2", + "/arrowparrleftright": "\u21C6", + "/arrowparrrightleft": "\u21C4", + "/arrowtailleft": "\u21A2", + "/arrowtailright": "\u21A3", + "/arrowtripleleft": "\u21DA", + "/arrowtripleright": "\u21DB", + "/check": "\u2713", + "/circleR": "\u00AE", + "/circleS": "\u24C8", + "/circleasterisk": "\u229B", + "/circleequal": "\u229C", + "/circlering": "\u229A", + "/clockwise": "\u27F3", + "/curlyleft": "\u21AB", + "/curlyright": "\u21AC", + "/dblarrowdwn": "\u21CA", + "/dblarrowheadleft": "\u219E", + "/dblarrowheadright": "\u21A0", + # diff : "/dblarrowup": "\u21C8", + "/defines": "\u225C", + "/diamondsolid": "\u2666", + "/difference": "\u224F", + "/downfall": "\u22CE", + "/equaldotleftright": "\u2252", + "/equaldotrightleft": "\u2253", + "/equalorfollows": "\u22DF", + # diff : "/equalorgreater": "\u2A96", + # diff : "/equalorless": "\u2A95", + "/equalsdots": "\u2251", + "/followsorequal": "\u227F", + "/forcesbar": "\u22AA", + # diff : "/fork": "\u22D4", + "/geomequivalent": "\u224E", + "/greaterdbleqlless": "\u2A8C", + "/greaterdblequal": "\u2267", + "/greaterlessequal": "\u22DB", + "/greaterorapproxeql": "\u2A86", + "/greaterorequalslant": "\u2A7E", + "/greaterorsimilar": "\u2273", + "/harpoondownleft": "\u21C3", + "/harpoondownright": "\u21C2", + "/harpoonleftright": "\u21CC", + "/harpoonrightleft": "\u21CB", + "/harpoonupleft": "\u21BF", + "/harpoonupright": "\u21BE", + "/intercal": "\u22BA", + "/lessdbleqlgreater": "\u2A8B", + "/lessdblequal": "\u2266", + "/lessequalgreater": "\u22DA", + "/lessorapproxeql": "\u2A85", + "/lessorequalslant": "\u2A7D", + "/lessorsimilar": "\u2272", + "/maltesecross": "\u2720", + "/multiopenleft": "\u22CB", + "/multiopenright": "\u22CC", + "/orunderscore": "\u22BB", + "/perpcorrespond": "\u2A5E", + # diff : "/precedesorequal": "\u227E", + "/primereverse": "\u2035", + "/revasymptequal": "\u22CD", + "/revsimilar": "\u223D", + "/rightanglene": "\u231D", + "/rightanglenw": "\u231C", + "/rightanglese": "\u231F", + "/rightanglesw": "\u231E", + "/satisfies": "\u22A8", + "/shiftleft": "\u21B0", + "/shiftright": "\u21B1", + "/square": "\u25A1", + "/squaredot": "\u22A1", + "/squareminus": "\u229F", + "/squaremultiply": "\u22A0", + "/squareplus": "\u229E", + "/squaresolid": "\u25A0", + "/squiggleleftright": "\u21AD", + "/squiggleright": "\u21DD", + "/subsetdblequal": "\u2AC5", + "/supersetdbl": "\u22D1", + "/supersetdblequal": "\u2AC6", + "/triangledownsld": "\u25BC", + "/triangleleftequal": "\u22B4", + "/triangleleftsld": "\u25C0", + "/trianglerightequal": "\u22B5", + "/trianglerightsld": "\u25B6", + "/trianglesolid": "\u25B2", + "/uprise": "\u22CF", + # diff : "/Digamma": "\u1D7C", + "/Finv": "\u2132", + "/Gmir": "\u2141", + "/Omegainv": "\u2127", + "/approxorequal": "\u224A", + "/archleftdown": "\u21B6", + "/archrightdown": "\u21B7", + "/beth": "\u2136", + "/daleth": "\u2138", + "/dividemultiply": "\u22C7", + "/downslope": "\u29F9", + "/equalorsimilar": "\u2242", + "/follownotdbleqv": "\u2ABA", + "/follownotslnteql": "\u2AB6", + "/followornoteqvlnt": "\u22E9", + "/greaternotdblequal": "\u2A8A", + "/greaternotequal": "\u2A88", + "/greaterornotdbleql": "\u2269", + "/greaterornotequal": "\u2269", + "/integerdivide": "\u2216", + "/lessnotdblequal": "\u2A89", + "/lessnotequal": "\u2A87", + "/lessornotdbleql": "\u2268", + "/lessornotequal": "\u2268", + "/multicloseleft": "\u22C9", + "/multicloseright": "\u22CA", + "/notapproxequal": "\u2247", + "/notarrowboth": "\u21AE", + "/notarrowleft": "\u219A", + "/notarrowright": "\u219B", + "/notbar": "\u2224", + "/notdblarrowboth": "\u21CE", + "/notdblarrowleft": "\u21CD", + "/notdblarrowright": "\u21CF", + "/notfollows": "\u2281", + "/notfollowsoreql": "\u2AB0", + "/notforces": "\u22AE", + "/notforcesextra": "\u22AF", + "/notgreaterdblequal": "\u2267", + "/notgreaterequal": "\u2271", + "/notgreaterorslnteql": "\u2A7E", + "/notlessdblequal": "\u2266", + "/notlessequal": "\u2270", + "/notlessorslnteql": "\u2A7D", + "/notprecedesoreql": "\u2AAF", + "/notsatisfies": "\u22AD", + "/notsimilar": "\u2241", + "/notsubseteql": "\u2288", + "/notsubsetordbleql": "\u2AC5", + "/notsubsetoreql": "\u228A", + "/notsuperseteql": "\u2289", + "/notsupersetordbleql": "\u2AC6", + "/notsupersetoreql": "\u228B", + "/nottriangeqlleft": "\u22EC", + "/nottriangeqlright": "\u22ED", + "/nottriangleleft": "\u22EA", + "/nottriangleright": "\u22EB", + "/notturnstile": "\u22AC", + "/planckover2pi": "\u210F", + "/planckover2pi1": "\u210F", + "/precedenotdbleqv": "\u2AB9", + "/precedenotslnteql": "\u2AB5", + "/precedeornoteqvlnt": "\u22E8", + "/subsetnoteql": "\u228A", + "/subsetornotdbleql": "\u2ACB", + "/supersetnoteql": "\u228B", + "/supersetornotdbleql": "\u2ACC", + "/upslope": "\u29F8", +} + + +def _complete() -> None: + for i in range(256): + adobe_glyphs[f"/a{i}"] = chr(i) + adobe_glyphs["/.notdef"] = "□" + + +_complete() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/core_font_metrics.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/core_font_metrics.py new file mode 100644 index 0000000000000000000000000000000000000000..f086ef7a5155332de371f9e97e4982cb5a5a21f9 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/core_font_metrics.py @@ -0,0 +1,4483 @@ +# This file is based upon the 14 core AFM files provided by Adobe/Macromedia at +# https://download.macromedia.com/pub/developer/opentype/tech-notes/Core14_AFMs.zip +# The original copyright follows: +# +# ----------------------------------------------------------------------------------------------- +# Core 14 AFM Files - ReadMe +# +# This file and the 14 PostScript(R) AFM files it accompanies may be used, copied, and +# distributed for any purpose and without charge, with or without modification, provided that all +# copyright notices are retained; that the AFM files are not distributed without this file; that +# all modifications to this file or any of the AFM files are prominently noted in the modified +# file(s); and that this paragraph is not modified. Adobe Systems has no responsibility or +# obligation to support the use of the AFM files. +# ----------------------------------------------------------------------------------------------- + + +from pypdf._font import CoreFontMetrics, FontDescriptor + +CORE_FONT_METRICS: dict[str, CoreFontMetrics] = { + # Generated from Courier.afm + # Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. + "Courier": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier", + family="Courier", + weight="Medium", + ascent=629, + descent=-157, + cap_height=562, + x_height=426, + italic_angle=0, + flags=33, + bbox=(-23.0, -250.0, 715.0, 805.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Courier-Bold.afm + # Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved. + "Courier-Bold": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier-Bold", + family="Courier", + weight="Bold", + ascent=629, + descent=-157, + cap_height=562, + x_height=439, + italic_angle=0, + flags=33, + bbox=(-113.0, -250.0, 749.0, 801.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Courier-BoldOblique.afm + # Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved. + "Courier-BoldOblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier-BoldOblique", + family="Courier", + weight="Bold", + ascent=629, + descent=-157, + cap_height=562, + x_height=439, + italic_angle=-12, + flags=97, + bbox=(-57.0, -250.0, 869.0, 801.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Courier-Oblique.afm + # Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. + "Courier-Oblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier-Oblique", + family="Courier", + weight="Medium", + ascent=629, + descent=-157, + cap_height=562, + x_height=426, + italic_angle=-12, + flags=97, + bbox=(-27.0, -250.0, 849.0, 805.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Helvetica.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica", + family="Helvetica", + weight="Medium", + ascent=718, + descent=-207, + cap_height=718, + x_height=523, + italic_angle=0, + flags=32, + bbox=(-166.0, -225.0, 1000.0, 931.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 278, + '"': 355, + "#": 556, + "$": 556, + "%": 889, + "&": 667, + "\u2019": 222, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 278, + ";": 278, + "<": 584, + "=": 584, + ">": 584, + "?": 556, + "@": 1015, + "A": 667, + "B": 667, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 500, + "K": 667, + "L": 556, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 278, + "\\": 278, + "]": 278, + "^": 469, + "_": 556, + "\u2018": 222, + "a": 556, + "b": 556, + "c": 500, + "d": 556, + "e": 556, + "f": 278, + "g": 556, + "h": 556, + "i": 222, + "j": 222, + "k": 500, + "l": 222, + "m": 833, + "n": 556, + "o": 556, + "p": 556, + "q": 556, + "r": 333, + "s": 500, + "t": 278, + "u": 556, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 500, + "{": 334, + "|": 260, + "}": 334, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 191, + "\u201c": 333, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 500, + "\ufb02": 500, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 537, + "\u2022": 350, + "\u201a": 222, + "\u201e": 333, + "\u201d": 333, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 556, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 222, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 556, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 667, + "\xe1": 556, + "\xdb": 722, + "\xfd": 500, + "\u0219": 500, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 500, + "\xe5": 556, + "\u0145": 722, + "\u013a": 222, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 500, + "\u015f": 500, + "\xed": 278, + "\u25ca": 471, + "\u0158": 722, + "\u0122": 778, + "\xfb": 556, + "\xe2": 556, + "\u0100": 667, + "\u0159": 333, + "\xe7": 500, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 643, + "\u016a": 722, + "\u016f": 556, + "\xb3": 333, + "\xd2": 778, + "\xc0": 667, + "\u0102": 667, + "\xd7": 584, + "\xfa": 556, + "\u0164": 611, + "\u2202": 476, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 500, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 260, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 333, + "\u014d": 556, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 222, + "\u0165": 317, + "\u0119": 556, + "\u0172": 722, + "\xc1": 667, + "\xc4": 667, + "\xe8": 556, + "\u017a": 500, + "\u012f": 222, + "\xd3": 778, + "\xf3": 556, + "\u0101": 556, + "\u015b": 500, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 556, + "\xb2": 333, + "\xd6": 778, + "\xb5": 556, + "\xec": 278, + "\u0151": 556, + "\u0118": 667, + "\u0111": 556, + "\xbe": 834, + "\u015e": 667, + "\u013e": 299, + "\u0136": 667, + "\u0139": 556, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 556, + "\xbd": 834, + "\u2264": 549, + "\xf4": 556, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 556, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 556, + "\u010c": 722, + "\xf9": 556, + "\u221a": 453, + "\u010e": 722, + "\u0157": 333, + "\xd1": 722, + "\xf5": 556, + "\u0156": 722, + "\u013b": 556, + "\xc3": 667, + "\u0104": 667, + "\xc5": 667, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 500, + "\u2212": 584, + "\xce": 278, + "\u0148": 556, + "\u0163": 278, + "\xac": 584, + "\xf6": 556, + "\xfc": 556, + "\u2260": 549, + "\u0123": 556, + "\xf0": 556, + "\u017e": 500, + "\u0146": 556, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Helvetica-Bold.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica-Bold": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica-Bold", + family="Helvetica", + weight="Bold", + ascent=718, + descent=-207, + cap_height=718, + x_height=532, + italic_angle=0, + flags=32, + bbox=(-170.0, -228.0, 1003.0, 962.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 333, + '"': 474, + "#": 556, + "$": 556, + "%": 889, + "&": 722, + "\u2019": 278, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 333, + ";": 333, + "<": 584, + "=": 584, + ">": 584, + "?": 611, + "@": 975, + "A": 722, + "B": 722, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 556, + "K": 722, + "L": 611, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 584, + "_": 556, + "\u2018": 278, + "a": 556, + "b": 611, + "c": 556, + "d": 611, + "e": 556, + "f": 333, + "g": 611, + "h": 611, + "i": 278, + "j": 278, + "k": 556, + "l": 278, + "m": 889, + "n": 611, + "o": 611, + "p": 611, + "q": 611, + "r": 389, + "s": 556, + "t": 333, + "u": 611, + "v": 556, + "w": 778, + "x": 556, + "y": 556, + "z": 500, + "{": 389, + "|": 280, + "}": 389, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 238, + "\u201c": 500, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 611, + "\ufb02": 611, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 556, + "\u2022": 350, + "\u201a": 278, + "\u201e": 500, + "\u201d": 500, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 611, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 278, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 611, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 722, + "\xe1": 556, + "\xdb": 722, + "\xfd": 556, + "\u0219": 556, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 611, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 556, + "\xe5": 556, + "\u0145": 722, + "\u013a": 278, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 556, + "\u015f": 556, + "\xed": 278, + "\u25ca": 494, + "\u0158": 722, + "\u0122": 778, + "\xfb": 611, + "\xe2": 556, + "\u0100": 722, + "\u0159": 389, + "\xe7": 556, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 743, + "\u016a": 722, + "\u016f": 611, + "\xb3": 333, + "\xd2": 778, + "\xc0": 722, + "\u0102": 722, + "\xd7": 584, + "\xfa": 611, + "\u0164": 611, + "\u2202": 494, + "\xff": 556, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 556, + "\u0144": 611, + "\u016b": 611, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 280, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 389, + "\u014d": 611, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 278, + "\u0165": 389, + "\u0119": 556, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 556, + "\u017a": 500, + "\u012f": 278, + "\xd3": 778, + "\xf3": 611, + "\u0101": 556, + "\u015b": 556, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 611, + "\xb2": 333, + "\xd6": 778, + "\xb5": 611, + "\xec": 278, + "\u0151": 611, + "\u0118": 667, + "\u0111": 611, + "\xbe": 834, + "\u015e": 667, + "\u013e": 400, + "\u0136": 722, + "\u0139": 611, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 611, + "\xbd": 834, + "\u2264": 549, + "\xf4": 611, + "\xf1": 611, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 611, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 611, + "\u010c": 722, + "\xf9": 611, + "\u221a": 549, + "\u010e": 722, + "\u0157": 389, + "\xd1": 722, + "\xf5": 611, + "\u0156": 722, + "\u013b": 611, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 556, + "\u2212": 584, + "\xce": 278, + "\u0148": 611, + "\u0163": 333, + "\xac": 584, + "\xf6": 611, + "\xfc": 611, + "\u2260": 549, + "\u0123": 611, + "\xf0": 611, + "\u017e": 500, + "\u0146": 611, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Helvetica-BoldOblique.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica-BoldOblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica-BoldOblique", + family="Helvetica", + weight="Bold", + ascent=718, + descent=-207, + cap_height=718, + x_height=532, + italic_angle=-12, + flags=96, + bbox=(-174.0, -228.0, 1114.0, 962.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 333, + '"': 474, + "#": 556, + "$": 556, + "%": 889, + "&": 722, + "\u2019": 278, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 333, + ";": 333, + "<": 584, + "=": 584, + ">": 584, + "?": 611, + "@": 975, + "A": 722, + "B": 722, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 556, + "K": 722, + "L": 611, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 584, + "_": 556, + "\u2018": 278, + "a": 556, + "b": 611, + "c": 556, + "d": 611, + "e": 556, + "f": 333, + "g": 611, + "h": 611, + "i": 278, + "j": 278, + "k": 556, + "l": 278, + "m": 889, + "n": 611, + "o": 611, + "p": 611, + "q": 611, + "r": 389, + "s": 556, + "t": 333, + "u": 611, + "v": 556, + "w": 778, + "x": 556, + "y": 556, + "z": 500, + "{": 389, + "|": 280, + "}": 389, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 238, + "\u201c": 500, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 611, + "\ufb02": 611, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 556, + "\u2022": 350, + "\u201a": 278, + "\u201e": 500, + "\u201d": 500, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 611, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 278, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 611, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 722, + "\xe1": 556, + "\xdb": 722, + "\xfd": 556, + "\u0219": 556, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 611, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 556, + "\xe5": 556, + "\u0145": 722, + "\u013a": 278, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 556, + "\u015f": 556, + "\xed": 278, + "\u25ca": 494, + "\u0158": 722, + "\u0122": 778, + "\xfb": 611, + "\xe2": 556, + "\u0100": 722, + "\u0159": 389, + "\xe7": 556, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 743, + "\u016a": 722, + "\u016f": 611, + "\xb3": 333, + "\xd2": 778, + "\xc0": 722, + "\u0102": 722, + "\xd7": 584, + "\xfa": 611, + "\u0164": 611, + "\u2202": 494, + "\xff": 556, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 556, + "\u0144": 611, + "\u016b": 611, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 280, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 389, + "\u014d": 611, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 278, + "\u0165": 389, + "\u0119": 556, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 556, + "\u017a": 500, + "\u012f": 278, + "\xd3": 778, + "\xf3": 611, + "\u0101": 556, + "\u015b": 556, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 611, + "\xb2": 333, + "\xd6": 778, + "\xb5": 611, + "\xec": 278, + "\u0151": 611, + "\u0118": 667, + "\u0111": 611, + "\xbe": 834, + "\u015e": 667, + "\u013e": 400, + "\u0136": 722, + "\u0139": 611, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 611, + "\xbd": 834, + "\u2264": 549, + "\xf4": 611, + "\xf1": 611, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 611, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 611, + "\u010c": 722, + "\xf9": 611, + "\u221a": 549, + "\u010e": 722, + "\u0157": 389, + "\xd1": 722, + "\xf5": 611, + "\u0156": 722, + "\u013b": 611, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 556, + "\u2212": 584, + "\xce": 278, + "\u0148": 611, + "\u0163": 333, + "\xac": 584, + "\xf6": 611, + "\xfc": 611, + "\u2260": 549, + "\u0123": 611, + "\xf0": 611, + "\u017e": 500, + "\u0146": 611, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Helvetica-Oblique.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica-Oblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica-Oblique", + family="Helvetica", + weight="Medium", + ascent=718, + descent=-207, + cap_height=718, + x_height=523, + italic_angle=-12, + flags=96, + bbox=(-170.0, -225.0, 1116.0, 931.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 278, + '"': 355, + "#": 556, + "$": 556, + "%": 889, + "&": 667, + "\u2019": 222, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 278, + ";": 278, + "<": 584, + "=": 584, + ">": 584, + "?": 556, + "@": 1015, + "A": 667, + "B": 667, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 500, + "K": 667, + "L": 556, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 278, + "\\": 278, + "]": 278, + "^": 469, + "_": 556, + "\u2018": 222, + "a": 556, + "b": 556, + "c": 500, + "d": 556, + "e": 556, + "f": 278, + "g": 556, + "h": 556, + "i": 222, + "j": 222, + "k": 500, + "l": 222, + "m": 833, + "n": 556, + "o": 556, + "p": 556, + "q": 556, + "r": 333, + "s": 500, + "t": 278, + "u": 556, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 500, + "{": 334, + "|": 260, + "}": 334, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 191, + "\u201c": 333, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 500, + "\ufb02": 500, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 537, + "\u2022": 350, + "\u201a": 222, + "\u201e": 333, + "\u201d": 333, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 556, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 222, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 556, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 667, + "\xe1": 556, + "\xdb": 722, + "\xfd": 500, + "\u0219": 500, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 500, + "\xe5": 556, + "\u0145": 722, + "\u013a": 222, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 500, + "\u015f": 500, + "\xed": 278, + "\u25ca": 471, + "\u0158": 722, + "\u0122": 778, + "\xfb": 556, + "\xe2": 556, + "\u0100": 667, + "\u0159": 333, + "\xe7": 500, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 643, + "\u016a": 722, + "\u016f": 556, + "\xb3": 333, + "\xd2": 778, + "\xc0": 667, + "\u0102": 667, + "\xd7": 584, + "\xfa": 556, + "\u0164": 611, + "\u2202": 476, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 500, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 260, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 333, + "\u014d": 556, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 222, + "\u0165": 317, + "\u0119": 556, + "\u0172": 722, + "\xc1": 667, + "\xc4": 667, + "\xe8": 556, + "\u017a": 500, + "\u012f": 222, + "\xd3": 778, + "\xf3": 556, + "\u0101": 556, + "\u015b": 500, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 556, + "\xb2": 333, + "\xd6": 778, + "\xb5": 556, + "\xec": 278, + "\u0151": 556, + "\u0118": 667, + "\u0111": 556, + "\xbe": 834, + "\u015e": 667, + "\u013e": 299, + "\u0136": 667, + "\u0139": 556, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 556, + "\xbd": 834, + "\u2264": 549, + "\xf4": 556, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 556, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 556, + "\u010c": 722, + "\xf9": 556, + "\u221a": 453, + "\u010e": 722, + "\u0157": 333, + "\xd1": 722, + "\xf5": 556, + "\u0156": 722, + "\u013b": 556, + "\xc3": 667, + "\u0104": 667, + "\xc5": 667, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 500, + "\u2212": 584, + "\xce": 278, + "\u0148": 556, + "\u0163": 278, + "\xac": 584, + "\xf6": 556, + "\xfc": 556, + "\u2260": 549, + "\u0123": 556, + "\xf0": 556, + "\u017e": 500, + "\u0146": 556, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Symbol.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved. + "Symbol": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Symbol", + family="Symbol", + weight="Medium", + ascent=0.0, + descent=0.0, + cap_height=0.0, + x_height=0.0, + italic_angle=0, + flags=4, + bbox=(-180.0, -293.0, 1090.0, 1010.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + "\u2200": 713, + "#": 500, + "\u2203": 549, + "%": 833, + "&": 778, + "\u220b": 439, + "(": 333, + ")": 333, + "\u2217": 500, + "+": 549, + ",": 250, + "\u2212": 549, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 278, + ";": 278, + "<": 549, + "=": 549, + ">": 549, + "?": 444, + "\u2245": 549, + "\u0391": 722, + "\u0392": 667, + "\u03a7": 722, + "\u2206": 612, + "\u0395": 611, + "\u03a6": 763, + "\u0393": 603, + "\u0397": 722, + "\u0399": 333, + "\u03d1": 631, + "\u039a": 722, + "\u039b": 686, + "\u039c": 889, + "\u039d": 722, + "\u039f": 722, + "\u03a0": 768, + "\u0398": 741, + "\u03a1": 556, + "\u03a3": 592, + "\u03a4": 611, + "\u03a5": 690, + "\u03c2": 439, + "\u2126": 768, + "\u039e": 645, + "\u03a8": 795, + "\u0396": 611, + "[": 333, + "\u2234": 863, + "]": 333, + "\u22a5": 658, + "_": 500, + "\uf8e5": 500, + "\u03b1": 631, + "\u03b2": 549, + "\u03c7": 549, + "\u03b4": 494, + "\u03b5": 439, + "\u03c6": 521, + "\u03b3": 411, + "\u03b7": 603, + "\u03b9": 329, + "\u03d5": 603, + "\u03ba": 549, + "\u03bb": 549, + "\xb5": 576, + "\u03bd": 521, + "\u03bf": 549, + "\u03c0": 549, + "\u03b8": 521, + "\u03c1": 549, + "\u03c3": 603, + "\u03c4": 439, + "\u03c5": 576, + "\u03d6": 713, + "\u03c9": 686, + "\u03be": 493, + "\u03c8": 686, + "\u03b6": 494, + "{": 480, + "|": 200, + "}": 480, + "\u223c": 549, + "\u20ac": 750, + "\u03d2": 620, + "\u2032": 247, + "\u2264": 549, + "\u2044": 167, + "\u221e": 713, + "\u0192": 500, + "\u2663": 753, + "\u2666": 753, + "\u2665": 753, + "\u2660": 753, + "\u2194": 1042, + "\u2190": 987, + "\u2191": 603, + "\u2192": 987, + "\u2193": 603, + "\xb0": 400, + "\xb1": 549, + "\u2033": 411, + "\u2265": 549, + "\xd7": 549, + "\u221d": 713, + "\u2202": 494, + "\u2022": 460, + "\xf7": 549, + "\u2260": 549, + "\u2261": 549, + "\u2248": 549, + "\u2026": 1000, + "\uf8e6": 603, + "\uf8e7": 1000, + "\u21b5": 658, + "\u2135": 823, + "\u2111": 686, + "\u211c": 795, + "\u2118": 987, + "\u2297": 768, + "\u2295": 768, + "\u2205": 823, + "\u2229": 768, + "\u222a": 768, + "\u2283": 713, + "\u2287": 713, + "\u2284": 713, + "\u2282": 713, + "\u2286": 713, + "\u2208": 713, + "\u2209": 713, + "\u2220": 768, + "\u2207": 713, + "\uf6da": 790, + "\uf6d9": 790, + "\uf6db": 890, + "\u220f": 823, + "\u221a": 549, + "\u22c5": 250, + "\xac": 713, + "\u2227": 603, + "\u2228": 603, + "\u21d4": 1042, + "\u21d0": 987, + "\u21d1": 603, + "\u21d2": 987, + "\u21d3": 603, + "\u25ca": 494, + "\u2329": 329, + "\uf8e8": 790, + "\uf8e9": 790, + "\uf8ea": 786, + "\u2211": 713, + "\uf8eb": 384, + "\uf8ec": 384, + "\uf8ed": 384, + "\uf8ee": 384, + "\uf8ef": 384, + "\uf8f0": 384, + "\uf8f1": 494, + "\uf8f2": 494, + "\uf8f3": 494, + "\uf8f4": 494, + "\u232a": 329, + "\u222b": 274, + "\u2320": 686, + "\uf8f5": 686, + "\u2321": 686, + "\uf8f6": 384, + "\uf8f7": 384, + "\uf8f8": 384, + "\uf8f9": 384, + "\uf8fa": 384, + "\uf8fb": 384, + "\uf8fc": 494, + "\uf8fd": 494, + "\uf8fe": 494, + "\uf8ff": 790, + }, + ), + # Generated from Times-Bold.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-Bold": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-Bold", + family="Times", + weight="Bold", + ascent=683, + descent=-217, + cap_height=676, + x_height=461, + italic_angle=0, + flags=34, + bbox=(-168.0, -218.0, 1000.0, 935.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + '"': 555, + "#": 500, + "$": 500, + "%": 1000, + "&": 833, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 570, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 333, + ";": 333, + "<": 570, + "=": 570, + ">": 570, + "?": 500, + "@": 930, + "A": 722, + "B": 667, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 778, + "I": 389, + "J": 500, + "K": 778, + "L": 667, + "M": 944, + "N": 722, + "O": 778, + "P": 611, + "Q": 778, + "R": 722, + "S": 556, + "T": 667, + "U": 722, + "V": 722, + "W": 1000, + "X": 722, + "Y": 722, + "Z": 667, + "[": 333, + "\\": 278, + "]": 333, + "^": 581, + "_": 500, + "\u2018": 333, + "a": 500, + "b": 556, + "c": 444, + "d": 556, + "e": 444, + "f": 333, + "g": 500, + "h": 556, + "i": 278, + "j": 333, + "k": 556, + "l": 278, + "m": 833, + "n": 556, + "o": 500, + "p": 556, + "q": 556, + "r": 444, + "s": 389, + "t": 333, + "u": 556, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 444, + "{": 394, + "|": 220, + "}": 394, + "~": 520, + "\xa1": 333, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 278, + "\u201c": 500, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 556, + "\ufb02": 556, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 540, + "\u2022": 350, + "\u201a": 333, + "\u201e": 500, + "\u201d": 500, + "\xbb": 500, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 500, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 300, + "\u0141": 667, + "\xd8": 778, + "\u0152": 1000, + "\xba": 330, + "\xe6": 722, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 722, + "\xdf": 556, + "\xcf": 389, + "\xe9": 444, + "\u0103": 500, + "\u0171": 556, + "\u011b": 444, + "\u0178": 722, + "\xf7": 570, + "\xdd": 722, + "\xc2": 722, + "\xe1": 500, + "\xdb": 722, + "\xfd": 500, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 500, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 747, + "\u0112": 667, + "\u010d": 444, + "\xe5": 500, + "\u0145": 722, + "\u013a": 278, + "\xe0": 500, + "\u0162": 667, + "\u0106": 722, + "\xe3": 500, + "\u0116": 667, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 494, + "\u0158": 722, + "\u0122": 778, + "\xfb": 556, + "\xe2": 500, + "\u0100": 722, + "\u0159": 444, + "\xe7": 444, + "\u017b": 667, + "\xde": 611, + "\u014c": 778, + "\u0154": 722, + "\u015a": 556, + "\u010f": 672, + "\u016a": 722, + "\u016f": 556, + "\xb3": 300, + "\xd2": 778, + "\xc0": 722, + "\u0102": 722, + "\xd7": 570, + "\xfa": 556, + "\u0164": 667, + "\u2202": 494, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 500, + "\xeb": 444, + "\u0107": 444, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 389, + "\xb1": 570, + "\xa6": 220, + "\xae": 747, + "\u011e": 778, + "\u0130": 389, + "\u2211": 600, + "\xc8": 667, + "\u0155": 444, + "\u014d": 500, + "\u0179": 667, + "\u017d": 667, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 278, + "\u0165": 416, + "\u0119": 444, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 444, + "\u017a": 444, + "\u012f": 278, + "\xd3": 778, + "\xf3": 500, + "\u0101": 500, + "\u015b": 389, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 556, + "\xb2": 300, + "\xd6": 778, + "\xb5": 556, + "\xec": 278, + "\u0151": 500, + "\u0118": 667, + "\u0111": 556, + "\xbe": 750, + "\u015e": 556, + "\u013e": 394, + "\u0136": 778, + "\u0139": 667, + "\u2122": 1000, + "\u0117": 444, + "\xcc": 389, + "\u012a": 389, + "\u013d": 667, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 556, + "\u0218": 556, + "\u0150": 778, + "\xb0": 400, + "\xf2": 500, + "\u010c": 722, + "\xf9": 556, + "\u221a": 549, + "\u010e": 722, + "\u0157": 444, + "\xd1": 722, + "\xf5": 500, + "\u0156": 722, + "\u013b": 667, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 778, + "\u017c": 444, + "\u011a": 667, + "\u012e": 389, + "\u0137": 556, + "\u2212": 570, + "\xce": 389, + "\u0148": 556, + "\u0163": 333, + "\xac": 570, + "\xf6": 500, + "\xfc": 556, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 444, + "\u0146": 556, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from Times-BoldItalic.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-BoldItalic": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-BoldItalic", + family="Times", + weight="Bold", + ascent=683, + descent=-217, + cap_height=669, + x_height=462, + italic_angle=-15, + flags=98, + bbox=(-200.0, -218.0, 996.0, 921.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 389, + '"': 555, + "#": 500, + "$": 500, + "%": 833, + "&": 778, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 570, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 333, + ";": 333, + "<": 570, + "=": 570, + ">": 570, + "?": 500, + "@": 832, + "A": 667, + "B": 667, + "C": 667, + "D": 722, + "E": 667, + "F": 667, + "G": 722, + "H": 778, + "I": 389, + "J": 500, + "K": 667, + "L": 611, + "M": 889, + "N": 722, + "O": 722, + "P": 611, + "Q": 722, + "R": 667, + "S": 556, + "T": 611, + "U": 722, + "V": 667, + "W": 889, + "X": 667, + "Y": 611, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 570, + "_": 500, + "\u2018": 333, + "a": 500, + "b": 500, + "c": 444, + "d": 500, + "e": 444, + "f": 333, + "g": 500, + "h": 556, + "i": 278, + "j": 278, + "k": 500, + "l": 278, + "m": 778, + "n": 556, + "o": 500, + "p": 500, + "q": 500, + "r": 389, + "s": 389, + "t": 278, + "u": 556, + "v": 444, + "w": 667, + "x": 500, + "y": 444, + "z": 389, + "{": 348, + "|": 220, + "}": 348, + "~": 570, + "\xa1": 389, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 278, + "\u201c": 500, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 556, + "\ufb02": 556, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 500, + "\u2022": 350, + "\u201a": 333, + "\u201e": 500, + "\u201d": 500, + "\xbb": 500, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 500, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 944, + "\xaa": 266, + "\u0141": 611, + "\xd8": 722, + "\u0152": 944, + "\xba": 300, + "\xe6": 722, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 722, + "\xdf": 500, + "\xcf": 389, + "\xe9": 444, + "\u0103": 500, + "\u0171": 556, + "\u011b": 444, + "\u0178": 611, + "\xf7": 570, + "\xdd": 611, + "\xc2": 667, + "\xe1": 500, + "\xdb": 722, + "\xfd": 444, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 500, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 747, + "\u0112": 667, + "\u010d": 444, + "\xe5": 500, + "\u0145": 722, + "\u013a": 278, + "\xe0": 500, + "\u0162": 611, + "\u0106": 667, + "\xe3": 500, + "\u0116": 667, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 494, + "\u0158": 667, + "\u0122": 722, + "\xfb": 556, + "\xe2": 500, + "\u0100": 667, + "\u0159": 389, + "\xe7": 444, + "\u017b": 611, + "\xde": 611, + "\u014c": 722, + "\u0154": 667, + "\u015a": 556, + "\u010f": 608, + "\u016a": 722, + "\u016f": 556, + "\xb3": 300, + "\xd2": 722, + "\xc0": 667, + "\u0102": 667, + "\xd7": 570, + "\xfa": 556, + "\u0164": 611, + "\u2202": 494, + "\xff": 444, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 500, + "\xeb": 444, + "\u0107": 444, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 389, + "\xb1": 570, + "\xa6": 220, + "\xae": 747, + "\u011e": 722, + "\u0130": 389, + "\u2211": 600, + "\xc8": 667, + "\u0155": 389, + "\u014d": 500, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 667, + "\u013c": 278, + "\u0165": 366, + "\u0119": 444, + "\u0172": 722, + "\xc1": 667, + "\xc4": 667, + "\xe8": 444, + "\u017a": 389, + "\u012f": 278, + "\xd3": 722, + "\xf3": 500, + "\u0101": 500, + "\u015b": 389, + "\xef": 278, + "\xd4": 722, + "\xd9": 722, + "\u2206": 612, + "\xfe": 500, + "\xb2": 300, + "\xd6": 722, + "\xb5": 576, + "\xec": 278, + "\u0151": 500, + "\u0118": 667, + "\u0111": 500, + "\xbe": 750, + "\u015e": 556, + "\u013e": 382, + "\u0136": 667, + "\u0139": 611, + "\u2122": 1000, + "\u0117": 444, + "\xcc": 389, + "\u012a": 389, + "\u013d": 611, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 556, + "\u0218": 556, + "\u0150": 722, + "\xb0": 400, + "\xf2": 500, + "\u010c": 667, + "\xf9": 556, + "\u221a": 549, + "\u010e": 722, + "\u0157": 389, + "\xd1": 722, + "\xf5": 500, + "\u0156": 667, + "\u013b": 611, + "\xc3": 667, + "\u0104": 667, + "\xc5": 667, + "\xd5": 722, + "\u017c": 389, + "\u011a": 667, + "\u012e": 389, + "\u0137": 500, + "\u2212": 606, + "\xce": 389, + "\u0148": 556, + "\u0163": 278, + "\xac": 606, + "\xf6": 500, + "\xfc": 556, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 389, + "\u0146": 556, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from Times-Italic.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-Italic": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-Italic", + family="Times", + weight="Medium", + ascent=683, + descent=-217, + cap_height=653, + x_height=441, + italic_angle=-15.5, + flags=98, + bbox=(-169.0, -217.0, 1010.0, 883.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + '"': 420, + "#": 500, + "$": 500, + "%": 833, + "&": 778, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 675, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 333, + ";": 333, + "<": 675, + "=": 675, + ">": 675, + "?": 500, + "@": 920, + "A": 611, + "B": 611, + "C": 667, + "D": 722, + "E": 611, + "F": 611, + "G": 722, + "H": 722, + "I": 333, + "J": 444, + "K": 667, + "L": 556, + "M": 833, + "N": 667, + "O": 722, + "P": 611, + "Q": 722, + "R": 611, + "S": 500, + "T": 556, + "U": 722, + "V": 611, + "W": 833, + "X": 611, + "Y": 556, + "Z": 556, + "[": 389, + "\\": 278, + "]": 389, + "^": 422, + "_": 500, + "\u2018": 333, + "a": 500, + "b": 500, + "c": 444, + "d": 500, + "e": 444, + "f": 278, + "g": 500, + "h": 500, + "i": 278, + "j": 278, + "k": 444, + "l": 278, + "m": 722, + "n": 500, + "o": 500, + "p": 500, + "q": 500, + "r": 389, + "s": 389, + "t": 278, + "u": 500, + "v": 444, + "w": 667, + "x": 444, + "y": 444, + "z": 389, + "{": 400, + "|": 275, + "}": 400, + "~": 541, + "\xa1": 389, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 214, + "\u201c": 556, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 500, + "\ufb02": 500, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 523, + "\u2022": 350, + "\u201a": 333, + "\u201e": 556, + "\u201d": 556, + "\xbb": 500, + "\u2026": 889, + "\u2030": 1000, + "\xbf": 500, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 889, + "\xc6": 889, + "\xaa": 276, + "\u0141": 556, + "\xd8": 722, + "\u0152": 944, + "\xba": 310, + "\xe6": 667, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 667, + "\xdf": 500, + "\xcf": 333, + "\xe9": 444, + "\u0103": 500, + "\u0171": 500, + "\u011b": 444, + "\u0178": 556, + "\xf7": 675, + "\xdd": 556, + "\xc2": 611, + "\xe1": 500, + "\xdb": 722, + "\xfd": 444, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 500, + "\xda": 722, + "\u0173": 500, + "\xcb": 611, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 760, + "\u0112": 611, + "\u010d": 444, + "\xe5": 500, + "\u0145": 667, + "\u013a": 278, + "\xe0": 500, + "\u0162": 556, + "\u0106": 667, + "\xe3": 500, + "\u0116": 611, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 471, + "\u0158": 611, + "\u0122": 722, + "\xfb": 500, + "\xe2": 500, + "\u0100": 611, + "\u0159": 389, + "\xe7": 444, + "\u017b": 556, + "\xde": 611, + "\u014c": 722, + "\u0154": 611, + "\u015a": 500, + "\u010f": 544, + "\u016a": 722, + "\u016f": 500, + "\xb3": 300, + "\xd2": 722, + "\xc0": 611, + "\u0102": 611, + "\xd7": 675, + "\xfa": 500, + "\u0164": 556, + "\u2202": 476, + "\xff": 444, + "\u0143": 667, + "\xee": 278, + "\xca": 611, + "\xe4": 500, + "\xeb": 444, + "\u0107": 444, + "\u0144": 500, + "\u016b": 500, + "\u0147": 667, + "\xcd": 333, + "\xb1": 675, + "\xa6": 275, + "\xae": 760, + "\u011e": 722, + "\u0130": 333, + "\u2211": 600, + "\xc8": 611, + "\u0155": 389, + "\u014d": 500, + "\u0179": 556, + "\u017d": 556, + "\u2265": 549, + "\xd0": 722, + "\xc7": 667, + "\u013c": 278, + "\u0165": 300, + "\u0119": 444, + "\u0172": 722, + "\xc1": 611, + "\xc4": 611, + "\xe8": 444, + "\u017a": 389, + "\u012f": 278, + "\xd3": 722, + "\xf3": 500, + "\u0101": 500, + "\u015b": 389, + "\xef": 278, + "\xd4": 722, + "\xd9": 722, + "\u2206": 612, + "\xfe": 500, + "\xb2": 300, + "\xd6": 722, + "\xb5": 500, + "\xec": 278, + "\u0151": 500, + "\u0118": 611, + "\u0111": 500, + "\xbe": 750, + "\u015e": 500, + "\u013e": 300, + "\u0136": 667, + "\u0139": 556, + "\u2122": 980, + "\u0117": 444, + "\xcc": 333, + "\u012a": 333, + "\u013d": 611, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 500, + "\u0170": 722, + "\xc9": 611, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 500, + "\u0218": 500, + "\u0150": 722, + "\xb0": 400, + "\xf2": 500, + "\u010c": 667, + "\xf9": 500, + "\u221a": 453, + "\u010e": 722, + "\u0157": 389, + "\xd1": 667, + "\xf5": 500, + "\u0156": 611, + "\u013b": 556, + "\xc3": 611, + "\u0104": 611, + "\xc5": 611, + "\xd5": 722, + "\u017c": 389, + "\u011a": 611, + "\u012e": 333, + "\u0137": 444, + "\u2212": 675, + "\xce": 333, + "\u0148": 500, + "\u0163": 278, + "\xac": 675, + "\xf6": 500, + "\xfc": 500, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 389, + "\u0146": 500, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from Times-Roman.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-Roman": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-Roman", + family="Times", + weight="Roman", + ascent=683, + descent=-217, + cap_height=662, + x_height=450, + italic_angle=0, + flags=34, + bbox=(-168.0, -218.0, 1000.0, 898.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + '"': 408, + "#": 500, + "$": 500, + "%": 833, + "&": 778, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 564, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 278, + ";": 278, + "<": 564, + "=": 564, + ">": 564, + "?": 444, + "@": 921, + "A": 722, + "B": 667, + "C": 667, + "D": 722, + "E": 611, + "F": 556, + "G": 722, + "H": 722, + "I": 333, + "J": 389, + "K": 722, + "L": 611, + "M": 889, + "N": 722, + "O": 722, + "P": 556, + "Q": 722, + "R": 667, + "S": 556, + "T": 611, + "U": 722, + "V": 722, + "W": 944, + "X": 722, + "Y": 722, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 469, + "_": 500, + "\u2018": 333, + "a": 444, + "b": 500, + "c": 444, + "d": 500, + "e": 444, + "f": 333, + "g": 500, + "h": 500, + "i": 278, + "j": 278, + "k": 500, + "l": 278, + "m": 778, + "n": 500, + "o": 500, + "p": 500, + "q": 500, + "r": 333, + "s": 389, + "t": 278, + "u": 500, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 444, + "{": 480, + "|": 200, + "}": 480, + "~": 541, + "\xa1": 333, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 180, + "\u201c": 444, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 556, + "\ufb02": 556, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 453, + "\u2022": 350, + "\u201a": 333, + "\u201e": 444, + "\u201d": 444, + "\xbb": 500, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 444, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 889, + "\xaa": 276, + "\u0141": 611, + "\xd8": 722, + "\u0152": 889, + "\xba": 310, + "\xe6": 667, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 722, + "\xdf": 500, + "\xcf": 333, + "\xe9": 444, + "\u0103": 444, + "\u0171": 500, + "\u011b": 444, + "\u0178": 722, + "\xf7": 564, + "\xdd": 722, + "\xc2": 722, + "\xe1": 444, + "\xdb": 722, + "\xfd": 500, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 444, + "\xda": 722, + "\u0173": 500, + "\xcb": 611, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 760, + "\u0112": 611, + "\u010d": 444, + "\xe5": 444, + "\u0145": 722, + "\u013a": 278, + "\xe0": 444, + "\u0162": 611, + "\u0106": 667, + "\xe3": 444, + "\u0116": 611, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 471, + "\u0158": 667, + "\u0122": 722, + "\xfb": 500, + "\xe2": 444, + "\u0100": 722, + "\u0159": 333, + "\xe7": 444, + "\u017b": 611, + "\xde": 556, + "\u014c": 722, + "\u0154": 667, + "\u015a": 556, + "\u010f": 588, + "\u016a": 722, + "\u016f": 500, + "\xb3": 300, + "\xd2": 722, + "\xc0": 722, + "\u0102": 722, + "\xd7": 564, + "\xfa": 500, + "\u0164": 611, + "\u2202": 476, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 611, + "\xe4": 444, + "\xeb": 444, + "\u0107": 444, + "\u0144": 500, + "\u016b": 500, + "\u0147": 722, + "\xcd": 333, + "\xb1": 564, + "\xa6": 200, + "\xae": 760, + "\u011e": 722, + "\u0130": 333, + "\u2211": 600, + "\xc8": 611, + "\u0155": 333, + "\u014d": 500, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 667, + "\u013c": 278, + "\u0165": 326, + "\u0119": 444, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 444, + "\u017a": 444, + "\u012f": 278, + "\xd3": 722, + "\xf3": 500, + "\u0101": 444, + "\u015b": 389, + "\xef": 278, + "\xd4": 722, + "\xd9": 722, + "\u2206": 612, + "\xfe": 500, + "\xb2": 300, + "\xd6": 722, + "\xb5": 500, + "\xec": 278, + "\u0151": 500, + "\u0118": 611, + "\u0111": 500, + "\xbe": 750, + "\u015e": 556, + "\u013e": 344, + "\u0136": 722, + "\u0139": 611, + "\u2122": 980, + "\u0117": 444, + "\xcc": 333, + "\u012a": 333, + "\u013d": 611, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 500, + "\u0170": 722, + "\xc9": 611, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 556, + "\u0218": 556, + "\u0150": 722, + "\xb0": 400, + "\xf2": 500, + "\u010c": 667, + "\xf9": 500, + "\u221a": 453, + "\u010e": 722, + "\u0157": 333, + "\xd1": 722, + "\xf5": 500, + "\u0156": 667, + "\u013b": 611, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 722, + "\u017c": 444, + "\u011a": 611, + "\u012e": 333, + "\u0137": 500, + "\u2212": 564, + "\xce": 333, + "\u0148": 500, + "\u0163": 278, + "\xac": 564, + "\xf6": 500, + "\xfc": 500, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 444, + "\u0146": 500, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from ZapfDingbats.afm + # Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems Incorporated. All Rights Reserved. + # ITC Zapf Dingbats is a registered trademark of International Typeface Corporation. + "ZapfDingbats": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="ZapfDingbats", + family="ZapfDingbats", + weight="Medium", + ascent=0.0, + descent=0.0, + cap_height=0.0, + x_height=0.0, + italic_angle=0, + flags=4, + bbox=(-1.0, -143.0, 981.0, 820.0), + ), + character_widths={ + " ": 790, + "default": 1580, + "\x01": 974, + "\x02": 961, + "\xca": 974, + "\x03": 980, + "\x04": 719, + "\x05": 789, + "w": 790, + "v": 791, + "u": 690, + "\x0b": 960, + "\x0c": 939, + "\r": 549, + "\x0e": 855, + "\x0f": 911, + "\x10": 933, + "i": 911, + "\x11": 945, + "\x12": 974, + "\x13": 755, + "\x14": 846, + "\x15": 762, + "\x16": 761, + "\x17": 571, + "\x18": 677, + "\x19": 763, + "\x1a": 760, + "\x1b": 759, + "\x1c": 754, + "\x06": 494, + "\x07": 552, + "\x08": 537, + "\t": 577, + "\n": 692, + "\x1d": 786, + "\x1e": 788, + "\x1f": 788, + "!": 793, + '"': 794, + "#": 816, + "$": 823, + "%": 789, + "&": 841, + "'": 823, + "(": 833, + ")": 816, + "*": 831, + "+": 923, + ",": 744, + "-": 723, + ".": 749, + "/": 790, + "0": 792, + "1": 695, + "2": 776, + "3": 768, + "4": 792, + "5": 759, + "6": 707, + "7": 708, + "8": 682, + "9": 701, + ":": 826, + ";": 815, + "<": 789, + "=": 789, + ">": 707, + "?": 687, + "@": 696, + "A": 689, + "B": 786, + "C": 787, + "D": 713, + "E": 791, + "F": 785, + "G": 791, + "H": 873, + "I": 761, + "J": 762, + "\xcb": 762, + "K": 759, + "\xcc": 759, + "L": 892, + "M": 892, + "N": 788, + "O": 784, + "Q": 438, + "R": 138, + "S": 277, + "T": 415, + "a": 392, + "b": 392, + "c": 668, + "d": 668, + "Y": 390, + "Z": 390, + "]": 317, + "^": 317, + "[": 276, + "\\": 276, + "\xcd": 509, + "U": 509, + "\xce": 410, + "V": 410, + "W": 234, + "X": 234, + "_": 334, + "`": 334, + "e": 732, + "f": 544, + "g": 544, + "h": 910, + "j": 667, + "k": 760, + "l": 760, + "p": 776, + "o": 595, + "n": 694, + "m": 626, + "x": 788, + "y": 788, + "z": 788, + "{": 788, + "|": 788, + "}": 788, + "~": 788, + "\x7f": 788, + "\x80": 788, + "\x81": 788, + "\x82": 788, + "\x83": 788, + "\x84": 788, + "\x85": 788, + "\x86": 788, + "\x87": 788, + "\x88": 788, + "\x89": 788, + "\x8a": 788, + "\x8b": 788, + "\x8c": 788, + "\x8d": 788, + "\x8e": 788, + "\x8f": 788, + "\x90": 788, + "\x91": 788, + "\x92": 788, + "\x93": 788, + "\x94": 788, + "\x95": 788, + "\x96": 788, + "\x97": 788, + "\x98": 788, + "\x99": 788, + "\x9a": 788, + "\x9b": 788, + "\x9c": 788, + "\x9d": 788, + "\x9e": 788, + "\x9f": 788, + "\xa0": 894, + "\xa1": 838, + "\xa3": 1016, + "\xa4": 458, + "\xc4": 748, + "\xa5": 924, + "\xc0": 748, + "\xa6": 918, + "\xa7": 927, + "\xa8": 928, + "\xa9": 928, + "\xaa": 834, + "\xab": 873, + "\xac": 828, + "\xad": 924, + "\xa2": 924, + "\xae": 917, + "\xaf": 930, + "\xb0": 931, + "\xb1": 463, + "\xb2": 883, + "\xb3": 836, + "\xc1": 836, + "\xb4": 867, + "\xc7": 867, + "\xb5": 696, + "\xc8": 696, + "\xb6": 874, + "\xc9": 874, + "\xb7": 760, + "\xb8": 946, + "\xc5": 771, + "\xb9": 865, + "\xc2": 771, + "\xc6": 888, + "\xba": 967, + "\xc3": 888, + "\xbb": 831, + "\xbc": 873, + "\xbd": 927, + "\xbe": 970, + "\xbf": 918, + }, + ), +} + + +# Add aliases per table H.3 on pp. 1109-1110 of the PDF 1.7 reference +CORE_FONT_METRICS["Arial"] = CORE_FONT_METRICS["Helvetica"] +CORE_FONT_METRICS["Arial,Italic"] = CORE_FONT_METRICS["Helvetica-Oblique"] +CORE_FONT_METRICS["Arial,Bold"] = CORE_FONT_METRICS["Helvetica-Bold"] +CORE_FONT_METRICS["Arial,BoldItalic"] = CORE_FONT_METRICS["Helvetica-BoldOblique"] +CORE_FONT_METRICS["CourierNew"] = CORE_FONT_METRICS["Courier"] +CORE_FONT_METRICS["CourierNew,Italic"] = CORE_FONT_METRICS["Courier-Oblique"] +CORE_FONT_METRICS["CourierNew,Bold"] = CORE_FONT_METRICS["Courier-Bold"] +CORE_FONT_METRICS["CourierNew,BoldItalic"] = CORE_FONT_METRICS["Courier-BoldOblique"] +CORE_FONT_METRICS["TimesNewRoman"] = CORE_FONT_METRICS["Times-Roman"] +CORE_FONT_METRICS["TimesNewRoman,Italic"] = CORE_FONT_METRICS["Times-Italic"] +CORE_FONT_METRICS["TimesNewRoman,Bold"] = CORE_FONT_METRICS["Times-Bold"] +CORE_FONT_METRICS["TimesNewRoman,BoldItalic"] = CORE_FONT_METRICS["Times-BoldItalic"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/pdfdoc.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/pdfdoc.py new file mode 100644 index 0000000000000000000000000000000000000000..306357a59c4d9a0fd846bb52e5b6774d82c6ae51 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/pdfdoc.py @@ -0,0 +1,264 @@ +# PDFDocEncoding Character Set: Table D.2 of PDF Reference 1.7 +# C.1 Predefined encodings sorted by character name of another PDF reference +# Some indices have '\u0000' although they should have something else: +# 22: should be '\u0017' +_pdfdoc_encoding = [ + "\u0000", + "\u0001", + "\u0002", + "\u0003", + "\u0004", + "\u0005", + "\u0006", + "\u0007", # 0 - 7 + "\u0008", + "\u0009", + "\u000a", + "\u000b", + "\u000c", + "\u000d", + "\u000e", + "\u000f", # 8 - 15 + "\u0010", + "\u0011", + "\u0012", + "\u0013", + "\u0014", + "\u0015", + "\u0000", + "\u0017", # 16 - 23 + "\u02d8", + "\u02c7", + "\u02c6", + "\u02d9", + "\u02dd", + "\u02db", + "\u02da", + "\u02dc", # 24 - 31 + "\u0020", + "\u0021", + "\u0022", + "\u0023", + "\u0024", + "\u0025", + "\u0026", + "\u0027", # 32 - 39 + "\u0028", + "\u0029", + "\u002a", + "\u002b", + "\u002c", + "\u002d", + "\u002e", + "\u002f", # 40 - 47 + "\u0030", + "\u0031", + "\u0032", + "\u0033", + "\u0034", + "\u0035", + "\u0036", + "\u0037", # 48 - 55 + "\u0038", + "\u0039", + "\u003a", + "\u003b", + "\u003c", + "\u003d", + "\u003e", + "\u003f", # 56 - 63 + "\u0040", + "\u0041", + "\u0042", + "\u0043", + "\u0044", + "\u0045", + "\u0046", + "\u0047", # 64 - 71 + "\u0048", + "\u0049", + "\u004a", + "\u004b", + "\u004c", + "\u004d", + "\u004e", + "\u004f", # 72 - 79 + "\u0050", + "\u0051", + "\u0052", + "\u0053", + "\u0054", + "\u0055", + "\u0056", + "\u0057", # 80 - 87 + "\u0058", + "\u0059", + "\u005a", + "\u005b", + "\u005c", + "\u005d", + "\u005e", + "\u005f", # 88 - 95 + "\u0060", + "\u0061", + "\u0062", + "\u0063", + "\u0064", + "\u0065", + "\u0066", + "\u0067", # 96 - 103 + "\u0068", + "\u0069", + "\u006a", + "\u006b", + "\u006c", + "\u006d", + "\u006e", + "\u006f", # 104 - 111 + "\u0070", + "\u0071", + "\u0072", + "\u0073", + "\u0074", + "\u0075", + "\u0076", + "\u0077", # 112 - 119 + "\u0078", + "\u0079", + "\u007a", + "\u007b", + "\u007c", + "\u007d", + "\u007e", + "\u0000", # 120 - 127 + "\u2022", + "\u2020", + "\u2021", + "\u2026", + "\u2014", + "\u2013", + "\u0192", + "\u2044", # 128 - 135 + "\u2039", + "\u203a", + "\u2212", + "\u2030", + "\u201e", + "\u201c", + "\u201d", + "\u2018", # 136 - 143 + "\u2019", + "\u201a", + "\u2122", + "\ufb01", + "\ufb02", + "\u0141", + "\u0152", + "\u0160", # 144 - 151 + "\u0178", + "\u017d", + "\u0131", + "\u0142", + "\u0153", + "\u0161", + "\u017e", + "\u0000", # 152 - 159 + "\u20ac", + "\u00a1", + "\u00a2", + "\u00a3", + "\u00a4", + "\u00a5", + "\u00a6", + "\u00a7", # 160 - 167 + "\u00a8", + "\u00a9", + "\u00aa", + "\u00ab", + "\u00ac", + "\u0000", + "\u00ae", + "\u00af", # 168 - 175 + "\u00b0", + "\u00b1", + "\u00b2", + "\u00b3", + "\u00b4", + "\u00b5", + "\u00b6", + "\u00b7", # 176 - 183 + "\u00b8", + "\u00b9", + "\u00ba", + "\u00bb", + "\u00bc", + "\u00bd", + "\u00be", + "\u00bf", # 184 - 191 + "\u00c0", + "\u00c1", + "\u00c2", + "\u00c3", + "\u00c4", + "\u00c5", + "\u00c6", + "\u00c7", # 192 - 199 + "\u00c8", + "\u00c9", + "\u00ca", + "\u00cb", + "\u00cc", + "\u00cd", + "\u00ce", + "\u00cf", # 200 - 207 + "\u00d0", + "\u00d1", + "\u00d2", + "\u00d3", + "\u00d4", + "\u00d5", + "\u00d6", + "\u00d7", # 208 - 215 + "\u00d8", + "\u00d9", + "\u00da", + "\u00db", + "\u00dc", + "\u00dd", + "\u00de", + "\u00df", # 216 - 223 + "\u00e0", + "\u00e1", + "\u00e2", + "\u00e3", + "\u00e4", + "\u00e5", + "\u00e6", + "\u00e7", # 224 - 231 + "\u00e8", + "\u00e9", + "\u00ea", + "\u00eb", + "\u00ec", + "\u00ed", + "\u00ee", + "\u00ef", # 232 - 239 + "\u00f0", + "\u00f1", + "\u00f2", + "\u00f3", + "\u00f4", + "\u00f5", + "\u00f6", + "\u00f7", # 240 - 247 + "\u00f8", + "\u00f9", + "\u00fa", + "\u00fb", + "\u00fc", + "\u00fd", + "\u00fe", + "\u00ff", # 248 - 255 +] + +assert len(_pdfdoc_encoding) == 256 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/std.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/std.py new file mode 100644 index 0000000000000000000000000000000000000000..a6057ff3c7a90e9c31389d2bab1bd0f6058ad724 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/std.py @@ -0,0 +1,258 @@ +_std_encoding = [ + "\x00", + "\x01", + "\x02", + "\x03", + "\x04", + "\x05", + "\x06", + "\x07", + "\x08", + "\t", + "\n", + "\x0b", + "\x0c", + "\r", + "\x0e", + "\x0f", + "\x10", + "\x11", + "\x12", + "\x13", + "\x14", + "\x15", + "\x16", + "\x17", + "\x18", + "\x19", + "\x1a", + "\x1b", + "\x1c", + "\x1d", + "\x1e", + "\x1f", + " ", + "!", + '"', + "#", + "$", + "%", + "&", + "’", + "(", + ")", + "*", + "+", + ",", + "-", + ".", + "/", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + ":", + ";", + "<", + "=", + ">", + "?", + "@", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "[", + "\\", + "]", + "^", + "_", + "‘", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "{", + "|", + "}", + "~", + "\x7f", + "\x80", + "\x81", + "\x82", + "\x83", + "\x84", + "\x85", + "\x86", + "\x87", + "\x88", + "\x89", + "\x8a", + "\x8b", + "\x8c", + "\x8d", + "\x8e", + "\x8f", + "\x90", + "\x91", + "\x92", + "\x93", + "\x94", + "\x95", + "\x96", + "\x97", + "\x98", + "\x99", + "\x9a", + "\x9b", + "\x9c", + "\x9d", + "\x9e", + "\x9f", + "\xa0", + "¡", + "¢", + "£", + "⁄", + "¥", + "ƒ", + "§", + "¤", + "'", + "“", + "«", + "‹", + "›", + "fi", + "fl", + "°", + "–", + "†", + "‡", + "·", + "µ", + "¶", + "•", + "‚", + "„", + "”", + "»", + "…", + "‰", + "¾", + "¿", + "À", + "`", + "´", + "ˆ", + "˜", + "¯", + "˘", + "˙", + "¨", + "É", + "˚", + "¸", + "Ì", + "˝", + "˛", + "ˇ", + "—", + "Ñ", + "Ò", + "Ó", + "Ô", + "Õ", + "Ö", + "×", + "Ø", + "Ù", + "Ú", + "Û", + "Ü", + "Ý", + "Þ", + "ß", + "à", + "Æ", + "â", + "ª", + "ä", + "å", + "æ", + "ç", + "Ł", + "Ø", + "Œ", + "º", + "ì", + "í", + "î", + "ï", + "ð", + "æ", + "ò", + "ó", + "ô", + "ı", + "ö", + "÷", + "ł", + "ø", + "œ", + "ß", + "ü", + "ý", + "þ", + "ÿ", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/symbol.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/symbol.py new file mode 100644 index 0000000000000000000000000000000000000000..4c0d680ff242a475d3f48916ad6b7998b30ff76a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/symbol.py @@ -0,0 +1,260 @@ +# manually generated from https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt +_symbol_encoding = [ + "\u0000", + "\u0001", + "\u0002", + "\u0003", + "\u0004", + "\u0005", + "\u0006", + "\u0007", + "\u0008", + "\u0009", + "\u000A", + "\u000B", + "\u000C", + "\u000D", + "\u000E", + "\u000F", + "\u0010", + "\u0011", + "\u0012", + "\u0013", + "\u0014", + "\u0015", + "\u0016", + "\u0017", + "\u0018", + "\u0019", + "\u001A", + "\u001B", + "\u001C", + "\u001D", + "\u001E", + "\u001F", + "\u0020", + "\u0021", + "\u2200", + "\u0023", + "\u2203", + "\u0025", + "\u0026", + "\u220B", + "\u0028", + "\u0029", + "\u2217", + "\u002B", + "\u002C", + "\u2212", + "\u002E", + "\u002F", + "\u0030", + "\u0031", + "\u0032", + "\u0033", + "\u0034", + "\u0035", + "\u0036", + "\u0037", + "\u0038", + "\u0039", + "\u003A", + "\u003B", + "\u003C", + "\u003D", + "\u003E", + "\u003F", + "\u2245", + "\u0391", + "\u0392", + "\u03A7", + "\u0394", + "\u0395", + "\u03A6", + "\u0393", + "\u0397", + "\u0399", + "\u03D1", + "\u039A", + "\u039B", + "\u039C", + "\u039D", + "\u039F", + "\u03A0", + "\u0398", + "\u03A1", + "\u03A3", + "\u03A4", + "\u03A5", + "\u03C2", + "\u03A9", + "\u039E", + "\u03A8", + "\u0396", + "\u005B", + "\u2234", + "\u005D", + "\u22A5", + "\u005F", + "\uF8E5", + "\u03B1", + "\u03B2", + "\u03C7", + "\u03B4", + "\u03B5", + "\u03C6", + "\u03B3", + "\u03B7", + "\u03B9", + "\u03D5", + "\u03BA", + "\u03BB", + "\u00B5", + "\u03BD", + "\u03BF", + "\u03C0", + "\u03B8", + "\u03C1", + "\u03C3", + "\u03C4", + "\u03C5", + "\u03D6", + "\u03C9", + "\u03BE", + "\u03C8", + "\u03B6", + "\u007B", + "\u007C", + "\u007D", + "\u223C", + "\u007F", + "\u0080", + "\u0081", + "\u0082", + "\u0083", + "\u0084", + "\u0085", + "\u0086", + "\u0087", + "\u0088", + "\u0089", + "\u008A", + "\u008B", + "\u008C", + "\u008D", + "\u008E", + "\u008F", + "\u0090", + "\u0091", + "\u0092", + "\u0093", + "\u0094", + "\u0095", + "\u0096", + "\u0097", + "\u0098", + "\u0099", + "\u009A", + "\u009B", + "\u009C", + "\u009D", + "\u009E", + "\u009F", + "\u20AC", + "\u03D2", + "\u2032", + "\u2264", + "\u2044", + "\u221E", + "\u0192", + "\u2663", + "\u2666", + "\u2665", + "\u2660", + "\u2194", + "\u2190", + "\u2191", + "\u2192", + "\u2193", + "\u00B0", + "\u00B1", + "\u2033", + "\u2265", + "\u00D7", + "\u221D", + "\u2202", + "\u2022", + "\u00F7", + "\u2260", + "\u2261", + "\u2248", + "\u2026", + "\uF8E6", + "\uF8E7", + "\u21B5", + "\u2135", + "\u2111", + "\u211C", + "\u2118", + "\u2297", + "\u2295", + "\u2205", + "\u2229", + "\u222A", + "\u2283", + "\u2287", + "\u2284", + "\u2282", + "\u2286", + "\u2208", + "\u2209", + "\u2220", + "\u2207", + "\uF6DA", + "\uF6D9", + "\uF6DB", + "\u220F", + "\u221A", + "\u22C5", + "\u00AC", + "\u2227", + "\u2228", + "\u21D4", + "\u21D0", + "\u21D1", + "\u21D2", + "\u21D3", + "\u25CA", + "\u2329", + "\uF8E8", + "\uF8E9", + "\uF8EA", + "\u2211", + "\uF8EB", + "\uF8EC", + "\uF8ED", + "\uF8EE", + "\uF8EF", + "\uF8F0", + "\uF8F1", + "\uF8F2", + "\uF8F3", + "\uF8F4", + "\u00F0", + "\u232A", + "\u222B", + "\u2320", + "\uF8F5", + "\u2321", + "\uF8F6", + "\uF8F7", + "\uF8F8", + "\uF8F9", + "\uF8FA", + "\uF8FB", + "\uF8FC", + "\uF8FD", + "\uF8FE", + "\u00FF", +] +assert len(_symbol_encoding) == 256 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/zapfding.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/zapfding.py new file mode 100644 index 0000000000000000000000000000000000000000..9b6cdbcc0bca199f3eb8cca9e2cc7fe6001a34fb --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_codecs/zapfding.py @@ -0,0 +1,261 @@ +# manually generated from https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/zdingbat.txt + +_zapfding_encoding = [ + "\u0000", + "\u0001", + "\u0002", + "\u0003", + "\u0004", + "\u0005", + "\u0006", + "\u0007", + "\u0008", + "\u0009", + "\u000A", + "\u000B", + "\u000C", + "\u000D", + "\u000E", + "\u000F", + "\u0010", + "\u0011", + "\u0012", + "\u0013", + "\u0014", + "\u0015", + "\u0016", + "\u0017", + "\u0018", + "\u0019", + "\u001A", + "\u001B", + "\u001C", + "\u001D", + "\u001E", + "\u001F", + "\u0020", + "\u2701", + "\u2702", + "\u2703", + "\u2704", + "\u260E", + "\u2706", + "\u2707", + "\u2708", + "\u2709", + "\u261B", + "\u261E", + "\u270C", + "\u270D", + "\u270E", + "\u270F", + "\u2710", + "\u2711", + "\u2712", + "\u2713", + "\u2714", + "\u2715", + "\u2716", + "\u2717", + "\u2718", + "\u2719", + "\u271A", + "\u271B", + "\u271C", + "\u271D", + "\u271E", + "\u271F", + "\u2720", + "\u2721", + "\u2722", + "\u2723", + "\u2724", + "\u2725", + "\u2726", + "\u2727", + "\u2605", + "\u2729", + "\u272A", + "\u272B", + "\u272C", + "\u272D", + "\u272E", + "\u272F", + "\u2730", + "\u2731", + "\u2732", + "\u2733", + "\u2734", + "\u2735", + "\u2736", + "\u2737", + "\u2738", + "\u2739", + "\u273A", + "\u273B", + "\u273C", + "\u273D", + "\u273E", + "\u273F", + "\u2740", + "\u2741", + "\u2742", + "\u2743", + "\u2744", + "\u2745", + "\u2746", + "\u2747", + "\u2748", + "\u2749", + "\u274A", + "\u274B", + "\u25CF", + "\u274D", + "\u25A0", + "\u274F", + "\u2750", + "\u2751", + "\u2752", + "\u25B2", + "\u25BC", + "\u25C6", + "\u2756", + "\u25D7", + "\u2758", + "\u2759", + "\u275A", + "\u275B", + "\u275C", + "\u275D", + "\u275E", + "\u007F", + "\uF8D7", + "\uF8D8", + "\uF8D9", + "\uF8DA", + "\uF8DB", + "\uF8DC", + "\uF8DD", + "\uF8DE", + "\uF8DF", + "\uF8E0", + "\uF8E1", + "\uF8E2", + "\uF8E3", + "\uF8E4", + "\u008E", + "\u008F", + "\u0090", + "\u0091", + "\u0092", + "\u0093", + "\u0094", + "\u0095", + "\u0096", + "\u0097", + "\u0098", + "\u0099", + "\u009A", + "\u009B", + "\u009C", + "\u009D", + "\u009E", + "\u009F", + "\u00A0", + "\u2761", + "\u2762", + "\u2763", + "\u2764", + "\u2765", + "\u2766", + "\u2767", + "\u2663", + "\u2666", + "\u2665", + "\u2660", + "\u2460", + "\u2461", + "\u2462", + "\u2463", + "\u2464", + "\u2465", + "\u2466", + "\u2467", + "\u2468", + "\u2469", + "\u2776", + "\u2777", + "\u2778", + "\u2779", + "\u277A", + "\u277B", + "\u277C", + "\u277D", + "\u277E", + "\u277F", + "\u2780", + "\u2781", + "\u2782", + "\u2783", + "\u2784", + "\u2785", + "\u2786", + "\u2787", + "\u2788", + "\u2789", + "\u278A", + "\u278B", + "\u278C", + "\u278D", + "\u278E", + "\u278F", + "\u2790", + "\u2791", + "\u2792", + "\u2793", + "\u2794", + "\u2192", + "\u2194", + "\u2195", + "\u2798", + "\u2799", + "\u279A", + "\u279B", + "\u279C", + "\u279D", + "\u279E", + "\u279F", + "\u27A0", + "\u27A1", + "\u27A2", + "\u27A3", + "\u27A4", + "\u27A5", + "\u27A6", + "\u27A7", + "\u27A8", + "\u27A9", + "\u27AA", + "\u27AB", + "\u27AC", + "\u27AD", + "\u27AE", + "\u27AF", + "\u00F0", + "\u27B1", + "\u27B2", + "\u27B3", + "\u27B4", + "\u27B5", + "\u27B6", + "\u27B7", + "\u27B8", + "\u27B9", + "\u27BA", + "\u27BB", + "\u27BC", + "\u27BD", + "\u27BE", + "\u00FF", +] +assert len(_zapfding_encoding) == 256 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0cc63af94fd44e67cac24890b73c3a12a0c497bd --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/__init__.py @@ -0,0 +1,80 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from pypdf._crypt_providers._base import CryptBase, CryptIdentity + +try: + from pypdf._crypt_providers._cryptography import ( + CryptAES, + CryptRC4, + aes_cbc_decrypt, + aes_cbc_encrypt, + aes_ecb_decrypt, + aes_ecb_encrypt, + crypt_provider, + rc4_decrypt, + rc4_encrypt, + ) +except ImportError: + try: + from pypdf._crypt_providers._pycryptodome import ( # type: ignore + CryptAES, + CryptRC4, + aes_cbc_decrypt, + aes_cbc_encrypt, + aes_ecb_decrypt, + aes_ecb_encrypt, + crypt_provider, + rc4_decrypt, + rc4_encrypt, + ) + except ImportError: + from pypdf._crypt_providers._fallback import ( # type: ignore + CryptAES, + CryptRC4, + aes_cbc_decrypt, + aes_cbc_encrypt, + aes_ecb_decrypt, + aes_ecb_encrypt, + crypt_provider, + rc4_decrypt, + rc4_encrypt, + ) + +__all__ = [ + "CryptAES", + "CryptBase", + "CryptIdentity", + "CryptRC4", + "aes_cbc_decrypt", + "aes_cbc_encrypt", + "aes_ecb_decrypt", + "aes_ecb_encrypt", + "crypt_provider", + "rc4_decrypt", + "rc4_encrypt", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_base.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..d66dd4c2667723da4be677945388da7d1f07901f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_base.py @@ -0,0 +1,38 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +class CryptBase: + def encrypt(self, data: bytes) -> bytes: # pragma: no cover + return data + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: # pragma: no cover + return data + + +class CryptIdentity(CryptBase): + pass diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_cryptography.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_cryptography.py new file mode 100644 index 0000000000000000000000000000000000000000..f929337b34de7bb350f499d8bd3ceb5834a549f1 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_cryptography.py @@ -0,0 +1,133 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import secrets + +from cryptography import __version__ +from cryptography.hazmat.primitives.ciphers.algorithms import AES +from cryptography.hazmat.primitives.padding import PKCS7 + +from pypdf._utils import logger_warning +from pypdf.errors import PdfStreamError + +try: + # 43.0.0 - https://cryptography.io/en/latest/changelog/#v43-0-0 + from cryptography.hazmat.decrepit.ciphers.algorithms import ARC4 +except ImportError: + from cryptography.hazmat.primitives.ciphers.algorithms import ARC4 +from cryptography.hazmat.primitives.ciphers.base import Cipher +from cryptography.hazmat.primitives.ciphers.modes import CBC, ECB + +from pypdf._crypt_providers._base import CryptBase + +crypt_provider = ("cryptography", __version__) + + +class CryptRC4(CryptBase): + def __init__(self, key: bytes) -> None: + self.cipher = Cipher(ARC4(key), mode=None) + + def encrypt(self, data: bytes) -> bytes: + encryptor = self.cipher.encryptor() + return encryptor.update(data) + encryptor.finalize() + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + decryptor = self.cipher.decryptor() + return decryptor.update(data) + decryptor.finalize() + + +class CryptAES(CryptBase): + def __init__(self, key: bytes) -> None: + self.alg = AES(key) + + def encrypt(self, data: bytes) -> bytes: + iv = secrets.token_bytes(16) + padder = PKCS7(128).padder() + padded_data = padder.update(data) + padder.finalize() + + cipher = Cipher(self.alg, CBC(iv)) + encryptor = cipher.encryptor() + return iv + encryptor.update(padded_data) + encryptor.finalize() + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + iv = data[:16] + data = data[16:] + # for empty encrypted data + if not data: + return data + + if not strict and len(data) % 16 != 0: + logger_warning("Adding missing padding.", src=__name__) + padder = PKCS7(128).padder() + data = padder.update(data) + padder.finalize() + + cipher = Cipher(self.alg, CBC(iv)) + decryptor = cipher.decryptor() + try: + padded_data = decryptor.update(data) + decryptor.finalize() + except ValueError as exception: + # Only raised in strict mode. Non-strict mode fixes padding. + raise PdfStreamError(exception) + + unpadder = PKCS7(128).unpadder() + try: + return unpadder.update(padded_data) + unpadder.finalize() + except ValueError as exception: + if strict: + raise PdfStreamError(exception) + logger_warning(f"Ignoring padding error: {exception}", src=__name__) + return padded_data[: -padded_data[-1]] + + +def rc4_encrypt(key: bytes, data: bytes) -> bytes: + encryptor = Cipher(ARC4(key), mode=None).encryptor() + return encryptor.update(data) + encryptor.finalize() + + +def rc4_decrypt(key: bytes, data: bytes) -> bytes: + decryptor = Cipher(ARC4(key), mode=None).decryptor() + return decryptor.update(data) + decryptor.finalize() + + +def aes_ecb_encrypt(key: bytes, data: bytes) -> bytes: + encryptor = Cipher(AES(key), mode=ECB()).encryptor() + return encryptor.update(data) + encryptor.finalize() + + +def aes_ecb_decrypt(key: bytes, data: bytes) -> bytes: + decryptor = Cipher(AES(key), mode=ECB()).decryptor() + return decryptor.update(data) + decryptor.finalize() + + +def aes_cbc_encrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + encryptor = Cipher(AES(key), mode=CBC(iv)).encryptor() + return encryptor.update(data) + encryptor.finalize() + + +def aes_cbc_decrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + decryptor = Cipher(AES(key), mode=CBC(iv)).decryptor() + return decryptor.update(data) + decryptor.finalize() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_fallback.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_fallback.py new file mode 100644 index 0000000000000000000000000000000000000000..2b7d3275fd6c0fce04de8df7a316087350a02373 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_fallback.py @@ -0,0 +1,93 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from pypdf._crypt_providers._base import CryptBase +from pypdf.errors import DependencyError + +_DEPENDENCY_ERROR_STR = "cryptography>=3.1 is required for AES algorithm" + + +crypt_provider = ("local_crypt_fallback", "0.0.0") + + +class CryptRC4(CryptBase): + def __init__(self, key: bytes) -> None: + self.s = bytearray(range(256)) + j = 0 + for i in range(256): + j = (j + self.s[i] + key[i % len(key)]) % 256 + self.s[i], self.s[j] = self.s[j], self.s[i] + + def encrypt(self, data: bytes) -> bytes: + s = bytearray(self.s) + out = [0 for _ in range(len(data))] + i, j = 0, 0 + for k in range(len(data)): + i = (i + 1) % 256 + j = (j + s[i]) % 256 + s[i], s[j] = s[j], s[i] + x = s[(s[i] + s[j]) % 256] + out[k] = data[k] ^ x + return bytes(out) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + return self.encrypt(data) + + +class CryptAES(CryptBase): + def __init__(self, key: bytes) -> None: + pass + + def encrypt(self, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def rc4_encrypt(key: bytes, data: bytes) -> bytes: + return CryptRC4(key).encrypt(data) + + +def rc4_decrypt(key: bytes, data: bytes) -> bytes: + return CryptRC4(key).decrypt(data) + + +def aes_ecb_encrypt(key: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def aes_ecb_decrypt(key: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def aes_cbc_encrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def aes_cbc_decrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_pycryptodome.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_pycryptodome.py new file mode 100644 index 0000000000000000000000000000000000000000..cdef70cb578570f3cf5e1fa3122a0995f960256a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_crypt_providers/_pycryptodome.py @@ -0,0 +1,110 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import secrets + +from Crypto import __version__ +from Crypto.Cipher import AES, ARC4 +from Crypto.Util.Padding import pad, unpad + +from pypdf._crypt_providers._base import CryptBase +from pypdf._utils import logger_warning +from pypdf.errors import PdfStreamError + +crypt_provider = ("pycryptodome", __version__) + + +class CryptRC4(CryptBase): + def __init__(self, key: bytes) -> None: + self.key = key + + def encrypt(self, data: bytes) -> bytes: + return ARC4.ARC4Cipher(self.key).encrypt(data) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + return ARC4.ARC4Cipher(self.key).decrypt(data) + + +class CryptAES(CryptBase): + def __init__(self, key: bytes) -> None: + self.key = key + + def encrypt(self, data: bytes) -> bytes: + iv = secrets.token_bytes(16) + padded_data = pad(data, 16) + aes = AES.new(self.key, AES.MODE_CBC, iv) + return iv + aes.encrypt(padded_data) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + iv = data[:16] + data = data[16:] + # for empty encrypted data + if not data: + return data + + if not strict and len(data) % 16 != 0: + logger_warning("Adding missing padding.", src=__name__) + data = pad(data, 16) + + aes = AES.new(self.key, AES.MODE_CBC, iv) + try: + padded_data = aes.decrypt(data) + except ValueError as exception: + # Only raised in strict mode. Non-strict mode fixes padding. + raise PdfStreamError(exception) + + try: + return unpad(padded_data, 16) + except ValueError as exception: + if strict: + raise PdfStreamError(exception) + logger_warning(f"Ignoring padding error: {exception}", src=__name__) + return padded_data[: -padded_data[-1]] + + +def rc4_encrypt(key: bytes, data: bytes) -> bytes: + return ARC4.ARC4Cipher(key).encrypt(data) + + +def rc4_decrypt(key: bytes, data: bytes) -> bytes: + return ARC4.ARC4Cipher(key).decrypt(data) + + +def aes_ecb_encrypt(key: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_ECB).encrypt(data) + + +def aes_ecb_decrypt(key: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_ECB).decrypt(data) + + +def aes_cbc_encrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_CBC, iv).encrypt(data) + + +def aes_cbc_decrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_CBC, iv).decrypt(data) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_text_extraction/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_text_extraction/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fd51c243acb8b621f2c0f2f8f4c2657278d13ade --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_text_extraction/__init__.py @@ -0,0 +1,245 @@ +""" +Code related to text extraction. + +Some parts are still in _page.py. In doubt, they will stay there. +""" + +import math +from typing import Any, Callable, Optional, Union + +from .._font import Font +from ..generic import DictionaryObject, TextStringObject, encode_pdfdocencoding + +CUSTOM_RTL_MIN: int = -1 +CUSTOM_RTL_MAX: int = -1 +CUSTOM_RTL_SPECIAL_CHARS: list[int] = [] +LAYOUT_NEW_BT_GROUP_SPACE_WIDTHS: int = 5 + + +class OrientationNotFoundError(Exception): + pass + + +def set_custom_rtl( + _min: Union[str, int, None] = None, + _max: Union[str, int, None] = None, + specials: Union[str, list[int], None] = None, +) -> tuple[int, int, list[int]]: + """ + Change the Right-To-Left and special characters custom parameters. + + Args: + _min: The new minimum value for the range of custom characters that + will be written right to left. + If set to ``None``, the value will not be changed. + If set to an integer or string, it will be converted to its ASCII code. + The default value is -1, which sets no additional range to be converted. + _max: The new maximum value for the range of custom characters that will + be written right to left. + If set to ``None``, the value will not be changed. + If set to an integer or string, it will be converted to its ASCII code. + The default value is -1, which sets no additional range to be converted. + specials: The new list of special characters to be inserted in the + current insertion order. + If set to ``None``, the current value will not be changed. + If set to a string, it will be converted to a list of ASCII codes. + The default value is an empty list. + + Returns: + A tuple containing the new values for ``CUSTOM_RTL_MIN``, + ``CUSTOM_RTL_MAX``, and ``CUSTOM_RTL_SPECIAL_CHARS``. + + """ + global CUSTOM_RTL_MIN, CUSTOM_RTL_MAX, CUSTOM_RTL_SPECIAL_CHARS + if isinstance(_min, int): + CUSTOM_RTL_MIN = _min + elif isinstance(_min, str): + CUSTOM_RTL_MIN = ord(_min) + if isinstance(_max, int): + CUSTOM_RTL_MAX = _max + elif isinstance(_max, str): + CUSTOM_RTL_MAX = ord(_max) + if isinstance(specials, str): + CUSTOM_RTL_SPECIAL_CHARS = [ord(x) for x in specials] + elif isinstance(specials, list): + CUSTOM_RTL_SPECIAL_CHARS = specials + return CUSTOM_RTL_MIN, CUSTOM_RTL_MAX, CUSTOM_RTL_SPECIAL_CHARS + + +def mult(m: list[float], n: list[float]) -> list[float]: + return [ + m[0] * n[0] + m[1] * n[2], + m[0] * n[1] + m[1] * n[3], + m[2] * n[0] + m[3] * n[2], + m[2] * n[1] + m[3] * n[3], + m[4] * n[0] + m[5] * n[2] + n[4], + m[4] * n[1] + m[5] * n[3] + n[5], + ] + + +def orient(m: list[float]) -> int: + if m[3] > 1e-6: + return 0 + if m[3] < -1e-6: + return 180 + if m[1] > 0: + return 90 + return 270 + + +def crlf_space_check( + text: str, + cmtm_prev: tuple[list[float], list[float]], + cmtm_matrix: tuple[list[float], list[float]], + memo_cmtm: tuple[list[float], list[float]], + font_resource: Optional[DictionaryObject], + orientations: tuple[int, ...], + output: str, + font_size: float, + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]], + str_widths: float, + spacewidth: float, + str_height: float, +) -> tuple[str, str, list[float], list[float]]: + cm_prev = cmtm_prev[0] + tm_prev = cmtm_prev[1] + cm_matrix = cmtm_matrix[0] + tm_matrix = cmtm_matrix[1] + memo_cm = memo_cmtm[0] + memo_tm = memo_cmtm[1] + + m_prev = mult(tm_prev, cm_prev) + m = mult(tm_matrix, cm_matrix) + orientation = orient(m) + delta_x = m[4] - m_prev[4] + delta_y = m[5] - m_prev[5] + # Table 108 of the 1.7 reference ("Text positioning operators") + scale_prev_x = math.sqrt(tm_prev[0]**2 + tm_prev[1]**2) + scale_prev_y = math.sqrt(tm_prev[2]**2 + tm_prev[3]**2) + scale_y = math.sqrt(tm_matrix[2]**2 + tm_matrix[3]**2) + cm_prev = m + + if orientation not in orientations: + raise OrientationNotFoundError + if orientation in (0, 180): + moved_height: float = delta_y + moved_width: float = delta_x + elif orientation in (90, 270): + moved_height = delta_x + moved_width = delta_y + try: + if abs(moved_height) > 0.8 * min(str_height * scale_prev_y, font_size * scale_y): + if (output + text)[-1] != "\n": + output += text + "\n" + if visitor_text is not None: + visitor_text( + text + "\n", + memo_cm, + memo_tm, + font_resource, + font_size, + ) + text = "" + elif ( + (moved_width >= (spacewidth + str_widths) * scale_prev_x) + and (output + text)[-1] != " " + ): + text += " " + except Exception: + pass + tm_prev = tm_matrix.copy() + cm_prev = cm_matrix.copy() + return text, output, cm_prev, tm_prev + + +def get_text_operands( + operands: list[Union[str, TextStringObject]], + cm_matrix: list[float], + tm_matrix: list[float], + font: Font, + orientations: tuple[int, ...] +) -> tuple[str, bool]: + t: str = "" + is_str_operands = False + m = mult(tm_matrix, cm_matrix) + orientation = orient(m) + if orientation in orientations and len(operands) > 0: + if isinstance(operands[0], str): + t = operands[0] + is_str_operands = True + else: + t = "" + tt: bytes = ( + encode_pdfdocencoding(operands[0]) + if isinstance(operands[0], str) + else operands[0] + ) + if isinstance(font.encoding, str): + try: + t = tt.decode(font.encoding, "surrogatepass") # apply str encoding + except Exception: + # the data does not match the expectation, + # we use the alternative ; + # text extraction may not be good + t = tt.decode( + "utf-16-be" if font.encoding == "charmap" else "charmap", + "surrogatepass", + ) # apply str encoding + else: # apply dict encoding + t = "".join( + [font.encoding[x] if x in font.encoding else bytes((x,)).decode() for x in tt] + ) + return (t, is_str_operands) + + +def get_display_str( + text: str, + cm_matrix: list[float], + tm_matrix: list[float], + font_resource: Optional[DictionaryObject], + font: Font, + text_operands: str, + font_size: float, + rtl_dir: bool, + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]] +) -> tuple[str, bool, float]: + # "\u0590 - \u08FF \uFB50 - \uFDFF" + widths: float = 0.0 + for x in [font.character_map.get(x, x) for x in text_operands]: + # x can be a sequence of bytes ; ex: habibi.pdf + if len(x) == 1: + xx = ord(x) + else: + xx = 1 + # fmt: off + if ( + # cases where the current inserting order is kept + (xx <= 0x2F) # punctuations but... + or 0x3A <= xx <= 0x40 # numbers (x30-39) + or 0x2000 <= xx <= 0x206F # upper punctuations.. + or 0x20A0 <= xx <= 0x21FF # but (numbers) indices/exponents + or xx in CUSTOM_RTL_SPECIAL_CHARS # customized.... + ): + text = x + text if rtl_dir else text + x + elif ( # right-to-left characters set + 0x0590 <= xx <= 0x08FF + or 0xFB1D <= xx <= 0xFDFF + or 0xFE70 <= xx <= 0xFEFF + or CUSTOM_RTL_MIN <= xx <= CUSTOM_RTL_MAX + ): + if not rtl_dir: + rtl_dir = True + if visitor_text is not None: + visitor_text(text, cm_matrix, tm_matrix, font_resource, font_size) + text = "" + text = x + text + else: # left-to-right + if rtl_dir: + rtl_dir = False + if visitor_text is not None: + visitor_text(text, cm_matrix, tm_matrix, font_resource, font_size) + text = "" + text = text + x + widths += font.space_width if x == " " else font.text_width(x) + # fmt: on + return text, rtl_dir, widths diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_text_extraction/_text_extractor.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_text_extraction/_text_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..866f1fdbf346acd469efa3ca0e6f6124547987ea --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/_text_extraction/_text_extractor.py @@ -0,0 +1,350 @@ +# Copyright (c) 2006, Mathieu Fenniak +# Copyright (c) 2007, Ashish Kulkarni +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import math +from typing import Any, Callable, Optional, Union + +from .._font import Font, FontDescriptor +from ..generic import DictionaryObject, TextStringObject +from . import OrientationNotFoundError, crlf_space_check, get_display_str, get_text_operands, mult + + +class TextExtraction: + """ + A class to handle PDF text extraction operations. + + This class encapsulates all the state and operations needed for extracting + text from PDF content streams, replacing the nested functions and nonlocal + variables in the original implementation. + """ + + def __init__(self) -> None: + self._font_width_maps: dict[str, tuple[dict[Any, float], str, float]] = {} + + # Text extraction state variables + self.cm_matrix: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.tm_matrix: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.cm_stack: list[ + tuple[ + list[float], + Optional[DictionaryObject], + Font, + float, + float, + float, + float, + ] + ] = [] + + # Store the last modified matrices; can be an intermediate position + self.cm_prev: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.tm_prev: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + # Store the position at the beginning of building the text + self.memo_cm: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.memo_tm: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + self.char_scale = 1.0 + self.space_scale = 1.0 + self._space_width: float = 500.0 # will be set correctly at first Tf + self._actual_str_size: dict[str, float] = { + "str_widths": 0.0, + "str_height": 0.0, + } # will be set to string length calculation result + self.TL = 0.0 + self.font_size = 12.0 # init just in case of + + # Text extraction variables + self.text: str = "" + self.output: str = "" + self.rtl_dir: bool = False # right-to-left + self.font_resource: Optional[DictionaryObject] = None + self.font = Font( + name = "NotInitialized", + sub_type="Unknown", + encoding="charmap", + font_descriptor=FontDescriptor(), + ) + self.orientations: tuple[int, ...] = (0, 90, 180, 270) + self.visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]] = None + self.font_resources: dict[str, DictionaryObject] = {} + self.fonts: dict[str, Font] = {} + + self.operation_handlers = { + b"BT": self._handle_bt, + b"ET": self._handle_et, + b"q": self._handle_save_graphics_state, + b"Q": self._handle_restore_graphics_state, + b"cm": self._handle_cm, + b"Tz": self._handle_tz, + b"Tw": self._handle_tw, + b"TL": self._handle_tl, + b"Tf": self._handle_tf, + b"Td": self._handle_td, + b"Tm": self._handle_tm, + b"T*": self._handle_t_star, + b"Tj": self._handle_tj_operation, + } + + def initialize_extraction( + self, + orientations: tuple[int, ...] = (0, 90, 180, 270), + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]] = None, + font_resources: Optional[dict[str, DictionaryObject]] = None, + fonts: Optional[dict[str, Font]] = None + ) -> None: + """Initialize the extractor with extraction parameters.""" + self.orientations = orientations + self.visitor_text = visitor_text + self.font_resources = font_resources or {} + self.fonts = fonts or {} + + # Reset state + self.text = "" + self.output = "" + self.rtl_dir = False + + def compute_str_widths(self, str_widths: float) -> float: + return str_widths / 1000 + + def process_operation(self, operator: bytes, operands: list[Any]) -> None: + if operator in self.operation_handlers: + handler = self.operation_handlers[operator] + str_widths = handler(operands) + + # Post-process operations that affect text positioning + if operator in {b"Td", b"Tm", b"T*", b"Tj"}: + self._post_process_text_operation(str_widths or 0.0) + + def _post_process_text_operation(self, str_widths: float) -> None: + """Handle common post-processing for text positioning operations.""" + try: + self.text, self.output, self.cm_prev, self.tm_prev = crlf_space_check( + self.text, + (self.cm_prev, self.tm_prev), + (self.cm_matrix, self.tm_matrix), + (self.memo_cm, self.memo_tm), + self.font_resource, + self.orientations, + self.output, + self.font_size, + self.visitor_text, + str_widths, + self.compute_str_widths(self.font_size * self._space_width), + self._actual_str_size["str_height"], + ) + if self.text == "": + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + except OrientationNotFoundError: + pass + + def _handle_tj( + self, + text: str, + operands: list[Union[str, TextStringObject]], + cm_matrix: list[float], + tm_matrix: list[float], + font_resource: Optional[DictionaryObject], + font: Font, + orientations: tuple[int, ...], + font_size: float, + rtl_dir: bool, + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]], + actual_str_size: dict[str, float], + ) -> tuple[str, bool, dict[str, float]]: + text_operands, is_str_operands = get_text_operands( + operands, cm_matrix, tm_matrix, font, orientations + ) + if is_str_operands: + text += text_operands + font_widths = sum([font.space_width if x == " " else font.text_width(x) for x in text_operands]) + else: + text, rtl_dir, font_widths = get_display_str( + text, + cm_matrix, + tm_matrix, # text matrix + font_resource, + font, + text_operands, + font_size, + rtl_dir, + visitor_text, + ) + actual_str_size["str_widths"] += font_widths * font_size + actual_str_size["str_height"] = font_size + return text, rtl_dir, actual_str_size + + def _flush_text(self) -> None: + """Flush accumulated text to output and call visitor if present.""" + self.output += self.text + if self.visitor_text is not None: + self.visitor_text(self.text, self.memo_cm, self.memo_tm, self.font_resource, self.font_size) + self.text = "" + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + + # Operation handlers + + def _handle_bt(self, operands: list[Any]) -> None: + """Handle BT (Begin Text) operation - Table 5.4 page 405.""" + self.tm_matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self._flush_text() + + def _handle_et(self, operands: list[Any]) -> None: + """Handle ET (End Text) operation - Table 5.4 page 405.""" + self._flush_text() + + def _handle_save_graphics_state(self, operands: list[Any]) -> None: + """Handle q (Save graphics state) operation - Table 4.7 page 219.""" + self.cm_stack.append( + ( + self.cm_matrix, + self.font_resource, + self.font, + self.font_size, + self.char_scale, + self.space_scale, + self.TL, + ) + ) + + def _handle_restore_graphics_state(self, operands: list[Any]) -> None: + """Handle Q (Restore graphics state) operation - Table 4.7 page 219.""" + try: + ( + self.cm_matrix, + self.font_resource, + self.font, + self.font_size, + self.char_scale, + self.space_scale, + self.TL, + ) = self.cm_stack.pop() + except Exception: + self.cm_matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + def _handle_cm(self, operands: list[Any]) -> None: + """Handle cm (Modify current matrix) operation - Table 4.7 page 219.""" + self.output += self.text + if self.visitor_text is not None: + self.visitor_text(self.text, self.memo_cm, self.memo_tm, self.font_resource, self.font_size) + self.text = "" + try: + self.cm_matrix = mult([float(operand) for operand in operands[:6]], self.cm_matrix) + except Exception: + self.cm_matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + + def _handle_tz(self, operands: list[Any]) -> None: + """Handle Tz (Set horizontal text scaling) operation - Table 5.2 page 398.""" + self.char_scale = float(operands[0]) / 100 if operands else 1.0 + + def _handle_tw(self, operands: list[Any]) -> None: + """Handle Tw (Set word spacing) operation - Table 5.2 page 398.""" + self.space_scale = 1.0 + float(operands[0] if operands else 0.0) + + def _handle_tl(self, operands: list[Any]) -> None: + """Handle TL (Set Text Leading) operation - Table 5.2 page 398.""" + scale_x = math.sqrt(self.tm_matrix[0] ** 2 + self.tm_matrix[2] ** 2) + self.TL = float(operands[0] if operands else 0.0) * self.font_size * scale_x + + def _handle_tf(self, operands: list[Any]) -> None: + """Handle Tf (Set font size) operation - Table 5.2 page 398.""" + if self.text != "": + self.output += self.text # .translate(cmap) + if self.visitor_text is not None: + self.visitor_text(self.text, self.memo_cm, self.memo_tm, self.font_resource, self.font_size) + self.text = "" + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + try: + self.font_resource = self.font_resources[operands[0]] + self.font = self.fonts[operands[0]] + except KeyError: # font not found + self.font_resource = None + font_descriptor = FontDescriptor() + self.font = Font( + "Unknown", + space_width=250, + encoding=dict.fromkeys(range(256), "�"), + font_descriptor=font_descriptor, + character_map={}, + ) + + self._space_width = self.font.space_width / 2 # Actually the width of _half_ a space... + try: + self.font_size = float(operands[1]) + except Exception: + pass # keep previous size + + def _handle_td(self, operands: list[Any]) -> float: + """Handle Td (Move text position) operation - Table 5.5 page 406.""" + # A special case is a translating only tm: + # tm = [1, 0, 0, 1, e, f] + # i.e. tm[4] += tx, tm[5] += ty. + tx, ty = float(operands[0]), float(operands[1]) + self.tm_matrix[4] += tx * self.tm_matrix[0] + ty * self.tm_matrix[2] + self.tm_matrix[5] += tx * self.tm_matrix[1] + ty * self.tm_matrix[3] + str_widths = self.compute_str_widths(self._actual_str_size["str_widths"]) + self._actual_str_size["str_widths"] = 0.0 + return str_widths + + def _handle_tm(self, operands: list[Any]) -> float: + """Handle Tm (Set text matrix) operation - Table 5.5 page 406.""" + self.tm_matrix = [float(operand) for operand in operands[:6]] + str_widths = self.compute_str_widths(self._actual_str_size["str_widths"]) + self._actual_str_size["str_widths"] = 0.0 + return str_widths + + def _handle_t_star(self, operands: list[Any]) -> float: + """Handle T* (Move to next line) operation - Table 5.5 page 406.""" + self.tm_matrix[4] -= self.TL * self.tm_matrix[2] + self.tm_matrix[5] -= self.TL * self.tm_matrix[3] + str_widths = self.compute_str_widths(self._actual_str_size["str_widths"]) + self._actual_str_size["str_widths"] = 0.0 + return str_widths + + def _handle_tj_operation(self, operands: list[Any]) -> float: + """Handle Tj (Show text) operation - Table 5.5 page 406.""" + self.text, self.rtl_dir, self._actual_str_size = self._handle_tj( + self.text, + operands, + self.cm_matrix, + self.tm_matrix, + self.font_resource, + self.font, + self.orientations, + self.font_size, + self.rtl_dir, + self.visitor_text, + self._actual_str_size, + ) + return 0.0 # str_widths will be handled in post-processing diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..44ed1dab5cacdfc7dbc9c07605e164e757a927b5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/__init__.py @@ -0,0 +1,42 @@ +""" +PDF specifies several annotation types which pypdf makes available here. + +The names of the annotations and their attributes do not reflect the names in +the specification in all cases. For example, the PDF standard defines a +'Square' annotation that does not actually need to be square. For this reason, +pypdf calls it 'Rectangle'. + +At their core, all annotation types are DictionaryObjects. That means if pypdf +does not implement a feature, users can easily extend the given functionality. +""" + + +from ._base import NO_FLAGS, AnnotationDictionary +from ._markup_annotations import ( + Ellipse, + FreeText, + Highlight, + Line, + MarkupAnnotation, + Polygon, + PolyLine, + Rectangle, + Text, +) +from ._non_markup_annotations import Link, Popup + +__all__ = [ + "NO_FLAGS", + "AnnotationDictionary", + "Ellipse", + "FreeText", + "Highlight", + "Line", + "Link", + "MarkupAnnotation", + "PolyLine", + "Polygon", + "Popup", + "Rectangle", + "Text", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_base.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..7731b18682b898a4f5b312d69e07df7df3494100 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_base.py @@ -0,0 +1,29 @@ +from abc import ABC + +from ..constants import AnnotationFlag +from ..generic import NameObject, NumberObject +from ..generic._data_structures import DictionaryObject + + +class AnnotationDictionary(DictionaryObject, ABC): + def __init__(self) -> None: + super().__init__() + + from ..generic._base import NameObject # noqa: PLC0415 + + # /Rect should not be added here as Polygon and PolyLine can automatically set it + self[NameObject("/Type")] = NameObject("/Annot") + # The flags were NOT added to the constructor on purpose: + # We expect that most users don't want to change the default. + # If they do, they can use the property. The default is 0. + + @property + def flags(self) -> AnnotationFlag: + return AnnotationFlag(self.get(NameObject("/F"), 0)) + + @flags.setter + def flags(self, value: AnnotationFlag) -> None: + self[NameObject("/F")] = NumberObject(value) + + +NO_FLAGS = AnnotationFlag(0) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_markup_annotations.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_markup_annotations.py new file mode 100644 index 0000000000000000000000000000000000000000..25eb0dfc48cc776513d27ca38e0a9a5c42602281 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_markup_annotations.py @@ -0,0 +1,351 @@ +import sys +import uuid +from abc import ABC +from typing import Any, Literal, Optional, Union + +from ..constants import AnnotationFlag +from ..generic import ArrayObject, DictionaryObject +from ..generic._base import ( + BooleanObject, + FloatObject, + IndirectObject, + NameObject, + NumberObject, + TextStringObject, +) +from ..generic._rectangle import RectangleObject +from ..generic._utils import hex_to_rgb +from ._base import NO_FLAGS, AnnotationDictionary + +if sys.version_info[:2] >= (3, 10): + from typing import TypeAlias +else: + # PEP 613 introduced typing.TypeAlias with Python 3.10 + # For older Python versions, the backport typing_extensions is necessary: + from typing_extensions import TypeAlias + + +Vertex: TypeAlias = tuple[float, float] + + +def _get_bounding_rectangle(vertices: list[Vertex]) -> RectangleObject: + x_min, y_min = vertices[0][0], vertices[0][1] + x_max, y_max = vertices[0][0], vertices[0][1] + for x, y in vertices: + x_min = min(x_min, x) + y_min = min(y_min, y) + x_max = max(x_max, x) + y_max = max(y_max, y) + return RectangleObject((x_min, y_min, x_max, y_max)) + + +class MarkupAnnotation(AnnotationDictionary, ABC): + """ + Base class for all markup annotations. + + Args: + title_bar: Text to be displayed in the title bar of the annotation; + by convention this is the name of the author + in_reply_to: The annotation that this annotation is "in reply to" + (PDF 1.5). Can be either an annotation (previously added using + :meth:`~pypdf.PdfWriter.add_annotation`) or a reference to the + target annotation. + reply_type: The relationship between this annotation and the one + specified by ``in_reply_to``. Either ``"R"`` (a reply, default) + or ``"Group"`` (grouped with the parent annotation). Raises + ``ValueError`` if a non-default value is provided without + ``in_reply_to``. + annotation_name: A text string uniquely identifying this annotation + among all annotations on its page. Automatically generated when + ``in_reply_to`` is set and no name is provided. Raises + ``ValueError`` if provided without ``in_reply_to``. + + """ + + def __init__( + self, + *, + title_bar: Optional[str] = None, + in_reply_to: Optional[Union[DictionaryObject, IndirectObject]] = None, + reply_type: Literal["R", "Group"] = "R", + annotation_name: Optional[str] = None, + ) -> None: + if title_bar is not None: + self[NameObject("/T")] = TextStringObject(title_bar) + if annotation_name is not None and in_reply_to is None: + raise ValueError( + "annotation_name is only supported when in_reply_to is set" + ) + if reply_type != "R" and in_reply_to is None: + raise ValueError( + "reply_type is only meaningful when in_reply_to is set" + ) + if in_reply_to is not None: + if isinstance(in_reply_to, IndirectObject): + ref: IndirectObject = in_reply_to + else: + indirect_ref = getattr(in_reply_to, "indirect_reference", None) + if not isinstance(indirect_ref, IndirectObject): + raise ValueError( + "in_reply_to must be a registered annotation " + "(added via writer.add_annotation() first)" + ) + ref = indirect_ref + self[NameObject("/IRT")] = ref + self[NameObject("/RT")] = NameObject(f"/{reply_type}") + if annotation_name is None: + annotation_name = str(uuid.uuid4()) + self[NameObject("/NM")] = TextStringObject(annotation_name) + + +class Text(MarkupAnnotation): + """ + A text annotation. + + Args: + rect: array of four integers ``[xLL, yLL, xUR, yUR]`` + specifying the clickable rectangular area + text: The text that is added to the document + open: + flags: + + """ + + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + text: str, + open: bool = False, + flags: int = NO_FLAGS, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self[NameObject("/Subtype")] = NameObject("/Text") + self[NameObject("/Rect")] = RectangleObject(rect) + self[NameObject("/Contents")] = TextStringObject(text) + self[NameObject("/Open")] = BooleanObject(open) + self[NameObject("/Flags")] = NumberObject(flags) + + +class FreeText(MarkupAnnotation): + """A FreeText annotation""" + + def __init__( + self, + *, + text: str, + rect: Union[RectangleObject, tuple[float, float, float, float]], + font: str = "Helvetica", + bold: bool = False, + italic: bool = False, + font_size: str = "14pt", + font_color: str = "000000", + border_color: Optional[str] = "000000", + background_color: Optional[str] = "ffffff", + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self[NameObject("/Subtype")] = NameObject("/FreeText") + self[NameObject("/Rect")] = RectangleObject(rect) + + # Table 225 of the 1.7 reference ("CSS2 style attributes used in rich text strings") + font_str = "font: " + if italic: + font_str = f"{font_str}italic " + else: + font_str = f"{font_str}normal " + if bold: + font_str = f"{font_str}bold " + else: + font_str = f"{font_str}normal " + font_str = f"{font_str}{font_size} {font}" + font_str = f"{font_str};text-align:left;color:#{font_color}" + + default_appearance_string = "" + if border_color: + for st in hex_to_rgb(border_color): + default_appearance_string = f"{default_appearance_string}{st} " + default_appearance_string = f"{default_appearance_string}rg" + + self.update( + { + NameObject("/Subtype"): NameObject("/FreeText"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/Contents"): TextStringObject(text), + # font size color + NameObject("/DS"): TextStringObject(font_str), + NameObject("/DA"): TextStringObject(default_appearance_string), + } + ) + if border_color is None: + # Border Style + self[NameObject("/BS")] = DictionaryObject( + { + # width of 0 means no border + NameObject("/W"): NumberObject(0) + } + ) + if background_color is not None: + self[NameObject("/C")] = ArrayObject( + [FloatObject(n) for n in hex_to_rgb(background_color)] + ) + + +class Line(MarkupAnnotation): + def __init__( + self, + p1: Vertex, + p2: Vertex, + rect: Union[RectangleObject, tuple[float, float, float, float]], + text: str = "", + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Subtype"): NameObject("/Line"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/L"): ArrayObject( + [ + FloatObject(p1[0]), + FloatObject(p1[1]), + FloatObject(p2[0]), + FloatObject(p2[1]), + ] + ), + NameObject("/LE"): ArrayObject( + [ + NameObject("/None"), + NameObject("/None"), + ] + ), + NameObject("/IC"): ArrayObject( + [ + FloatObject(0.5), + FloatObject(0.5), + FloatObject(0.5), + ] + ), + NameObject("/Contents"): TextStringObject(text), + } + ) + + +class PolyLine(MarkupAnnotation): + def __init__( + self, + vertices: list[Vertex], + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + if len(vertices) == 0: + raise ValueError("A polyline needs at least 1 vertex with two coordinates") + coord_list = [] + for x, y in vertices: + coord_list.append(NumberObject(x)) + coord_list.append(NumberObject(y)) + self.update( + { + NameObject("/Subtype"): NameObject("/PolyLine"), + NameObject("/Vertices"): ArrayObject(coord_list), + NameObject("/Rect"): RectangleObject(_get_bounding_rectangle(vertices)), + } + ) + + +class Rectangle(MarkupAnnotation): + def __init__( + self, + rect: Union[RectangleObject, tuple[float, float, float, float]], + *, + interior_color: Optional[str] = None, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Square"), + NameObject("/Rect"): RectangleObject(rect), + } + ) + + if interior_color: + self[NameObject("/IC")] = ArrayObject( + [FloatObject(n) for n in hex_to_rgb(interior_color)] + ) + + +class Highlight(MarkupAnnotation): + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + quad_points: ArrayObject, + highlight_color: str = "ff0000", + printing: bool = False, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Subtype"): NameObject("/Highlight"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/QuadPoints"): quad_points, + NameObject("/C"): ArrayObject( + [FloatObject(n) for n in hex_to_rgb(highlight_color)] + ), + } + ) + if printing: + self.flags = AnnotationFlag.PRINT + + +class Ellipse(MarkupAnnotation): + def __init__( + self, + rect: Union[RectangleObject, tuple[float, float, float, float]], + *, + interior_color: Optional[str] = None, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Circle"), + NameObject("/Rect"): RectangleObject(rect), + } + ) + + if interior_color: + self[NameObject("/IC")] = ArrayObject( + [FloatObject(n) for n in hex_to_rgb(interior_color)] + ) + + +class Polygon(MarkupAnnotation): + def __init__( + self, + vertices: list[tuple[float, float]], + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + if len(vertices) == 0: + raise ValueError("A polygon needs at least 1 vertex with two coordinates") + + coord_list = [] + for x, y in vertices: + coord_list.append(NumberObject(x)) + coord_list.append(NumberObject(y)) + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Polygon"), + NameObject("/Vertices"): ArrayObject(coord_list), + NameObject("/IT"): NameObject("/PolygonCloud"), + NameObject("/Rect"): RectangleObject(_get_bounding_rectangle(vertices)), + } + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_non_markup_annotations.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_non_markup_annotations.py new file mode 100644 index 0000000000000000000000000000000000000000..144546094f2a8b0499073342410c3b0185db08f2 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/annotations/_non_markup_annotations.py @@ -0,0 +1,106 @@ +from typing import TYPE_CHECKING, Any, Optional, Union + +from ..generic._base import ( + BooleanObject, + NameObject, + NumberObject, + TextStringObject, +) +from ..generic._data_structures import ArrayObject, DictionaryObject +from ..generic._fit import DEFAULT_FIT, Fit +from ..generic._rectangle import RectangleObject +from ._base import AnnotationDictionary + + +class Link(AnnotationDictionary): + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + border: Optional[ArrayObject] = None, + url: Optional[str] = None, + target_page_index: Optional[int] = None, + fit: Fit = DEFAULT_FIT, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + if TYPE_CHECKING: + from ..types import BorderArrayType # noqa: PLC0415 + + is_external = url is not None + is_internal = target_page_index is not None + if not is_external and not is_internal: + raise ValueError( + "Either 'url' or 'target_page_index' have to be provided. Both were None." + ) + if is_external and is_internal: + raise ValueError( + "Either 'url' or 'target_page_index' have to be provided. " + f"{url=}, {target_page_index=}" + ) + + border_arr: BorderArrayType + if border is not None: + border_arr = [NumberObject(n) for n in border[:3]] + if len(border) == 4: + dash_pattern = ArrayObject([NumberObject(n) for n in border[3]]) + border_arr.append(dash_pattern) + else: + border_arr = [NumberObject(0)] * 3 + + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Link"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/Border"): ArrayObject(border_arr), + } + ) + if is_external: + self[NameObject("/A")] = DictionaryObject( + { + NameObject("/S"): NameObject("/URI"), + NameObject("/Type"): NameObject("/Action"), + NameObject("/URI"): TextStringObject(url), + } + ) + if is_internal: + # This needs to be updated later! + dest_deferred = DictionaryObject( + { + "target_page_index": NumberObject(target_page_index), + "fit": NameObject(fit.fit_type), + "fit_args": fit.fit_args, + } + ) + self[NameObject("/Dest")] = dest_deferred + + +class Popup(AnnotationDictionary): + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + parent: Optional[DictionaryObject] = None, + open: bool = False, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Subtype"): NameObject("/Popup"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/Open"): BooleanObject(open), + } + ) + if parent: + # This needs to be an indirect object + try: + self[NameObject("/Parent")] = parent.indirect_reference + except AttributeError: + from .._utils import logger_warning # noqa: PLC0415 + + logger_warning( + "Unregistered Parent object : No Parent field set", + __name__, + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bde1628fb7a02f9dab04666123c1f3d8bdeeb94b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/__init__.py @@ -0,0 +1,115 @@ +# Copyright (c) 2006, Mathieu Fenniak +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +"""Implementation of generic PDF objects (dictionary, number, string, ...).""" +__author__ = "Mathieu Fenniak" +__author_email__ = "biziqe@mathieu.fenniak.net" + +from ..constants import OutlineFontFlag +from ._base import ( + BooleanObject, + ByteStringObject, + FloatObject, + IndirectObject, + NameObject, + NullObject, + NumberObject, + PdfObject, + TextStringObject, + encode_pdfdocencoding, + is_null_or_none, +) +from ._data_structures import ( + ArrayObject, + ContentStream, + DecodedStreamObject, + Destination, + DictionaryObject, + EncodedStreamObject, + Field, + StreamObject, + TreeObject, + read_object, +) +from ._files import EmbeddedFile +from ._fit import Fit +from ._link import DirectReferenceLink, NamedReferenceLink, ReferenceLink, extract_links +from ._outline import OutlineItem +from ._rectangle import RectangleObject +from ._utils import ( + create_string_object, + decode_pdfdocencoding, + hex_to_rgb, + read_hex_string_from_stream, + read_string_from_stream, +) +from ._viewerpref import ViewerPreferences + +PAGE_FIT = Fit.fit() + + +__all__ = [ + "PAGE_FIT", + "ArrayObject", + "BooleanObject", + "ByteStringObject", + "ContentStream", + "DecodedStreamObject", + "Destination", + "DictionaryObject", + "DirectReferenceLink", + "EmbeddedFile", + "EncodedStreamObject", + "Field", + "Fit", + "FloatObject", + "IndirectObject", + "NameObject", + "NamedReferenceLink", + "NullObject", + "NumberObject", + "OutlineFontFlag", + "OutlineItem", + "PdfObject", + "RectangleObject", + "ReferenceLink", + "StreamObject", + "TextStringObject", + "TreeObject", + "ViewerPreferences", + # Utility functions + "create_string_object", + "decode_pdfdocencoding", + "encode_pdfdocencoding", + "extract_links", + "hex_to_rgb", + "is_null_or_none", + "read_hex_string_from_stream", + # Data structures core functions + "read_object", + "read_string_from_stream", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_appearance_stream.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_appearance_stream.py new file mode 100644 index 0000000000000000000000000000000000000000..cee5c79ec7955175cfb357c3f53801de68f7f568 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_appearance_stream.py @@ -0,0 +1,589 @@ +import re +from dataclasses import dataclass +from enum import IntEnum +from typing import Any, Optional, Union, cast + +from .._codecs import fill_from_encoding +from .._codecs.core_font_metrics import CORE_FONT_METRICS +from .._font import Font +from .._utils import logger_warning +from ..constants import AnnotationDictionaryAttributes, BorderStyles, FieldDictionaryAttributes +from ..generic import ( + DecodedStreamObject, + DictionaryObject, + NameObject, + NumberObject, + RectangleObject, +) +from ..generic._base import ByteStringObject, TextStringObject, is_null_or_none + +DEFAULT_FONT_SIZE_IN_MULTILINE = 12 + + +@dataclass +class BaseStreamConfig: + """A container representing the basic layout of an appearance stream.""" + rectangle: Union[RectangleObject, tuple[float, float, float, float]] = (0.0, 0.0, 0.0, 0.0) + border_width: int = 1 # The width of the border in points + border_style: str = BorderStyles.SOLID + + +class BaseStreamAppearance(DecodedStreamObject): + """A class representing the very base of an appearance stream, that is, a rectangle and a border.""" + + def __init__(self, layout: Optional[BaseStreamConfig] = None) -> None: + """ + Takes the appearance stream layout as an argument. + + Args: + layout: The basic layout parameters. + """ + super().__init__() + self._layout = layout or BaseStreamConfig() + self[NameObject("/Type")] = NameObject("/XObject") + self[NameObject("/Subtype")] = NameObject("/Form") + self[NameObject("/BBox")] = RectangleObject(self._layout.rectangle) + + +class TextAlignment(IntEnum): + """Defines the alignment options for text within a form field's appearance stream.""" + + LEFT = 0 + CENTER = 1 + RIGHT = 2 + + +class TextStreamAppearance(BaseStreamAppearance): + """ + A class representing the appearance stream for a text-based form field. + + This class generates the content stream (the `ap_stream_data`) that dictates + how text is rendered within a form field's bounding box. It handles properties + like font, font size, color, multiline text, and text selection highlighting. + """ + + def _scale_text( + self, + font: Font, + font_size: float, + leading_factor: float, + field_width: float, + field_height: float, + text: str, + min_font_size: float, + font_size_step: float = 0.2 + ) -> tuple[list[tuple[float, str]], float]: + """ + Takes a piece of text and scales it to field_width or field_height, given font_name + and font_size. Wraps text where necessary. + + Args: + font: The font to be used. + font_size: The font size in points. + leading_factor: The line distance. + field_width: The width of the field in which to fit the text. + field_height: The height of the field in which to fit the text. + text: The text to fit with the field. + min_font_size: The minimum font size at which to scale the text. + font_size_step: The amount by which to decrement font size per step while scaling. + + Returns: + The text in the form of list of tuples, each tuple containing the length of a line + and its contents, and the font_size for these lines and lengths. + """ + orig_text = text + paragraphs = text.replace("\n", "\r").split("\r") + wrapped_lines = [] + current_line_words: list[str] = [] + current_line_width: float = 0 + space_width = font.space_width * font_size / 1000 + for paragraph in paragraphs: + if not paragraph.strip(): + wrapped_lines.append((0.0, "")) + continue + words = paragraph.split(" ") + for i, word in enumerate(words): + word_width = font.text_width(word) * font_size / 1000 + test_width = current_line_width + word_width + (space_width if i else 0) + if test_width > field_width and current_line_words: + wrapped_lines.append((current_line_width, " ".join(current_line_words))) + current_line_words = [word] + current_line_width = word_width + elif not current_line_words and word_width > field_width: + wrapped_lines.append((word_width, word)) + current_line_words = [] + current_line_width = 0 + else: + if current_line_words: + current_line_width += space_width + current_line_words.append(word) + current_line_width += word_width + if current_line_words: + wrapped_lines.append((current_line_width, " ".join(current_line_words))) + current_line_words = [] + current_line_width = 0 + # Estimate total height. + estimated_total_height = font_size + (len(wrapped_lines) - 1) * leading_factor * font_size + if estimated_total_height > field_height: + # Text overflows height; Retry with smaller font size. + new_font_size = font_size - font_size_step + if new_font_size >= min_font_size: + return self._scale_text( + font, + new_font_size, + leading_factor, + field_width, + field_height, + orig_text, + min_font_size, + font_size_step + ) + return wrapped_lines, round(font_size, 1) + + def _generate_appearance_stream_data( + self, + text: str, + selection: Union[list[str], None], + font: Font, + font_glyph_byte_map: Optional[dict[str, bytes]] = None, + font_name: str = "/Helv", + font_size: float = 0.0, + font_color: str = "0 g", + is_multiline: bool = False, + alignment: TextAlignment = TextAlignment.LEFT, + is_comb: bool = False, + max_length: Optional[int] = None + ) -> bytes: + """ + Generates the raw bytes of the PDF appearance stream for a text field. + + This private method assembles the PDF content stream operators to draw + the provided text within the specified rectangle. It handles text positioning, + font application, color, and special formatting like selected text. + + Args: + text: The text to be rendered in the form field. + selection: An optional list of strings that should be highlighted as selected. + font: The font to use. + font_glyph_byte_map: An optional dictionary mapping characters to their + byte representation for glyph encoding. + font_name: The name of the font resource to use (e.g., "/Helv"). + font_size: The font size. If 0, it is automatically calculated + based on whether the field is multiline or not. + font_color: The color to apply to the font, represented as a PDF + graphics state string (e.g., "0 g" for black). + is_multiline: A boolean indicating if the text field is multiline. + alignment: Text alignment, can be TextAlignment.LEFT, .RIGHT, or .CENTER. + is_comb: Boolean that designates fixed-length fields, where every character + fills one "cell", such as in a postcode. + max_length: Used if is_comb is set. The maximum number of characters for a fixed- + length field. + + Returns: + A byte string containing the PDF content stream data. + + """ + rectangle = self._layout.rectangle + font_glyph_byte_map = font_glyph_byte_map or {} + if isinstance(rectangle, tuple): + rectangle = RectangleObject(rectangle) + leading_factor = (font.font_descriptor.bbox[3] - font.font_descriptor.bbox[1]) / 1000.0 + + # Set margins based on border width and style, but never less than 1 point + factor = 2 if self._layout.border_style in {"/B", "/I"} else 1 + margin = max(self._layout.border_width * factor, 1) + field_height = rectangle.height - 2 * margin + field_width = rectangle.width - 4 * margin + + # If font_size is 0, apply the logic for multiline or large-as-possible font + if font_size == 0: + min_font_size = 4.0 # The mininum font size + if selection: # Don't wrap text when dealing with a /Ch field, in order to prevent problems + is_multiline = False # with matching "selection" with "line" later on. + if is_multiline: + font_size = DEFAULT_FONT_SIZE_IN_MULTILINE + lines, font_size = self._scale_text( + font, + font_size, + leading_factor, + field_width, + field_height, + text, + min_font_size + ) + else: + max_vertical_size = field_height / leading_factor + text_width_unscaled = font.text_width(text) / 1000 + max_horizontal_size = field_width / (text_width_unscaled or 1) + font_size = round(max(min(max_vertical_size, max_horizontal_size), min_font_size), 1) + lines = [(text_width_unscaled * font_size, text)] + elif is_comb: + if max_length and len(text) > max_length: + logger_warning ( + f"Length of text {text} exceeds maximum length ({max_length}) of field, input truncated.", + __name__ + ) + # We act as if each character is one line, because we draw it separately later on + lines = [( + font.text_width(char) * font_size / 1000, + char + ) for index, char in enumerate(text) if index < (max_length or len(text))] + else: + lines = [( + font.text_width(line) * font_size / 1000, + line + ) for line in text.replace("\n", "\r").split("\r")] + + # Set the vertical offset + if is_multiline: + y_offset = rectangle.height + margin - font.font_descriptor.bbox[3] * font_size / 1000.0 + else: + y_offset = margin + ((field_height - font.font_descriptor.ascent * font_size / 1000) / 2) + default_appearance = f"{font_name} {font_size} Tf {font_color}" + + ap_stream = ( + f"q\n/Tx BMC \nq\n{2 * margin} {margin} {field_width} {field_height} " + f"re\nW\nBT\n{default_appearance}\n" + ).encode() + current_x_pos: float = 0 # Initial virtual position within the text object. + + for line_number, (line_width, line) in enumerate(lines): + if selection and line in selection: + # Might be improved, but cannot find how to get fill working => replaced with lined box + ap_stream += ( + f"1 {y_offset - (line_number * font_size * leading_factor) - 1} " + f"{rectangle.width - 2} {font_size + 2} re\n" + f"0.5 0.5 0.5 rg s\n{default_appearance}\n" + ).encode() + + # Calculate the desired absolute starting X for the current line + desired_abs_x_start: float = 0 + if is_comb and max_length: + # Calculate the width of a cell for one character + cell_width = rectangle.width / max_length + # Space from the left edge of the cell to the character's baseline start + # line_width here is the *actual* character width in points for the single character 'line' + centering_offset_in_cell = (cell_width - line_width) / 2 + # Absolute start X = (Cell Index, i.e., line_number * Cell Width) + Centering Offset + desired_abs_x_start = (line_number * cell_width) + centering_offset_in_cell + elif alignment == TextAlignment.RIGHT: + desired_abs_x_start = rectangle.width - margin * 2 - line_width + elif alignment == TextAlignment.CENTER: + desired_abs_x_start = (rectangle.width - line_width) / 2 + else: # Left aligned; default + desired_abs_x_start = margin * 2 + # Calculate x_rel_offset: how much to move from the current_x_pos + # to reach the desired_abs_x_start. + x_rel_offset = desired_abs_x_start - current_x_pos + + # Y-offset: + y_rel_offset: float = 0 + if line_number == 0: + y_rel_offset = y_offset # Initial vertical position + elif is_comb: + y_rel_offset = 0.0 # DO NOT move vertically for subsequent characters + else: + y_rel_offset = - font_size * leading_factor # Move down by line height + + # Td is a relative translation (Tx and Ty). + # It updates the current text position. + ap_stream += f"{x_rel_offset} {y_rel_offset} Td\n".encode() + # Update current_x_pos based on the Td operation for the next iteration. + # This is the X position where the *current line* will start. + current_x_pos = desired_abs_x_start + + encoded_line: list[bytes] = [ + font_glyph_byte_map.get(c, c.encode("utf-16-be")) for c in line + ] + if any(len(c) >= 2 for c in encoded_line): + ap_stream += b"<" + (b"".join(encoded_line)).hex().encode() + b"> Tj\n" + else: + ap_stream += b"(" + b"".join(encoded_line) + b") Tj\n" + ap_stream += b"ET\nQ\nEMC\nQ\n" + return ap_stream + + def __init__( + self, + layout: Optional[BaseStreamConfig] = None, + text: str = "", + selection: Optional[list[str]] = None, + font_resource: Optional[DictionaryObject] = None, + font_name: str = "/Helv", + font_size: float = 0.0, + font_color: str = "0 g", + is_multiline: bool = False, + alignment: TextAlignment = TextAlignment.LEFT, + is_comb: bool = False, + max_length: Optional[int] = None + ) -> None: + """ + Initializes a TextStreamAppearance object. + + This constructor creates a new PDF stream object configured as an XObject + of subtype Form. It uses the `_appearance_stream_data` method to generate + the content for the stream. + + Args: + layout: The basic layout parameters. + text: The text to be rendered in the form field. + selection: An optional list of strings that should be highlighted as selected. + font_resource: An optional variable that represents a PDF font dictionary. + font_name: The name of the font resource, e.g., "/Helv". + font_size: The font size. If 0, it's auto-calculated. + font_color: The font color string. + is_multiline: A boolean indicating if the text field is multiline. + alignment: Text alignment, can be TextAlignment.LEFT, .RIGHT, or .CENTER. + is_comb: Boolean that designates fixed-length fields, where every character + fills one "cell", such as in a postcode. + max_length: Used if is_comb is set. The maximum number of characters for a fixed- + length field. + + """ + super().__init__(layout) + + # If a font resource was added, get the font character map + if font_resource: + font = Font.from_font_resource(font_resource) + else: + logger_warning(f"Font dictionary for {font_name} not found; defaulting to Helvetica.", __name__) + font_name = "/Helv" + core_font_metrics = CORE_FONT_METRICS["Helvetica"] + font = Font( + name="Helvetica", + character_map={}, + encoding=dict(zip(range(256), fill_from_encoding("cp1252"))), # WinAnsiEncoding + sub_type="Type1", + font_descriptor=core_font_metrics.font_descriptor, + character_widths=core_font_metrics.character_widths + ) + font_resource = font.as_font_resource() + + # Check whether the font resource is able to encode the text value. + encodable = True + try: + if isinstance(font.encoding, str): + text.encode(font.encoding, "surrogatepass") + else: + supported_chars = set(font.encoding.values()) + if any(char not in supported_chars for char in text): + encodable = False + # We should add a final check against the character_map (CMap) of the font, + # but we don't appear to have PDF forms with such fonts, so we skip this for + # now. + + except UnicodeEncodeError: + encodable = False + + if not encodable: + logger_warning( + f"Text string '{text}' contains characters not supported by font encoding. " + "This may result in text corruption. " + "Consider calling writer.update_page_form_field_values with auto_regenerate=True.", + __name__ + ) + + font_glyph_byte_map: dict[str, bytes] + if isinstance(font.encoding, str): + font_glyph_byte_map = { + v: k.encode(font.encoding) for k, v in font.character_map.items() + } + else: + font_glyph_byte_map = {v: bytes((k,)) for k, v in font.encoding.items()} + font_encoding_rev = {v: bytes((k,)) for k, v in font.encoding.items()} + for key, value in font.character_map.items(): + font_glyph_byte_map[value] = font_encoding_rev.get(key, key) + + ap_stream_data = self._generate_appearance_stream_data( + text, + selection, + font, + font_glyph_byte_map, + font_name=font_name, + font_size=font_size, + font_color=font_color, + is_multiline=is_multiline, + alignment=alignment, + is_comb=is_comb, + max_length=max_length + ) + + self.set_data(ByteStringObject(ap_stream_data)) + self[NameObject("/Length")] = NumberObject(len(ap_stream_data)) + # Update Resources with font information + self[NameObject("/Resources")] = DictionaryObject({ + NameObject("/Font"): DictionaryObject({ + NameObject(font_name): getattr(font_resource, "indirect_reference", font_resource) + }) + }) + + @staticmethod + def _find_annotation_font_resource( + font_name: str, + annotation: DictionaryObject, + acro_form: DictionaryObject + ) -> tuple[str, DictionaryObject]: + # Try to find a resource dictionary for the font by examining the annotation and, if that fails, + # the AcroForm resources dictionary + acro_form_resources: Any = cast( + DictionaryObject, + annotation.get_inherited( + "/DR", + acro_form.get("/DR", DictionaryObject()), + ), + ) + acro_form_font_resources = acro_form_resources.get("/Font", DictionaryObject()) + font_resource = acro_form_font_resources.get(font_name, None) + + # Normally, we should have found a font resource by now. However, when a user has provided a specific + # font name, we may not have found the associated font resource among the AcroForm resources. Also, in + # case of the 14 Adobe Core fonts, we may be expected to construct a font resource ourselves. + if is_null_or_none(font_resource): + if font_name.removeprefix("/") not in CORE_FONT_METRICS: + # Default to Helvetica if we haven't found a font resource and cannot construct one ourselves. + logger_warning(f"Font dictionary for {font_name} not found; defaulting to Helvetica.", __name__) + font_name = "/Helvetica" + core_font_metrics = CORE_FONT_METRICS[font_name.removeprefix("/")] + font_resource = Font( + name=font_name.removeprefix("/"), + character_map={}, + encoding=dict(zip(range(256), fill_from_encoding("cp1252"))), # WinAnsiEncoding + sub_type="Type1", + font_descriptor=core_font_metrics.font_descriptor, + character_widths=core_font_metrics.character_widths + ).as_font_resource() + + return font_name, font_resource + + @classmethod + def from_text_annotation( + cls, + acro_form: DictionaryObject, # _root_object[CatalogDictionary.ACRO_FORM]) + field: DictionaryObject, + annotation: DictionaryObject, + user_font_name: str = "", + user_font_size: float = -1, + ) -> "TextStreamAppearance": + """ + Creates a TextStreamAppearance object from a text field annotation. + + This class method is a factory for creating a `TextStreamAppearance` + instance by extracting all necessary information (bounding box, font, + text content, etc.) from the PDF field and annotation dictionaries. + It respects inheritance for properties like default appearance (`/DA`). + + Args: + acro_form: The root AcroForm dictionary from the PDF catalog. + field: The field dictionary object. + annotation: The widget annotation dictionary object associated with the field. + user_font_name: An optional user-provided font name to override the + default. Defaults to an empty string. + user_font_size: An optional user-provided font size to override the + default. A value of -1 indicates no override. + + Returns: + A new `TextStreamAppearance` instance configured for the given field. + + """ + # Calculate rectangle dimensions + _rectangle = cast(RectangleObject, annotation[AnnotationDictionaryAttributes.Rect]) + rectangle = RectangleObject((0, 0, abs(_rectangle[2] - _rectangle[0]), abs(_rectangle[3] - _rectangle[1]))) + + # Get default appearance dictionary from annotation + default_appearance = annotation.get_inherited( + AnnotationDictionaryAttributes.DA, + acro_form.get(AnnotationDictionaryAttributes.DA, None), + ) + if not default_appearance: + # Create a default appearance if none was found in the annotation + default_appearance = TextStringObject("/Helv 0 Tf 0 g") + else: + default_appearance = default_appearance.get_object() + + # Retrieve field text and selected values + field_flags = field.get(FieldDictionaryAttributes.Ff, 0) + if ( + field.get(FieldDictionaryAttributes.FT, "/Tx") == "/Ch" and + field_flags & FieldDictionaryAttributes.FfBits.Combo == 0 + ): + text = "\n".join(annotation.get_inherited(FieldDictionaryAttributes.Opt, [])) + selection = field.get("/V", []) + if not isinstance(selection, list): + selection = [selection] + else: # /Tx + text = field.get("/V", "") + selection = [] + + # Escape parentheses (PDF 1.7 reference, table 3.2, Literal Strings) + text = text.replace("\\", "\\\\").replace("(", r"\(").replace(")", r"\)") + + # Derive font name, size and color from the default appearance. Also set + # user-provided font name and font size in the default appearance, if given. + # For a font name, this presumes that we can find an associated font resource + # dictionary. Uses the variable font_properties as an intermediate. + # As per the PDF spec: + # "At a minimum, the string [that is, default_appearance] shall include a Tf (text + # font) operator along with its two operands, font and size" (Section 12.7.4.3 + # "Variable text" of the PDF 2.0 specification). + font_properties = [prop for prop in re.split(r"\s", default_appearance) if prop] + font_name = font_properties.pop(font_properties.index("Tf") - 2) + font_size = float(font_properties.pop(font_properties.index("Tf") - 1)) + font_properties.remove("Tf") + font_color = " ".join(font_properties) + # Determine the font name to use, prioritizing the user's input + if user_font_name: + font_name = user_font_name + # Determine the font size to use, prioritizing the user's input + if user_font_size > 0: + font_size = user_font_size + + font_name, font_resource = cls._find_annotation_font_resource(font_name, annotation, acro_form) + + # Retrieve formatting information + is_comb = False + max_length = None + if field_flags & FieldDictionaryAttributes.FfBits.Comb: + is_comb = True + max_length = annotation.get("/MaxLen") + is_multiline = False + if field_flags & FieldDictionaryAttributes.FfBits.Multiline: + is_multiline = True + alignment = field.get("/Q", TextAlignment.LEFT) + border_width = 1 + border_style = BorderStyles.SOLID + if "/BS" in field: + border_width = cast(DictionaryObject, field["/BS"]).get("/W", border_width) + border_style = cast(DictionaryObject, field["/BS"]).get("/S", border_style) + + # Create the TextStreamAppearance instance + layout = BaseStreamConfig(rectangle=rectangle, border_width=border_width, border_style=border_style) + new_appearance_stream = cls( + layout, + text, + selection, + font_resource, + font_name=font_name, + font_size=font_size, + font_color=font_color, + is_multiline=is_multiline, + alignment=alignment, + is_comb=is_comb, + max_length=max_length + ) + + if AnnotationDictionaryAttributes.AP in annotation: + for key, value in ( + cast(DictionaryObject, annotation[AnnotationDictionaryAttributes.AP]).get("/N", {}).items() + ): + if key in {"/BBox", "/Length", "/Subtype", "/Type", "/Filter"}: + continue + # Don't overwrite font resources added by TextAppearanceStream.__init__ + if key == "/Resources": + if "/Font" not in value: + value.get_object()[NameObject("/Font")] = DictionaryObject() + value["/Font"].get_object()[NameObject(font_name)] = getattr( + font_resource, "indirect_reference", font_resource + ) + else: + new_appearance_stream[key] = value + + return new_appearance_stream diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_base.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..975e2e12b98c804329ac589b93cfd5a5a5fe2023 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_base.py @@ -0,0 +1,953 @@ +# Copyright (c) 2006, Mathieu Fenniak +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +import binascii +import codecs +import hashlib +import re +import sys +from collections.abc import Sequence +from math import log10 +from struct import iter_unpack +from typing import Any, Callable, ClassVar, Optional, Union, cast + +if sys.version_info[:2] >= (3, 10): + from typing import TypeGuard +else: + from typing_extensions import TypeGuard # PEP 647 + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +from .._codecs import _pdfdoc_encoding_rev +from .._protocols import PdfObjectProtocol, PdfWriterProtocol +from .._utils import ( + StreamType, + classproperty, + deprecation_no_replacement, + deprecation_with_replacement, + logger_warning, + read_non_whitespace, + read_until_regex, +) +from ..errors import STREAM_TRUNCATED_PREMATURELY, PdfReadError, PdfStreamError + +__author__ = "Mathieu Fenniak" +__author_email__ = "biziqe@mathieu.fenniak.net" + + +class PdfObject(PdfObjectProtocol): + # function for calculating a hash value + hash_func: Callable[..., "hashlib._Hash"] = hashlib.sha1 + indirect_reference: Optional["IndirectObject"] + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + raise NotImplementedError( + f"{self.__class__.__name__} does not implement .hash_bin() so far" + ) + + def hash_value_data(self) -> bytes: + return f"{self}".encode() + + def hash_value(self) -> bytes: + return ( + f"{self.__class__.__name__}:" + f"{self.hash_func(self.hash_value_data()).hexdigest()}" + ).encode() + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "PdfObject": + """ + Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter) + without ensuring links. This is used in clone_document_from_root with incremental = True. + + Args: + pdf_dest: Target to clone to. + + Returns: + The cloned PdfObject + + """ + return self.clone(pdf_dest) + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "PdfObject": + """ + Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter). + + By default, this method will call ``_reference_clone`` (see ``_reference``). + + + Args: + pdf_dest: Target to clone to. + force_duplicate: By default, if the object has already been cloned and referenced, + the copy will be returned; when ``True``, a new copy will be created. + (Default value = ``False``) + ignore_fields: List/tuple of field names (for dictionaries) that will be ignored + during cloning (applies to children duplication as well). If fields are to be + considered for a limited number of levels, you have to add it as integer, for + example ``[1,"/B","/TOTO"]`` means that ``"/B"`` will be ignored at the first + level only but ``"/TOTO"`` on all levels. + + Returns: + The cloned PdfObject + + """ + raise NotImplementedError( + f"{self.__class__.__name__} does not implement .clone so far" + ) + + def _reference_clone( + self, clone: "PdfObject", pdf_dest: PdfWriterProtocol, force_duplicate: bool = False + ) -> "PdfObject": + """ + Reference the object within the _objects of pdf_dest only if + indirect_reference attribute exists (which means the objects was + already identified in xref/xobjstm) if object has been already + referenced do nothing. + + Args: + clone: + pdf_dest: + + Returns: + The clone + + """ + try: + if ( + not force_duplicate + and clone.indirect_reference is not None + and clone.indirect_reference.pdf == pdf_dest + ): + return clone + except Exception: + pass + # if hasattr(clone, "indirect_reference"): + try: + ind = self.indirect_reference + except AttributeError: + return clone + if ( + pdf_dest.incremental + and ind is not None + and ind.pdf == pdf_dest._reader + and ind.idnum <= len(pdf_dest._objects) + ): + i = ind.idnum + else: + i = len(pdf_dest._objects) + 1 + if ind is not None: + if id(ind.pdf) not in pdf_dest._id_translated: + pdf_dest._id_translated[id(ind.pdf)] = {} + pdf_dest._id_translated[id(ind.pdf)]["PreventGC"] = ind.pdf # type: ignore[index] + if ( + not force_duplicate + and ind.idnum in pdf_dest._id_translated[id(ind.pdf)] + ): + obj = pdf_dest.get_object( + pdf_dest._id_translated[id(ind.pdf)][ind.idnum] + ) + assert isinstance(obj, PdfObject), "mypy" + return obj + pdf_dest._id_translated[id(ind.pdf)][ind.idnum] = i + try: + pdf_dest._objects[i - 1] = clone + except IndexError: + pdf_dest._objects.append(clone) + i = len(pdf_dest._objects) + clone.indirect_reference = IndirectObject(i, 0, pdf_dest) + return clone + + def get_object(self) -> Optional["PdfObject"]: + """Resolve indirect references.""" + return self + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + raise NotImplementedError + + +class NullObject(PdfObject): + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "NullObject": + """Clone object into pdf_dest.""" + return cast( + "NullObject", self._reference_clone(NullObject(), pdf_dest, force_duplicate) + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__,)) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"null") + + @staticmethod + def read_from_stream(stream: StreamType) -> "NullObject": + nulltxt = stream.read(4) + if nulltxt != b"null": + raise PdfReadError("Could not read Null object") + return NullObject() + + def __repr__(self) -> str: + return "NullObject" + + def __eq__(self, other: object) -> bool: + return isinstance(other, NullObject) + + def __hash__(self) -> int: + return self.hash_bin() + + +class BooleanObject(PdfObject): + value: bool + + def __init__(self, value: Any) -> None: + self.value = value + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "BooleanObject": + """Clone object into pdf_dest.""" + return cast( + "BooleanObject", + self._reference_clone(BooleanObject(self.value), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.value)) + + def __eq__(self, o: object, /) -> bool: + if isinstance(o, BooleanObject): + return self.value == o.value + if isinstance(o, bool): + return self.value == o + return False + + def __hash__(self) -> int: + return self.hash_bin() + + def __repr__(self) -> str: + return "True" if self.value else "False" + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + if self.value: + stream.write(b"true") + else: + stream.write(b"false") + + @staticmethod + def read_from_stream(stream: StreamType) -> "BooleanObject": + word = stream.read(4) + if word == b"true": + return BooleanObject(True) + if word == b"fals": + stream.read(1) + return BooleanObject(False) + raise PdfReadError("Could not read Boolean object") + + +class IndirectObject(PdfObject): + def __init__(self, idnum: int, generation: int, pdf: Any) -> None: # PdfReader + self.idnum = idnum + self.generation = generation + self.pdf = pdf + + def __hash__(self) -> int: + return hash((self.idnum, self.generation, id(self.pdf))) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.idnum, self.generation, id(self.pdf))) + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "PdfObject": + return IndirectObject(self.idnum, self.generation, pdf_dest) + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "IndirectObject": + """Clone object into pdf_dest.""" + if self.pdf == pdf_dest and not force_duplicate: + # Already duplicated and no extra duplication required + return self + if id(self.pdf) not in pdf_dest._id_translated: + pdf_dest._id_translated[id(self.pdf)] = {} + pdf_dest._id_translated[id(self.pdf)]["PreventGC"] = self.pdf # type: ignore[index] + + if self.idnum in pdf_dest._id_translated[id(self.pdf)]: + dup = pdf_dest.get_object(pdf_dest._id_translated[id(self.pdf)][self.idnum]) + if force_duplicate: + assert dup is not None + assert dup.indirect_reference is not None + idref = dup.indirect_reference + return IndirectObject(idref.idnum, idref.generation, idref.pdf) + else: + obj = self.get_object() + # case observed : a pointed object can not be found + if obj is None: + # this normally + obj = NullObject() + assert isinstance(self, (IndirectObject,)) + obj.indirect_reference = self + dup = pdf_dest._add_object( + obj.clone(pdf_dest, force_duplicate, ignore_fields) + ) + assert isinstance(dup, PdfObject), "mypy" + assert dup.indirect_reference is not None, "mypy" + return dup.indirect_reference + + @property + def indirect_reference(self) -> "IndirectObject": # type: ignore[override] + return self + + def get_object(self) -> Optional["PdfObject"]: + obj: Optional[PdfObject] = self.pdf.get_object(self) + return obj + + def __deepcopy__(self, memo: Any) -> "IndirectObject": + return IndirectObject(self.idnum, self.generation, self.pdf) + + def _get_object_with_check(self) -> Optional["PdfObject"]: + o = self.get_object() + # the check is done here to not slow down get_object() + if isinstance(o, IndirectObject): + raise PdfStreamError( + f"{self.__repr__()} references an IndirectObject {o.__repr__()}" + ) + return o + + def __getattr__(self, name: str) -> Any: + # Attribute not found in object: look in pointed object + try: + return getattr(self._get_object_with_check(), name) + except AttributeError: + raise AttributeError( + f"No attribute {name} found in IndirectObject or pointed object" + ) + + def __getitem__(self, key: Any) -> Any: + # items should be extracted from pointed Object + return self._get_object_with_check()[key] # type: ignore + + def __contains__(self, key: Any) -> bool: + return key in self._get_object_with_check() # type: ignore + + def __iter__(self) -> Any: + return self._get_object_with_check().__iter__() # type: ignore + + def __float__(self) -> str: + # in this case we are looking for the pointed data + return self.get_object().__float__() # type: ignore + + def __int__(self) -> int: + # in this case we are looking for the pointed data + return self.get_object().__int__() # type: ignore + + def __str__(self) -> str: + # in this case we are looking for the pointed data + return self.get_object().__str__() + + def __repr__(self) -> str: + return f"IndirectObject({self.idnum!r}, {self.generation!r}, {id(self.pdf)})" + + def __eq__(self, other: object) -> bool: + return ( + other is not None + and isinstance(other, IndirectObject) + and self.idnum == other.idnum + and self.generation == other.generation + and self.pdf is other.pdf + ) + + def __ne__(self, other: object) -> bool: + return not self.__eq__(other) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(f"{self.idnum} {self.generation} R".encode()) + + @staticmethod + def read_from_stream(stream: StreamType, pdf: Any) -> "IndirectObject": # PdfReader + idnum = b"" + while True: + tok = stream.read(1) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok.isspace(): + break + idnum += tok + generation = b"" + while True: + tok = stream.read(1) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok.isspace(): + if not generation: + continue + break + generation += tok + r = read_non_whitespace(stream) + if r != b"R": + raise PdfReadError( + f"Error reading indirect object reference at byte {hex(stream.tell())}" + ) + return IndirectObject(int(idnum), int(generation), pdf) + + +FLOAT_WRITE_PRECISION = 8 # shall be min 5 digits max, allow user adj + + +class FloatObject(float, PdfObject): + def __new__( + cls, value: Any = "0.0", context: Optional[Any] = None + ) -> Self: + try: + value = float(value) + return float.__new__(cls, value) + except Exception as e: + # If this isn't a valid decimal (happens in malformed PDFs) + # fallback to 0 + logger_warning( + f"{e} : FloatObject ({value}) invalid; use 0.0 instead", __name__ + ) + return float.__new__(cls, 0.0) + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "FloatObject": + """Clone object into pdf_dest.""" + return cast( + "FloatObject", + self._reference_clone(FloatObject(self), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.as_numeric)) + + def myrepr(self) -> str: + if self == 0: # type: ignore[comparison-overlap] + return "0.0" + nb = FLOAT_WRITE_PRECISION - int(log10(abs(self))) + return f"{self:.{max(1, nb)}f}".rstrip("0").rstrip(".") + + def __repr__(self) -> str: + return self.myrepr() # repr(float(self)) + + def as_numeric(self) -> float: + return float(self) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(self.myrepr().encode("utf8")) + + +class NumberObject(int, PdfObject): + NumberPattern = re.compile(b"[^+-.0-9]") + + def __new__(cls, value: Any) -> Self: + try: + return int.__new__(cls, int(value)) + except ValueError: + logger_warning(f"NumberObject({value}) invalid; use 0 instead", __name__) + return int.__new__(cls, 0) + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "NumberObject": + """Clone object into pdf_dest.""" + return cast( + "NumberObject", + self._reference_clone(NumberObject(self), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.as_numeric())) + + def as_numeric(self) -> int: + return int(repr(self).encode("utf8")) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(repr(self).encode("utf8")) + + @staticmethod + def read_from_stream(stream: StreamType) -> Union["NumberObject", "FloatObject"]: + num = read_until_regex(stream, NumberObject.NumberPattern) + if b"." in num: + return FloatObject(num) + return NumberObject(num) + + +class ByteStringObject(bytes, PdfObject): + """ + Represents a string object where the text encoding could not be determined. + + This occurs quite often, as the PDF spec doesn't provide an alternate way to + represent strings -- for example, the encryption data stored in files (like + /O) is clearly not text, but is still stored in a "String" object. + """ + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "ByteStringObject": + """Clone object into pdf_dest.""" + return cast( + "ByteStringObject", + self._reference_clone( + ByteStringObject(bytes(self)), pdf_dest, force_duplicate + ), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, bytes(self))) + + @property + def original_bytes(self) -> bytes: + """For compatibility with TextStringObject.original_bytes.""" + return self + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<") + stream.write(binascii.hexlify(self)) + stream.write(b">") + + def __str__(self) -> str: + charset_to_try = ["utf-16", *list(NameObject.CHARSETS)] + for enc in charset_to_try: + try: + return self.decode(enc) + except UnicodeDecodeError: + pass + raise PdfReadError("Cannot decode ByteStringObject.") + + +class TextStringObject(str, PdfObject): # noqa: SLOT000 + """ + A string object that has been decoded into a real unicode string. + + If read from a PDF document, this string appeared to match the + PDFDocEncoding, or contained a UTF-16BE BOM mark to cause UTF-16 decoding + to occur. + """ + + autodetect_pdfdocencoding: bool + autodetect_utf16: bool + utf16_bom: bytes + _original_bytes: Optional[bytes] = None + + def __new__(cls, value: Any) -> Self: + original_bytes = None + if isinstance(value, bytes): + original_bytes = value + value = value.decode("charmap") + text_string_object = str.__new__(cls, value) + text_string_object._original_bytes = original_bytes + text_string_object.autodetect_utf16 = False + text_string_object.autodetect_pdfdocencoding = False + text_string_object.utf16_bom = b"" + if original_bytes is not None and original_bytes[:2] in {codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE}: + # The value of `original_bytes` is only set for inputs being `bytes`. + # If this is UTF-16 data according to the BOM (first two characters), + # perform special handling. All other cases should not need any special conversion + # due to already being a string. + try: + text_string_object = str.__new__(cls, original_bytes.decode("utf-16")) + except UnicodeDecodeError as exception: + logger_warning( + f"{exception!s}\ninitial string:{exception.object!r}", + __name__, + ) + text_string_object = str.__new__(cls, exception.object[: exception.start].decode("utf-16")) + text_string_object._original_bytes = original_bytes + text_string_object.autodetect_utf16 = True + text_string_object.utf16_bom = original_bytes[:2] + else: + try: + encode_pdfdocencoding(text_string_object) + text_string_object.autodetect_pdfdocencoding = True + except UnicodeEncodeError: + text_string_object.autodetect_utf16 = True + text_string_object.utf16_bom = codecs.BOM_UTF16_BE + return text_string_object + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "TextStringObject": + """Clone object into pdf_dest.""" + obj = TextStringObject(self) + obj._original_bytes = self._original_bytes + obj.autodetect_pdfdocencoding = self.autodetect_pdfdocencoding + obj.autodetect_utf16 = self.autodetect_utf16 + obj.utf16_bom = self.utf16_bom + return cast( + "TextStringObject", self._reference_clone(obj, pdf_dest, force_duplicate) + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.original_bytes)) + + @property + def original_bytes(self) -> bytes: + """ + It is occasionally possible that a text string object gets created where + a byte string object was expected due to the autodetection mechanism -- + if that occurs, this "original_bytes" property can be used to + back-calculate what the original encoded bytes were. + """ + if self._original_bytes is not None: + return self._original_bytes + return self.get_original_bytes() + + def get_original_bytes(self) -> bytes: + # We're a text string object, but the library is trying to get our raw + # bytes. This can happen if we auto-detected this string as text, but + # we were wrong. It's pretty common. Return the original bytes that + # would have been used to create this object, based upon the autodetect + # method. + if self.autodetect_utf16: + if self.utf16_bom == codecs.BOM_UTF16_LE: + return codecs.BOM_UTF16_LE + self.encode("utf-16le") + if self.utf16_bom == codecs.BOM_UTF16_BE: + return codecs.BOM_UTF16_BE + self.encode("utf-16be") + return self.encode("utf-16be") + if self.autodetect_pdfdocencoding: + return encode_pdfdocencoding(self) + raise Exception("no information about original bytes") # pragma: no cover + + def get_encoded_bytes(self) -> bytes: + # Try to write the string out as a PDFDocEncoding encoded string. It's + # nicer to look at in the PDF file. Sadly, we take a performance hit + # here for trying... + try: + if self._original_bytes is not None: + return self._original_bytes + if self.autodetect_utf16: + raise UnicodeEncodeError("", "forced", -1, -1, "") + bytearr = encode_pdfdocencoding(self) + except UnicodeEncodeError: + if self.utf16_bom == codecs.BOM_UTF16_LE: + bytearr = codecs.BOM_UTF16_LE + self.encode("utf-16le") + elif self.utf16_bom == codecs.BOM_UTF16_BE: + bytearr = codecs.BOM_UTF16_BE + self.encode("utf-16be") + else: + bytearr = self.encode("utf-16be") + return bytearr + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + bytearr = self.get_encoded_bytes() + stream.write(b"(") + for c_ in iter_unpack("c", bytearr): + c = cast(bytes, c_[0]) + if not c.isalnum() and c != b" ": + # This: + # stream.write(rf"\{c:0>3o}".encode()) + # gives + # https://github.com/davidhalter/parso/issues/207 + stream.write(b"\\%03o" % ord(c)) + else: + stream.write(c) + stream.write(b")") + + +class NameObject(str, PdfObject): # noqa: SLOT000 + delimiter_pattern = re.compile(rb"\s+|[\(\)<>\[\]{}/%]") + prefix = b"/" + renumber_table: ClassVar[dict[str, bytes]] = { + **{chr(i): f"#{i:02X}".encode() for i in b"#()<>[]{}/%"}, + **{chr(i): f"#{i:02X}".encode() for i in range(33)}, + } + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "NameObject": + """Clone object into pdf_dest.""" + return cast( + "NameObject", + self._reference_clone(NameObject(self), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self)) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(self.renumber()) + + def renumber(self) -> bytes: + out = self[0].encode("utf-8") + if out != b"/": + deprecation_no_replacement( + f"Incorrect first char in NameObject, should start with '/': ({self})", + "5.0.0", + ) + parts = [out] + for c in self[1:]: + if c > "~": + parts.extend(f"#{x:02X}".encode() for x in c.encode("utf-8")) + else: + try: + parts.append(self.renumber_table[c]) + except KeyError: + parts.append(c.encode("utf-8")) + return b"".join(parts) + + def _sanitize(self) -> "NameObject": + """ + Sanitize the NameObject's name to be a valid PDF name part + (alphanumeric, underscore, hyphen). The _sanitize method replaces + spaces and any non-alphanumeric/non-underscore/non-hyphen with + underscores. + + Returns: + NameObject with sanitized name. + """ + name = str(self).removeprefix("/") + name = re.sub(r"\ ", "_", name) + name = re.sub(r"[^a-zA-Z0-9_-]", "_", name) + return NameObject("/" + name) + + @classproperty + def surfix(cls) -> bytes: # noqa: N805 + deprecation_with_replacement("surfix", "prefix", "5.0.0") + return b"/" + + @staticmethod + def unnumber(sin: bytes) -> bytes: + result = bytearray() + i = 0 + while i < len(sin): + if sin[i:i + 1] == b"#": + try: + result.append(int(sin[i + 1 : i + 3], 16)) + i += 3 + continue + except (ValueError, IndexError): + # if the 2 characters after # can not be converted to hex + # we change nothing and carry on + pass + result.append(sin[i]) + i += 1 + return bytes(result) + + CHARSETS = ("utf-8", "gbk", "latin1") + + @staticmethod + def read_from_stream(stream: StreamType, pdf: Any) -> "NameObject": # PdfReader + name = stream.read(1) + if name != NameObject.prefix: + raise PdfReadError("Name read error") + name += read_until_regex(stream, NameObject.delimiter_pattern) + try: + # Name objects should represent irregular characters + # with a '#' followed by the symbol's hex number + name = NameObject.unnumber(name) + for enc in NameObject.CHARSETS: + try: + ret = name.decode(enc) + return NameObject(ret) + except Exception: + pass + raise UnicodeDecodeError("", name, 0, 0, "Code Not Found") + except (UnicodeEncodeError, UnicodeDecodeError) as e: + if not pdf.strict: + logger_warning( + f"Illegal character in NameObject ({name!r}), " + "you may need to adjust NameObject.CHARSETS", + __name__, + ) + return NameObject(name.decode("charmap")) + raise PdfReadError( + f"Illegal character in NameObject ({name!r}). " + "You may need to adjust NameObject.CHARSETS.", + ) from e + + +def encode_pdfdocencoding(unicode_string: str) -> bytes: + try: + return bytes([_pdfdoc_encoding_rev[k] for k in unicode_string]) + except KeyError: + raise UnicodeEncodeError( + "pdfdocencoding", + unicode_string, + -1, + -1, + "does not exist in translation table", + ) + + +def is_null_or_none(x: Any) -> TypeGuard[Union[None, NullObject, IndirectObject]]: + """ + Returns: + True if x is None or NullObject. + + """ + return x is None or ( + isinstance(x, PdfObject) + and (x.get_object() is None or isinstance(x.get_object(), NullObject)) + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_data_structures.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_data_structures.py new file mode 100644 index 0000000000000000000000000000000000000000..12a064653262c23ea1ed57b8381e2d2a081bcbbd --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_data_structures.py @@ -0,0 +1,1804 @@ +# Copyright (c) 2006, Mathieu Fenniak +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +__author__ = "Mathieu Fenniak" +__author_email__ = "biziqe@mathieu.fenniak.net" + +import logging +import re +import sys +from collections.abc import Iterable, Sequence +from io import BytesIO +from math import ceil +from typing import ( + Any, + Callable, + Optional, + Union, + cast, +) + +from .._protocols import PdfReaderProtocol, PdfWriterProtocol, XmpInformationProtocol +from .._utils import ( + WHITESPACES, + BinaryStreamType, + StreamType, + deprecation_no_replacement, + logger_warning, + read_non_whitespace, + read_until_regex, + read_until_whitespace, + skip_over_comment, +) +from ..constants import ( + CheckboxRadioButtonAttributes, + FieldDictionaryAttributes, + OutlineFontFlag, + StreamAttributes, +) +from ..constants import FilterTypes as FT +from ..constants import TypArguments as TA +from ..constants import TypFitArguments as TF +from ..errors import STREAM_TRUNCATED_PREMATURELY, LimitReachedError, PdfReadError, PdfStreamError +from ._base import ( + BooleanObject, + ByteStringObject, + FloatObject, + IndirectObject, + NameObject, + NullObject, + NumberObject, + PdfObject, + TextStringObject, + is_null_or_none, +) +from ._fit import Fit +from ._image_inline import ( + extract_inline__ascii85_decode, + extract_inline__ascii_hex_decode, + extract_inline__dct_decode, + extract_inline__run_length_decode, + extract_inline_default, +) +from ._utils import read_hex_string_from_stream, read_string_from_stream + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +logger = logging.getLogger(__name__) + +IndirectPattern = re.compile(rb"[+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]") + + +class ArrayObject(list[Any], PdfObject): + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "ArrayObject": + arr = cast( + "ArrayObject", + self._reference_clone(ArrayObject(), pdf_dest, False), + ) + for data in self: + if hasattr(data, "replicate"): + arr.append(data.replicate(pdf_dest)) + else: + arr.append(data) + return arr + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "ArrayObject": + """Clone object into pdf_dest.""" + try: + if self.indirect_reference.pdf == pdf_dest and not force_duplicate: # type: ignore + return self + except Exception: + pass + arr = cast( + "ArrayObject", + self._reference_clone(ArrayObject(), pdf_dest, force_duplicate=True), + ) + for data in self: + if isinstance(data, StreamObject): + dup = data._reference_clone( + data.clone(pdf_dest, force_duplicate, ignore_fields), + pdf_dest, + force_duplicate, + ) + arr.append(dup.indirect_reference) + elif isinstance(data, IndirectObject) and isinstance(resolved := data.get_object(), StreamObject): + dup = data._reference_clone( + resolved.clone(pdf_dest, force_duplicate=True, ignore_fields=ignore_fields), + pdf_dest, + force_duplicate, + ) + arr.append(dup.indirect_reference) + elif hasattr(data, "clone"): + arr.append(data.clone(pdf_dest, force_duplicate, ignore_fields)) + else: + arr.append(data) + return arr + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, tuple(x.hash_bin() for x in self))) + + def items(self) -> Iterable[Any]: + """Emulate DictionaryObject.items for a list (index, object).""" + return enumerate(self) + + def _to_lst(self, lst: Any) -> list[Any]: + # Convert to list, internal + result: list[Any] + if isinstance(lst, (list, tuple, set)): + result = list(lst) + elif isinstance(lst, PdfObject): + result = [lst] + elif isinstance(lst, str): + if lst[0] == "/": + result = [NameObject(lst)] + else: + result = [TextStringObject(lst)] + elif isinstance(lst, bytes): + result = [ByteStringObject(lst)] + else: # for numbers,... + result = [lst] + return result + + def __add__(self, lst: Any) -> "ArrayObject": + """ + Allow extension by adding list or add one element only + + Args: + lst: any list, tuples are extended the list. + other types(numbers,...) will be appended. + if str is passed it will be converted into TextStringObject + or NameObject (if starting with "/") + if bytes is passed it will be converted into ByteStringObject + + Returns: + ArrayObject with all elements + + """ + temp = ArrayObject(self) + temp.extend(self._to_lst(lst)) + return temp + + def __iadd__(self, lst: Any) -> Self: + """ + Allow extension by adding list or add one element only + + Args: + lst: any list, tuples are extended the list. + other types(numbers,...) will be appended. + if str is passed it will be converted into TextStringObject + or NameObject (if starting with "/") + if bytes is passed it will be converted into ByteStringObject + + """ + self.extend(self._to_lst(lst)) + return self + + def __isub__(self, lst: Any) -> Self: + """Allow to remove items""" + for x in self._to_lst(lst): + try: + index = self.index(x) + del self[index] + except ValueError: + pass + return self + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"[") + for data in self: + stream.write(b" ") + data.write_to_stream(stream) + stream.write(b" ]") + + @staticmethod + def read_from_stream( + stream: StreamType, + pdf: Optional[PdfReaderProtocol], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, + ) -> "ArrayObject": + arr = ArrayObject() + tmp = stream.read(1) + if tmp != b"[": + raise PdfReadError("Could not read array") + while True: + # skip leading whitespace + tok = stream.read(1) + while tok.isspace(): + tok = stream.read(1) + if tok == b"": + break + if tok == b"%": + stream.seek(-1, 1) + skip_over_comment(stream) + continue + stream.seek(-1, 1) + # check for array ending + peek_ahead = stream.read(1) + if peek_ahead == b"]": + break + stream.seek(-1, 1) + # read and append object + arr.append(read_object(stream, pdf, forced_encoding)) + return arr + + +class DictionaryObject(dict[Any, Any], PdfObject): + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "DictionaryObject": + d__ = cast( + "DictionaryObject", + self._reference_clone(self.__class__(), pdf_dest, False), + ) + for k, v in self.items(): + d__[k.replicate(pdf_dest)] = ( + v.replicate(pdf_dest) if hasattr(v, "replicate") else v + ) + return d__ + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "DictionaryObject": + """Clone object into pdf_dest.""" + try: + if self.indirect_reference.pdf == pdf_dest and not force_duplicate: # type: ignore + return self + except Exception: + pass + + visited: set[tuple[int, int]] = set() # (idnum, generation) + d__ = cast( + "DictionaryObject", + self._reference_clone(self.__class__(), pdf_dest, force_duplicate), + ) + if ignore_fields is None: + ignore_fields = [] + if len(d__.keys()) == 0: + d__._clone(self, pdf_dest, force_duplicate, ignore_fields, visited) + return d__ + + def _clone( + self, + src: "DictionaryObject", + pdf_dest: PdfWriterProtocol, + force_duplicate: bool, + ignore_fields: Optional[Sequence[Union[str, int]]], + visited: set[tuple[int, int]], # (idnum, generation) + ) -> None: + """ + Update the object from src. + + Args: + src: "DictionaryObject": + pdf_dest: + force_duplicate: + ignore_fields: + + """ + # First we remove the ignore_fields + # that are for a limited number of levels + assert ignore_fields is not None + ignore_fields = list(ignore_fields) + x = 0 + while x < len(ignore_fields): + if isinstance(ignore_fields[x], int): + if cast(int, ignore_fields[x]) <= 0: + del ignore_fields[x] + del ignore_fields[x] + continue + ignore_fields[x] -= 1 # type:ignore + x += 1 + # Check if this is a chain list, we need to loop to prevent recur + if any( + field not in ignore_fields + and field in src + and isinstance(src.raw_get(field), IndirectObject) + and isinstance(src[field], DictionaryObject) + and ( + src.get("/Type", None) is None + or cast(DictionaryObject, src[field]).get("/Type", None) is None + or src.get("/Type", None) + == cast(DictionaryObject, src[field]).get("/Type", None) + ) + for field in ["/Next", "/Prev", "/N", "/V"] + ): + ignore_fields = list(ignore_fields) + for lst in (("/Next", "/Prev"), ("/N", "/V")): + for k in lst: + objs = [] + if ( + k in src + and k not in self + and isinstance(src.raw_get(k), IndirectObject) + and isinstance(src[k], DictionaryObject) + # If need to go further the idea is to check + # that the types are the same + and ( + src.get("/Type", None) is None + or cast(DictionaryObject, src[k]).get("/Type", None) is None + or src.get("/Type", None) + == cast(DictionaryObject, src[k]).get("/Type", None) + ) + ): + cur_obj: Optional[DictionaryObject] = cast( + "DictionaryObject", src[k] + ) + prev_obj: Optional[DictionaryObject] = self + while cur_obj is not None: + clon = cast( + "DictionaryObject", + cur_obj._reference_clone( + cur_obj.__class__(), pdf_dest, force_duplicate + ), + ) + # Check to see if we've previously processed our item + if clon.indirect_reference is not None: + idnum = clon.indirect_reference.idnum + generation = clon.indirect_reference.generation + if (idnum, generation) in visited: + cur_obj = None + break + visited.add((idnum, generation)) + objs.append((cur_obj, clon)) + assert prev_obj is not None + prev_obj[NameObject(k)] = clon.indirect_reference + prev_obj = clon + try: + if cur_obj == src: + cur_obj = None + else: + cur_obj = cast("DictionaryObject", cur_obj[k]) + except Exception: + cur_obj = None + for s, c in objs: + c._clone( + s, pdf_dest, force_duplicate, ignore_fields, visited + ) + + for k, v in src.items(): + if k not in ignore_fields: + if isinstance(v, StreamObject): + if not hasattr(v, "indirect_reference"): + v.indirect_reference = None + vv = v.clone(pdf_dest, force_duplicate, ignore_fields) + assert vv.indirect_reference is not None + self[k.clone(pdf_dest)] = vv.indirect_reference + elif k not in self: + self[NameObject(k)] = ( + v.clone(pdf_dest, force_duplicate, ignore_fields) + if hasattr(v, "clone") + else v + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash( + (self.__class__, tuple(((k, v.hash_bin()) for k, v in self.items()))) + ) + + def raw_get(self, key: Any) -> Any: + return dict.__getitem__(self, key) + + def get_inherited(self, key: str, default: Any = None) -> Any: + """ + Returns the value of a key or from the parent if not found. + If not found returns default. + + Args: + key: string identifying the field to return + + default: default value to return + + Returns: + Current key or inherited one, otherwise default value. + + """ + if key in self: + return self[key] + try: + if "/Parent" not in self: + return default + raise KeyError("Not present") + except KeyError: + return cast("DictionaryObject", self["/Parent"].get_object()).get_inherited( + key, default + ) + + def __setitem__(self, key: Any, value: Any) -> Any: + if not isinstance(key, PdfObject): + raise ValueError("Key must be a PdfObject") + if not isinstance(value, PdfObject): + raise ValueError("Value must be a PdfObject") + return dict.__setitem__(self, key, value) + + def setdefault(self, key: Any, value: Optional[Any] = None) -> Any: + if not isinstance(key, PdfObject): + raise ValueError("Key must be a PdfObject") + if not isinstance(value, PdfObject): + raise ValueError("Value must be a PdfObject") + return dict.setdefault(self, key, value) + + def __getitem__(self, key: Any) -> PdfObject: + return cast(PdfObject, dict.__getitem__(self, key).get_object()) + + @property + def xmp_metadata(self) -> Optional[XmpInformationProtocol]: + """ + Retrieve XMP (Extensible Metadata Platform) data relevant to this + object, if available. + + See Table 347 — Additional entries in a metadata stream dictionary. + + Returns: + Returns a :class:`~pypdf.xmp.XmpInformation` instance + that can be used to access XMP metadata from the document. Can also + return None if no metadata was found on the document root. + + """ + from ..xmp import XmpInformation # noqa: PLC0415 + + metadata = self.get("/Metadata", None) + if is_null_or_none(metadata): + return None + assert metadata is not None, "mypy" + metadata = metadata.get_object() + return XmpInformation(metadata) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<<\n") + for key, value in self.items(): + if len(key) > 2 and key[1] == "%" and key[-1] == "%": + continue + key.write_to_stream(stream, encryption_key) + stream.write(b" ") + value.write_to_stream(stream) + stream.write(b"\n") + stream.write(b">>") + + @classmethod + def _get_next_object_position( + cls, position_before: int, position_end: int, generations: list[int], pdf: PdfReaderProtocol + ) -> int: + out = position_end + for generation in generations: + location = pdf.xref[generation] + values = [x for x in location.values() if position_before < x <= position_end] + if values: + out = min(out, *values) + return out + + @classmethod + def _read_unsized_from_stream( + cls, stream: BinaryStreamType, pdf: PdfReaderProtocol + ) -> bytes: + object_position = cls._get_next_object_position( + position_before=stream.tell(), position_end=2 ** 32, generations=list(pdf.xref), pdf=pdf + ) - 1 + current_position = stream.tell() + # Read until the next object position. + read_value = stream.read(object_position - stream.tell()) + endstream_position = read_value.find(b"endstream") + if endstream_position < 0: + raise PdfReadError( + f"Unable to find 'endstream' marker for obj starting at {current_position}." + ) + # 9 = len(b"endstream") + stream.seek(current_position + endstream_position + 9) + return read_value[: endstream_position - 1] + + @staticmethod + def read_from_stream( + stream: StreamType, + pdf: Optional[PdfReaderProtocol], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, + ) -> "DictionaryObject": + tmp = stream.read(2) + if tmp != b"<<": + raise PdfReadError( + f"Dictionary read error at byte {hex(stream.tell())}: " + "stream must begin with '<<'" + ) + data: dict[Any, Any] = {} + while True: + tok = read_non_whitespace(stream) + if tok == b"\x00": + continue + if tok == b"%": + stream.seek(-1, 1) + skip_over_comment(stream) + continue + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + + if tok == b">": + stream.read(1) + break + stream.seek(-1, 1) + try: + try: + key = read_object(stream, pdf) + if isinstance(key, NullObject): + break + if not isinstance(key, NameObject): + raise PdfReadError( + f"Expecting a NameObject for key but found {key!r}" + ) + except PdfReadError as exc: + if pdf is not None and pdf.strict: + raise + logger_warning(exc.__repr__(), __name__) + continue + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + value = read_object(stream, pdf, forced_encoding) + except (RecursionError, LimitReachedError) as exc: + raise PdfReadError(exc.__repr__()) + except Exception as exc: + if pdf is not None and pdf.strict: + raise PdfReadError(exc.__repr__()) + logger_warning(exc.__repr__(), __name__) + retval = DictionaryObject() + retval.update(data) + return retval # return partial data + + if not data.get(key): + data[key] = value + else: + # multiple definitions of key not permitted + msg = ( + f"Multiple definitions in dictionary at byte " + f"{hex(stream.tell())} for key {key}" + ) + if pdf is not None and pdf.strict: + raise PdfReadError(msg) + logger_warning(msg, __name__) + + pos = stream.tell() + s = read_non_whitespace(stream) + if s == b"s" and stream.read(5) == b"tream": + eol = stream.read(1) + # Occasional PDF file output has spaces after 'stream' keyword but before EOL. + # patch provided by Danial Sandler + while eol == b" ": + eol = stream.read(1) + if eol not in (b"\n", b"\r"): + raise PdfStreamError("Stream data must be followed by a newline") + if eol == b"\r" and stream.read(1) != b"\n": + stream.seek(-1, 1) + # this is a stream object, not a dictionary + if StreamAttributes.LENGTH not in data: + if pdf is not None and pdf.strict: + raise PdfStreamError("Stream length not defined") + logger_warning( + f"Stream length not defined @pos={stream.tell()}", __name__ + ) + data[NameObject(StreamAttributes.LENGTH)] = NumberObject(-1) + length = data[StreamAttributes.LENGTH] + if isinstance(length, IndirectObject): + t = stream.tell() + assert pdf is not None, "mypy" + length = pdf.get_object(length) + stream.seek(t, 0) + if length is None: # if the PDF is damaged + length = -1 + pstart = stream.tell() + if length >= 0: + from ..filters import MAX_DECLARED_STREAM_LENGTH # noqa: PLC0415 + if length > MAX_DECLARED_STREAM_LENGTH: + raise LimitReachedError(f"Declared stream length of {length} exceeds maximum allowed length.") + + data["__streamdata__"] = stream.read(length) + else: + data["__streamdata__"] = read_until_regex( + stream, re.compile(b"endstream") + ) + e = read_non_whitespace(stream) + ndstream = stream.read(8) + if (e + ndstream) != b"endstream": + # the odd PDF file has a length that is too long, so + # we need to read backwards to find the "endstream" ending. + # ReportLab (unknown version) generates files with this bug, + # and Python users into PDF files tend to be our audience. + # we need to do this to correct the streamdata and chop off + # an extra character. + pos = stream.tell() + stream.seek(-10, 1) + end = stream.read(9) + if end == b"endstream": + # we found it by looking back one character further. + data["__streamdata__"] = data["__streamdata__"][:-1] + elif pdf is not None and not pdf.strict: + stream.seek(pstart, 0) + data["__streamdata__"] = DictionaryObject._read_unsized_from_stream(stream, pdf) + pos = stream.tell() + else: + stream.seek(pos, 0) + raise PdfReadError( + "Unable to find 'endstream' marker after stream at byte " + f"{hex(stream.tell())} (nd='{ndstream!r}', end='{end!r}')." + ) + else: + stream.seek(pos, 0) + if "__streamdata__" in data: + return StreamObject.initialize_from_dictionary(data) + retval = DictionaryObject() + retval.update(data) + return retval + + +class TreeObject(DictionaryObject): + def __init__(self, dct: Optional[DictionaryObject] = None) -> None: + DictionaryObject.__init__(self) + if dct: + self.update(dct) + + def has_children(self) -> bool: + return "/First" in self + + def __iter__(self) -> Any: + return self.children() + + def children(self) -> Iterable[Any]: + if not self.has_children(): + return + + child_ref = self[NameObject("/First")] + last = self[NameObject("/Last")] + child = child_ref.get_object() + visited: set[int] = set() + while True: + child_id = id(child) + if child_id in visited: + logger_warning(f"Detected cycle in outline structure for {child}", __name__) + return + visited.add(child_id) + + yield child + + if child == last: + return + child_ref = child.get(NameObject("/Next")) # type: ignore + if is_null_or_none(child_ref): + return + child = child_ref.get_object() + + def add_child(self, child: Any, pdf: PdfWriterProtocol) -> None: + self.insert_child(child, None, pdf) + + def inc_parent_counter_default( + self, parent: Union[None, IndirectObject, "TreeObject"], n: int + ) -> None: + if is_null_or_none(parent): + return + assert parent is not None, "mypy" + parent = cast("TreeObject", parent.get_object()) + if "/Count" in parent: + parent[NameObject("/Count")] = NumberObject( + max(0, cast(int, parent[NameObject("/Count")]) + n) + ) + self.inc_parent_counter_default(parent.get("/Parent", None), n) + + def inc_parent_counter_outline( + self, parent: Union[None, IndirectObject, "TreeObject"], n: int + ) -> None: + if is_null_or_none(parent): + return + assert parent is not None, "mypy" + parent = cast("TreeObject", parent.get_object()) + # BooleanObject requires comparison with == not is + opn = parent.get("/%is_open%", True) == True # noqa: E712 + c = cast(int, parent.get("/Count", 0)) + if c < 0: + c = abs(c) + parent[NameObject("/Count")] = NumberObject((c + n) * (1 if opn else -1)) + if not opn: + return + self.inc_parent_counter_outline(parent.get("/Parent", None), n) + + def insert_child( + self, + child: Any, + before: Any, + pdf: PdfWriterProtocol, + inc_parent_counter: Optional[Callable[..., Any]] = None, + ) -> IndirectObject: + if inc_parent_counter is None: + inc_parent_counter = self.inc_parent_counter_default + child_obj = child.get_object() + assert child.indirect_reference is not None, "mypy" + child_reference: IndirectObject = child.indirect_reference + + prev: Optional[DictionaryObject] + if "/First" not in self: # no child yet + self[NameObject("/First")] = child_reference + self[NameObject("/Count")] = NumberObject(0) + self[NameObject("/Last")] = child_reference + child_obj[NameObject("/Parent")] = self.indirect_reference + inc_parent_counter(self, child_obj.get("/Count", 1)) + if "/Next" in child_obj: + del child_obj["/Next"] + if "/Prev" in child_obj: + del child_obj["/Prev"] + return child_reference + prev = cast("DictionaryObject", self["/Last"]) + + while prev.indirect_reference != before: + if "/Next" in prev: + prev = cast("TreeObject", prev["/Next"]) + else: # append at the end + prev[NameObject("/Next")] = cast("TreeObject", child_reference) + child_obj[NameObject("/Prev")] = prev.indirect_reference + child_obj[NameObject("/Parent")] = self.indirect_reference + if "/Next" in child_obj: + del child_obj["/Next"] + self[NameObject("/Last")] = child_reference + inc_parent_counter(self, child_obj.get("/Count", 1)) + return child_reference + try: # insert as first or in the middle + assert isinstance(prev["/Prev"], DictionaryObject) + prev["/Prev"][NameObject("/Next")] = child_reference + child_obj[NameObject("/Prev")] = prev["/Prev"] + except Exception: # it means we are inserting in first position + del child_obj["/Next"] + child_obj[NameObject("/Next")] = prev + prev[NameObject("/Prev")] = child_reference + child_obj[NameObject("/Parent")] = self.indirect_reference + inc_parent_counter(self, child_obj.get("/Count", 1)) + return child_reference + + def _remove_node_from_tree( + self, prev: Any, prev_ref: Any, cur: Any, last: Any + ) -> None: + """ + Adjust the pointers of the linked list and tree node count. + + Args: + prev: + prev_ref: + cur: + last: + + """ + next_ref = cur.get(NameObject("/Next"), None) + if prev is None: + if next_ref: + # Removing first tree node + next_obj = next_ref.get_object() + del next_obj[NameObject("/Prev")] + self[NameObject("/First")] = next_ref + self[NameObject("/Count")] = NumberObject( + self[NameObject("/Count")] - 1 # type: ignore + ) + + else: + # Removing only tree node + self[NameObject("/Count")] = NumberObject(0) + del self[NameObject("/First")] + if NameObject("/Last") in self: + del self[NameObject("/Last")] + else: + if next_ref: + # Removing middle tree node + next_obj = next_ref.get_object() + next_obj[NameObject("/Prev")] = prev_ref + prev[NameObject("/Next")] = next_ref + else: + # Removing last tree node + assert cur == last + del prev[NameObject("/Next")] + self[NameObject("/Last")] = prev_ref + self[NameObject("/Count")] = NumberObject(self[NameObject("/Count")] - 1) # type: ignore + + def remove_child(self, child: Any) -> None: + child_obj = child.get_object() + child = child_obj.indirect_reference + + if NameObject("/Parent") not in child_obj: + raise ValueError("Removed child does not appear to be a tree item") + if child_obj[NameObject("/Parent")] != self: + raise ValueError("Removed child is not a member of this tree") + + found = False + prev_ref = None + prev = None + cur_ref: Optional[Any] = self[NameObject("/First")] + cur: Optional[dict[str, Any]] = cur_ref.get_object() # type: ignore + last_ref = self[NameObject("/Last")] + last = last_ref.get_object() + while cur is not None: + if cur == child_obj: + self._remove_node_from_tree(prev, prev_ref, cur, last) + found = True + break + + # Go to the next node + prev_ref = cur_ref + prev = cur + if NameObject("/Next") in cur: + cur_ref = cur[NameObject("/Next")] + cur = cur_ref.get_object() + else: + cur_ref = None + cur = None + + if not found: + raise ValueError("Removal couldn't find item in tree") + + _reset_node_tree_relationship(child_obj) + + def remove_from_tree(self) -> None: + """Remove the object from the tree it is in.""" + if NameObject("/Parent") not in self: + raise ValueError("Removed child does not appear to be a tree item") + cast("TreeObject", self["/Parent"]).remove_child(self) + + def empty_tree(self) -> None: + for child in self: + child_obj = child.get_object() + _reset_node_tree_relationship(child_obj) + + if NameObject("/Count") in self: + del self[NameObject("/Count")] + if NameObject("/First") in self: + del self[NameObject("/First")] + if NameObject("/Last") in self: + del self[NameObject("/Last")] + + +def _reset_node_tree_relationship(child_obj: Any) -> None: + """ + Call this after a node has been removed from a tree. + + This resets the nodes attributes in respect to that tree. + + Args: + child_obj: + + """ + del child_obj[NameObject("/Parent")] + if NameObject("/Next") in child_obj: + del child_obj[NameObject("/Next")] + if NameObject("/Prev") in child_obj: + del child_obj[NameObject("/Prev")] + + +class StreamObject(DictionaryObject): + def __init__(self) -> None: + self._data: bytes = b"" + self.decoded_self: Optional[DecodedStreamObject] = None + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "StreamObject": + d__ = cast( + "StreamObject", + self._reference_clone(self.__class__(), pdf_dest, False), + ) + d__._data = self._data + try: + decoded_self = self.decoded_self + if decoded_self is None: + self.decoded_self = None + else: + self.decoded_self = cast( + "DecodedStreamObject", decoded_self.replicate(pdf_dest) + ) + except Exception: + pass + for k, v in self.items(): + d__[k.replicate(pdf_dest)] = ( + v.replicate(pdf_dest) if hasattr(v, "replicate") else v + ) + return d__ + + def _clone( + self, + src: DictionaryObject, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool, + ignore_fields: Optional[Sequence[Union[str, int]]], + visited: set[tuple[int, int]], + ) -> None: + """ + Update the object from src. + + Args: + src: + pdf_dest: + force_duplicate: + ignore_fields: + + """ + self._data = cast("StreamObject", src)._data + try: + decoded_self = cast("StreamObject", src).decoded_self + if decoded_self is None: + self.decoded_self = None + else: + self.decoded_self = cast( + "DecodedStreamObject", + decoded_self.clone(pdf_dest, force_duplicate, ignore_fields), + ) + except Exception: + pass + super()._clone(src, pdf_dest, force_duplicate, ignore_fields, visited) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + # Use _data to prevent errors on non-decoded streams. + return hash((super().hash_bin(), self._data)) + + def get_data(self) -> bytes: + return self._data + + def set_data(self, data: bytes) -> None: + self._data = data + + def hash_value_data(self) -> bytes: + data = super().hash_value_data() + data += self.get_data() + return data + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + self[NameObject(StreamAttributes.LENGTH)] = NumberObject(len(self._data)) + DictionaryObject.write_to_stream(self, stream) + del self[StreamAttributes.LENGTH] + stream.write(b"\nstream\n") + stream.write(self._data) + stream.write(b"\nendstream") + + @staticmethod + def initialize_from_dictionary( + data: dict[str, Any] + ) -> Union["EncodedStreamObject", "DecodedStreamObject"]: + retval: Union[EncodedStreamObject, DecodedStreamObject] + if StreamAttributes.FILTER in data: + retval = EncodedStreamObject() + else: + retval = DecodedStreamObject() + retval._data = data["__streamdata__"] + del data["__streamdata__"] + if StreamAttributes.LENGTH in data: + del data[StreamAttributes.LENGTH] + retval.update(data) + return retval + + def flate_encode(self, level: int = -1) -> "EncodedStreamObject": + from ..filters import FlateDecode # noqa: PLC0415 + + if StreamAttributes.FILTER in self: + f = self[StreamAttributes.FILTER] + if isinstance(f, ArrayObject): + f = ArrayObject([NameObject(FT.FLATE_DECODE), *f]) + try: + params = ArrayObject( + [NullObject(), *self.get(StreamAttributes.DECODE_PARMS, ArrayObject())] + ) + except TypeError: + # case of error where the * operator is not working (not an array + params = ArrayObject( + [NullObject(), self.get(StreamAttributes.DECODE_PARMS, ArrayObject())] + ) + else: + f = ArrayObject([NameObject(FT.FLATE_DECODE), f]) + params = ArrayObject( + [NullObject(), self.get(StreamAttributes.DECODE_PARMS, NullObject())] + ) + else: + f = NameObject(FT.FLATE_DECODE) + params = None + retval = EncodedStreamObject() + retval.update(self) + retval[NameObject(StreamAttributes.FILTER)] = f + if params is not None: + retval[NameObject(StreamAttributes.DECODE_PARMS)] = params + retval._data = FlateDecode.encode(self._data, level) + return retval + + def decode_as_image(self, pillow_parameters: Union[dict[str, Any], None] = None) -> Any: + """ + Try to decode the stream object as an image + + Args: + pillow_parameters: parameters provided to Pillow Image.save() method, + cf. + + Returns: + a PIL image if proper decoding has been found + Raises: + Exception: Errors during decoding will be reported. + It is recommended to catch exceptions to prevent + stops in your program. + + """ + from ._image_xobject import _xobj_to_image # noqa: PLC0415 + + if self.get("/Subtype", "") != "/Image": + try: + msg = f"{self.indirect_reference} does not seem to be an Image" # pragma: no cover + except AttributeError: + msg = f"{self.__repr__()} object does not seem to be an Image" # pragma: no cover + logger_warning(msg, __name__) + extension, _, img = _xobj_to_image(self, pillow_parameters) + if extension is None: + return None # pragma: no cover + return img + + +class DecodedStreamObject(StreamObject): + pass + + +class EncodedStreamObject(StreamObject): + def __init__(self) -> None: + self.decoded_self: Optional[DecodedStreamObject] = None + + # This overrides the parent method + def get_data(self) -> bytes: + from ..filters import decode_stream_data # noqa: PLC0415 + + if self.decoded_self is not None: + # Cached version of decoded object + return self.decoded_self.get_data() + + # Create decoded object + decoded = DecodedStreamObject() + decoded.set_data(decode_stream_data(self)) + for key, value in self.items(): + if key not in (StreamAttributes.LENGTH, StreamAttributes.FILTER, StreamAttributes.DECODE_PARMS): + decoded[key] = value + self.decoded_self = decoded + return decoded.get_data() + + # This overrides the parent method: + def set_data(self, data: bytes) -> None: + from ..filters import FlateDecode # noqa: PLC0415 + + if self.get(StreamAttributes.FILTER, "") in (FT.FLATE_DECODE, [FT.FLATE_DECODE]): + if not isinstance(data, bytes): + raise TypeError("Data must be bytes") + if self.decoded_self is None: + self.get_data() # to create self.decoded_self + assert self.decoded_self is not None, "mypy" + self.decoded_self.set_data(data) + super().set_data(FlateDecode.encode(data)) + else: + raise PdfReadError( + "Streams encoded with a filter different from FlateDecode are not supported" + ) + + +CONTENT_STREAM_ARRAY_MAX_LENGTH = 10_000 + + +class ContentStream(DecodedStreamObject): + """ + In order to be fast, this data structure can contain either: + + * raw data in ._data + * parsed stream operations in ._operations. + + At any time, ContentStream object can either have both of those fields defined, + or one field defined and the other set to None. + + These fields are "rebuilt" lazily, when accessed: + + * when .get_data() is called, if ._data is None, it is rebuilt from ._operations. + * when .operations is called, if ._operations is None, it is rebuilt from ._data. + + Conversely, these fields can be invalidated: + + * when .set_data() is called, ._operations is set to None. + * when .operations is set, ._data is set to None. + """ + + def __init__( + self, + stream: Any, + pdf: Any, + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, + ) -> None: + self.pdf = pdf + self._operations: list[tuple[Any, bytes]] = [] + + # stream may be a StreamObject or an ArrayObject containing + # StreamObjects to be concatenated together. + if stream is None: + super().set_data(b"") + else: + stream = stream.get_object() + if isinstance(stream, ArrayObject): + from pypdf.filters import MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH # noqa: PLC0415 + + if (stream_length := len(stream)) > CONTENT_STREAM_ARRAY_MAX_LENGTH: + raise LimitReachedError( + f"Array-based stream has {stream_length} > {CONTENT_STREAM_ARRAY_MAX_LENGTH} elements." + ) + data = bytearray() + length = 0 + for s in stream: + s_resolved = s.get_object() + if isinstance(s_resolved, NullObject): + continue + if not isinstance(s_resolved, StreamObject): + # No need to emit an exception here for now - the PDF structure + # seems to already be broken beforehand in these cases. + logger_warning( + f"Expected StreamObject, got {type(s_resolved).__name__} instead. Data might be wrong.", + __name__ + ) + else: + new_data = s_resolved.get_data() + length += len(new_data) + if length > MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH: + raise LimitReachedError( + f"Array-based stream has at least {length} > " + f"{MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH} output bytes." + ) + data += new_data + if len(data) == 0 or data[-1:] != b"\n": + # There should be no direct need to check for a change of one byte. + length += 1 + data += b"\n" + super().set_data(bytes(data)) + else: + stream_data = stream.get_data() + assert stream_data is not None + super().set_data(stream_data) + self.forced_encoding = forced_encoding + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "ContentStream": + d__ = cast( + "ContentStream", + self._reference_clone(self.__class__(None, None), pdf_dest, False), + ) + d__._data = self._data + try: + decoded_self = self.decoded_self + if decoded_self is None: + self.decoded_self = None + else: + self.decoded_self = cast( + "DecodedStreamObject", decoded_self.replicate(pdf_dest) + ) + except Exception: + pass + for k, v in self.items(): + d__[k.replicate(pdf_dest)] = ( + v.replicate(pdf_dest) if hasattr(v, "replicate") else v + ) + return d__ + d__.set_data(self._data) + d__.pdf = pdf_dest + d__._operations = list(self._operations) + d__.forced_encoding = self.forced_encoding + return d__ + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "ContentStream": + """ + Clone object into pdf_dest. + + Args: + pdf_dest: + force_duplicate: + ignore_fields: + + Returns: + The cloned ContentStream + + """ + try: + if self.indirect_reference.pdf == pdf_dest and not force_duplicate: # type: ignore + return self + except Exception: + pass + + visited: set[tuple[int, int]] = set() + d__ = cast( + "ContentStream", + self._reference_clone( + self.__class__(None, None), pdf_dest, force_duplicate + ), + ) + if ignore_fields is None: + ignore_fields = [] + d__._clone(self, pdf_dest, force_duplicate, ignore_fields, visited) + return d__ + + def _clone( + self, + src: DictionaryObject, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool, + ignore_fields: Optional[Sequence[Union[str, int]]], + visited: set[tuple[int, int]], + ) -> None: + """ + Update the object from src. + + Args: + src: + pdf_dest: + force_duplicate: + ignore_fields: + + """ + src_cs = cast("ContentStream", src) + super().set_data(src_cs._data) + self.pdf = pdf_dest + self._operations = list(src_cs._operations) + self.forced_encoding = src_cs.forced_encoding + # no need to call DictionaryObjection or anything + # like super(DictionaryObject,self)._clone(src, pdf_dest, force_duplicate, ignore_fields, visited) + + def _parse_content_stream(self, stream: StreamType) -> None: + # 7.8.2 Content Streams + stream.seek(0, 0) + operands: list[Union[int, str, PdfObject]] = [] + while True: + peek = read_non_whitespace(stream) + if peek in (b"", 0): + break + stream.seek(-1, 1) + if peek.isalpha() or peek in (b"'", b'"'): + operator = read_until_regex(stream, NameObject.delimiter_pattern) + if operator == b"BI": + # begin inline image - a completely different parsing + # mechanism is required, of course... thanks buddy... + assert operands == [] + ii = self._read_inline_image(stream) + self._operations.append((ii, b"INLINE IMAGE")) + else: + self._operations.append((operands, operator)) + operands = [] + elif peek == b"%": + # If we encounter a comment in the content stream, we have to + # handle it here. Typically, read_object will handle + # encountering a comment -- but read_object assumes that + # following the comment must be the object we're trying to + # read. In this case, it could be an operator instead. + while peek not in (b"\r", b"\n", b""): + peek = stream.read(1) + else: + operands.append(read_object(stream, None, self.forced_encoding)) + + def _read_inline_image(self, stream: StreamType) -> dict[str, Any]: + # begin reading just after the "BI" - begin image + # first read the dictionary of settings. + settings = DictionaryObject() + while True: + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + if tok == b"I": + # "ID" - begin of image data + break + key = read_object(stream, self.pdf) + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + value = read_object(stream, self.pdf) + settings[key] = value + # left at beginning of ID + tmp = stream.read(3) + assert tmp[:2] == b"ID" + filtr = settings.get("/F", settings.get("/Filter", "not set")) + savpos = stream.tell() + if isinstance(filtr, list): + filtr = filtr[0] # used forencoding + if "AHx" in filtr or "ASCIIHexDecode" in filtr: + data = extract_inline__ascii_hex_decode(stream) + elif "A85" in filtr or "ASCII85Decode" in filtr: + data = extract_inline__ascii85_decode(stream) + elif "RL" in filtr or "RunLengthDecode" in filtr: + data = extract_inline__run_length_decode(stream) + elif "DCT" in filtr or "DCTDecode" in filtr: + data = extract_inline__dct_decode(stream) + elif filtr == "not set": + cs = settings.get("/CS", "") + if isinstance(cs, list): + cs = cs[0] + if "RGB" in cs: + lcs = 3 + elif "CMYK" in cs: + lcs = 4 + else: + bits = settings.get( + "/BPC", + 8 if cs in {"/I", "/G", "/Indexed", "/DeviceGray"} else -1, + ) + if bits > 0: + lcs = bits / 8.0 + else: + data = extract_inline_default(stream) + lcs = -1 + if lcs > 0: + data = stream.read( + ceil(cast(int, settings["/W"]) * lcs) * cast(int, settings["/H"]) + ) + # Move to the `EI` if possible. + ei = read_non_whitespace(stream) + stream.seek(-1, 1) + else: + data = extract_inline_default(stream) + + ei = stream.read(3) + stream.seek(-1, 1) + if ei[:2] != b"EI" or ei[2:3] not in WHITESPACES: + # Deal with wrong/missing `EI` tags. Example: Wrong dimensions specified above. + stream.seek(savpos, 0) + data = extract_inline_default(stream) + ei = stream.read(3) + stream.seek(-1, 1) + if ei[:2] != b"EI" or ei[2:3] not in WHITESPACES: # pragma: no cover + # Check the same condition again. This should never fail as + # edge cases are covered by `extract_inline_default` above, + # but check this ot make sure that we are behind the `EI` afterwards. + raise PdfStreamError( + f"Could not extract inline image, even using fallback. Expected 'EI', got {ei!r}" + ) + return {"settings": settings, "data": data} + + # This overrides the parent method + def get_data(self) -> bytes: + if not self._data: + new_data = BytesIO() + for operands, operator in self._operations: + if operator == b"INLINE IMAGE": + new_data.write(b"BI") + dict_text = BytesIO() + operands["settings"].write_to_stream(dict_text) + new_data.write(dict_text.getvalue()[2:-2]) + new_data.write(b"ID ") + new_data.write(operands["data"]) + new_data.write(b"EI") + else: + for op in operands: + op.write_to_stream(new_data) + new_data.write(b" ") + new_data.write(operator) + new_data.write(b"\n") + self._data = new_data.getvalue() + return self._data + + # This overrides the parent method + def set_data(self, data: bytes) -> None: + super().set_data(data) + self._operations = [] + + @property + def operations(self) -> list[tuple[Any, bytes]]: + if not self._operations and self._data: + self._parse_content_stream(BytesIO(self._data)) + self._data = b"" + return self._operations + + @operations.setter + def operations(self, operations: list[tuple[Any, bytes]]) -> None: + self._operations = operations + self._data = b"" + + def isolate_graphics_state(self) -> None: + if self._operations: + self._operations.insert(0, ([], b"q")) + self._operations.append(([], b"Q")) + elif self._data: + self._data = b"q\n" + self._data + b"\nQ\n" + + # This overrides the parent method + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if not self._data and self._operations: + self.get_data() # this ensures ._data is rebuilt + super().write_to_stream(stream, encryption_key) + + +def read_object( + stream: StreamType, + pdf: Optional[PdfReaderProtocol], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union[PdfObject, int, str, ContentStream]: + tok = stream.read(1) + stream.seek(-1, 1) # reset to start + if tok == b"/": + return NameObject.read_from_stream(stream, pdf) + if tok == b"<": + # hexadecimal string OR dictionary + peek = stream.read(2) + stream.seek(-2, 1) # reset to start + if peek == b"<<": + return DictionaryObject.read_from_stream(stream, pdf, forced_encoding) + return read_hex_string_from_stream(stream, forced_encoding) + if tok == b"[": + return ArrayObject.read_from_stream(stream, pdf, forced_encoding) + if tok in (b"t", b"f"): + return BooleanObject.read_from_stream(stream) + if tok == b"(": + return read_string_from_stream(stream, forced_encoding) + if tok == b"e" and stream.read(6) == b"endobj": + return NullObject() + if tok == b"n": + return NullObject.read_from_stream(stream) + if tok == b"%": + # comment + skip_over_comment(stream) + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + return read_object(stream, pdf, forced_encoding) + if tok in b"0123456789+-.": + # number object OR indirect reference + peek = stream.read(20) + stream.seek(-len(peek), 1) # reset to start + if IndirectPattern.match(peek) is not None: + assert pdf is not None, "mypy" + return IndirectObject.read_from_stream(stream, pdf) + return NumberObject.read_from_stream(stream) + pos = stream.tell() + stream.seek(-20, 1) + stream_extract = stream.read(80) + stream.seek(pos) + read_until_whitespace(stream) + raise PdfReadError( + f"Invalid Elementary Object starting with {tok!r} @{pos}: {stream_extract!r}" + ) + + +class Field(TreeObject): + """ + A class representing a field dictionary. + + This class is accessed through + :meth:`get_fields()` + """ + + def __init__(self, data: DictionaryObject) -> None: + DictionaryObject.__init__(self) + field_attributes = ( + FieldDictionaryAttributes.attributes() + + CheckboxRadioButtonAttributes.attributes() + ) + self.indirect_reference = data.indirect_reference + for attr in field_attributes: + try: + self[NameObject(attr)] = data[attr] + except KeyError: + pass + if isinstance(self.get("/V"), EncodedStreamObject): + d = cast(EncodedStreamObject, self[NameObject("/V")]).get_data() + if isinstance(d, bytes): + d_str = d.decode() + elif d is None: + d_str = "" + else: + raise Exception("Should never happen") + self[NameObject("/V")] = TextStringObject(d_str) + + # TABLE 8.69 Entries common to all field dictionaries + @property + def field_type(self) -> Optional[NameObject]: + """Read-only property accessing the type of this field.""" + return self.get(FieldDictionaryAttributes.FT) + + @property + def parent(self) -> Optional[DictionaryObject]: + """Read-only property accessing the parent of this field.""" + return self.get(FieldDictionaryAttributes.Parent) + + @property + def kids(self) -> Optional["ArrayObject"]: + """Read-only property accessing the kids of this field.""" + return self.get(FieldDictionaryAttributes.Kids) + + @property + def name(self) -> Optional[str]: + """Read-only property accessing the name of this field.""" + return self.get(FieldDictionaryAttributes.T) + + @property + def alternate_name(self) -> Optional[str]: + """Read-only property accessing the alternate name of this field.""" + return self.get(FieldDictionaryAttributes.TU) + + @property + def mapping_name(self) -> Optional[str]: + """ + Read-only property accessing the mapping name of this field. + + This name is used by pypdf as a key in the dictionary returned by + :meth:`get_fields()` + """ + return self.get(FieldDictionaryAttributes.TM) + + @property + def flags(self) -> Optional[int]: + """ + Read-only property accessing the field flags, specifying various + characteristics of the field (see Table 8.70 of the PDF 1.7 reference). + """ + return self.get(FieldDictionaryAttributes.Ff) + + @property + def value(self) -> Optional[Any]: + """ + Read-only property accessing the value of this field. + + Format varies based on field type. + """ + return self.get(FieldDictionaryAttributes.V) + + @property + def default_value(self) -> Optional[Any]: + """Read-only property accessing the default value of this field.""" + return self.get(FieldDictionaryAttributes.DV) + + @property + def additional_actions(self) -> Optional[DictionaryObject]: + """ + Read-only property accessing the additional actions dictionary. + + This dictionary defines the field's behavior in response to trigger + events. See Section 8.5.2 of the PDF 1.7 reference. + """ + return self.get(FieldDictionaryAttributes.AA) + + +class Destination(TreeObject): + """ + A class representing a destination within a PDF file. + + See section 12.3.2 of the PDF 2.0 reference. + + Args: + title: Title of this destination. + page: Reference to the page of this destination. Should + be an instance of :class:`IndirectObject`. + fit: How the destination is displayed. + + Raises: + PdfReadError: If destination type is invalid. + + """ + + node: Optional[ + DictionaryObject + ] = None # node provide access to the original Object + + def __init__( + self, + title: Union[str, bytes], + page: Union[NumberObject, IndirectObject, NullObject, DictionaryObject], + fit: Fit, + ) -> None: + self._filtered_children: list[Any] = [] # used in PdfWriter + + typ = fit.fit_type + args = fit.fit_args + + DictionaryObject.__init__(self) + self[NameObject("/Title")] = TextStringObject(title) + self[NameObject("/Page")] = page + self[NameObject("/Type")] = typ + + # from table 8.2 of the PDF 1.7 reference. + if typ == "/XYZ": + if len(args) < 1: # left is missing : should never occur + args.append(NumberObject(0.0)) + if len(args) < 2: # top is missing + args.append(NumberObject(0.0)) + if len(args) < 3: # zoom is missing + args.append(NumberObject(0.0)) + ( + self[NameObject(TA.LEFT)], + self[NameObject(TA.TOP)], + self[NameObject("/Zoom")], + ) = args + elif len(args) == 0: + pass + elif typ == TF.FIT_R: + ( + self[NameObject(TA.LEFT)], + self[NameObject(TA.BOTTOM)], + self[NameObject(TA.RIGHT)], + self[NameObject(TA.TOP)], + ) = args + elif typ in [TF.FIT_H, TF.FIT_BH]: + try: # Prefer to be more robust not only to null parameters + (self[NameObject(TA.TOP)],) = args + except Exception: + (self[NameObject(TA.TOP)],) = (NullObject(),) + elif typ in [TF.FIT_V, TF.FIT_BV]: + try: # Prefer to be more robust not only to null parameters + (self[NameObject(TA.LEFT)],) = args + except Exception: + (self[NameObject(TA.LEFT)],) = (NullObject(),) + elif typ in [TF.FIT, TF.FIT_B]: + pass + else: + raise PdfReadError(f"Unknown Destination Type: {typ!r}") + + @property + def dest_array(self) -> "ArrayObject": + return ArrayObject( + [self.raw_get("/Page"), self["/Type"]] + + [ + self[x] + for x in ["/Left", "/Bottom", "/Right", "/Top", "/Zoom"] + if x in self + ] + ) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<<\n") + key = NameObject("/D") + key.write_to_stream(stream) + stream.write(b" ") + value = self.dest_array + value.write_to_stream(stream) + + key = NameObject("/S") + key.write_to_stream(stream) + stream.write(b" ") + value_s = NameObject("/GoTo") + value_s.write_to_stream(stream) + + stream.write(b"\n") + stream.write(b">>") + + @property + def title(self) -> Optional[str]: + """Read-only property accessing the destination title.""" + return self.get("/Title") + + @property + def page(self) -> Optional[IndirectObject]: + """Read-only property accessing the IndirectObject of the destination page.""" + return self.get("/Page") + + @property + def typ(self) -> Optional[str]: + """Read-only property accessing the destination type.""" + return self.get("/Type") + + @property + def zoom(self) -> Optional[int]: + """Read-only property accessing the zoom factor.""" + return self.get("/Zoom", None) + + @property + def left(self) -> Optional[FloatObject]: + """Read-only property accessing the left horizontal coordinate.""" + return self.get("/Left", None) + + @property + def right(self) -> Optional[FloatObject]: + """Read-only property accessing the right horizontal coordinate.""" + return self.get("/Right", None) + + @property + def top(self) -> Optional[FloatObject]: + """Read-only property accessing the top vertical coordinate.""" + return self.get("/Top", None) + + @property + def bottom(self) -> Optional[FloatObject]: + """Read-only property accessing the bottom vertical coordinate.""" + return self.get("/Bottom", None) + + @property + def color(self) -> Optional["ArrayObject"]: + """Read-only property accessing the color in (R, G, B) with values 0.0-1.0.""" + return cast( + "ArrayObject", + self.get("/C", ArrayObject([FloatObject(0), FloatObject(0), FloatObject(0)])), + ) + + @property + def font_format(self) -> Optional[OutlineFontFlag]: + """ + Read-only property accessing the font type. + + 1=italic, 2=bold, 3=both + """ + return OutlineFontFlag(self.get("/F", 0)) + + @property + def outline_count(self) -> Optional[int]: + """ + Read-only property accessing the outline count. + + positive = expanded + negative = collapsed + absolute value = number of visible descendants at all levels + """ + return self.get("/Count", None) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_files.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_files.py new file mode 100644 index 0000000000000000000000000000000000000000..d40009f9ab1812c7c6ba8d754c6c99e8c3a95f16 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_files.py @@ -0,0 +1,404 @@ +from __future__ import annotations + +import bisect +from functools import cached_property +from typing import TYPE_CHECKING, cast + +from pypdf._utils import format_iso8824_date, parse_iso8824_date +from pypdf.constants import CatalogAttributes as CA +from pypdf.constants import FileSpecificationDictionaryEntries +from pypdf.constants import PageAttributes as PG +from pypdf.errors import PdfReadError, PyPdfError +from pypdf.generic import ( + ArrayObject, + ByteStringObject, + DecodedStreamObject, + DictionaryObject, + NameObject, + NullObject, + NumberObject, + StreamObject, + TextStringObject, + is_null_or_none, +) + +if TYPE_CHECKING: + import datetime + from collections.abc import Generator + + from pypdf._writer import PdfWriter + + +class EmbeddedFile: + """ + Container holding the information on an embedded file. + + Attributes are evaluated lazily if possible. + + Further information on embedded files can be found in section 7.11 of the PDF 2.0 specification. + """ + def __init__(self, name: str, pdf_object: DictionaryObject, parent: ArrayObject | None = None) -> None: + """ + Args: + name: The (primary) name as provided in the name tree. + pdf_object: The corresponding PDF object to allow retrieving further data. + parent: The parent list. + """ + self._name = name + self.pdf_object = pdf_object + self._parent = parent + + @property + def name(self) -> str: + """The (primary) name of the embedded file as provided in the name tree.""" + return self._name + + @classmethod + def _create_new(cls, writer: PdfWriter, name: str, content: str | bytes) -> EmbeddedFile: + """ + Create a new embedded file and add it to the PdfWriter. + + Args: + writer: The PdfWriter instance to add the embedded file to. + name: The filename to display. + content: The data in the file. + + Returns: + EmbeddedFile instance for the newly created embedded file. + """ + # Convert string content to bytes if needed + if isinstance(content, str): + content = content.encode("latin-1") + + # Create the file entry (the actual embedded file stream) + file_entry = DecodedStreamObject() + file_entry.set_data(content) + file_entry.update({NameObject(PG.TYPE): NameObject("/EmbeddedFile")}) + + # Create the /EF entry + ef_entry = DictionaryObject() + ef_entry.update({NameObject("/F"): writer._add_object(file_entry)}) + + # Create the filespec dictionary + from pypdf.generic import create_string_object # noqa: PLC0415 + filespec = DictionaryObject() + filespec_reference = writer._add_object(filespec) + name_object = cast(TextStringObject, create_string_object(name)) + filespec.update( + { + NameObject(PG.TYPE): NameObject("/Filespec"), + NameObject(FileSpecificationDictionaryEntries.F): name_object, + NameObject(FileSpecificationDictionaryEntries.EF): ef_entry, + } + ) + + # Add the name and filespec to the names array. + # We use the inverse order for insertion, as this allows us to re-use the + # same index. + names_array = cls._get_names_array(writer) + insertion_index = cls._get_insertion_index(names_array, name_object) + names_array.insert(insertion_index, filespec_reference) + names_array.insert(insertion_index, name_object) + + # Return an EmbeddedFile instance + return cls(name=name, pdf_object=filespec, parent=names_array) + + @classmethod + def _get_names_array(cls, writer: PdfWriter) -> ArrayObject: + """Get the names array for embedded files, possibly creating and flattening it.""" + if CA.NAMES not in writer.root_object: + # Add the /Names entry to the catalog. + writer.root_object[NameObject(CA.NAMES)] = writer._add_object(DictionaryObject()) + + names_dict = cast(DictionaryObject, writer.root_object[CA.NAMES]) + if "/EmbeddedFiles" not in names_dict: + # We do not yet have an entry for embedded files. Create and return it. + names = ArrayObject() + embedded_files_names_dictionary = DictionaryObject( + {NameObject(CA.NAMES): names} + ) + names_dict[NameObject("/EmbeddedFiles")] = writer._add_object(embedded_files_names_dictionary) + return names + + # We have an existing embedded files entry. + embedded_files_names_tree = cast(DictionaryObject, names_dict["/EmbeddedFiles"]) + if "/Names" in embedded_files_names_tree: + # Simple case: We already have a flat list. + return cast(ArrayObject, embedded_files_names_tree[NameObject(CA.NAMES)]) + if "/Kids" not in embedded_files_names_tree: + # Invalid case: This is no name tree. + raise PdfReadError("Got neither Names nor Kids in embedded files tree.") + + # Complex case: Convert a /Kids-based name tree to a /Names-based one. + # /Name-based ones are much easier to handle and allow us to simplify the + # actual insertion logic by only having to consider one case. + names = ArrayObject() + kids = cast(ArrayObject, embedded_files_names_tree["/Kids"].get_object()) + embedded_files_names_dictionary = DictionaryObject( + {NameObject(CA.NAMES): names} + ) + names_dict[NameObject("/EmbeddedFiles")] = writer._add_object(embedded_files_names_dictionary) + for kid in kids: + # Write the flattened file entries. As we do not change the actual files, + # this should not have any impact on references to them. + # There might be further (nested) kids here. + # Wait for an example before evaluating an implementation. + for name in kid.get_object().get("/Names", []): + names.append(name) + return names + + @classmethod + def _get_insertion_index(cls, names_array: ArrayObject, name: str) -> int: + keys = [names_array[i].encode("utf-8") for i in range(0, len(names_array), 2)] + name_bytes = name.encode("utf-8") + + start = bisect.bisect_left(keys, name_bytes) + end = bisect.bisect_right(keys, name_bytes) + + if start != end: + return end * 2 + if start == 0: + return 0 + if start == (key_count := len(keys)): + return key_count * 2 + return end * 2 + + @property + def alternative_name(self) -> str | None: + """Retrieve the alternative name (file specification).""" + for key in [FileSpecificationDictionaryEntries.UF, FileSpecificationDictionaryEntries.F]: + # PDF 2.0 reference, table 43: + # > A PDF reader shall use the value of the UF key, when present, instead of the F key. + if key in self.pdf_object: + value = self.pdf_object[key].get_object() + if not is_null_or_none(value): + return cast(str, value) + return None + + @alternative_name.setter + def alternative_name(self, value: TextStringObject | None) -> None: + """Set the alternative name (file specification).""" + if value is None: + if FileSpecificationDictionaryEntries.UF in self.pdf_object: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.UF)] = NullObject() + if FileSpecificationDictionaryEntries.F in self.pdf_object: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.F)] = NullObject() + else: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.UF)] = value + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.F)] = value + + @property + def description(self) -> str | None: + """Retrieve the description.""" + value = self.pdf_object.get(FileSpecificationDictionaryEntries.DESC) + if is_null_or_none(value): + return None + return value + + @description.setter + def description(self, value: TextStringObject | None) -> None: + """Set the description.""" + if value is None: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.DESC)] = NullObject() + else: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.DESC)] = value + + @property + def associated_file_relationship(self) -> str: + """Retrieve the relationship of the referring document to this embedded file.""" + return cast( + NameObject, + self.pdf_object.get("/AFRelationship", NameObject("/Unspecified")), + ) + + @associated_file_relationship.setter + def associated_file_relationship(self, value: NameObject) -> None: + """Set the relationship of the referring document to this embedded file.""" + self.pdf_object[NameObject("/AFRelationship")] = value + + @property + def _embedded_file(self) -> StreamObject: + """Retrieve the actual embedded file stream.""" + if "/EF" not in self.pdf_object: + raise PdfReadError(f"/EF entry not found: {self.pdf_object}") + ef = cast(DictionaryObject, self.pdf_object["/EF"]) + for key in [FileSpecificationDictionaryEntries.UF, FileSpecificationDictionaryEntries.F]: + if key in ef: + return cast(StreamObject, ef[key].get_object()) + raise PdfReadError(f"No /(U)F key found in file dictionary: {ef}") + + @property + def _params(self) -> DictionaryObject: + """Retrieve the file-specific parameters.""" + return cast(DictionaryObject, self._embedded_file.get("/Params", DictionaryObject()).get_object()) + + @cached_property + def _ensure_params(self) -> DictionaryObject: + """Ensure the /Params dictionary exists and return it.""" + embedded_file = self._embedded_file + if "/Params" not in embedded_file: + embedded_file[NameObject("/Params")] = DictionaryObject() + return cast(DictionaryObject, embedded_file["/Params"]) + + @property + def subtype(self) -> str | None: + """Retrieve the subtype. This is a MIME media type, prefixed by a slash.""" + value = self._embedded_file.get("/Subtype") + if is_null_or_none(value): + return None + return value + + @subtype.setter + def subtype(self, value: NameObject | None) -> None: + """Set the subtype. This should be a MIME media type, prefixed by a slash.""" + embedded_file = self._embedded_file + if value is None: + embedded_file[NameObject("/Subtype")] = NullObject() + else: + embedded_file[NameObject("/Subtype")] = value + + @property + def content(self) -> bytes: + """Retrieve the actual file content.""" + return self._embedded_file.get_data() + + @content.setter + def content(self, value: str | bytes) -> None: + """Set the file content.""" + if isinstance(value, str): + value = value.encode("latin-1") + self._embedded_file.set_data(value) + + @property + def size(self) -> int | None: + """Retrieve the size of the uncompressed file in bytes.""" + value = self._params.get("/Size") + if is_null_or_none(value): + return None + return value + + @size.setter + def size(self, value: NumberObject | None) -> None: + """Set the size of the uncompressed file in bytes.""" + params = self._ensure_params + if value is None: + params[NameObject("/Size")] = NullObject() + else: + params[NameObject("/Size")] = value + + @property + def creation_date(self) -> datetime.datetime | None: + """Retrieve the file creation datetime.""" + return parse_iso8824_date(self._params.get("/CreationDate")) + + @creation_date.setter + def creation_date(self, value: datetime.datetime | None) -> None: + """Set the file creation datetime.""" + params = self._ensure_params + if value is None: + params[NameObject("/CreationDate")] = NullObject() + else: + date_str = format_iso8824_date(value) + params[NameObject("/CreationDate")] = TextStringObject(date_str) + + @property + def modification_date(self) -> datetime.datetime | None: + """Retrieve the datetime of the last file modification.""" + return parse_iso8824_date(self._params.get("/ModDate")) + + @modification_date.setter + def modification_date(self, value: datetime.datetime | None) -> None: + """Set the datetime of the last file modification.""" + params = self._ensure_params + if value is None: + params[NameObject("/ModDate")] = NullObject() + else: + date_str = format_iso8824_date(value) + params[NameObject("/ModDate")] = TextStringObject(date_str) + + @property + def checksum(self) -> bytes | None: + """Retrieve the MD5 checksum of the (uncompressed) file.""" + value = self._params.get("/CheckSum") + if is_null_or_none(value): + return None + return value + + @checksum.setter + def checksum(self, value: ByteStringObject | None) -> None: + """Set the MD5 checksum of the (uncompressed) file.""" + params = self._ensure_params + if value is None: + params[NameObject("/CheckSum")] = NullObject() + else: + params[NameObject("/CheckSum")] = value + + def delete(self) -> None: + """Delete the file from the document.""" + if not self._parent: + raise PyPdfError("Parent required to delete file from document.") + if self.pdf_object in self._parent: + index = self._parent.index(self.pdf_object) + elif ( + (indirect_reference := getattr(self.pdf_object, "indirect_reference", None)) is not None + and indirect_reference in self._parent + ): + index = self._parent.index(indirect_reference) + else: + raise PyPdfError("File not found in parent object.") + self._parent.pop(index) # Reference. + self._parent.pop(index - 1) # Name. + self.pdf_object = DictionaryObject() # Invalidate. + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} name={self.name!r}>" + + @classmethod + def _load_from_names(cls, names: ArrayObject) -> Generator[EmbeddedFile]: + """ + Convert the given name tree into class instances. + + Args: + names: The name tree to load the data from. + + Returns: + Iterable of class instances for the files found. + """ + # This is a name tree of the format [name_1, reference_1, name_2, reference_2, ...] + for i, name in enumerate(names): + if not isinstance(name, str): + # Skip plain strings and retrieve them as `direct_name` by index. + file_dictionary = name.get_object() + direct_name = names[i - 1].get_object() + yield EmbeddedFile(name=direct_name, pdf_object=file_dictionary, parent=names) + + @classmethod + def _load(cls, catalog: DictionaryObject) -> Generator[EmbeddedFile]: + """ + Load the embedded files for the given document catalog. + + This method and its signature are considered internal API and thus not exposed publicly for now. + + Args: + catalog: The document catalog to load from. + + Returns: + Iterable of class instances for the files found. + """ + try: + container = cast( + DictionaryObject, + cast(DictionaryObject, catalog["/Names"])["/EmbeddedFiles"], + ) + except KeyError: + return + + if "/Kids" in container: + for kid in cast(ArrayObject, container["/Kids"].get_object()): + # There might be further (nested) kids here. + # Wait for an example before evaluating an implementation. + kid = kid.get_object() + if "/Names" in kid: + yield from cls._load_from_names(cast(ArrayObject, kid["/Names"])) + if "/Names" in container: + yield from cls._load_from_names(cast(ArrayObject, container["/Names"])) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_fit.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_fit.py new file mode 100644 index 0000000000000000000000000000000000000000..293066ad37cbab19401312c41c6d070fdb6a7971 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_fit.py @@ -0,0 +1,174 @@ +from typing import Any, Optional, Union + +from ._base import is_null_or_none + + +class Fit: + def __init__( + self, fit_type: str, fit_args: tuple[Union[None, float, Any], ...] = () + ) -> None: + from ._base import FloatObject, NameObject, NullObject, NumberObject # noqa: PLC0415 + + self.fit_type = NameObject(fit_type) + self.fit_args: list[Union[NullObject, FloatObject, NumberObject]] = [ + NullObject() if is_null_or_none(a) else FloatObject(a) for a in fit_args + ] + + @classmethod + def xyz( + cls, + left: Optional[float] = None, + top: Optional[float] = None, + zoom: Optional[float] = None, + ) -> "Fit": + """ + Display the page designated by page, with the coordinates (left, top) + positioned at the upper-left corner of the window and the contents + of the page magnified by the factor zoom. + + A null value for any of the parameters left, top, or zoom specifies + that the current value of that parameter is to be retained unchanged. + + A zoom value of 0 has the same meaning as a null value. + + Args: + left: + top: + zoom: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/XYZ", fit_args=(left, top, zoom)) + + @classmethod + def fit(cls) -> "Fit": + """ + Display the page designated by page, with its contents magnified just + enough to fit the entire page within the window both horizontally and + vertically. + + If the required horizontal and vertical magnification factors are + different, use the smaller of the two, centering the page within the + window in the other dimension. + """ + return Fit(fit_type="/Fit") + + @classmethod + def fit_horizontally(cls, top: Optional[float] = None) -> "Fit": + """ + Display the page designated by page, with the vertical coordinate top + positioned at the top edge of the window and the contents of the page + magnified just enough to fit the entire width of the page within the + window. + + A null value for ``top`` specifies that the current value of that + parameter is to be retained unchanged. + + Args: + top: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitH", fit_args=(top,)) + + @classmethod + def fit_vertically(cls, left: Optional[float] = None) -> "Fit": + return Fit(fit_type="/FitV", fit_args=(left,)) + + @classmethod + def fit_rectangle( + cls, + left: Optional[float] = None, + bottom: Optional[float] = None, + right: Optional[float] = None, + top: Optional[float] = None, + ) -> "Fit": + """ + Display the page designated by page, with its contents magnified + just enough to fit the rectangle specified by the coordinates + left, bottom, right, and top entirely within the window + both horizontally and vertically. + + If the required horizontal and vertical magnification factors are + different, use the smaller of the two, centering the rectangle within + the window in the other dimension. + + A null value for any of the parameters may result in unpredictable + behavior. + + Args: + left: + bottom: + right: + top: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitR", fit_args=(left, bottom, right, top)) + + @classmethod + def fit_box(cls) -> "Fit": + """ + Display the page designated by page, with its contents magnified just + enough to fit its bounding box entirely within the window both + horizontally and vertically. + + If the required horizontal and vertical magnification factors are + different, use the smaller of the two, centering the bounding box + within the window in the other dimension. + """ + return Fit(fit_type="/FitB") + + @classmethod + def fit_box_horizontally(cls, top: Optional[float] = None) -> "Fit": + """ + Display the page designated by page, with the vertical coordinate top + positioned at the top edge of the window and the contents of the page + magnified just enough to fit the entire width of its bounding box + within the window. + + A null value for top specifies that the current value of that parameter + is to be retained unchanged. + + Args: + top: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitBH", fit_args=(top,)) + + @classmethod + def fit_box_vertically(cls, left: Optional[float] = None) -> "Fit": + """ + Display the page designated by page, with the horizontal coordinate + left positioned at the left edge of the window and the contents of the + page magnified just enough to fit the entire height of its bounding box + within the window. + + A null value for left specifies that the current value of that + parameter is to be retained unchanged. + + Args: + left: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitBV", fit_args=(left,)) + + def __str__(self) -> str: + if not self.fit_args: + return f"Fit({self.fit_type})" + return f"Fit({self.fit_type}, {self.fit_args})" + + +DEFAULT_FIT = Fit.fit() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_image_inline.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_image_inline.py new file mode 100644 index 0000000000000000000000000000000000000000..82e423a18079b72066a9f5f9a32990f800d7641c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_image_inline.py @@ -0,0 +1,315 @@ +# Copyright (c) 2024, pypdf contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import logging +from io import BytesIO +from typing import IO + +from .._utils import ( + WHITESPACES, + WHITESPACES_AS_BYTES, + BinaryStreamType, + StreamType, + logger_warning, + read_non_whitespace, +) +from ..errors import PdfReadError + +logger = logging.getLogger(__name__) + +# An inline image should be used only for small images (4096 bytes or less), +# but allow twice this for cases where this has been exceeded. +BUFFER_SIZE = 8192 + + +def _check_end_image_marker(stream: StreamType) -> bool: + ei_tok = read_non_whitespace(stream) + ei_tok += stream.read(2) + stream.seek(-3, 1) + return ei_tok[:2] == b"EI" and (ei_tok[2:3] == b"" or ei_tok[2:3] in WHITESPACES) + + +def extract_inline__ascii_hex_decode(stream: StreamType) -> bytes: + """ + Extract HexEncoded stream from inline image. + The stream will be moved onto the EI. + """ + data_out = bytearray() + # Read data until delimiter > and EI as backup. + while True: + data_buffered = read_non_whitespace(stream) + stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_tok = data_buffered.find(b">") + if pos_tok >= 0: # found > + data_out += data_buffered[: pos_tok + 1] + stream.seek(-len(data_buffered) + pos_tok + 1, 1) + break + pos_ei = data_buffered.find(b"EI") + if pos_ei >= 0: # found EI + stream.seek(-len(data_buffered) + pos_ei - 1, 1) + c = stream.read(1) + while c in WHITESPACES: + stream.seek(-2, 1) + c = stream.read(1) + pos_ei -= 1 + data_out += data_buffered[:pos_ei] + break + if len(data_buffered) == 2: + data_out += data_buffered + raise PdfReadError("Unexpected end of stream") + # Neither > nor EI found + data_out += data_buffered[:-2] + stream.seek(-2, 1) + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline__ascii85_decode(stream: StreamType) -> bytes: + """ + Extract A85 stream from inline image. + The stream will be moved onto the EI. + """ + data_out = bytearray() + # Read data until delimiter ~> + while True: + data_buffered = read_non_whitespace(stream) + stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_tok = data_buffered.find(b"~>") + if pos_tok >= 0: # found! + data_out += data_buffered[: pos_tok + 2] + stream.seek(-len(data_buffered) + pos_tok + 2, 1) + break + if len(data_buffered) == 2: # end of buffer + data_out += data_buffered + raise PdfReadError("Unexpected end of stream") + data_out += data_buffered[ + :-2 + ] # back by one char in case of in the middle of ~> + stream.seek(-2, 1) + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline__run_length_decode(stream: StreamType) -> bytes: + """ + Extract RL (RunLengthDecode) stream from inline image. + The stream will be moved onto the EI. + """ + data_out = bytearray() + # Read data until delimiter 128 + while True: + data_buffered = stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_tok = data_buffered.find(b"\x80") + if pos_tok >= 0: # found + # Ideally, we could just use plain run-length decoding here, where 80_16 = 128_10 + # marks the EOD. But there apparently are cases like in issue #3517, where we have + # an inline image with up to 51 EOD markers. In these cases, be resilient here and + # use the default `EI` marker detection instead. Please note that this fallback + # still omits special `EI` handling within the stream, but for now assume that having + # both of these cases occur at the same time is very unlikely (and the image stream + # is broken anyway). + # For now, do not skip over more than one whitespace character. + after_token = data_buffered[pos_tok + 1 : pos_tok + 4] + if after_token.startswith(b"EI") or after_token.endswith(b"EI"): + data_out += data_buffered[: pos_tok + 1] + stream.seek(-len(data_buffered) + pos_tok + 1, 1) + else: + logger_warning("Early EOD in RunLengthDecode of inline image, using fallback.", __name__) + ei_marker = data_buffered.find(b"EI") + if ei_marker > 0: + data_out += data_buffered[: ei_marker] + stream.seek(-len(data_buffered) + ei_marker - 1, 1) + break + data_out += data_buffered + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline__dct_decode(stream: BinaryStreamType) -> bytes: + """ + Extract DCT (JPEG) stream from inline image. + The stream will be moved onto the EI. + """ + def read(length: int) -> bytes: + # If 0 bytes are returned, and *size* was not 0, this indicates end of file. + # If the object is in non-blocking mode and no bytes are available, `None` is returned. + _result = stream.read(length) + if _result is None or len(_result) != length: + raise PdfReadError("Unexpected end of stream") + return _result + + data_out = bytearray() + # Read Blocks of data (ID/Size/data) up to ID=FF/D9 + # https://www.digicamsoft.com/itu/itu-t81-36.html + not_first = False + while True: + c = read(1) + if not_first or (c == b"\xff"): + data_out += c + if c != b"\xff": + continue + not_first = True + c = read(1) + data_out += c + if c == b"\xff": + stream.seek(-1, 1) # pragma: no cover + elif c == b"\x00": # stuffing + pass + elif c == b"\xd9": # end + break + elif c in ( + b"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc9\xca\xcb\xcc\xcd\xce\xcf" + b"\xda\xdb\xdc\xdd\xde\xdf" + b"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xfe" + ): + c = read(2) + data_out += c + sz = c[0] * 256 + c[1] + data_out += read(sz - 2) + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline_default(stream: StreamType) -> bytes: + """Legacy method, used by default""" + stream_out = BytesIO() + # Read the inline image, while checking for EI (End Image) operator. + while True: + data_buffered = stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_ei = data_buffered.find( + b"E" + ) # We can not look straight for "EI" because it may not have been loaded in the buffer + + if pos_ei == -1: + stream_out.write(data_buffered) + else: + # Write out everything including E (the one from EI to be removed) + stream_out.write(data_buffered[0 : pos_ei + 1]) + sav_pos_ei = stream_out.tell() - 1 + # Seek back in the stream to read the E next + stream.seek(pos_ei + 1 - len(data_buffered), 1) + saved_pos = stream.tell() + # Check for End Image + tok2 = stream.read(1) # I of "EI" + if tok2 != b"I": + stream.seek(saved_pos, 0) + continue + tok3 = stream.read(1) # possible space after "EI" + if tok3 not in WHITESPACES: + stream.seek(saved_pos, 0) + continue + while tok3 in WHITESPACES: + tok3 = stream.read(1) + if data_buffered[pos_ei - 1 : pos_ei] not in WHITESPACES and tok3 not in { + b"Q", + b"E", + }: # for Q or EMC + stream.seek(saved_pos, 0) + continue + if is_followed_by_binary_data(stream): + # Inline image contains `EI ` sequence usually marking the end of it, but + # is followed by binary data which does not make sense for the actual end. + stream.seek(saved_pos, 0) + continue + # Data contains [\s]EI[\s](Q|EMC): 4 chars are sufficient + # remove E(I) wrongly inserted earlier + stream.seek(saved_pos - 1, 0) + stream_out.truncate(sav_pos_ei) + break + + return stream_out.getvalue() + + +def is_followed_by_binary_data(stream: IO[bytes], length: int = 10) -> bool: + """ + Check if the next bytes of the stream look like binary image data or regular page content. + + This is just some heuristics due to the PDF specification being too imprecise about + inline images containing the `EI` marker which would end an image. Starting with PDF 2.0, + we finally get a mandatory length field, but with (proper) PDF 2.0 support being very limited + everywhere, we should not expect to be able to remove such hacks in the near future - especially + considering legacy documents as well. + + The actual implementation draws some inspiration from + https://github.com/itext/itext-java/blob/9.1.0/kernel/src/main/java/com/itextpdf/kernel/pdf/canvas/parser/util/InlineImageParsingUtils.java + """ + position = stream.tell() + data = stream.read(length) + stream.seek(position) + if not data: + return False + operator_start = None + operator_end = None + + for index, byte in enumerate(data): + if byte < 32 and byte not in WHITESPACES_AS_BYTES: + # This covers all characters not being displayable directly, although omitting whitespace + # to allow for operator detection. + return True + is_whitespace = byte in WHITESPACES_AS_BYTES + if operator_start is None and not is_whitespace: + # Interpret all other non-whitespace characters as the start of an operation. + operator_start = index + if operator_start is not None and is_whitespace: + # A whitespace stops an operation. + # Assume that having an inline image with tons of whitespace is rather unlikely. + operator_end = index + break + + if operator_start is None: + # Inline images should not have tons of whitespaces, which would lead to no operator start. + return False + if operator_end is None: + # We probably are inside an operation. + operator_end = length + operator_length = operator_end - operator_start + operator = data[operator_start:operator_end] + if operator.startswith(b"/") and operator_length > 1: + # Name object. + return False + if operator.replace(b".", b"").isdigit(): + # Graphics operator, for example a move. A number (integer or float). + return False + if operator_length > 3: # noqa: SIM103 + # Usually, the operators inside a content stream should not have more than three characters, + # especially after an inline image. + return True + return False diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_image_xobject.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_image_xobject.py new file mode 100644 index 0000000000000000000000000000000000000000..04ebb6036e2635db72a26ea402c32dc2777a7d45 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_image_xobject.py @@ -0,0 +1,590 @@ +"""Functions to convert an image XObject to an image""" + +import sys +from io import BytesIO +from typing import Any, Literal, Optional, Union, cast + +from .._utils import check_if_whitespace_only, logger_warning +from ..constants import ColorSpaces, StreamAttributes +from ..constants import FilterTypes as FT +from ..constants import ImageAttributes as IA +from ..errors import EmptyImageDataError, LimitReachedError, PdfReadError +from ..generic import ( + ArrayObject, + DecodedStreamObject, + EncodedStreamObject, + NullObject, + TextStringObject, + is_null_or_none, +) + +if sys.version_info[:2] >= (3, 10): + from typing import TypeAlias +else: + from typing_extensions import TypeAlias + + +try: + from PIL import Image, UnidentifiedImageError +except ImportError: + raise ImportError( + "pillow is required to do image extraction. " + "It can be installed via 'pip install pypdf[image]'" + ) + +mode_str_type: TypeAlias = Literal[ + "", "1", "RGB", "2bits", "4bits", "P", "L", "RGBA", "CMYK" +] + +MAX_IMAGE_MODE_NESTING_DEPTH: int = 10 + + +def _get_image_mode( + color_space: Union[str, list[Any], Any], + color_components: int, + prev_mode: mode_str_type, + depth: int = 0, +) -> tuple[mode_str_type, bool]: + """ + Returns: + Image mode, not taking into account mask (transparency). + ColorInversion is required (like for some DeviceCMYK). + + """ + if depth > MAX_IMAGE_MODE_NESTING_DEPTH: + raise PdfReadError( + "Color spaces nested too deeply. If required, consider increasing MAX_IMAGE_MODE_NESTING_DEPTH." + ) + if is_null_or_none(color_space): + return "", False + color_space_str: str = "" + if isinstance(color_space, str): + color_space_str = color_space + elif not isinstance(color_space, list): + raise PdfReadError( + "Cannot interpret color space", color_space + ) # pragma: no cover + elif not color_space: + return "", False + elif color_space[0].startswith("/Cal"): # /CalRGB or /CalGray + color_space_str = "/Device" + color_space[0][4:] + elif color_space[0] == "/ICCBased": + icc_profile = color_space[1].get_object() + color_components = cast(int, icc_profile["/N"]) + color_space_str = icc_profile.get("/Alternate", "") + elif color_space[0] == "/Indexed": + color_space_str = color_space[1].get_object() + mode, invert_color = _get_image_mode( + color_space_str, color_components, prev_mode, depth + 1 + ) + if mode in ("RGB", "CMYK"): + mode = "P" + return mode, invert_color + elif color_space[0] == "/Separation": + color_space_str = color_space[2].get_object() + mode, invert_color = _get_image_mode( + color_space_str, color_components, prev_mode, depth + 1 + ) + return mode, True + elif color_space[0] == "/DeviceN": + original_color_space = color_space + color_components = len(color_space[1]) + color_space_str = color_space[2].get_object() + if color_space_str == "/DeviceCMYK" and color_components == 1: + if original_color_space[1][0] != "/Black": + logger_warning( + f"Color {original_color_space[1][0]} converted to Gray. Please share PDF with pypdf dev team", + __name__, + ) + return "L", True + mode, invert_color = _get_image_mode( + color_space_str, color_components, prev_mode, depth + 1 + ) + return mode, invert_color + + mode_map: dict[str, mode_str_type] = { + "1bit": "1", # must be zeroth position: color_components may index the values + "/DeviceGray": "L", # must be first position: color_components may index the values + "palette": "P", # must be second position: color_components may index the values + "/DeviceRGB": "RGB", # must be third position: color_components may index the values + "/DeviceCMYK": "CMYK", # must be fourth position: color_components may index the values + "2bit": "2bits", + "4bit": "4bits", + } + + mode = ( + mode_map.get(color_space_str) + or list(mode_map.values())[color_components] + or prev_mode + ) + + return mode, mode == "CMYK" + + +def bits2byte(data: bytes, size: tuple[int, int], bits: int) -> bytes: + from pypdf.filters import FLATE_MAX_BUFFER_SIZE # noqa: PLC0415 + + buffer_size = size[0] * size[1] + if buffer_size > FLATE_MAX_BUFFER_SIZE: + raise LimitReachedError(f"Requested buffer size {buffer_size} exceeds limit of {FLATE_MAX_BUFFER_SIZE}.") + + byte_buffer = bytearray(buffer_size) + mask = (1 << bits) - 1 + data_index = 0 + bit = 8 - bits + for y in range(size[1]): + if bit != 8 - bits: + data_index += 1 + bit = 8 - bits + for x in range(size[0]): + byte_buffer[x + y * size[0]] = (data[data_index] >> bit) & mask + bit -= bits + if bit < 0: + data_index += 1 + bit = 8 - bits + return bytes(byte_buffer) + + +def _extended_image_from_bytes( + mode: str, size: tuple[int, int], data: bytes +) -> Image.Image: + try: + img = Image.frombytes(mode, size, data) + except ValueError as exc: + nb_pix = size[0] * size[1] + data_length = len(data) + if data_length == 0: + raise EmptyImageDataError( + "Data is 0 bytes, cannot process an image from empty data." + ) from exc + if data_length % nb_pix != 0: + raise exc + k = nb_pix * len(mode) / data_length + data = b"".join(bytes((x,) * int(k)) for x in data) + img = Image.frombytes(mode, size, data) + return img + + +def __handle_flate__indexed(color_space: ArrayObject) -> tuple[Any, Any, Any, Any]: + count = len(color_space) + if count == 4: + color_space, base, hival, lookup = (value.get_object() for value in color_space) + return color_space, base, hival, lookup + + # Deal with strange AutoDesk files where `base` and `hival` look like this: + # /DeviceRGB\x00255 + element1 = color_space[1] + element1 = element1 if isinstance(element1, str) else element1.get_object() + if count == 3 and "\x00" in element1: + color_space, lookup = color_space[0].get_object(), color_space[2].get_object() + base, hival = element1.split("\x00") + hival = int(hival) + return color_space, base, hival, lookup + raise PdfReadError(f"Expected color space with 4 values, got {count}: {color_space}") + + +def _handle_flate( + size: tuple[int, int], + data: bytes, + mode: mode_str_type, + color_space: Union[str, ArrayObject], + colors: int, + obj_as_text: str, +) -> tuple[Image.Image, str, str, bool]: + """ + Process image encoded in flateEncode + Returns img, image_format, extension, color inversion + """ + extension = ".png" # mime_type: "image/png" + image_format = "PNG" + lookup: Any + base: Any + hival: Any + if isinstance(color_space, ArrayObject) and color_space[0] == "/Indexed": + color_space, base, hival, lookup = __handle_flate__indexed(color_space) + if mode == "2bits": + mode = "P" + data = bits2byte(data, size, 2) + elif mode == "4bits": + mode = "P" + data = bits2byte(data, size, 4) + img = _extended_image_from_bytes(mode, size, data) + if color_space == "/Indexed": + if isinstance(lookup, (EncodedStreamObject, DecodedStreamObject)): + lookup = lookup.get_data() + if isinstance(lookup, TextStringObject): + lookup = lookup.original_bytes + if isinstance(lookup, str): + lookup = lookup.encode() + try: + nb, conv, mode = { # type: ignore + "1": (0, "", ""), + "L": (1, "P", "L"), + "P": (0, "", ""), + "RGB": (3, "P", "RGB"), + "CMYK": (4, "P", "CMYK"), + }[_get_image_mode(base, 0, "")[0]] + except KeyError: # pragma: no cover + logger_warning( + f"Base {base} not coded please share the pdf file with pypdf dev team", + __name__, + ) + lookup = None + else: + if img.mode == "1": + # Two values ("high" and "low"). + expected_count = 2 * nb + actual_count = len(lookup) + if actual_count != expected_count: + if actual_count < expected_count: + logger_warning( + f"Not enough lookup values: Expected {expected_count}, got {actual_count}.", + __name__ + ) + lookup += bytes([0] * (expected_count - actual_count)) + elif not check_if_whitespace_only(lookup[expected_count:]): + logger_warning( + f"Too many lookup values: Expected {expected_count}, got {actual_count}.", + __name__ + ) + lookup = lookup[:expected_count] + colors_arr = [lookup[:nb], lookup[nb:]] + arr = b"".join( + b"".join( + colors_arr[1 if img.getpixel((x, y)) > 127 else 0] # type: ignore[operator,unused-ignore] # TODO: Remove unused-ignore on Python 3.10 + for x in range(img.size[0]) + ) + for y in range(img.size[1]) + ) + img = Image.frombytes(mode, img.size, arr) + else: + img = img.convert(conv) + if len(lookup) != (hival + 1) * nb: + logger_warning(f"Invalid Lookup Table in {obj_as_text}", __name__) + lookup = None + elif mode == "L": + # gray lookup does not work: it is converted to a similar RGB lookup + lookup = b"".join([bytes([b, b, b]) for b in lookup]) + mode = "RGB" + # TODO: https://github.com/py-pdf/pypdf/pull/2039 + # this is a work around until PIL is able to process CMYK images + elif mode == "CMYK": + _rgb = [] + for _c, _m, _y, _k in ( + lookup[n : n + 4] for n in range(0, 4 * (len(lookup) // 4), 4) + ): + _r = int(255 * (1 - _c / 255) * (1 - _k / 255)) + _g = int(255 * (1 - _m / 255) * (1 - _k / 255)) + _b = int(255 * (1 - _y / 255) * (1 - _k / 255)) + _rgb.append(bytes((_r, _g, _b))) + lookup = b"".join(_rgb) + mode = "RGB" + if lookup is not None: + img.putpalette(lookup, rawmode=mode) + img = img.convert("L" if base == ColorSpaces.DEVICE_GRAY else "RGB") + elif not is_null_or_none(color_space) and color_space[0] == "/ICCBased": + # Exclude pure black-and-white images. + # TODO: The remaining code still does not look correct. Shouldn't the proper way be + # to use the original image and apply the ICC transformation on it? + # For now, this just loads the original image with a different color space. + if mode != "1": + # Table 65 - Additional Entries Specific to an ICC Profile Stream Dictionary + mode2 = _get_image_mode(color_space, colors, mode)[0] + if mode != mode2: + img = Image.frombytes(mode, size, data) # reloaded as mode may have changed + if mode == "CMYK": + extension = ".tif" + image_format = "TIFF" + return img, image_format, extension, False + + +def _handle_jpx( + size: tuple[int, int], + data: bytes, + mode: mode_str_type, + color_space: str, + colors: int, +) -> tuple[Image.Image, str, str, bool]: + """ + Process image encoded as JPX/JPEG2000 + Returns img, image_format, extension, inversion + """ + extension = ".jp2" # mime_type: "image/x-jp2" + img1: Image.Image = Image.open(BytesIO(data), formats=("JPEG2000",)) + mode, invert_color = _get_image_mode(color_space, colors, mode) + if mode == "": + mode = cast(mode_str_type, img1.mode) + invert_color = mode == "CMYK" + if img1.mode == "RGBA" and mode == "RGB": + mode = "RGBA" + # we need to convert to the good mode + if img1.mode == mode or {img1.mode, mode} == {"L", "P"}: # compare (unordered) sets + # L and P are indexed modes which should not be changed. + img = img1 + elif {img1.mode, mode} == {"RGBA", "CMYK"}: + # RGBA / CMYK are 4bytes encoding where + # the encoding should be corrected + img = Image.frombytes(mode, img1.size, img1.tobytes()) + else: # pragma: no cover + img = img1.convert(mode) + # CMYK conversion + # https://stackverflow.com/questions/38855022/ + if img.mode == "CMYK" and color_space == "/ICCBased": + img = img.convert("RGB") + image_format = "JPEG2000" + return img, image_format, extension, invert_color + + +def _apply_decode( + img: Image.Image, + x_object_obj: dict[str, Any], + lfilters: FT, + color_space: Union[str, list[Any], Any], + invert_color: bool, +) -> Image.Image: + # CMYK image and other color spaces without decode + # requires reverting scale (cf p243,2§ last sentence) + if IA.DECODE in x_object_obj: + decode = x_object_obj[IA.DECODE] + # if invert_color and lfilters == FT.DCT_DECODE: + # decode = list(reversed(decode)) + elif img.mode == "CMYK" and lfilters == FT.JPX_DECODE: + decode = [1.0, 0.0] if not invert_color else [0.0, 1.0] + decode = decode * len(img.getbands()) + elif (img.mode == "CMYK" and lfilters == FT.DCT_DECODE) or (invert_color and img.mode == "L"): + decode = [1.0, 0.0] * len(img.getbands()) + else: + decode = None + + if ( + isinstance(color_space, ArrayObject) + and color_space[0].get_object() == "/Indexed" + ): + decode = None # decode is meaningless if Indexed + if ( + isinstance(color_space, ArrayObject) + and color_space[0].get_object() == "/Separation" + ): + decode = [1.0, 0.0] * len(img.getbands()) + if decode is not None and not all(decode[i] == i % 2 for i in range(len(decode))): + lut: list[int] = [] + for i in range(0, len(decode), 2): + dmin = decode[i] + dmax = decode[i + 1] + lut.extend( + round(255.0 * (j / 255.0 * (dmax - dmin) + dmin)) for j in range(256) + ) + img = img.point(lut) + return img + + +def _get_mode_and_invert_color( + x_object_obj: dict[str, Any], colors: int, color_space: Union[str, list[Any], Any] +) -> tuple[mode_str_type, bool]: + if ( + IA.COLOR_SPACE in x_object_obj + and x_object_obj[IA.COLOR_SPACE] == ColorSpaces.DEVICE_RGB + ): + # https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes + mode: mode_str_type = "RGB" + if x_object_obj.get("/BitsPerComponent", 8) < 8: + mode, invert_color = _get_image_mode( + f"{x_object_obj.get('/BitsPerComponent', 8)}bit", 0, "" + ) + else: + mode, invert_color = _get_image_mode( + color_space, + 2 + if ( + colors == 1 + and ( + not is_null_or_none(color_space) + and "Gray" not in color_space + ) + ) + else colors, + "", + ) + return mode, invert_color + + +def _xobj_to_image( + x_object: dict[str, Any], + pillow_parameters: Union[dict[str, Any], None] = None +) -> tuple[Optional[str], bytes, Any]: + """ + Users need to have the pillow package installed. + + It's unclear if pypdf will keep this function here, hence it's private. + It might get removed at any point. + + Args: + x_object: + pillow_parameters: parameters provided to Pillow Image.save() method, + cf. + + Returns: + Tuple[file extension, bytes, PIL.Image.Image] + + """ + def _apply_alpha( + img: Image.Image, + x_object: dict[str, Any], + obj_as_text: str, + image_format: str, + extension: str, + ) -> tuple[Image.Image, str, str]: + alpha = None + if IA.S_MASK in x_object: # add alpha channel + alpha = _xobj_to_image(x_object[IA.S_MASK])[2] + if img.size != alpha.size: + logger_warning( + f"image and mask size not matching: {obj_as_text}", __name__ + ) + else: + # TODO: implement mask + if alpha.mode != "L": + alpha = alpha.convert("L") + if img.mode == "P": + img = img.convert("RGB") + elif img.mode == "1": + img = img.convert("L") + img.putalpha(alpha) + if "JPEG" in image_format: + image_format = "JPEG2000" + extension = ".jp2" + else: + image_format = "PNG" + extension = ".png" + return img, extension, image_format + + # For error reporting + obj_as_text = ( + x_object.indirect_reference.__repr__() + if x_object is None # pragma: no cover + else x_object.__repr__() + ) + + # Get size and data + size = (cast(int, x_object[IA.WIDTH]), cast(int, x_object[IA.HEIGHT])) + data = x_object.get_data() # type: ignore + if isinstance(data, str): # pragma: no cover + data = data.encode() + if len(data) % (size[0] * size[1]) == 1 and data[-1] == 0x0A: # ie. '\n' + data = data[:-1] + + # Get color properties + colors = x_object.get("/Colors", 1) + color_space: Any = x_object.get("/ColorSpace", NullObject()).get_object() + if isinstance(color_space, list) and len(color_space) == 1: + color_space = color_space[0].get_object() + + mode, invert_color = _get_mode_and_invert_color(x_object, colors, color_space) + + # Get filters + filters = x_object.get(StreamAttributes.FILTER, NullObject()).get_object() + lfilters = filters[-1] if isinstance(filters, list) else filters + decode_parms = x_object.get(StreamAttributes.DECODE_PARMS) + if decode_parms and isinstance(decode_parms, (tuple, list)): + decode_parms = decode_parms[0] + else: + decode_parms = {} + if not isinstance(decode_parms, dict): + decode_parms = {} + + extension = None + if lfilters in (FT.FLATE_DECODE, FT.RUN_LENGTH_DECODE): + img, image_format, extension, _ = _handle_flate( + size, + data, + mode, + color_space, + colors, + obj_as_text, + ) + elif lfilters in (FT.LZW_DECODE, FT.ASCII_85_DECODE): + # I'm not sure if the following logic is correct. + # There might not be any relationship between the filters and the + # extension + if lfilters == FT.LZW_DECODE: + image_format = "TIFF" + extension = ".tiff" # mime_type = "image/tiff" + else: + image_format = "PNG" + extension = ".png" # mime_type = "image/png" + try: + img = Image.open(BytesIO(data), formats=("TIFF", "PNG")) + except UnidentifiedImageError: + img = _extended_image_from_bytes(mode, size, data) + elif lfilters == FT.DCT_DECODE: + img, image_format, extension = Image.open(BytesIO(data)), "JPEG", ".jpg" + # invert_color kept unchanged + elif lfilters == FT.JPX_DECODE: + img, image_format, extension, invert_color = _handle_jpx( + size, data, mode, color_space, colors + ) + elif lfilters == FT.CCITT_FAX_DECODE: + img, image_format, extension, invert_color = ( + Image.open(BytesIO(data), formats=("TIFF",)), + "TIFF", + ".tiff", + False, + ) + elif lfilters == FT.JBIG2_DECODE: + img, image_format, extension, invert_color = ( + Image.open(BytesIO(data), formats=("PNG", "PPM")), + "PNG", + ".png", + False, + ) + elif mode == "CMYK": + img, image_format, extension, invert_color = ( + _extended_image_from_bytes(mode, size, data), + "TIFF", + ".tif", + False, + ) + elif mode == "": + raise PdfReadError(f"ColorSpace field not found in {x_object}") + else: + img, image_format, extension, invert_color = ( + _extended_image_from_bytes(mode, size, data), + "PNG", + ".png", + False, + ) + + img = _apply_decode(img, x_object, lfilters, color_space, invert_color) + img, extension, image_format = _apply_alpha( + img, x_object, obj_as_text, image_format, extension + ) + + if pillow_parameters is None: + pillow_parameters = {} + # Preserve JPEG image quality - see issue #3515. + if image_format == "JPEG": + # This prevents: Cannot use 'keep' when original image is not a JPEG: + # "JPEG" is the value of PIL.JpegImagePlugin.JpegImageFile.format + img.format = "JPEG" + if "quality" not in pillow_parameters: + pillow_parameters["quality"] = "keep" + + # Save image to bytes + img_byte_arr = BytesIO() + try: + img.save(img_byte_arr, format=image_format, **pillow_parameters) + except OSError: # pragma: no cover # covered with pillow 10.3 + # in case of we convert to RGBA and then to PNG + img1 = img.convert("RGBA") + image_format = "PNG" + extension = ".png" + img_byte_arr = BytesIO() + img1.save(img_byte_arr, format=image_format) + data = img_byte_arr.getvalue() + + try: # temporary try/except until other fixes of images + img = Image.open(BytesIO(data)) + except Exception as exception: + logger_warning(f"Failed loading image: {exception}", __name__) + img = None # type: ignore[assignment,unused-ignore] # TODO: Remove unused-ignore on Python 3.10 + return extension, data, img diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_link.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_link.py new file mode 100644 index 0000000000000000000000000000000000000000..f3e7566549872e0f4d1b94388803c38b89ea7a9c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_link.py @@ -0,0 +1,144 @@ +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +# This module contains code used by _writer.py to track links in pages +# being added to the writer until the links can be resolved. + +from typing import TYPE_CHECKING, Optional, Union, cast + +from .._utils import logger_warning +from . import ArrayObject, DictionaryObject, IndirectObject, PdfObject, TextStringObject, is_null_or_none + +if TYPE_CHECKING: + from .._page import PageObject + from .._reader import PdfReader + from .._writer import PdfWriter + + +class NamedReferenceLink: + """Named reference link being preserved until we can resolve it correctly.""" + + def __init__(self, reference: TextStringObject, source_pdf: "PdfReader") -> None: + """reference: TextStringObject with named reference""" + self._reference = reference + self._source_pdf = source_pdf + + def find_referenced_page(self) -> Union[IndirectObject, None]: + destination = self._source_pdf.named_destinations.get(str(self._reference)) + return destination.page if destination else None + + def patch_reference(self, target_pdf: "PdfWriter", new_page: IndirectObject) -> None: + """target_pdf: PdfWriter which the new link went into""" + # point named destination in new PDF to the new page + if str(self._reference) not in target_pdf.named_destinations: + target_pdf.add_named_destination(str(self._reference), new_page.page_number) + + +class DirectReferenceLink: + """Direct reference link being preserved until we can resolve it correctly.""" + + def __init__(self, reference: ArrayObject) -> None: + """reference: an ArrayObject whose first element is the Page indirect object""" + self._reference = reference + + def find_referenced_page(self) -> IndirectObject: + return cast(IndirectObject, self._reference[0]) + + def patch_reference(self, target_pdf: "PdfWriter", new_page: IndirectObject) -> None: + """target_pdf: PdfWriter which the new link went into""" + self._reference[0] = new_page + + +ReferenceLink = Union[NamedReferenceLink, DirectReferenceLink] + + +def extract_links(new_page: "PageObject", old_page: "PageObject") -> list[tuple[ReferenceLink, ReferenceLink]]: + """Extracts links from two pages on the assumption that the two pages are + the same. Produces one list of (new link, old link) tuples. + + Non-link annotations are ignored before pairing to avoid dropping valid + links when one page includes additional non-link annotation entries. + """ + new_annotations = new_page.get("/Annots", ArrayObject()).get_object() + old_annotations = old_page.get("/Annots", ArrayObject()).get_object() + if is_null_or_none(new_annotations): + new_annotations = ArrayObject() + if is_null_or_none(old_annotations): + old_annotations = ArrayObject() + if not isinstance(new_annotations, ArrayObject) or not isinstance(old_annotations, ArrayObject): + logger_warning( + f"Expected annotation arrays: {old_annotations} {new_annotations}. Ignoring annotations.", + __name__ + ) + return [] + new_links = [ + link + for annotation in new_annotations + if (link := _build_link(annotation, new_page)) is not None + ] + old_links = [ + link + for annotation in old_annotations + if (link := _build_link(annotation, old_page)) is not None + ] + + if len(new_links) != len(old_links): + logger_warning( + f"Annotation sizes differ: {old_links} vs. {new_links}", + __name__, + ) + + return list(zip(new_links, old_links)) + + +def _build_link(indirect_object: IndirectObject, page: "PageObject") -> Optional[ReferenceLink]: + src = cast("PdfReader", page.pdf) + link = cast(DictionaryObject, indirect_object.get_object()) + if (not isinstance(link, DictionaryObject)) or link.get("/Subtype") != "/Link": + return None + + if "/A" in link: + action = cast(DictionaryObject, link["/A"]) + if action.get("/S") != "/GoTo": + return None + + if "/D" not in action: + return None + return _create_link(action["/D"], src) + + if "/Dest" in link: + return _create_link(link["/Dest"], src) + + return None # Nothing to do here + + +def _create_link(reference: PdfObject, source_pdf: "PdfReader") -> Optional[ReferenceLink]: + if isinstance(reference, TextStringObject): + return NamedReferenceLink(reference, source_pdf) + if isinstance(reference, ArrayObject): + return DirectReferenceLink(reference) + return None diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_outline.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_outline.py new file mode 100644 index 0000000000000000000000000000000000000000..d5d4bb132c412567fe69d75cb71c4c3da1d4bbfe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_outline.py @@ -0,0 +1,33 @@ +from typing import Union + +from .._utils import StreamType, deprecation_no_replacement +from ._base import NameObject +from ._data_structures import Destination + + +class OutlineItem(Destination): + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<<\n") + for key in [ + NameObject(x) + for x in ["/Title", "/Parent", "/First", "/Last", "/Next", "/Prev"] + if x in self + ]: + key.write_to_stream(stream) + stream.write(b" ") + value = self.raw_get(key) + value.write_to_stream(stream) + stream.write(b"\n") + key = NameObject("/Dest") + key.write_to_stream(stream) + stream.write(b" ") + value = self.dest_array + value.write_to_stream(stream) + stream.write(b"\n") + stream.write(b">>") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_rectangle.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_rectangle.py new file mode 100644 index 0000000000000000000000000000000000000000..c07d6bb1f42e90e01066055384c5aeea07d27a23 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_rectangle.py @@ -0,0 +1,136 @@ +from typing import Any, Union + +from ._base import FloatObject, NumberObject +from ._data_structures import ArrayObject + + +class RectangleObject(ArrayObject): + """ + This class is used to represent *page boxes* in pypdf. + + These boxes include: + + * :attr:`artbox ` + * :attr:`bleedbox ` + * :attr:`cropbox ` + * :attr:`mediabox ` + * :attr:`trimbox ` + """ + + def __init__( + self, arr: Union["RectangleObject", tuple[float, float, float, float]] + ) -> None: + # must have four points + assert len(arr) == 4 + # automatically convert arr[x] into NumberObject(arr[x]) if necessary + ArrayObject.__init__(self, [self._ensure_is_number(x) for x in arr]) + + def _ensure_is_number(self, value: Any) -> Union[FloatObject, NumberObject]: + if not isinstance(value, (FloatObject, NumberObject)): + return FloatObject(value) + return value + + def scale(self, sx: float, sy: float) -> "RectangleObject": + return RectangleObject( + ( + float(self.left) * sx, + float(self.bottom) * sy, + float(self.right) * sx, + float(self.top) * sy, + ) + ) + + def __repr__(self) -> str: + return f"RectangleObject({list(self)!r})" + + @property + def left(self) -> FloatObject: + value: FloatObject = self[0] + return value + + @left.setter + def left(self, f: float) -> None: + self[0] = FloatObject(f) + + @property + def bottom(self) -> FloatObject: + value: FloatObject = self[1] + return value + + @bottom.setter + def bottom(self, f: float) -> None: + self[1] = FloatObject(f) + + @property + def right(self) -> FloatObject: + value: FloatObject = self[2] + return value + + @right.setter + def right(self, f: float) -> None: + self[2] = FloatObject(f) + + @property + def top(self) -> FloatObject: + value: FloatObject = self[3] + return value + + @top.setter + def top(self, f: float) -> None: + self[3] = FloatObject(f) + + @property + def lower_left(self) -> tuple[float, float]: + """ + Property to read and modify the lower left coordinate of this box + in (x,y) form. + """ + return self.left, self.bottom + + @lower_left.setter + def lower_left(self, value: tuple[float, float]) -> None: + self[0], self[1] = (self._ensure_is_number(x) for x in value) + + @property + def lower_right(self) -> tuple[float, float]: + """ + Property to read and modify the lower right coordinate of this box + in (x,y) form. + """ + return self.right, self.bottom + + @lower_right.setter + def lower_right(self, value: tuple[float, float]) -> None: + self[2], self[1] = (self._ensure_is_number(x) for x in value) + + @property + def upper_left(self) -> tuple[float, float]: + """ + Property to read and modify the upper left coordinate of this box + in (x,y) form. + """ + return self.left, self.top + + @upper_left.setter + def upper_left(self, value: tuple[float, float]) -> None: + self[0], self[3] = (self._ensure_is_number(x) for x in value) + + @property + def upper_right(self) -> tuple[float, float]: + """ + Property to read and modify the upper right coordinate of this box + in (x,y) form. + """ + return self.right, self.top + + @upper_right.setter + def upper_right(self, value: tuple[float, float]) -> None: + self[2], self[3] = (self._ensure_is_number(x) for x in value) + + @property + def width(self) -> float: + return self.right - self.left + + @property + def height(self) -> float: + return self.top - self.bottom diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_utils.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..1b81fd23b0f8d7f4be86e6dfb3e583275e3716c5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_utils.py @@ -0,0 +1,208 @@ +import codecs +from typing import Union + +from .._codecs import _pdfdoc_encoding +from .._utils import StreamType, logger_warning, read_non_whitespace +from ..errors import STREAM_TRUNCATED_PREMATURELY, PdfStreamError +from ._base import ByteStringObject, TextStringObject + + +def hex_to_rgb(value: str) -> tuple[float, float, float]: + return tuple(int(value.lstrip("#")[i : i + 2], 16) / 255.0 for i in (0, 2, 4)) # type: ignore + + +def read_hex_string_from_stream( + stream: StreamType, + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union["TextStringObject", "ByteStringObject"]: + stream.read(1) + arr = [] + x = b"" + while True: + tok = read_non_whitespace(stream) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok == b">": + break + x += tok + if len(x) == 2: + arr.append(int(x, base=16)) + x = b"" + if len(x) == 1: + x += b"0" + if x != b"": + arr.append(int(x, base=16)) + return create_string_object(bytes(arr), forced_encoding) + + +__ESCAPE_DICT__ = { + b"n": ord(b"\n"), + b"r": ord(b"\r"), + b"t": ord(b"\t"), + b"b": ord(b"\b"), + b"f": ord(b"\f"), + b"(": ord(b"("), + b")": ord(b")"), + b"/": ord(b"/"), + b"\\": ord(b"\\"), + b" ": ord(b" "), + b"%": ord(b"%"), + b"<": ord(b"<"), + b">": ord(b">"), + b"[": ord(b"["), + b"]": ord(b"]"), + b"#": ord(b"#"), + b"_": ord(b"_"), + b"&": ord(b"&"), + b"$": ord(b"$"), +} +__BACKSLASH_CODE__ = 92 + + +def read_string_from_stream( + stream: StreamType, + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union["TextStringObject", "ByteStringObject"]: + tok = stream.read(1) + parens = 1 + txt = [] + while True: + tok = stream.read(1) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok == b"(": + parens += 1 + elif tok == b")": + parens -= 1 + if parens == 0: + break + elif tok == b"\\": + tok = stream.read(1) + try: + txt.append(__ESCAPE_DICT__[tok]) + continue + except KeyError: + if b"0" <= tok <= b"7": + # "The number ddd may consist of one, two, or three + # octal digits; high-order overflow shall be ignored. + # Three octal digits shall be used, with leading zeros + # as needed, if the next character of the string is also + # a digit." (PDF reference 7.3.4.2, p 16) + sav = stream.tell() - 1 + for _ in range(2): + ntok = stream.read(1) + if b"0" <= ntok <= b"7": + tok += ntok + else: + stream.seek(-1, 1) # ntok has to be analyzed + break + i = int(tok, base=8) + if i > 255: + txt.append(__BACKSLASH_CODE__) + stream.seek(sav) + else: + txt.append(i) + continue + if tok in b"\n\r": + # This case is hit when a backslash followed by a line + # break occurs. If it's a multi-char EOL, consume the + # second character: + tok = stream.read(1) + if tok not in b"\n\r": + stream.seek(-1, 1) + # Then don't add anything to the actual string, since this + # line break was escaped: + continue + msg = f"Unexpected escaped string: {tok.decode('utf-8', 'ignore')}" + logger_warning(msg, __name__) + txt.append(__BACKSLASH_CODE__) + txt.append(ord(tok)) + return create_string_object(bytes(txt), forced_encoding) + + +def create_string_object( + string: Union[str, bytes], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union[TextStringObject, ByteStringObject]: + """ + Create a ByteStringObject or a TextStringObject from a string to represent the string. + + Args: + string: The data being used + forced_encoding: Typically None, or an encoding string + + Returns: + A ByteStringObject + + Raises: + TypeError: If string is not of type str or bytes. + + """ + if isinstance(string, str): + return TextStringObject(string) + if isinstance(string, bytes): + if isinstance(forced_encoding, (list, dict)): + out = "" + for x in string: + try: + out += forced_encoding[x] + except Exception: + out += bytes((x,)).decode("charmap") + obj = TextStringObject(out) + obj._original_bytes = string + return obj + if isinstance(forced_encoding, str): + if forced_encoding == "bytes": + return ByteStringObject(string) + obj = TextStringObject(string.decode(forced_encoding)) + obj._original_bytes = string + return obj + try: + if string.startswith((codecs.BOM_UTF16_BE, codecs.BOM_UTF16_LE)): + retval = TextStringObject(string.decode("utf-16")) + retval._original_bytes = string + retval.autodetect_utf16 = True + retval.utf16_bom = string[:2] + return retval + if string.startswith(b"\x00"): + retval = TextStringObject(string.decode("utf-16be")) + retval._original_bytes = string + retval.autodetect_utf16 = True + retval.utf16_bom = codecs.BOM_UTF16_BE + return retval + if string[1:2] == b"\x00": + retval = TextStringObject(string.decode("utf-16le")) + retval._original_bytes = string + retval.autodetect_utf16 = True + retval.utf16_bom = codecs.BOM_UTF16_LE + return retval + + # This is probably a big performance hit here, but we need + # to convert string objects into the text/unicode-aware + # version if possible... and the only way to check if that's + # possible is to try. + # Some strings are strings, some are just byte arrays. + retval = TextStringObject(decode_pdfdocencoding(string)) + retval._original_bytes = string + retval.autodetect_pdfdocencoding = True + return retval + except UnicodeDecodeError: + return ByteStringObject(string) + else: + raise TypeError("create_string_object should have str or unicode arg") + + +def decode_pdfdocencoding(byte_array: bytes) -> str: + retval = "" + for b in byte_array: + c = _pdfdoc_encoding[b] + if c == "\u0000": + raise UnicodeDecodeError( + "pdfdocencoding", + bytearray(b), + -1, + -1, + "does not exist in translation table", + ) + retval += c + return retval diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_viewerpref.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_viewerpref.py new file mode 100644 index 0000000000000000000000000000000000000000..84fce613b162d0beeafda759c2d90f96b511196f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypdf/generic/_viewerpref.py @@ -0,0 +1,164 @@ +# Copyright (c) 2023, Pubpub-ZZ +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from typing import ( + Any, + Optional, + cast, +) + +from ._base import BooleanObject, NameObject, NumberObject, is_null_or_none +from ._data_structures import ArrayObject, DictionaryObject + +f_obj = BooleanObject(False) + + +class ViewerPreferences(DictionaryObject): + def __init__(self, obj: Optional[DictionaryObject] = None) -> None: + super().__init__(self) + if not is_null_or_none(obj): + self.update(obj.items()) # type: ignore + try: + self.indirect_reference = obj.indirect_reference # type: ignore + except AttributeError: + pass + + def _get_bool(self, key: str, default: Optional[BooleanObject]) -> Optional[BooleanObject]: + return self.get(key, default) + + def _set_bool(self, key: str, v: bool) -> None: + self[NameObject(key)] = BooleanObject(v is True) + + def _get_name(self, key: str, default: Optional[NameObject]) -> Optional[NameObject]: + return self.get(key, default) + + def _set_name(self, key: str, lst: list[str], v: NameObject) -> None: + if v[0] != "/": + raise ValueError(f"{v} does not start with '/'") + if lst != [] and v not in lst: + raise ValueError(f"{v} is an unacceptable value") + self[NameObject(key)] = NameObject(v) + + def _get_arr(self, key: str, default: Optional[list[Any]]) -> Optional[ArrayObject]: + return self.get(key, None if default is None else ArrayObject(default)) + + def _set_arr(self, key: str, v: Optional[ArrayObject]) -> None: + if v is None: + try: + del self[NameObject(key)] + except KeyError: + pass + return + if not isinstance(v, ArrayObject): + raise ValueError("ArrayObject is expected") + self[NameObject(key)] = v + + def _get_int(self, key: str, default: Optional[NumberObject]) -> Optional[NumberObject]: + return self.get(key, default) + + def _set_int(self, key: str, v: int) -> None: + self[NameObject(key)] = NumberObject(v) + + @property + def PRINT_SCALING(self) -> NameObject: + return NameObject("/PrintScaling") + + def __new__(cls: Any, value: Any = None) -> "ViewerPreferences": # noqa: PYI034 + def _add_prop_bool(key: str, default: Optional[BooleanObject]) -> property: + return property( + lambda self: self._get_bool(key, default), + lambda self, v: self._set_bool(key, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined + """, + ) + + def _add_prop_name( + key: str, lst: list[str], default: Optional[NameObject] + ) -> property: + return property( + lambda self: self._get_name(key, default), + lambda self, v: self._set_name(key, lst, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined. + Acceptable values: {lst} + """, + ) + + def _add_prop_arr(key: str, default: Optional[ArrayObject]) -> property: + return property( + lambda self: self._get_arr(key, default), + lambda self, v: self._set_arr(key, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined + """, + ) + + def _add_prop_int(key: str, default: Optional[int]) -> property: + return property( + lambda self: self._get_int(key, default), + lambda self, v: self._set_int(key, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined + """, + ) + + cls.hide_toolbar = _add_prop_bool("/HideToolbar", f_obj) + cls.hide_menubar = _add_prop_bool("/HideMenubar", f_obj) + cls.hide_windowui = _add_prop_bool("/HideWindowUI", f_obj) + cls.fit_window = _add_prop_bool("/FitWindow", f_obj) + cls.center_window = _add_prop_bool("/CenterWindow", f_obj) + cls.display_doctitle = _add_prop_bool("/DisplayDocTitle", f_obj) + + cls.non_fullscreen_pagemode = _add_prop_name( + "/NonFullScreenPageMode", + ["/UseNone", "/UseOutlines", "/UseThumbs", "/UseOC"], + NameObject("/UseNone"), + ) + cls.direction = _add_prop_name( + "/Direction", ["/L2R", "/R2L"], NameObject("/L2R") + ) + cls.view_area = _add_prop_name("/ViewArea", [], None) + cls.view_clip = _add_prop_name("/ViewClip", [], None) + cls.print_area = _add_prop_name("/PrintArea", [], None) + cls.print_clip = _add_prop_name("/PrintClip", [], None) + cls.print_scaling = _add_prop_name("/PrintScaling", [], None) + cls.duplex = _add_prop_name( + "/Duplex", ["/Simplex", "/DuplexFlipShortEdge", "/DuplexFlipLongEdge"], None + ) + cls.pick_tray_by_pdfsize = _add_prop_bool("/PickTrayByPDFSize", None) + cls.print_pagerange = _add_prop_arr("/PrintPageRange", None) + cls.num_copies = _add_prop_int("/NumCopies", None) + + cls.enforce = _add_prop_arr("/Enforce", ArrayObject()) + + return cast("ViewerPreferences", DictionaryObject.__new__(cls)) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5c842bba39af3d54c8e3683504e00bd0fc9b5e84 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/METADATA @@ -0,0 +1,1879 @@ +Metadata-Version: 2.4 +Name: PyPika +Version: 0.51.1 +Summary: A SQL query builder API for Python +Home-page: https://github.com/kayak/pypika +Author: Timothy Heys +Author-email: theys@kayak.com +License: Apache License Version 2.0 +Keywords: pypika python query builder querybuilder sql mysql postgres psql oracle vertica aggregated relational database rdbms business analytics bi data science analysis pandas orm object mapper +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: PL/SQL +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Scientific/Engineering :: Information Analysis +Classifier: Topic :: Scientific/Engineering :: Mathematics +Classifier: Operating System :: POSIX +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +License-File: LICENSE.txt +Requires-Dist: typing_extensions>=4.5.0; python_version < "3.11" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: requires-dist +Dynamic: summary + +PyPika - Python Query Builder +============================= + +.. _intro_start: + +|BuildStatus| |CoverageStatus| |Codacy| |Docs| |PyPi| |License| + +Abstract +-------- + +What is |Brand|? + +|Brand| is a Python API for building SQL queries. The motivation behind |Brand| is to provide a simple interface for +building SQL queries without limiting the flexibility of handwritten SQL. Designed with data analysis in mind, |Brand| +leverages the builder design pattern to construct queries to avoid messy string formatting and concatenation. It is also +easily extended to take full advantage of specific features of SQL database vendors. + +What are the design goals for |Brand|? +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +|Brand| is a fast, expressive and flexible way to replace handwritten SQL (or even ORM for the courageous souls amongst you). +Validation of SQL correctness is not an explicit goal of |Brand|. With such a large number of +SQL database vendors providing a robust validation of input data is difficult. Instead you are encouraged to check inputs you provide to |Brand| or appropriately handle errors raised from +your SQL database - just as you would have if you were writing SQL yourself. + +.. _intro_end: + +Read the docs: http://pypika.readthedocs.io/en/latest/ + +Installation +------------ + +.. _installation_start: + +|Brand| supports is tested for supported Python, i.e. 3.9+. It is tested for PyPy3.9 and PyPy3.10. It may also work Cython, and Jython but is not being tested for in the CI script. + +To install |Brand| run the following command: + +.. code-block:: bash + + pip install pypika + + +.. _installation_end: + + +Tutorial +-------- + +.. _tutorial_start: + +The main classes in pypika are ``pypika.Query``, ``pypika.Table``, and ``pypika.Field``. + +.. code-block:: python + + from pypika import Query, Table, Field + + +Selecting Data +^^^^^^^^^^^^^^ + +The entry point for building queries is ``pypika.Query``. In order to select columns from a table, the table must +first be added to the query. For simple queries with only one table, tables and columns can be references using +strings. For more sophisticated queries a ``pypika.Table`` must be used. + +.. code-block:: python + + q = Query.from_('customers').select('id', 'fname', 'lname', 'phone') + +To convert the query into raw SQL, it can be cast to a string. + +.. code-block:: python + + str(q) + +Alternatively, you can use the `Query.get_sql()` function: + +.. code-block:: python + + q.get_sql() + + +Tables, Columns, Schemas, and Databases +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In simple queries like the above example, columns in the "from" table can be referenced by passing string names into +the ``select`` query builder function. In more complex examples, the ``pypika.Table`` class should be used. Columns can be +referenced as attributes on instances of ``pypika.Table``. + +.. code-block:: python + + from pypika import Table, Query + + customers = Table('customers') + q = Query.from_(customers).select(customers.id, customers.fname, customers.lname, customers.phone) + +Both of the above examples result in the following SQL: + +.. code-block:: sql + + SELECT id,fname,lname,phone FROM customers + +An alias for the table can be given using the ``.as_`` function on ``pypika.Table`` + +.. code-block:: sql + + customers = Table('x_view_customers').as_('customers') + q = Query.from_(customers).select(customers.id, customers.phone) + +.. code-block:: sql + + SELECT id,phone FROM x_view_customers customers + +A schema can also be specified. Tables can be referenced as attributes on the schema. + +.. code-block:: sql + + from pypika import Table, Query, Schema + + views = Schema('views') + q = Query.from_(views.customers).select(customers.id, customers.phone) + +.. code-block:: sql + + SELECT id,phone FROM views.customers + +Also references to databases can be used. Schemas can be referenced as attributes on the database. + +.. code-block:: sql + + from pypika import Table, Query, Database + + my_db = Database('my_db') + q = Query.from_(my_db.analytics.customers).select(customers.id, customers.phone) + +.. code-block:: sql + + SELECT id,phone FROM my_db.analytics.customers + + +Results can be ordered by using the following syntax: + +.. code-block:: python + + from pypika import Order + Query.from_('customers').select('id', 'fname', 'lname', 'phone').orderby('id', order=Order.desc) + +This results in the following SQL: + +.. code-block:: sql + + SELECT "id","fname","lname","phone" FROM "customers" ORDER BY "id" DESC + +Arithmetic +"""""""""" + +Arithmetic expressions can also be constructed using pypika. Operators such as `+`, `-`, `*`, and `/` are implemented +by ``pypika.Field`` which can be used simply with a ``pypika.Table`` or directly. + +.. code-block:: python + + from pypika import Field + + q = Query.from_('account').select( + Field('revenue') - Field('cost') + ) + +.. code-block:: sql + + SELECT revenue-cost FROM accounts + +Using ``pypika.Table`` + +.. code-block:: python + + accounts = Table('accounts') + q = Query.from_(accounts).select( + accounts.revenue - accounts.cost + ) + +.. code-block:: sql + + SELECT revenue-cost FROM accounts + +An alias can also be used for fields and expressions. + +.. code-block:: sql + + q = Query.from_(accounts).select( + (accounts.revenue - accounts.cost).as_('profit') + ) + +.. code-block:: sql + + SELECT revenue-cost profit FROM accounts + +More arithmetic examples + +.. code-block:: python + + table = Table('table') + q = Query.from_(table).select( + table.foo + table.bar, + table.foo - table.bar, + table.foo * table.bar, + table.foo / table.bar, + (table.foo+table.bar) / table.fiz, + ) + +.. code-block:: sql + + SELECT foo+bar,foo-bar,foo*bar,foo/bar,(foo+bar)/fiz FROM table + +Bitwise operations are also supported using the ``bitwiseand`` and ``bitwiseor`` methods. + +.. code-block:: python + + from pypika import Query, Field + + q = Query.from_('flags').select('name').where(Field('permissions').bitwiseand(4) == 4) + +.. code-block:: sql + + SELECT "name" FROM "flags" WHERE ("permissions" & 4)=4 + +.. code-block:: python + + q = Query.from_('flags').select('name').where(Field('permissions').bitwiseor(2) == 3) + +.. code-block:: sql + + SELECT "name" FROM "flags" WHERE ("permissions" | 2)=3 + + +Filtering +""""""""" + +Queries can be filtered with ``pypika.Criterion`` by using equality or inequality operators + +.. code-block:: python + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id, customers.fname, customers.lname, customers.phone + ).where( + customers.lname == 'Mustermann' + ) + +.. code-block:: sql + + SELECT id,fname,lname,phone FROM customers WHERE lname='Mustermann' + +Query methods such as select, where, groupby, and orderby can be called multiple times. Multiple calls to the where +method will add additional conditions as + +.. code-block:: python + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id, customers.fname, customers.lname, customers.phone + ).where( + customers.fname == 'Max' + ).where( + customers.lname == 'Mustermann' + ) + +.. code-block:: sql + + SELECT id,fname,lname,phone FROM customers WHERE fname='Max' AND lname='Mustermann' + +Filters such as IN and BETWEEN are also supported + +.. code-block:: python + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id,customers.fname + ).where( + customers.age[18:65] & customers.status.isin(['new', 'active']) + ) + +.. code-block:: sql + + SELECT id,fname FROM customers WHERE age BETWEEN 18 AND 65 AND status IN ('new','active') + +Filtering with complex criteria can be created using boolean symbols ``&``, ``|``, and ``^``. + +AND + +.. code-block:: python + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id, customers.fname, customers.lname, customers.phone + ).where( + (customers.age >= 18) & (customers.lname == 'Mustermann') + ) + +.. code-block:: sql + + SELECT id,fname,lname,phone FROM customers WHERE age>=18 AND lname='Mustermann' + +OR + +.. code-block:: python + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id, customers.fname, customers.lname, customers.phone + ).where( + (customers.age >= 18) | (customers.lname == 'Mustermann') + ) + +.. code-block:: sql + + SELECT id,fname,lname,phone FROM customers WHERE age>=18 OR lname='Mustermann' + +XOR + +.. code-block:: python + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id, customers.fname, customers.lname, customers.phone + ).where( + (customers.age >= 18) ^ customers.is_registered + ) + +.. code-block:: sql + + SELECT id,fname,lname,phone FROM customers WHERE age>=18 XOR is_registered + + +Convenience Methods +""""""""""""""""""" + +In the `Criterion` class, there are the static methods `any` and `all` that allow building chains AND and OR expressions with a list of terms. + +.. code-block:: python + + from pypika import Criterion + + customers = Table('customers') + q = Query.from_(customers).select( + customers.id, + customers.fname + ).where( + Criterion.all([ + customers.is_registered, + customers.age >= 18, + customers.lname == "Jones", + ]) + ) + +.. code-block:: sql + + SELECT id,fname FROM customers WHERE is_registered AND age>=18 AND lname = "Jones" + + +Grouping and Aggregating +"""""""""""""""""""""""" + +Grouping allows for aggregated results and works similar to ``SELECT`` clauses. + +.. code-block:: python + + from pypika import functions as fn + + customers = Table('customers') + q = Query \ + .from_(customers) \ + .where(customers.age >= 18) \ + .groupby(customers.id) \ + .select(customers.id, fn.Sum(customers.revenue)) + +.. code-block:: sql + + SELECT id,SUM("revenue") FROM "customers" WHERE "age">=18 GROUP BY "id" + +After adding a ``GROUP BY`` clause to a query, the ``HAVING`` clause becomes available. The method +``Query.having()`` takes a ``Criterion`` parameter similar to the method ``Query.where()``. + +.. code-block:: python + + from pypika import functions as fn + + payments = Table('payments') + q = Query \ + .from_(payments) \ + .where(payments.transacted[date(2015, 1, 1):date(2016, 1, 1)]) \ + .groupby(payments.customer_id) \ + .having(fn.Sum(payments.total) >= 1000) \ + .select(payments.customer_id, fn.Sum(payments.total)) + +.. code-block:: sql + + SELECT customer_id,SUM(total) FROM payments + WHERE transacted BETWEEN '2015-01-01' AND '2016-01-01' + GROUP BY customer_id HAVING SUM(total)>=1000 + +The ``QUALIFY`` clause can be used to filter rows based on window function results. This is particularly useful +when you want to filter after window functions have been evaluated. + +.. code-block:: python + + from pypika import Query, Table, analytics as an + + table = Table('events') + rank_expr = an.Rank().over(table.user_id).orderby(table.created_at) + + q = Query.from_(table).select('*').qualify(rank_expr == 1) + +.. code-block:: sql + + SELECT * FROM "events" QUALIFY RANK() OVER(PARTITION BY "user_id" ORDER BY "created_at")=1 + +GROUP BY Modifiers +"""""""""""""""""" + +The ``ROLLUP`` modifier allows for aggregating to higher levels than the given groups, called super-aggregates. + +.. code-block:: python + + from pypika import Query, Table, Rollup, functions as fn + + products = Table('products') + q = Query.from_(products).select( + products.id, products.category, fn.Sum(products.price) + ).rollup(products.id, products.category) + +.. code-block:: sql + + SELECT "id","category",SUM("price") FROM "products" GROUP BY ROLLUP("id","category") + + +Joining Tables and Subqueries +""""""""""""""""""""""""""""" + +Tables and subqueries can be joined to any query using the ``Query.join()`` method. Joins can be performed with either +a ``USING`` or ``ON`` clauses. The ``USING`` clause can be used when both tables/subqueries contain the same field and +the ``ON`` clause can be used with a criterion. To perform a join, ``...join()`` can be chained but then must be +followed immediately by ``...on()`` or ``...using(*field)``. + + +Join Types +~~~~~~~~~~ + +All join types are supported by |Brand|. + +.. code-block:: python + + Query \ + .from_(base_table) + ... + .join(join_table, JoinType.left) + ... + + +.. code-block:: python + + Query \ + .from_(base_table) + ... + .left_join(join_table) \ + .left_outer_join(join_table) \ + .right_join(join_table) \ + .right_outer_join(join_table) \ + .inner_join(join_table) \ + .outer_join(join_table) \ + .full_outer_join(join_table) \ + .cross_join(join_table) \ + .hash_join(join_table) \ + ... + +See the list of join types here ``pypika.enums.JoinTypes`` + +Example of a join using `ON` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + history, customers = Tables('history', 'customers') + q = Query \ + .from_(history) \ + .join(customers) \ + .on(history.customer_id == customers.id) \ + .select(history.star) \ + .where(customers.id == 5) + + +.. code-block:: sql + + SELECT "history".* FROM "history" JOIN "customers" ON "history"."customer_id"="customers"."id" WHERE "customers"."id"=5 + +As a shortcut, the ``Query.join().on_field()`` function is provided for joining the (first) table in the ``FROM`` clause +with the joined table when the field name(s) are the same in both tables. + +Example of a join using `ON` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + history, customers = Tables('history', 'customers') + q = Query \ + .from_(history) \ + .join(customers) \ + .on_field('customer_id', 'group') \ + .select(history.star) \ + .where(customers.group == 'A') + + +.. code-block:: sql + + SELECT "history".* FROM "history" JOIN "customers" ON "history"."customer_id"="customers"."customer_id" AND "history"."group"="customers"."group" WHERE "customers"."group"='A' + + +Example of a join using `USING` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + history, customers = Tables('history', 'customers') + q = Query \ + .from_(history) \ + .join(customers) \ + .using('customer_id') \ + .select(history.star) \ + .where(customers.id == 5) + + +.. code-block:: sql + + SELECT "history".* FROM "history" JOIN "customers" USING "customer_id" WHERE "customers"."id"=5 + + +Example of a correlated subquery in the `SELECT` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + history, customers = Tables('history', 'customers') + last_purchase_at = Query.from_(history).select( + history.purchase_at + ).where(history.customer_id==customers.customer_id).orderby( + history.purchase_at, order=Order.desc + ).limit(1) + q = Query.from_(customers).select( + customers.id, last_purchase_at.as_('last_purchase_at') + ) + + +.. code-block:: sql + + SELECT + "id", + (SELECT "history"."purchase_at" + FROM "history" + WHERE "history"."customer_id" = "customers"."customer_id" + ORDER BY "history"."purchase_at" DESC + LIMIT 1) "last_purchase_at" + FROM "customers" + + +Unions +"""""" + +Both ``UNION`` and ``UNION ALL`` are supported. ``UNION DISTINCT`` is synonymous with ``UNION`` so |Brand| does not +provide a separate function for it. Unions require that queries have the same number of ``SELECT`` clauses so +trying to cast a unioned query to string will throw a ``SetOperationException`` if the column sizes are mismatched. + +To create a union query, use either the ``Query.union()`` method or `+` operator with two query instances. For a +union all, use ``Query.union_all()`` or the `*` operator. + +.. code-block:: python + + provider_a, provider_b = Tables('provider_a', 'provider_b') + q = Query.from_(provider_a).select( + provider_a.created_time, provider_a.foo, provider_a.bar + ) + Query.from_(provider_b).select( + provider_b.created_time, provider_b.fiz, provider_b.buz + ) + +.. code-block:: sql + + SELECT "created_time","foo","bar" FROM "provider_a" UNION SELECT "created_time","fiz","buz" FROM "provider_b" + +Intersect +""""""""" + +``INTERSECT`` is supported. Intersects require that queries have the same number of ``SELECT`` clauses so +trying to cast a intersected query to string will throw a ``SetOperationException`` if the column sizes are mismatched. + +To create a intersect query, use the ``Query.intersect()`` method. + +.. code-block:: python + + provider_a, provider_b = Tables('provider_a', 'provider_b') + q = Query.from_(provider_a).select( + provider_a.created_time, provider_a.foo, provider_a.bar + ) + r = Query.from_(provider_b).select( + provider_b.created_time, provider_b.fiz, provider_b.buz + ) + intersected_query = q.intersect(r) + +.. code-block:: sql + + SELECT "created_time","foo","bar" FROM "provider_a" INTERSECT SELECT "created_time","fiz","buz" FROM "provider_b" + +Minus +""""" + +``MINUS`` is supported. Minus require that queries have the same number of ``SELECT`` clauses so +trying to cast a minus query to string will throw a ``SetOperationException`` if the column sizes are mismatched. + +To create a minus query, use either the ``Query.minus()`` method or `-` operator with two query instances. + +.. code-block:: python + + provider_a, provider_b = Tables('provider_a', 'provider_b') + q = Query.from_(provider_a).select( + provider_a.created_time, provider_a.foo, provider_a.bar + ) + r = Query.from_(provider_b).select( + provider_b.created_time, provider_b.fiz, provider_b.buz + ) + minus_query = q.minus(r) + + (or) + + minus_query = Query.from_(provider_a).select( + provider_a.created_time, provider_a.foo, provider_a.bar + ) - Query.from_(provider_b).select( + provider_b.created_time, provider_b.fiz, provider_b.buz + ) + +.. code-block:: sql + + SELECT "created_time","foo","bar" FROM "provider_a" MINUS SELECT "created_time","fiz","buz" FROM "provider_b" + +EXCEPT +"""""" + +``EXCEPT`` is supported. Minus require that queries have the same number of ``SELECT`` clauses so +trying to cast a except query to string will throw a ``SetOperationException`` if the column sizes are mismatched. + +To create a except query, use the ``Query.except_of()`` method. + +.. code-block:: python + + provider_a, provider_b = Tables('provider_a', 'provider_b') + q = Query.from_(provider_a).select( + provider_a.created_time, provider_a.foo, provider_a.bar + ) + r = Query.from_(provider_b).select( + provider_b.created_time, provider_b.fiz, provider_b.buz + ) + minus_query = q.except_of(r) + +.. code-block:: sql + + SELECT "created_time","foo","bar" FROM "provider_a" EXCEPT SELECT "created_time","fiz","buz" FROM "provider_b" + +Date, Time, and Intervals +""""""""""""""""""""""""" + +Using ``pypika.Interval``, queries can be constructed with date arithmetic. Any combination of intervals can be +used except for weeks and quarters, which must be used separately and will ignore any other values if selected. + +.. code-block:: python + + from pypika import functions as fn + + fruits = Tables('fruits') + q = Query.from_(fruits) \ + .select(fruits.id, fruits.name) \ + .where(fruits.harvest_date + Interval(months=1) < fn.Now()) + +.. code-block:: sql + + SELECT id,name FROM fruits WHERE harvest_date+INTERVAL 1 MONTH= 18) + ) + + parameter = QmarkParameter() + sql = q.get_sql(parameter=parameter) + params = parameter.get_parameters() + + # sql: SELECT * FROM "customers" WHERE "status"=? AND "age">=? + # params: ['active', 18] + +This works with all parameter types. For dict-based parameters like ``NamedParameter``: + +.. code-block:: python + + from pypika import Query, Table, NamedParameter + + customers = Table('customers') + q = Query.from_(customers).select('*').where(customers.status == 'active') + + parameter = NamedParameter() + sql = q.get_sql(parameter=parameter) + params = parameter.get_parameters() + + # sql: SELECT * FROM "customers" WHERE "status"=:param1 + # params: {'param1': 'active'} + +Temporal support +^^^^^^^^^^^^^^^^ + +Temporal criteria can be added to the tables. + +Select +"""""" + +Here is a select using system time. + +.. code-block:: python + + t = Table("abc") + q = Query.from_(t.for_(SYSTEM_TIME.as_of('2020-01-01'))).select("*") + +This produces: + +.. code-block:: sql + + SELECT * FROM "abc" FOR SYSTEM_TIME AS OF '2020-01-01' + +You can also use between. + +.. code-block:: python + + t = Table("abc") + q = Query.from_( + t.for_(SYSTEM_TIME.between('2020-01-01', '2020-02-01')) + ).select("*") + +This produces: + +.. code-block:: sql + + SELECT * FROM "abc" FOR SYSTEM_TIME BETWEEN '2020-01-01' AND '2020-02-01' + +You can also use a period range. + +.. code-block:: python + + t = Table("abc") + q = Query.from_( + t.for_(SYSTEM_TIME.from_to('2020-01-01', '2020-02-01')) + ).select("*") + +This produces: + +.. code-block:: sql + + SELECT * FROM "abc" FOR SYSTEM_TIME FROM '2020-01-01' TO '2020-02-01' + +Finally you can select for all times: + +.. code-block:: python + + t = Table("abc") + q = Query.from_(t.for_(SYSTEM_TIME.all_())).select("*") + +This produces: + +.. code-block:: sql + + SELECT * FROM "abc" FOR SYSTEM_TIME ALL + +A user defined period can also be used in the following manner. + +.. code-block:: python + + t = Table("abc") + q = Query.from_( + t.for_(t.valid_period.between('2020-01-01', '2020-02-01')) + ).select("*") + +This produces: + +.. code-block:: sql + + SELECT * FROM "abc" FOR "valid_period" BETWEEN '2020-01-01' AND '2020-02-01' + +Joins +""""" + +With joins, when the table object is used when specifying columns, it is +important to use the table from which the temporal constraint was generated. +This is because `Table("abc")` is not the same table as `Table("abc").for_(...)`. +The following example demonstrates this. + +.. code-block:: python + + t0 = Table("abc").for_(SYSTEM_TIME.as_of('2020-01-01')) + t1 = Table("efg").for_(SYSTEM_TIME.as_of('2020-01-01')) + query = ( + Query.from_(t0) + .join(t1) + .on(t0.foo == t1.bar) + .select("*") + ) + +This produces: + +.. code-block:: sql + + SELECT * FROM "abc" FOR SYSTEM_TIME AS OF '2020-01-01' + JOIN "efg" FOR SYSTEM_TIME AS OF '2020-01-01' + ON "abc"."foo"="efg"."bar" + +Update & Deletes +"""""""""""""""" + +An update can be written as follows: + +.. code-block:: python + + t = Table("abc") + q = Query.update( + t.for_portion( + SYSTEM_TIME.from_to('2020-01-01', '2020-02-01') + ) + ).set("foo", "bar") + +This produces: + +.. code-block:: sql + + UPDATE "abc" + FOR PORTION OF SYSTEM_TIME FROM '2020-01-01' TO '2020-02-01' + SET "foo"='bar' + +Here is a delete: + +.. code-block:: python + + t = Table("abc") + q = Query.from_( + t.for_portion(t.valid_period.from_to('2020-01-01', '2020-02-01')) + ).delete() + +This produces: + +.. code-block:: sql + + DELETE FROM "abc" + FOR PORTION OF "valid_period" FROM '2020-01-01' TO '2020-02-01' + +Creating Tables +^^^^^^^^^^^^^^^ + +The entry point for creating tables is ``pypika.Query.create_table``, which is used with the class ``pypika.Column``. +As with selecting data, first the table should be specified. This can be either a +string or a `pypika.Table`. Then the columns, and constraints. Here's an example +that demonstrates much of the functionality. + +.. code-block:: python + + stmt = Query \ + .create_table("person") \ + .columns( + Column("id", "INT", nullable=False), + Column("first_name", "VARCHAR(100)", nullable=False), + Column("last_name", "VARCHAR(100)", nullable=False), + Column("phone_number", "VARCHAR(20)", nullable=True), + Column("status", "VARCHAR(20)", nullable=False, default=ValueWrapper("NEW")), + Column("date_of_birth", "DATETIME")) \ + .unique("last_name", "first_name") \ + .primary_key("id") + +This produces: + +.. code-block:: sql + + CREATE TABLE "person" ( + "id" INT NOT NULL, + "first_name" VARCHAR(100) NOT NULL, + "last_name" VARCHAR(100) NOT NULL, + "phone_number" VARCHAR(20) NULL, + "status" VARCHAR(20) NOT NULL DEFAULT 'NEW', + "date_of_birth" DATETIME, + UNIQUE ("last_name","first_name"), + PRIMARY KEY ("id") + ) + +There is also support for creating a table from a query. + +.. code-block:: python + + stmt = Query.create_table("names").as_select( + Query.from_("person").select("last_name", "first_name") + ) + +This produces: + +.. code-block:: sql + + CREATE TABLE "names" AS (SELECT "last_name","first_name" FROM "person") + +TEMPORARY and UNLOGGED tables can also be created: + +.. code-block:: python + + from pypika import Query, Table, Columns + + columns = Columns(('id', 'INT'), ('name', 'VARCHAR(100)')) + + Query.create_table('temp_items').columns(*columns).temporary() + Query.create_table('fast_items').columns(*columns).unlogged() + +.. code-block:: sql + + CREATE TEMPORARY TABLE "temp_items" ("id" INT,"name" VARCHAR(100)) + + CREATE UNLOGGED TABLE "fast_items" ("id" INT,"name" VARCHAR(100)) + +Managing Table Indices +^^^^^^^^^^^^^^^^^^^^^^ + +Create Indices +"""""""""""""""" + +The entry point for creating indices is ``pypika.Query.create_index``. +An index name (as ``str``) or a ``pypika.terms.Index`` a table (as ``str`` or ``pypika.Table``) and +columns (as ``pypika.Column``) must be specified. + +.. code-block:: python + + my_index = Index("my_index") + person = Table("person") + stmt = Query \ + .create_index(my_index) \ + .on(person) \ + .columns(person.first_name, person.last_name) + +This produces: + +.. code-block:: sql + + CREATE INDEX my_index + ON person (first_name, last_name) + +It is also possible to create a unique index + +.. code-block:: python + + my_index = Index("my_index") + person = Table("person") + stmt = Query \ + .create_index(my_index) \ + .on(person) \ + .columns(person.first_name, person.last_name) \ + .unique() + +This produces: + +.. code-block:: sql + + CREATE UNIQUE INDEX my_index + ON person (first_name, last_name) + +It is also possible to create an index if it does not exist + +.. code-block:: python + + my_index = Index("my_index") + person = Table("person") + stmt = Query \ + .create_index(my_index) \ + .on(person) \ + .columns(person.first_name, person.last_name) \ + .if_not_exists() + +This produces: + +.. code-block:: sql + + CREATE INDEX IF NOT EXISTS my_index + ON person (first_name, last_name) + +Drop Indices +"""""""""""""""" + +Then entry point for dropping indices is ``pypika.Query.drop_index``. +It takes either ``str`` or ``pypika.terms.Index`` as an argument. + +.. code-block:: python + + my_index = Index("my_index") + stmt = Query.drop_index(my_index) + +This produces: + +.. code-block:: sql + + DROP INDEX my_index + +It is also possible to drop an index if it exists + +.. code-block:: python + + my_index = Index("my_index") + stmt = Query.drop_index(my_index).if_exists() + +This produces: + +.. code-block:: sql + + DROP INDEX IF EXISTS my_index + + +Handling Different Database Platforms +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +There can sometimes be differences between how database vendors implement SQL in their platform, for example +which quote characters are used. To ensure that the correct SQL standard is used for your platform, +the platform-specific Query classes can be used. + +.. code-block:: python + + from pypika import MySQLQuery, MSSQLQuery, PostgreSQLQuery, OracleQuery, VerticaQuery, ClickHouseQuery + +You can use these query classes as a drop in replacement for the default ``Query`` class shown in the other examples. + + +ClickHouse-Specific Features +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +|Brand| provides several ClickHouse-specific query features through the ``ClickHouseQuery`` class. + +FINAL +""""" + +The ``FINAL`` modifier forces ClickHouse to fully merge data before returning results, useful with +ReplacingMergeTree and CollapsingMergeTree tables. + +.. code-block:: python + + from pypika import ClickHouseQuery, Table + + t = Table('events') + q = ClickHouseQuery.from_(t).select(t.user_id, t.event).final() + +.. code-block:: sql + + SELECT "user_id","event" FROM "events" FINAL + +SAMPLE +"""""" + +The ``SAMPLE`` clause enables approximate query processing on a fraction of data. + +.. code-block:: python + + from pypika import ClickHouseQuery, Table + + t = Table('events') + q = ClickHouseQuery.from_(t).select(t.user_id).sample(10) + +.. code-block:: sql + + SELECT "user_id" FROM "events" SAMPLE 10 + +You can also specify an offset: + +.. code-block:: python + + q = ClickHouseQuery.from_(t).select(t.user_id).sample(10, 5) + +.. code-block:: sql + + SELECT "user_id" FROM "events" SAMPLE 10 OFFSET 5 + +DISTINCT ON +""""""""""" + +ClickHouse supports ``DISTINCT ON`` to return distinct rows based on specific columns. + +.. code-block:: python + + from pypika import ClickHouseQuery, Table + + t = Table('users') + q = ClickHouseQuery.from_(t).distinct_on('department', t.role).select('name', 'department', 'role') + +.. code-block:: sql + + SELECT DISTINCT ON("department","role") "name","department","role" FROM "users" + +LIMIT BY +"""""""" + +The ``LIMIT BY`` clause limits the number of rows per group of column values. + +.. code-block:: python + + from pypika import ClickHouseQuery, Table + + t = Table('events') + q = ClickHouseQuery.from_(t).select('user_id', 'event', 'timestamp').limit_by(3, 'user_id') + +.. code-block:: sql + + SELECT "user_id","event","timestamp" FROM "events" LIMIT 3 BY ("user_id") + +You can also specify an offset with ``limit_offset_by``: + +.. code-block:: python + + q = ClickHouseQuery.from_(t).select('user_id', 'event').limit_offset_by(3, 1, 'user_id') + +.. code-block:: sql + + SELECT "user_id","event" FROM "events" LIMIT 3 OFFSET 1 BY ("user_id") + + +Oracle-Specific Features +^^^^^^^^^^^^^^^^^^^^^^^^ + +LIMIT and OFFSET +"""""""""""""""" + +Oracle queries support ``LIMIT`` and ``OFFSET`` using the ``FETCH NEXT ... ROWS ONLY`` and ``OFFSET ... ROWS`` syntax. + +.. code-block:: python + + from pypika import OracleQuery, Table + + t = Table('employees') + q = OracleQuery.from_(t).select(t.name).limit(10) + +.. code-block:: sql + + SELECT name FROM employees FETCH NEXT 10 ROWS ONLY + +With offset: + +.. code-block:: python + + q = OracleQuery.from_(t).select(t.name).limit(10).offset(20) + +.. code-block:: sql + + SELECT name FROM employees OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY + + +Jira Query Language (JQL) +^^^^^^^^^^^^^^^^^^^^^^^^^ + +|Brand| supports generating Jira Query Language expressions through the ``JiraQuery`` class. + +.. code-block:: python + + from pypika import JiraQuery + + J = JiraQuery.Table() + query = ( + JiraQuery.where(J.project.isin(["PROJ1", "PROJ2"])) + .where(J.issuetype == "Bug") + .where(J.labels.isempty() | J.labels.notin(["stale", "wontfix"])) + ) + +.. code-block:: sql + + project IN ("PROJ1","PROJ2") AND issuetype="Bug" AND (labels is EMPTY OR labels NOT IN ("stale","wontfix")) + +JQL fields support ``isempty()`` and ``notempty()`` methods for checking empty/non-empty values. + +.. _advanced_end: + +Chaining Functions +^^^^^^^^^^^^^^^^^^ + +The ``QueryBuilder.pipe`` method gives a more readable alternative while chaining functions. + +.. code-block:: python + + # This + ( + query + .pipe(func1, *args) + .pipe(func2, **kwargs) + .pipe(func3) + ) + + # Is equivalent to this + func3(func2(func1(query, *args), **kwargs)) + +Or for a more concrete example: + +.. code-block:: python + + from pypika import Field, Query, functions as fn + from pypika.queries import QueryBuilder + + def filter_days(query: QueryBuilder, col, num_days: int) -> QueryBuilder: + if isinstance(col, str): + col = Field(col) + + return query.where(col > fn.Now() - num_days) + + def count_groups(query: QueryBuilder, *groups) -> QueryBuilder: + return query.groupby(*groups).select(*groups, fn.Count("*").as_("n_rows")) + + base_query = Query.from_("table") + + query = ( + base_query + .pipe(filter_days, "date", num_days=7) + .pipe(count_groups, "col1", "col2") + ) + +This produces: + +.. code-block:: sql + + SELECT "col1","col2",COUNT(*) n_rows + FROM "table" + WHERE "date">NOW()-7 + GROUP BY "col1","col2" + +.. _tutorial_end: + +.. _contributing_start: + +Contributing +------------ + +We welcome community contributions to |Brand|. Please see the `contributing guide <6_contributing.html>`_ to more info. + +.. _contributing_end: + + +.. _license_start: + +License +------- + +Copyright 2020 KAYAK Germany, GmbH + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +Crafted with ♥ in Berlin. + +.. _license_end: + + +.. _appendix_start: + +.. |Brand| replace:: *PyPika* + +.. _appendix_end: + +.. _available_badges_start: + +.. |BuildStatus| image:: https://github.com/kayak/pypika/workflows/Unit%20Tests/badge.svg + :target: https://github.com/kayak/pypika/actions +.. |CoverageStatus| image:: https://coveralls.io/repos/kayak/pypika/badge.svg?branch=master + :target: https://coveralls.io/github/kayak/pypika?branch=master +.. |Codacy| image:: https://api.codacy.com/project/badge/Grade/6d7e44e5628b4839a23da0bd82eaafcf + :target: https://www.codacy.com/app/twheys/pypika +.. |Docs| image:: https://readthedocs.org/projects/pypika/badge/?version=latest + :target: http://pypika.readthedocs.io/en/latest/ +.. |PyPi| image:: https://img.shields.io/pypi/v/pypika.svg?style=flat + :target: https://pypi.python.org/pypi/pypika +.. |License| image:: https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000 + :target: http://www.apache.org/licenses/LICENSE-2.0 + +.. _available_badges_end: diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..436fa8e1219901aa1c5f5b5e2590de2d2ce53eb0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/RECORD @@ -0,0 +1,39 @@ +pypika-0.51.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pypika-0.51.1.dist-info/METADATA,sha256=NJx9lzkGLQXvk6kgXN7ZUSAvnv0FuM1oXNzm6uUvpRg,51987 +pypika-0.51.1.dist-info/RECORD,, +pypika-0.51.1.dist-info/WHEEL,sha256=Mk1ST5gDzEO5il5kYREiBnzzM469m5sI8ESPl7TRhJY,110 +pypika-0.51.1.dist-info/licenses/LICENSE.txt,sha256=xazLvYVG6Uw0rtJK_miaYXYn0Y7tWmxIJ35I21fCOFE,11356 +pypika-0.51.1.dist-info/top_level.txt,sha256=jxoMoGSWV0-WzJzIUK5Zfdpd04A0PQGhMsPBnAVua0s,7 +pypika/__init__.py,sha256=HqDn8MztsDtVJmuxCzQuYP0LL5zmIzBfOqxYKmNgpeg,3481 +pypika/__pycache__/__init__.cpython-311.pyc,, +pypika/__pycache__/analytics.cpython-311.pyc,, +pypika/__pycache__/dialects.cpython-311.pyc,, +pypika/__pycache__/enums.cpython-311.pyc,, +pypika/__pycache__/functions.cpython-311.pyc,, +pypika/__pycache__/pseudocolumns.cpython-311.pyc,, +pypika/__pycache__/queries.cpython-311.pyc,, +pypika/__pycache__/terms.cpython-311.pyc,, +pypika/__pycache__/utils.cpython-311.pyc,, +pypika/analytics.py,sha256=443DbrmVM9soj9qngRzYndob_8vePVQZSbyqcFdwF0M,3144 +pypika/clickhouse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pypika/clickhouse/__pycache__/__init__.cpython-311.pyc,, +pypika/clickhouse/__pycache__/array.cpython-311.pyc,, +pypika/clickhouse/__pycache__/condition.cpython-311.pyc,, +pypika/clickhouse/__pycache__/dates_and_times.cpython-311.pyc,, +pypika/clickhouse/__pycache__/nullable_arg.cpython-311.pyc,, +pypika/clickhouse/__pycache__/search_string.cpython-311.pyc,, +pypika/clickhouse/__pycache__/type_conversion.cpython-311.pyc,, +pypika/clickhouse/array.py,sha256=rM4qxwF1aBSS6GdctQg5M9XuAJ89M1Q-kwWY7G29RJo,2893 +pypika/clickhouse/condition.py,sha256=lCAA2jPuBrQd2_xj9ppFgEJOQXMIqpm0NDgKkPdfRfg,290 +pypika/clickhouse/dates_and_times.py,sha256=X-ufzVUU6idvRKQdXHY8JLCxzqFAqnZyS5jwKBNaW5c,1225 +pypika/clickhouse/nullable_arg.py,sha256=2fI_9HFDaUzcQLID11Kxb8sNnRGLHpqZLkwfaQGMvD0,161 +pypika/clickhouse/search_string.py,sha256=DwHyNn3xMZaMh6Ezey_ZkXXQj897CSlL7Mz6eQKHgWA,2597 +pypika/clickhouse/type_conversion.py,sha256=EZ0nKjrwMKlooP_hO9galdQTOJuorJMCOpTVfLNWXvk,2627 +pypika/dialects.py,sha256=Cvwp6ECeBH_e5YCbZaUj6LEVesDZElvMXSla7p3PGmo,35977 +pypika/enums.py,sha256=HI-Uzm-6sIZ14MiBl6OxilCMoW2mzO0_BS40XyJdqv8,3162 +pypika/functions.py,sha256=XYkwktn44V4JLfH9tylTTk5MZ3qkMi9yd1Mu1oFylFY,9634 +pypika/pseudocolumns.py,sha256=kbOVVf6nPV7wng_ymayQJxuNkHF8MbYDkDS2hRHSol0,252 +pypika/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +pypika/queries.py,sha256=gDjKg__fNe1AOuJX-Cl_zfro6HiIKflvDk08O61oN54,76398 +pypika/terms.py,sha256=bKXySs2ehkjUpGnLiCPCmqbGTmzq2VY0Ck5P6iruF_8,61281 +pypika/utils.py,sha256=FzUZVcXLYRtGha2xtlDv9FWrER_doU6h8ikUmphRzsg,4487 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..798dd6195b88f8618eca3eb9b05be33268fa3dac --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.10.2) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/licenses/LICENSE.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c8f3ea0871e0bfe81da0fa6e7c1d7d156dc380e --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/licenses/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/top_level.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..3799c3584c0ff88333425095981baa7a6fa57723 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika-0.51.1.dist-info/top_level.txt @@ -0,0 +1 @@ +pypika diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5bda7a5c087e109435bfc66bc8499980d2a87197 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__init__.py @@ -0,0 +1,180 @@ +""" +PyPika is divided into a couple of modules, primarily the ``queries`` and ``terms`` modules. + +pypika.analytics +---------------- + +Wrappers for SQL analytic functions + +pypika.dialects +--------------- + +This contains all of the dialect specific implementations of the ``Query`` class. + +pypika.enums +------------ + +Enumerated values are kept in this package which are used as options for Queries and Terms. + +pypika.functions +---------------- + +Wrappers for common SQL functions are stored in this package. + +pypika.pseudocolumns +-------------------- + +Wrappers for common SQL pseudocolumns are stored in this package. + +pypika.queries +-------------- + +This is where the ``Query`` class can be found which is the core class in PyPika. Also, other top level classes such +as ``Table`` can be found here. ``Query`` is a container that holds all of the ``Term`` types together and also +serializes the builder to a string. + +pypika.terms +------------ + +This module contains the classes which represent individual parts of queries that extend the ``Term`` base class. + +pypika.utils +------------ + +This contains all of the utility classes such as exceptions and decorators. +""" + +# noinspection PyUnresolvedReferences +from pypika.dialects import ( + ClickHouseQuery, + Dialects, + JiraQuery, + MSSQLQuery, + MySQLQuery, + OracleQuery, + PostgreSQLQuery, + RedshiftQuery, + SQLLiteQuery, + VerticaQuery, +) + +# noinspection PyUnresolvedReferences +from pypika.enums import ( + DatePart, + JoinType, + Order, +) + +# noinspection PyUnresolvedReferences +from pypika.queries import ( + AliasedQuery, + Column, + Database, + Query, + Schema, + Table, +) +from pypika.queries import ( + make_columns as Columns, +) +from pypika.queries import ( + make_tables as Tables, +) + +# noinspection PyUnresolvedReferences +from pypika.terms import ( + JSON, + Array, + Bracket, + Case, + Criterion, + CustomFunction, + EmptyCriterion, + Field, + FormatParameter, + Index, + Interval, + NamedParameter, + Not, + NullValue, + NumericParameter, + Parameter, + PyformatParameter, + QmarkParameter, + Rollup, + SystemTimeValue, + Tuple, +) + +# noinspection PyUnresolvedReferences +from pypika.utils import ( + CaseException, + FunctionException, + GroupingException, + JoinException, + QueryException, + RollupException, + SetOperationException, +) + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" +__version__ = "0.51.1" + +NULL = NullValue() +SYSTEM_TIME = SystemTimeValue() + +__all__ = ( + 'ClickHouseQuery', + 'Dialects', + 'JiraQuery', + 'MSSQLQuery', + 'MySQLQuery', + 'OracleQuery', + 'PostgreSQLQuery', + 'RedshiftQuery', + 'SQLLiteQuery', + 'VerticaQuery', + 'DatePart', + 'JoinType', + 'Order', + 'AliasedQuery', + 'Query', + 'Schema', + 'Table', + 'Column', + 'Database', + 'Tables', + 'Columns', + 'Array', + 'Bracket', + 'Case', + 'Criterion', + 'EmptyCriterion', + 'Field', + 'Index', + 'Interval', + 'JSON', + 'Not', + 'NullValue', + 'SystemTimeValue', + 'Parameter', + 'QmarkParameter', + 'NumericParameter', + 'NamedParameter', + 'FormatParameter', + 'PyformatParameter', + 'Rollup', + 'Tuple', + 'CustomFunction', + 'CaseException', + 'GroupingException', + 'JiraQuery', + 'JoinException', + 'QueryException', + 'RollupException', + 'SetOperationException', + 'FunctionException', + 'NULL', + 'SYSTEM_TIME', +) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e325b99c2e51b57cabb4ae0c4c4fee1129eaea42 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/analytics.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/analytics.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..415c846e97373067a0be942a02588b9523f931e0 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/analytics.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/dialects.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/dialects.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8881746b5b0491605faa9658b8964ce813f79dbf Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/dialects.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/enums.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/enums.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67f74445029036b5d3f6048643fc0e40319b2ee5 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/enums.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/functions.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/functions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62d528e23752c8efd2b093a9a728d6a0f577dc02 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/functions.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/pseudocolumns.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/pseudocolumns.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0eeb23df3add69b90f28cebdc467768e0d5b54f4 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/pseudocolumns.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/utils.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40f4ed59fbe424abf244615063f4d7dbe9ba831c Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/__pycache__/utils.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/analytics.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/analytics.py new file mode 100644 index 0000000000000000000000000000000000000000..78589aef5075f6c63d222ff148fade6a1bdde47f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/analytics.py @@ -0,0 +1,125 @@ +""" +Package for SQL analytic functions wrappers +""" + +from __future__ import annotations + +from pypika.terms import ( + AnalyticFunction, + IgnoreNullsAnalyticFunction, + WindowFrameAnalyticFunction, +) + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" + + +class Preceding(WindowFrameAnalyticFunction.Edge): + modifier = "PRECEDING" + + +class Following(WindowFrameAnalyticFunction.Edge): + modifier = "FOLLOWING" + + +CURRENT_ROW = "CURRENT ROW" + + +class Rank(AnalyticFunction): + def __init__(self, **kwargs): + super().__init__("RANK", **kwargs) + + +class DenseRank(AnalyticFunction): + def __init__(self, **kwargs): + super().__init__("DENSE_RANK", **kwargs) + + +class RowNumber(AnalyticFunction): + def __init__(self, **kwargs): + super().__init__("ROW_NUMBER", **kwargs) + + +class NTile(AnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("NTILE", term, **kwargs) + + +class FirstValue(WindowFrameAnalyticFunction, IgnoreNullsAnalyticFunction): + def __init__(self, *terms, **kwargs): + super().__init__("FIRST_VALUE", *terms, **kwargs) + + +class LastValue(WindowFrameAnalyticFunction, IgnoreNullsAnalyticFunction): + def __init__(self, *terms, **kwargs): + super().__init__("LAST_VALUE", *terms, **kwargs) + + +class Median(AnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("MEDIAN", term, **kwargs) + + +class Avg(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("AVG", term, **kwargs) + + +class StdDev(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("STDDEV", term, **kwargs) + + +class StdDevPop(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("STDDEV_POP", term, **kwargs) + + +class StdDevSamp(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("STDDEV_SAMP", term, **kwargs) + + +class Variance(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("VARIANCE", term, **kwargs) + + +class VarPop(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("VAR_POP", term, **kwargs) + + +class VarSamp(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("VAR_SAMP", term, **kwargs) + + +class Count(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("COUNT", term, **kwargs) + + +class Sum(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("SUM", term, **kwargs) + + +class Max(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("MAX", term, **kwargs) + + +class Min(WindowFrameAnalyticFunction): + def __init__(self, term, **kwargs): + super().__init__("MIN", term, **kwargs) + + +class Lag(AnalyticFunction): + def __init__(self, *args, **kwargs): + super().__init__("LAG", *args, **kwargs) + + +class Lead(AnalyticFunction): + def __init__(self, *args, **kwargs): + super().__init__("LEAD", *args, **kwargs) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05bc4c9db34fcc8d08115b431f975cd5b5e39567 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/array.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/array.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f80002c201965ad1d1f4948c6f488187c7c619dc Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/array.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/condition.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/condition.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83472bae775d755b41bc83f4cf9943832dfadfdd Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/condition.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/dates_and_times.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/dates_and_times.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0af34e3e0271fac2918998b4c2375eedebda3a8a Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/dates_and_times.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/nullable_arg.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/nullable_arg.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e42c7e7c7afa0843bb7f20fe01962abca8c5ca6 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/nullable_arg.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/search_string.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/search_string.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c7fe7c05f41ce908a288c0bc961dc22b25a4bf6 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/search_string.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/type_conversion.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/type_conversion.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e472fe12e403bb99eddeeed3618759fd58cae32 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/__pycache__/type_conversion.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/array.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/array.py new file mode 100644 index 0000000000000000000000000000000000000000..2c6250f601605b29b0fae11ac0a50c4ab97a5312 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/array.py @@ -0,0 +1,98 @@ +from __future__ import annotations + +import abc + +from pypika.terms import ( + Field, + Function, + Term, +) +from pypika.utils import format_alias_sql + + +class Array(Term): + def __init__( + self, values: list, converter_cls=None, converter_options: dict | None = None, alias: str | None = None + ): + super().__init__(alias) + self._values = values + self._converter_cls = converter_cls + self._converter_options = converter_options or dict() + + def get_sql(self): + if self._converter_cls: + converted = [] + for value in self._values: + converter = self._converter_cls(value, **self._converter_options) + converted.append(converter.get_sql()) + sql = "".join(["[", ",".join(converted), "]"]) + + else: + sql = str(self._values) + + return format_alias_sql(sql, self.alias) + + +class HasAny(Function): + def __init__( + self, + left_array: Array or Field, + right_array: Array or Field, + alias: str | None = None, + schema: str | None = None, + ): + self._left_array = left_array + self._right_array = right_array + self.alias = alias + self.schema = schema + self.args = () + self.name = "hasAny" + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + left = self._left_array.get_sql() + right = self._right_array.get_sql() + sql = "{name}({left},{right})".format( + name=self.name, + left='"%s"' % left if isinstance(self._left_array, Field) else left, + right='"%s"' % right if isinstance(self._right_array, Field) else right, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class _AbstractArrayFunction(Function, metaclass=abc.ABCMeta): + def __init__(self, array: Array or Field, alias: str | None = None, schema: str | None = None): + self.schema = schema + self.alias = alias + self.name = self.clickhouse_function() + self._array = array + + def get_sql(self, with_namespace=False, quote_char=None, dialect=None, **kwargs): + array = self._array.get_sql() + sql = "{name}({array})".format( + name=self.name, + array='"%s"' % array if isinstance(self._array, Field) else array, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + @classmethod + @abc.abstractmethod + def clickhouse_function(cls) -> str: + pass + + +class NotEmpty(_AbstractArrayFunction): + @classmethod + def clickhouse_function(cls) -> str: + return "notEmpty" + + +class Empty(_AbstractArrayFunction): + @classmethod + def clickhouse_function(cls) -> str: + return "empty" + + +class Length(_AbstractArrayFunction): + @classmethod + def clickhouse_function(cls) -> str: + return "length" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/condition.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/condition.py new file mode 100644 index 0000000000000000000000000000000000000000..ed08224e22fb27eb18876595a542dcd3ad14bffc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/condition.py @@ -0,0 +1,11 @@ +from pypika.terms import Function + + +class If(Function): + def __init__(self, *conditions, **kwargs): + super().__init__("if", *conditions, **kwargs) + + +class MultiIf(Function): + def __init__(self, *conditions, **kwargs): + super().__init__("multiIf", *conditions, **kwargs) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/dates_and_times.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/dates_and_times.py new file mode 100644 index 0000000000000000000000000000000000000000..0c975902ce5e2145dc4f7ed9b5ae10ad8cf9cfe5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/dates_and_times.py @@ -0,0 +1,22 @@ +from pypika import CustomFunction + +_add_subtract_args = ["name", "interval"] + +ToYYYYMM = CustomFunction("toYYYYMM") +AddYears = CustomFunction("addYears", _add_subtract_args) +AddMonths = CustomFunction("addMonths", _add_subtract_args) +AddWeeks = CustomFunction("addWeeks", _add_subtract_args) +AddDays = CustomFunction("addDays", _add_subtract_args) +AddHours = CustomFunction("addHours", _add_subtract_args) +AddMinutes = CustomFunction("addMinutes", _add_subtract_args) +AddSeconds = CustomFunction("addSeconds", _add_subtract_args) +AddQuarters = CustomFunction("addQuarters", _add_subtract_args) +SubtractYears = CustomFunction("subtractYears", _add_subtract_args) +SubtractMonths = CustomFunction("subtractMonths", _add_subtract_args) +SubtractWeeks = CustomFunction("subtractWeeks", _add_subtract_args) +SubtractDays = CustomFunction("subtractDays", _add_subtract_args) +SubtractHours = CustomFunction("subtractHours", _add_subtract_args) +SubtractMinutes = CustomFunction("subtractMinutes", _add_subtract_args) +SubtractSeconds = CustomFunction("subtractSeconds", _add_subtract_args) +SubtractQuarters = CustomFunction("subtractQuarters", _add_subtract_args) +FormatDateTime = CustomFunction("formatDateTime", ["name", "dt_format"]) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/nullable_arg.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/nullable_arg.py new file mode 100644 index 0000000000000000000000000000000000000000..a3f23fe53af3174a33b002f6965e2d1ca06d2790 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/nullable_arg.py @@ -0,0 +1,6 @@ +from pypika.terms import Function + + +class IfNull(Function): + def __init__(self, term, alt, **kwargs): + super().__init__("ifNull", term, alt, **kwargs) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/search_string.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/search_string.py new file mode 100644 index 0000000000000000000000000000000000000000..4dfb1ec06b4c1182454b8bc508b50410efc2c79a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/search_string.py @@ -0,0 +1,90 @@ +from __future__ import annotations + +import abc + +from pypika.terms import Function +from pypika.utils import format_alias_sql + + +class _AbstractSearchString(Function, metaclass=abc.ABCMeta): + def __init__(self, name, pattern: str, alias: str | None = None): + super().__init__(self.clickhouse_function(), name, alias=alias) + + self._pattern = pattern + + @classmethod + @abc.abstractmethod + def clickhouse_function(cls) -> str: + pass + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + args = [] + for p in self.args: + if hasattr(p, "get_sql"): + args.append('toString("{arg}")'.format(arg=p.get_sql(with_alias=False, **kwargs))) + else: + args.append(str(p)) + + sql = "{name}({args},'{pattern}')".format( + name=self.name, + args=",".join(args), + pattern=self._pattern, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class Match(_AbstractSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "match" + + +class Like(_AbstractSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "like" + + +class NotLike(_AbstractSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "notLike" + + +class _AbstractMultiSearchString(Function, metaclass=abc.ABCMeta): + def __init__(self, name, patterns: list, alias: str | None = None): + super().__init__(self.clickhouse_function(), name, alias=alias) + + self._patterns = patterns + + @classmethod + @abc.abstractmethod + def clickhouse_function(cls) -> str: + pass + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + args = [] + for p in self.args: + if hasattr(p, "get_sql"): + args.append('toString("{arg}")'.format(arg=p.get_sql(with_alias=False, **kwargs))) + else: + args.append(str(p)) + + sql = "{name}({args},[{patterns}])".format( + name=self.name, + args=",".join(args), + patterns=",".join(["'%s'" % i for i in self._patterns]), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class MultiSearchAny(_AbstractMultiSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "multiSearchAny" + + +class MultiMatchAny(_AbstractMultiSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "multiMatchAny" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/type_conversion.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/type_conversion.py new file mode 100644 index 0000000000000000000000000000000000000000..a17cd02d133199bf1477cfda78d218c20af74270 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/clickhouse/type_conversion.py @@ -0,0 +1,90 @@ +from __future__ import annotations + +from pypika.terms import ( + Field, + Function, +) +from pypika.utils import format_alias_sql + + +class ToString(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toString", name, alias=alias) + + +class ToFixedString(Function): + def __init__(self, field, length: int, alias: str | None = None, schema: str | None = None): + self._length = length + self._field = field + self.alias = alias + self.name = "toFixedString" + self.schema = schema + self.args = () + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + sql = "{name}({field},{length})".format( + name=self.name, + field=self._field if isinstance(self._field, Field) else "'%s'" % str(self._field), + length=self._length, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class ToInt8(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt8", name, alias=alias) + + +class ToInt16(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt16", name, alias=alias) + + +class ToInt32(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt32", name, alias=alias) + + +class ToInt64(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt64", name, alias=alias) + + +class ToUInt8(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt8", name, alias=alias) + + +class ToUInt16(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt16", name, alias=alias) + + +class ToUInt32(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt32", name, alias=alias) + + +class ToUInt64(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt64", name, alias=alias) + + +class ToFloat32(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toFloat32", name, alias=alias) + + +class ToFloat64(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toFloat64", name, alias=alias) + + +class ToDate(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toDate", name, alias=alias) + + +class ToDateTime(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toDateTime", name, alias=alias) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/dialects.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/dialects.py new file mode 100644 index 0000000000000000000000000000000000000000..578f36931b7d3d9d70341195f5c2c7e56b78352d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/dialects.py @@ -0,0 +1,1068 @@ +from __future__ import annotations + +import itertools +import warnings +from copy import copy +from typing import Any + +from pypika.enums import Dialects +from pypika.queries import ( + CreateQueryBuilder, + Database, + DropQueryBuilder, + Query, + QueryBuilder, + Selectable, + Table, +) +from pypika.terms import ( + ArithmeticExpression, + Criterion, + EmptyCriterion, + Field, + Function, + NullCriterion, + Star, + Term, + ValueWrapper, +) +from pypika.utils import QueryException, builder, format_alias_sql, format_quotes + + +class SnowflakeQuery(Query): + """ + Defines a query class for use with Snowflake. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> SnowflakeQueryBuilder: + return SnowflakeQueryBuilder(**kwargs) + + @classmethod + def create_table(cls, table: str | Table) -> SnowflakeCreateQueryBuilder: + return SnowflakeCreateQueryBuilder().create_table(table) + + @classmethod + def drop_table(cls, table: str | Table) -> SnowflakeDropQueryBuilder: + return SnowflakeDropQueryBuilder().drop_table(table) + + +class SnowflakeQueryBuilder(QueryBuilder): + QUOTE_CHAR = None + ALIAS_QUOTE_CHAR = '"' + QUERY_ALIAS_QUOTE_CHAR = '' + QUERY_CLS = SnowflakeQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.SNOWFLAKE, **kwargs) + + +class SnowflakeCreateQueryBuilder(CreateQueryBuilder): + QUOTE_CHAR = None + QUERY_CLS = SnowflakeQuery + + def __init__(self) -> None: + super().__init__(dialect=Dialects.SNOWFLAKE) + + +class SnowflakeDropQueryBuilder(DropQueryBuilder): + QUOTE_CHAR = None + QUERY_CLS = SnowflakeQuery + + def __init__(self) -> None: + super().__init__(dialect=Dialects.SNOWFLAKE) + + +class MySQLQuery(Query): + """ + Defines a query class for use with MySQL. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> MySQLQueryBuilder: + return MySQLQueryBuilder(**kwargs) + + @classmethod + def load(cls, fp: str) -> MySQLLoadQueryBuilder: + return MySQLLoadQueryBuilder().load(fp) + + @classmethod + def create_table(cls, table: str | Table) -> MySQLCreateQueryBuilder: + return MySQLCreateQueryBuilder().create_table(table) + + @classmethod + def drop_table(cls, table: str | Table) -> MySQLDropQueryBuilder: + return MySQLDropQueryBuilder().drop_table(table) + + +class MySQLQueryBuilder(QueryBuilder): + QUOTE_CHAR = "`" + QUERY_CLS = MySQLQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.MYSQL, **kwargs) + self._duplicate_updates = [] + self._ignore_duplicates = False + self._modifiers = [] + + self._for_update_nowait = False + self._for_update_skip_locked = False + self._for_update_of = set() + + def __copy__(self) -> MySQLQueryBuilder: + newone = super().__copy__() + newone._duplicate_updates = copy(self._duplicate_updates) + newone._ignore_duplicates = copy(self._ignore_duplicates) + return newone + + @builder + def for_update(self, nowait: bool = False, skip_locked: bool = False, of: tuple[str, ...] = ()) -> None: + self._for_update = True + self._for_update_skip_locked = skip_locked + self._for_update_nowait = nowait + self._for_update_of = set(of) + + @builder + def on_duplicate_key_update(self, field: Field | str, value: Any) -> None: + if self._ignore_duplicates: + raise QueryException("Can not have two conflict handlers") + + field = Field(field) if not isinstance(field, Field) else field + self._duplicate_updates.append((field, ValueWrapper(value))) + + @builder + def on_duplicate_key_ignore(self) -> None: + if self._duplicate_updates: + raise QueryException("Can not have two conflict handlers") + + self._ignore_duplicates = True + + def get_sql(self, **kwargs: Any) -> str: + self._set_kwargs_defaults(kwargs) + querystring = super().get_sql(**kwargs) + if querystring: + if self._duplicate_updates: + querystring += self._on_duplicate_key_update_sql(**kwargs) + elif self._ignore_duplicates: + querystring += self._on_duplicate_key_ignore_sql() + return querystring + + def _for_update_sql(self, **kwargs) -> str: + if self._for_update: + for_update = ' FOR UPDATE' + if self._for_update_of: + for_update += f' OF {", ".join([Table(item).get_sql(**kwargs) for item in self._for_update_of])}' + if self._for_update_nowait: + for_update += ' NOWAIT' + elif self._for_update_skip_locked: + for_update += ' SKIP LOCKED' + else: + for_update = '' + + return for_update + + def _on_duplicate_key_update_sql(self, **kwargs: Any) -> str: + return " ON DUPLICATE KEY UPDATE {updates}".format( + updates=",".join( + "{field}={value}".format(field=field.get_sql(**kwargs), value=value.get_sql(**kwargs)) + for field, value in self._duplicate_updates + ) + ) + + def _on_duplicate_key_ignore_sql(self) -> str: + return " ON DUPLICATE KEY IGNORE" + + @builder + def modifier(self, value: str) -> None: + """ + Adds a modifier such as SQL_CALC_FOUND_ROWS to the query. + https://dev.mysql.com/doc/refman/5.7/en/select.html + + :param value: The modifier value e.g. SQL_CALC_FOUND_ROWS + """ + self._modifiers.append(value) + + def _select_sql(self, **kwargs: Any) -> str: + """ + Overridden function to generate the SELECT part of the SQL statement, + with the addition of the a modifier if present. + """ + return "SELECT {distinct}{modifier}{select}".format( + distinct="DISTINCT " if self._distinct else "", + modifier="{} ".format(" ".join(self._modifiers)) if self._modifiers else "", + select=",".join(term.get_sql(with_alias=True, subquery=True, **kwargs) for term in self._selects), + ) + + +class MySQLLoadQueryBuilder: + QUERY_CLS = MySQLQuery + + def __init__(self) -> None: + self._load_file = None + self._into_table = None + + @builder + def load(self, fp: str) -> None: + self._load_file = fp + + @builder + def into(self, table: str | Table) -> None: + self._into_table = table if isinstance(table, Table) else Table(table) + + def get_sql(self, *args: Any, **kwargs: Any) -> str: + querystring = "" + if self._load_file and self._into_table: + querystring += self._load_file_sql(**kwargs) + querystring += self._into_table_sql(**kwargs) + querystring += self._options_sql(**kwargs) + + return querystring + + def _load_file_sql(self, **kwargs: Any) -> str: + return "LOAD DATA LOCAL INFILE '{}'".format(self._load_file) + + def _into_table_sql(self, **kwargs: Any) -> str: + return " INTO TABLE `{}`".format(self._into_table.get_sql(**kwargs)) + + def _options_sql(self, **kwargs: Any) -> str: + return " FIELDS TERMINATED BY ','" + + def __str__(self) -> str: + return self.get_sql() + + +class MySQLCreateQueryBuilder(CreateQueryBuilder): + QUOTE_CHAR = "`" + + +class MySQLDropQueryBuilder(DropQueryBuilder): + QUOTE_CHAR = "`" + + +class VerticaQuery(Query): + """ + Defines a query class for use with Vertica. + """ + + @classmethod + def _builder(cls, **kwargs) -> VerticaQueryBuilder: + return VerticaQueryBuilder(**kwargs) + + @classmethod + def from_file(cls, fp: str) -> VerticaCopyQueryBuilder: + return VerticaCopyQueryBuilder().from_file(fp) + + @classmethod + def create_table(cls, table: str | Table) -> VerticaCreateQueryBuilder: + return VerticaCreateQueryBuilder().create_table(table) + + +class VerticaQueryBuilder(QueryBuilder): + QUERY_CLS = VerticaQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.VERTICA, **kwargs) + self._hint = None + + @builder + def hint(self, label: str) -> None: + self._hint = label + + def get_sql(self, *args: Any, **kwargs: Any) -> str: + sql = super().get_sql(*args, **kwargs) + + if self._hint is not None: + sql = "".join([sql[:7], "/*+label({hint})*/".format(hint=self._hint), sql[6:]]) + + return sql + + +class VerticaCreateQueryBuilder(CreateQueryBuilder): + QUERY_CLS = VerticaQuery + + def __init__(self) -> None: + super().__init__(dialect=Dialects.VERTICA) + self._local = False + self._preserve_rows = False + + @builder + def local(self) -> None: + if not self._temporary: + raise AttributeError("'Query' object has no attribute temporary") + + self._local = True + + @builder + def preserve_rows(self) -> None: + if not self._temporary: + raise AttributeError("'Query' object has no attribute temporary") + + self._preserve_rows = True + + def _create_table_sql(self, **kwargs: Any) -> str: + return "CREATE {local}{temporary}TABLE {table}".format( + local="LOCAL " if self._local else "", + temporary="TEMPORARY " if self._temporary else "", + table=self._create_table.get_sql(**kwargs), + ) + + def _table_options_sql(self, **kwargs) -> str: + table_options = super()._table_options_sql(**kwargs) + table_options += self._preserve_rows_sql() + return table_options + + def _as_select_sql(self, **kwargs: Any) -> str: + return "{preserve_rows} AS ({query})".format( + preserve_rows=self._preserve_rows_sql(), + query=self._as_select.get_sql(**kwargs), + ) + + def _preserve_rows_sql(self) -> str: + return " ON COMMIT PRESERVE ROWS" if self._preserve_rows else "" + + +class VerticaCopyQueryBuilder: + QUERY_CLS = VerticaQuery + + def __init__(self) -> None: + self._copy_table = None + self._from_file = None + + @builder + def from_file(self, fp: str) -> None: + self._from_file = fp + + @builder + def copy_(self, table: str | Table) -> None: + self._copy_table = table if isinstance(table, Table) else Table(table) + + def get_sql(self, *args: Any, **kwargs: Any) -> str: + querystring = "" + if self._copy_table and self._from_file: + querystring += self._copy_table_sql(**kwargs) + querystring += self._from_file_sql(**kwargs) + querystring += self._options_sql(**kwargs) + + return querystring + + def _copy_table_sql(self, **kwargs: Any) -> str: + return 'COPY "{}"'.format(self._copy_table.get_sql(**kwargs)) + + def _from_file_sql(self, **kwargs: Any) -> str: + return " FROM LOCAL '{}'".format(self._from_file) + + def _options_sql(self, **kwargs: Any) -> str: + return " PARSER fcsvparser(header=false)" + + def __str__(self) -> str: + return self.get_sql() + + +class FetchNextAndOffsetRowsQueryBuilder(QueryBuilder): + def _limit_sql(self) -> str: + return " FETCH NEXT {limit} ROWS ONLY".format(limit=self._limit) + + def _offset_sql(self) -> str: + return " OFFSET {offset} ROWS".format(offset=self._offset or 0) + + @builder + def fetch_next(self, limit: int) -> None: + warnings.warn("`fetch_next` is deprecated - please use the `limit` method", DeprecationWarning) + self._limit = limit + + +class OracleQuery(Query): + """ + Defines a query class for use with Oracle. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> OracleQueryBuilder: + return OracleQueryBuilder(**kwargs) + + +class OracleQueryBuilder(FetchNextAndOffsetRowsQueryBuilder): + QUOTE_CHAR = None + QUERY_CLS = OracleQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.ORACLE, **kwargs) + + def get_sql(self, *args: Any, **kwargs: Any) -> str: + # Oracle does not support group by a field alias + # Note: set directly in kwargs as they are re-used down the tree in the case of subqueries! + kwargs['groupby_alias'] = False + return super().get_sql(*args, **kwargs) + + def _apply_pagination(self, querystring: str, **kwargs) -> str: + # Note: Overridden as Oracle specifies offset before the fetch next limit + if self._offset: + querystring += self._offset_sql() + + if self._limit is not None: + querystring += self._limit_sql() + + return querystring + + +class PostgreSQLQuery(Query): + """ + Defines a query class for use with PostgreSQL. + """ + + @classmethod + def _builder(cls, **kwargs) -> PostgreSQLQueryBuilder: + return PostgreSQLQueryBuilder(**kwargs) + + +class PostgreSQLQueryBuilder(QueryBuilder): + ALIAS_QUOTE_CHAR = '"' + QUERY_CLS = PostgreSQLQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.POSTGRESQL, **kwargs) + self._returns = [] + self._return_star = False + + self._on_conflict = False + self._on_conflict_fields = [] + self._on_conflict_do_nothing = False + self._on_conflict_do_updates = [] + self._on_conflict_wheres = None + self._on_conflict_do_update_wheres = None + + self._distinct_on = [] + + self._for_update_nowait = False + self._for_update_skip_locked = False + self._for_update_of = set() + + def __copy__(self) -> PostgreSQLQueryBuilder: + newone = super().__copy__() + newone._returns = copy(self._returns) + newone._on_conflict_do_updates = copy(self._on_conflict_do_updates) + return newone + + @builder + def distinct_on(self, *fields: str | Term) -> None: + for field in fields: + if isinstance(field, str): + self._distinct_on.append(Field(field)) + elif isinstance(field, Term): + self._distinct_on.append(field) + + @builder + def for_update(self, nowait: bool = False, skip_locked: bool = False, of: tuple[str, ...] = ()) -> QueryBuilder: + self._for_update = True + self._for_update_skip_locked = skip_locked + self._for_update_nowait = nowait + self._for_update_of = set(of) + + @builder + def on_conflict(self, *target_fields: str | Term) -> None: + if not self._insert_table: + raise QueryException("On conflict only applies to insert query") + + self._on_conflict = True + + for target_field in target_fields: + if isinstance(target_field, str): + self._on_conflict_fields.append(self._conflict_field_str(target_field)) + elif isinstance(target_field, Term): + self._on_conflict_fields.append(target_field) + + @builder + def do_nothing(self) -> None: + if len(self._on_conflict_do_updates) > 0: + raise QueryException("Can not have two conflict handlers") + self._on_conflict_do_nothing = True + + @builder + def do_update(self, update_field: str | Field, update_value: Any | None = None) -> None: + if self._on_conflict_do_nothing: + raise QueryException("Can not have two conflict handlers") + + if isinstance(update_field, str): + field = self._conflict_field_str(update_field) + elif isinstance(update_field, Field): + field = update_field + else: + raise QueryException("Unsupported update_field") + + if update_value is not None: + self._on_conflict_do_updates.append((field, ValueWrapper(update_value))) + else: + self._on_conflict_do_updates.append((field, None)) + + @builder + def where(self, criterion: Criterion) -> None: + if not self._on_conflict: + return super().where(criterion) + + if isinstance(criterion, EmptyCriterion): + return + + if self._on_conflict_do_nothing: + raise QueryException('DO NOTHING doest not support WHERE') + + if self._on_conflict_fields and self._on_conflict_do_updates: + if self._on_conflict_do_update_wheres: + self._on_conflict_do_update_wheres &= criterion + else: + self._on_conflict_do_update_wheres = criterion + elif self._on_conflict_fields: + if self._on_conflict_wheres: + self._on_conflict_wheres &= criterion + else: + self._on_conflict_wheres = criterion + else: + raise QueryException('Can not have fieldless ON CONFLICT WHERE') + + @builder + def using(self, table: Selectable | str) -> None: + self._using.append(table) + + def _distinct_sql(self, **kwargs: Any) -> str: + if self._distinct_on: + return "DISTINCT ON({distinct_on}) ".format( + distinct_on=",".join(term.get_sql(with_alias=True, **kwargs) for term in self._distinct_on) + ) + return super()._distinct_sql(**kwargs) + + def _conflict_field_str(self, term: str) -> Field | None: + if self._insert_table: + return Field(term, table=self._insert_table) + + def _on_conflict_sql(self, **kwargs: Any) -> str: + if not self._on_conflict_do_nothing and len(self._on_conflict_do_updates) == 0: + if not self._on_conflict_fields: + return "" + raise QueryException("No handler defined for on conflict") + + if self._on_conflict_do_updates and not self._on_conflict_fields: + raise QueryException("Can not have fieldless on conflict do update") + + conflict_query = " ON CONFLICT" + if self._on_conflict_fields: + fields = [f.get_sql(with_alias=True, **kwargs) for f in self._on_conflict_fields] + conflict_query += " (" + ', '.join(fields) + ")" + + if self._on_conflict_wheres: + conflict_query += " WHERE {where}".format(where=self._on_conflict_wheres.get_sql(subquery=True, **kwargs)) + + return conflict_query + + def _for_update_sql(self, **kwargs) -> str: + if self._for_update: + for_update = ' FOR UPDATE' + if self._for_update_of: + for_update += f' OF {", ".join([Table(item).get_sql(**kwargs) for item in self._for_update_of])}' + if self._for_update_nowait: + for_update += ' NOWAIT' + elif self._for_update_skip_locked: + for_update += ' SKIP LOCKED' + else: + for_update = '' + + return for_update + + def _on_conflict_action_sql(self, **kwargs: Any) -> str: + if self._on_conflict_do_nothing: + return " DO NOTHING" + elif len(self._on_conflict_do_updates) > 0: + updates = [] + for field, value in self._on_conflict_do_updates: + if value: + updates.append( + "{field}={value}".format( + field=field.get_sql(**kwargs), + value=value.get_sql(with_namespace=True, **kwargs), + ) + ) + else: + updates.append( + "{field}=EXCLUDED.{value}".format( + field=field.get_sql(**kwargs), + value=field.get_sql(**kwargs), + ) + ) + action_sql = " DO UPDATE SET {updates}".format(updates=",".join(updates)) + + if self._on_conflict_do_update_wheres: + action_sql += " WHERE {where}".format( + where=self._on_conflict_do_update_wheres.get_sql(subquery=True, with_namespace=True, **kwargs) + ) + return action_sql + + return '' + + @builder + def returning(self, *terms: Any) -> None: + for term in terms: + if isinstance(term, Field): + self._return_field(term) + elif isinstance(term, str): + self._return_field_str(term) + elif isinstance(term, (Function, ArithmeticExpression)): + if term.is_aggregate: + raise QueryException("Aggregate functions are not allowed in returning") + self._return_other(term) + else: + self._return_other(self.wrap_constant(term, self._wrapper_cls)) + + def _validate_returning_term(self, term: Term) -> None: + for field in term.fields_(): + if not any([self._insert_table, self._update_table, self._delete_from]): + raise QueryException("Returning can't be used in this query") + + table_is_insert_or_update_table = field.table in {self._insert_table, self._update_table} + join_tables = set(itertools.chain.from_iterable([j.criterion.tables_ for j in self._joins])) + join_and_base_tables = set(self._from) | join_tables + table_not_base_or_join = bool(term.tables_ - join_and_base_tables) + if not table_is_insert_or_update_table and table_not_base_or_join: + raise QueryException("You can't return from other tables") + + def _set_returns_for_star(self) -> None: + self._returns = [returning for returning in self._returns if not hasattr(returning, "table")] + self._return_star = True + + def _return_field(self, term: str | Field) -> None: + if self._return_star: + # Do not add select terms after a star is selected + return + + self._validate_returning_term(term) + + if isinstance(term, Star): + self._set_returns_for_star() + + self._returns.append(term) + + def _return_field_str(self, term: str | Field) -> None: + if term == "*": + self._set_returns_for_star() + self._returns.append(Star()) + return + + if self._insert_table: + self._return_field(Field(term, table=self._insert_table)) + elif self._update_table: + self._return_field(Field(term, table=self._update_table)) + elif self._delete_from: + self._return_field(Field(term, table=self._from[0])) + else: + raise QueryException("Returning can't be used in this query") + + def _return_other(self, function: Term) -> None: + self._validate_returning_term(function) + self._returns.append(function) + + def _returning_sql(self, **kwargs: Any) -> str: + return " RETURNING {returning}".format( + returning=",".join(term.get_sql(with_alias=True, **kwargs) for term in self._returns), + ) + + def get_sql(self, with_alias: bool = False, subquery: bool = False, **kwargs: Any) -> str: + self._set_kwargs_defaults(kwargs) + + querystring = super().get_sql(with_alias, subquery, **kwargs) + + querystring += self._on_conflict_sql(**kwargs) + querystring += self._on_conflict_action_sql(**kwargs) + + if self._returns: + kwargs['with_namespace'] = self._update_table and self.from_ + querystring += self._returning_sql(**kwargs) + return querystring + + +class RedshiftQuery(Query): + """ + Defines a query class for use with Amazon Redshift. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> RedShiftQueryBuilder: + return RedShiftQueryBuilder(dialect=Dialects.REDSHIFT, **kwargs) + + +class RedShiftQueryBuilder(QueryBuilder): + QUERY_CLS = RedshiftQuery + + +class MSSQLQuery(Query): + """ + Defines a query class for use with Microsoft SQL Server. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> MSSQLQueryBuilder: + return MSSQLQueryBuilder(**kwargs) + + +class MSSQLQueryBuilder(FetchNextAndOffsetRowsQueryBuilder): + QUERY_CLS = MSSQLQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.MSSQL, **kwargs) + self._top: int | None = None + self._top_with_ties: bool = False + self._top_percent: bool = False + + @builder + def top(self, value: str | int, percent: bool = False, with_ties: bool = False) -> None: + """ + Implements support for simple TOP clauses. + https://docs.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql?view=sql-server-2017 + """ + try: + self._top = int(value) + except ValueError: + raise QueryException("TOP value must be an integer") + + if percent and not (0 <= int(value) <= 100): + raise QueryException("TOP value must be between 0 and 100 when `percent`" " is specified") + self._top_percent: bool = percent + self._top_with_ties: bool = with_ties + + def _apply_pagination(self, querystring: str, **kwargs) -> str: + # Note: Overridden as MSSQL specifies offset before the fetch next limit + if self._limit is not None or self._offset: + # Offset has to be present if fetch next is specified in a MSSQL query + querystring += self._offset_sql() + + if self._limit is not None: + querystring += self._limit_sql() + + return querystring + + def get_sql(self, *args: Any, **kwargs: Any) -> str: + # MSSQL does not support group by a field alias. + # Note: set directly in kwargs as they are re-used down the tree in the case of subqueries! + kwargs['groupby_alias'] = False + return super().get_sql(*args, **kwargs) + + def _top_sql(self) -> str: + _top_statement: str = "" + if self._top: + _top_statement = f"TOP ({self._top}) " + if self._top_percent: + _top_statement = f"{_top_statement}PERCENT " + if self._top_with_ties: + _top_statement = f"{_top_statement}WITH TIES " + + return _top_statement + + def _select_sql(self, **kwargs: Any) -> str: + return "SELECT {distinct}{top}{select}".format( + top=self._top_sql(), + distinct="DISTINCT " if self._distinct else "", + select=",".join(term.get_sql(with_alias=True, subquery=True, **kwargs) for term in self._selects), + ) + + +class ClickHouseQuery(Query): + """ + Defines a query class for use with Yandex ClickHouse. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> ClickHouseQueryBuilder: + return ClickHouseQueryBuilder( + dialect=Dialects.CLICKHOUSE, wrap_set_operation_queries=False, as_keyword=True, **kwargs + ) + + @classmethod + def drop_database(self, database: Database | str) -> ClickHouseDropQueryBuilder: + return ClickHouseDropQueryBuilder().drop_database(database) + + @classmethod + def drop_table(self, table: Table | str) -> ClickHouseDropQueryBuilder: + return ClickHouseDropQueryBuilder().drop_table(table) + + @classmethod + def drop_dictionary(self, dictionary: str) -> ClickHouseDropQueryBuilder: + return ClickHouseDropQueryBuilder().drop_dictionary(dictionary) + + @classmethod + def drop_quota(self, quota: str) -> ClickHouseDropQueryBuilder: + return ClickHouseDropQueryBuilder().drop_quota(quota) + + @classmethod + def drop_user(self, user: str) -> ClickHouseDropQueryBuilder: + return ClickHouseDropQueryBuilder().drop_user(user) + + @classmethod + def drop_view(self, view: str) -> ClickHouseDropQueryBuilder: + return ClickHouseDropQueryBuilder().drop_view(view) + + +class ClickHouseQueryBuilder(QueryBuilder): + QUERY_CLS = ClickHouseQuery + + _distinct_on: list[Term] + _limit_by: tuple[int, int, list[Term]] | None + + def __init__(self, **kwargs) -> None: + super().__init__(**kwargs) + self._final = False + self._sample = None + self._sample_offset = None + self._distinct_on = [] + self._limit_by = None + + def __copy__(self) -> ClickHouseQueryBuilder: + newone = super().__copy__() + newone._limit_by = copy(self._limit_by) + return newone + + @builder + def final(self) -> None: + self._final = True + + @builder + def sample(self, sample: int, offset: int | None = None) -> None: + self._sample = sample + self._sample_offset = offset + + @staticmethod + def _delete_sql(**kwargs: Any) -> str: + return 'ALTER TABLE' + + def _update_sql(self, **kwargs: Any) -> str: + return "ALTER TABLE {table}".format(table=self._update_table.get_sql(**kwargs)) + + def _from_sql(self, with_namespace: bool = False, **kwargs: Any) -> str: + selectable = ",".join(clause.get_sql(subquery=True, with_alias=True, **kwargs) for clause in self._from) + if self._delete_from: + return f" {selectable} DELETE" + clauses = [selectable] + if self._final is not False: + clauses.append("FINAL") + if self._sample is not None: + clauses.append(f"SAMPLE {self._sample}") + if self._sample_offset is not None: + clauses.append(f"OFFSET {self._sample_offset}") + return " FROM {clauses}".format(clauses=" ".join(clauses)) + + def _set_sql(self, **kwargs: Any) -> str: + return " UPDATE {set}".format( + set=",".join( + "{field}={value}".format( + field=field.get_sql(**dict(kwargs, with_namespace=False)), value=value.get_sql(**kwargs) + ) + for field, value in self._updates + ) + ) + + @builder + def distinct_on(self, *fields: str | Term) -> None: + for field in fields: + if isinstance(field, str): + self._distinct_on.append(Field(field)) + elif isinstance(field, Term): + self._distinct_on.append(field) + + def _distinct_sql(self, **kwargs: Any) -> str: + if self._distinct_on: + return "DISTINCT ON({distinct_on}) ".format( + distinct_on=",".join(term.get_sql(with_alias=True, **kwargs) for term in self._distinct_on) + ) + return super()._distinct_sql(**kwargs) + + @builder + def limit_by(self, n, *by: str | Term) -> None: + self._limit_by = (n, 0, [Field(field) if isinstance(field, str) else field for field in by]) + + @builder + def limit_offset_by(self, n, offset, *by: str | Term) -> None: + self._limit_by = (n, offset, [Field(field) if isinstance(field, str) else field for field in by]) + + def _apply_pagination(self, querystring: str, **kwargs) -> str: + # LIMIT BY isn't really a pagination per se but since we need + # to add this to the query right before an actual LIMIT clause + # this is good enough. + if self._limit_by: + querystring += self._limit_by_sql(**kwargs) + return super()._apply_pagination(querystring, **kwargs) + + def _limit_by_sql(self, **kwargs: Any) -> str: + (n, offset, by) = self._limit_by + by = ",".join(term.get_sql(with_alias=True, **kwargs) for term in by) + if offset != 0: + return f" LIMIT {n} OFFSET {offset} BY ({by})" + else: + return f" LIMIT {n} BY ({by})" + + def replace_table(self, current_table: Table | None, new_table: Table | None) -> ClickHouseQueryBuilder: + newone = super().replace_table(current_table, new_table) + if self._limit_by: + newone._limit_by = ( + self._limit_by[0], + self._limit_by[1], + [column.replace_table(current_table, new_table) for column in self._limit_by[2]], + ) + return newone + + +class ClickHouseDropQueryBuilder(DropQueryBuilder): + QUERY_CLS = ClickHouseQuery + + def __init__(self): + super().__init__(dialect=Dialects.CLICKHOUSE) + self._cluster_name = None + + @builder + def drop_dictionary(self, dictionary: str) -> None: + super()._set_target('DICTIONARY', dictionary) + + @builder + def drop_quota(self, quota: str) -> None: + super()._set_target('QUOTA', quota) + + @builder + def on_cluster(self, cluster: str) -> None: + if self._cluster_name: + raise AttributeError("'DropQuery' object already has attribute cluster_name") + self._cluster_name = cluster + + def get_sql(self, **kwargs: Any) -> str: + query = super().get_sql(**kwargs) + + if self._drop_target_kind != "DICTIONARY" and self._cluster_name is not None: + query += " ON CLUSTER " + format_quotes(self._cluster_name, super().QUOTE_CHAR) + + return query + + +class SQLLiteValueWrapper(ValueWrapper): + def get_value_sql(self, **kwargs: Any) -> str: + if isinstance(self.value, bool): + return "1" if self.value else "0" + return super().get_value_sql(**kwargs) + + +class SQLLiteQuery(Query): + """ + Defines a query class for use with Microsoft SQL Server. + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> SQLLiteQueryBuilder: + return SQLLiteQueryBuilder(**kwargs) + + +class SQLLiteQueryBuilder(QueryBuilder): + QUERY_CLS = SQLLiteQuery + + def __init__(self, **kwargs: Any) -> None: + super().__init__(dialect=Dialects.SQLLITE, wrapper_cls=SQLLiteValueWrapper, **kwargs) + self._insert_or_replace = False + + @builder + def insert_or_replace(self, *terms: Any) -> None: + self._apply_terms(*terms) + self._replace = True + self._insert_or_replace = True + + def _replace_sql(self, **kwargs: Any) -> str: + prefix = "INSERT OR " if self._insert_or_replace else "" + return prefix + super()._replace_sql(**kwargs) + + +class JiraQuery(Query): + """ + Defines a query class for use with Jira. + """ + + @classmethod + def _builder(cls, **kwargs) -> JiraQueryBuilder: + return JiraQueryBuilder(**kwargs) + + @classmethod + def where(cls, *args, **kwargs) -> QueryBuilder: + return JiraQueryBuilder().where(*args, **kwargs) + + @classmethod + def Table(cls, table_name: str = '', **_) -> JiraTable: + """ + Convenience method for creating a JiraTable + """ + del table_name + return JiraTable() + + @classmethod + def Tables(cls, *names: tuple[str, str] | str, **kwargs: Any) -> list[JiraTable]: + """ + Convenience method for creating many JiraTable instances + """ + del kwargs + return [JiraTable() for _ in range(len(names))] + + +class JiraQueryBuilder(QueryBuilder): + """ + Defines a main query builder class to produce JQL expression + """ + + QUOTE_CHAR = "" + SECONDARY_QUOTE_CHAR = '"' + QUERY_CLS = JiraQuery + + def __init__(self, **kwargs) -> None: + super().__init__(dialect=Dialects.JIRA, **kwargs) + self._from = [JiraTable()] + self._selects = [Star()] + self._select_star = True + + def get_sql(self, with_alias: bool = False, subquery: bool = False, **kwargs) -> str: + return super().get_sql(with_alias, subquery, **kwargs).strip() + + def _from_sql(self, with_namespace: bool = False, **_: Any) -> str: + """ + JQL doen't have from statements + """ + return "" + + def _select_sql(self, **_: Any) -> str: + """ + JQL doen't have select statements + """ + return "" + + def _where_sql(self, quote_char=None, **kwargs: Any) -> str: + return self._wheres.get_sql(quote_char=quote_char, subquery=True, **kwargs) + + +class JiraEmptyCriterion(NullCriterion): + def get_sql(self, with_alias: bool = False, **kwargs: Any) -> str: + del with_alias + sql = "{term} is EMPTY".format( + term=self.term.get_sql(**kwargs), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class JiraNotEmptyCriterion(JiraEmptyCriterion): + def get_sql(self, with_alias: bool = False, **kwargs) -> str: + del with_alias + sql = "{term} is not EMPTY".format( + term=self.term.get_sql(**kwargs), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class JiraField(Field): + def isempty(self) -> JiraEmptyCriterion: + return JiraEmptyCriterion(self) + + def notempty(self) -> JiraNotEmptyCriterion: + return JiraNotEmptyCriterion(self) + + +class JiraTable(Table): + def __init__(self): + super().__init__("issues") + + def field(self, name: str) -> JiraField: + return JiraField(name, table=self) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/enums.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/enums.py new file mode 100644 index 0000000000000000000000000000000000000000..482b687f3cf99e184a027dae974a95a3308bc26b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/enums.py @@ -0,0 +1,161 @@ +from __future__ import annotations + +from enum import Enum +from typing import Any + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" + + +class Arithmetic(Enum): + add = "+" + sub = "-" + mul = "*" + div = "/" + lshift = "<<" + rshift = ">>" + + +class Comparator(Enum): + pass + + +class Equality(Comparator): + eq = "=" + ne = "<>" + gt = ">" + gte = ">=" + lt = "<" + lte = "<=" + + +class Matching(Comparator): + not_like = " NOT LIKE " + like = " LIKE " + not_ilike = " NOT ILIKE " + ilike = " ILIKE " + rlike = " RLIKE " + regex = " REGEX " + regexp = " REGEXP " + bin_regex = " REGEX BINARY " + as_of = " AS OF " + glob = " GLOB " + + +class Boolean(Comparator): + and_ = "AND" + or_ = "OR" + xor_ = "XOR" + true = "TRUE" + false = "FALSE" + + +class Order(Enum): + asc = "ASC" + desc = "DESC" + + +class JoinType(Enum): + inner = "" + left = "LEFT" + right = "RIGHT" + outer = "FULL OUTER" + left_outer = "LEFT OUTER" + right_outer = "RIGHT OUTER" + full_outer = "FULL OUTER" + cross = "CROSS" + hash = "HASH" + + +class ReferenceOption(Enum): + cascade = "CASCADE" + no_action = "NO ACTION" + restrict = "RESTRICT" + set_null = "SET NULL" + set_default = "SET DEFAULT" + + +class SetOperation(Enum): + union = "UNION" + union_all = "UNION ALL" + intersect = "INTERSECT" + except_of = "EXCEPT" + minus = "MINUS" + + +class DatePart(Enum): + year = "YEAR" + quarter = "QUARTER" + month = "MONTH" + week = "WEEK" + day = "DAY" + hour = "HOUR" + minute = "MINUTE" + second = "SECOND" + microsecond = "MICROSECOND" + + +class SqlType: + def __init__(self, name: str) -> None: + self.name = name + + def __call__(self, length: int) -> SqlTypeLength: + return SqlTypeLength(self.name, length) + + def get_sql(self, **kwargs: Any) -> str: + return "{name}".format(name=self.name) + + +class SqlTypeLength: + def __init__(self, name: str, length: int) -> None: + self.name = name + self.length = length + + def get_sql(self, **kwargs: Any) -> str: + return "{name}({length})".format(name=self.name, length=self.length) + + +class SqlTypes: + BOOLEAN = "BOOLEAN" + INTEGER = "INTEGER" + FLOAT = "FLOAT" + NUMERIC = "NUMERIC" + SIGNED = "SIGNED" + UNSIGNED = "UNSIGNED" + INTEGER_AUTO_INCREMENT = "INTEGER AUTO_INCREMENT" + + DATE = "DATE" + TIME = "TIME" + TIMESTAMP = "TIMESTAMP" + + CHAR = SqlType("CHAR") + VARCHAR = SqlType("VARCHAR") + LONG_VARCHAR = SqlType("LONG VARCHAR") + BINARY = SqlType("BINARY") + VARBINARY = SqlType("VARBINARY") + LONG_VARBINARY = SqlType("LONG VARBINARY") + + +class Dialects(Enum): + VERTICA = "vertica" + CLICKHOUSE = "clickhouse" + JIRA = "jira" + ORACLE = "oracle" + MSSQL = "mssql" + MYSQL = "mysql" + POSTGRESQL = "postgresql" + REDSHIFT = "redshift" + SQLLITE = "sqllite" + SNOWFLAKE = "snowflake" + + +class JSONOperators(Enum): + HAS_KEY = "?" + CONTAINS = "@>" + CONTAINED_BY = "<@" + HAS_KEYS = "?&" + HAS_ANY_KEYS = "?|" + GET_JSON_VALUE = "->" + GET_TEXT_VALUE = "->>" + GET_PATH_JSON_VALUE = "#>" + GET_PATH_TEXT_VALUE = "#>>" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/functions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/functions.py new file mode 100644 index 0000000000000000000000000000000000000000..7e8cab56e220d752e566fce46657ed98ceb7d358 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/functions.py @@ -0,0 +1,314 @@ +""" +Package for SQL functions wrappers +""" + +from __future__ import annotations + +from pypika import Field +from pypika.enums import SqlTypes +from pypika.terms import AggregateFunction, Function, LiteralValue, Star, Term +from pypika.utils import builder + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" + + +class DistinctOptionFunction(AggregateFunction): + def __init__(self, name, *args, **kwargs): + alias = kwargs.get("alias") + super().__init__(name, *args, alias=alias) + self._distinct = False + + def get_function_sql(self, **kwargs): + s = super().get_function_sql(**kwargs) + + n = len(self.name) + 1 + if self._distinct: + return s[:n] + "DISTINCT " + s[n:] + return s + + @builder + def distinct(self): + self._distinct = True + + +class Count(DistinctOptionFunction): + def __init__(self, param: str | Term, alias: str | None = None) -> None: + is_star = isinstance(param, str) and "*" == param + super().__init__("COUNT", Star() if is_star else param, alias=alias) + + +# Arithmetic Functions +class Sum(DistinctOptionFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("SUM", term, alias=alias) + + +class Avg(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("AVG", term, alias=alias) + + +class Min(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("MIN", term, alias=alias) + + +class Max(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("MAX", term, alias=alias) + + +class Std(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("STD", term, alias=alias) + + +class StdDev(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("STDDEV", term, alias=alias) + + +class Abs(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("ABS", term, alias=alias) + + +class First(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("FIRST", term, alias=alias) + + +class Last(AggregateFunction): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("LAST", term, alias=alias) + + +class Sqrt(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("SQRT", term, alias=alias) + + +class Floor(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("FLOOR", term, alias=alias) + + +class ApproximatePercentile(AggregateFunction): + def __init__(self, term, percentile, alias=None): + super().__init__("APPROXIMATE_PERCENTILE", term, alias=alias) + self.percentile = float(percentile) + + def get_special_params_sql(self, **kwargs): + return "USING PARAMETERS percentile={percentile}".format(percentile=self.percentile) + + +# Type Functions +class Cast(Function): + def __init__(self, term, as_type, alias=None): + super().__init__("CAST", term, alias=alias) + self.as_type = as_type + + def get_special_params_sql(self, **kwargs): + type_sql = self.as_type.get_sql(**kwargs) if hasattr(self.as_type, "get_sql") else str(self.as_type).upper() + return "AS {type}".format(type=type_sql) + + +class Convert(Function): + def __init__(self, term, encoding, alias=None): + super().__init__("CONVERT", term, alias=alias) + self.encoding = encoding + + def get_special_params_sql(self, **kwargs): + return "USING {type}".format(type=self.encoding.value) + + +class ToChar(Function): + def __init__(self, term, as_type, alias=None): + super().__init__("TO_CHAR", term, as_type, alias=alias) + + +class Signed(Cast): + def __init__(self, term: Term, alias: str | None = None): + super().__init__(term, SqlTypes.SIGNED, alias=alias) + + +class Unsigned(Cast): + def __init__(self, term: Term, alias: str | None = None): + super().__init__(term, SqlTypes.UNSIGNED, alias=alias) + + +class Date(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("DATE", term, alias=alias) + + +class DateDiff(Function): + def __init__(self, interval, start_date, end_date, alias=None): + super().__init__("DATEDIFF", interval, start_date, end_date, alias=alias) + + +class TimeDiff(Function): + def __init__(self, start_time, end_time, alias=None): + super().__init__("TIMEDIFF", start_time, end_time, alias=alias) + + +class DateAdd(Function): + def __init__(self, date_part, interval, term: Term, alias: str | None = None): + date_part = getattr(date_part, "value", date_part) + super().__init__("DATE_ADD", LiteralValue(date_part), interval, term, alias=alias) + + +class ToDate(Function): + def __init__(self, value, format_mask, alias=None): + super().__init__("TO_DATE", value, format_mask, alias=alias) + + +class Timestamp(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("TIMESTAMP", term, alias=alias) + + +class TimestampAdd(Function): + def __init__(self, date_part, interval, term: Term, alias: str | None = None): + date_part = getattr(date_part, 'value', date_part) + super().__init__("TIMESTAMPADD", LiteralValue(date_part), interval, term, alias=alias) + + +# String Functions +class Ascii(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("ASCII", term, alias=alias) + + +class NullIf(Function): + def __init__(self, term, condition, **kwargs): + super().__init__("NULLIF", term, condition, **kwargs) + + +class Bin(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("BIN", term, alias=alias) + + +class Concat(Function): + def __init__(self, *terms, **kwargs): + super().__init__("CONCAT", *terms, **kwargs) + + +class Insert(Function): + def __init__(self, term, start, stop, subterm, alias=None): + term, start, stop, subterm = [term for term in [term, start, stop, subterm]] + super().__init__("INSERT", term, start, stop, subterm, alias=alias) + + +class Length(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("LENGTH", term, alias=alias) + + +class Upper(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("UPPER", term, alias=alias) + + +class Lower(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("LOWER", term, alias=alias) + + +class Substring(Function): + def __init__(self, term, start, stop, alias=None): + super().__init__("SUBSTRING", term, start, stop, alias=alias) + + +class Reverse(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("REVERSE", term, alias=alias) + + +class Trim(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("TRIM", term, alias=alias) + + +class SplitPart(Function): + def __init__(self, term, delimiter, index, alias=None): + super().__init__("SPLIT_PART", term, delimiter, index, alias=alias) + + +class RegexpMatches(Function): + def __init__(self, term, pattern, modifiers=None, alias=None): + super().__init__("REGEXP_MATCHES", term, pattern, modifiers, alias=alias) + + +class RegexpLike(Function): + def __init__(self, term, pattern, modifiers=None, alias=None): + super().__init__("REGEXP_LIKE", term, pattern, modifiers, alias=alias) + + +class Replace(Function): + def __init__(self, term, find_string, replace_with, alias=None): + super().__init__("REPLACE", term, find_string, replace_with, alias=alias) + + +# Date/Time Functions +class Now(Function): + def __init__(self, alias=None): + super().__init__("NOW", alias=alias) + + +class UtcTimestamp(Function): + def __init__(self, alias=None): + super().__init__("UTC_TIMESTAMP", alias=alias) + + +class CurTimestamp(Function): + def __init__(self, alias=None): + super().__init__("CURRENT_TIMESTAMP", alias=alias) + + def get_function_sql(self, **kwargs): + # CURRENT_TIMESTAMP takes no arguments, so the SQL to generate is quite + # simple. Note that empty parentheses have been omitted intentionally. + return "CURRENT_TIMESTAMP" + + +class CurDate(Function): + def __init__(self, alias=None): + super().__init__("CURRENT_DATE", alias=alias) + + +class CurTime(Function): + def __init__(self, alias=None): + super().__init__("CURRENT_TIME", alias=alias) + + +class Extract(Function): + def __init__(self, date_part, field, alias=None): + date_part = getattr(date_part, "value", date_part) + super().__init__("EXTRACT", LiteralValue(date_part), alias=alias) + self.field = field + + def get_special_params_sql(self, **kwargs): + return "FROM {field}".format(field=self.field.get_sql(**kwargs)) + + +# Null Functions +class IsNull(Function): + def __init__(self, term: Term, alias: str | None = None): + super().__init__("ISNULL", term, alias=alias) + + +class Coalesce(Function): + def __init__(self, term, *default_values, **kwargs): + super().__init__("COALESCE", term, *default_values, **kwargs) + + +class IfNull(Function): + def __init__(self, condition, term, **kwargs): + super().__init__("IFNULL", condition, term, **kwargs) + + +class NVL(Function): + def __init__(self, condition, term: Term, alias: str | None = None): + super().__init__("NVL", condition, term, alias=alias) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/pseudocolumns.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/pseudocolumns.py new file mode 100644 index 0000000000000000000000000000000000000000..6aeb47c0e5045d3a2bc477a71a79f170e36caa11 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/pseudocolumns.py @@ -0,0 +1,8 @@ +from .terms import PseudoColumn + +ColumnValue = PseudoColumn("COLUMN_VALUE") +ObjectID = PseudoColumn("OBJECT_ID") +ObjectValue = PseudoColumn("OBJECT_VALUE") +RowNum = PseudoColumn("ROWNUM") +RowID = PseudoColumn("ROWID") +SysDate = PseudoColumn("SYSDATE") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/py.typed @@ -0,0 +1 @@ + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/queries.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/queries.py new file mode 100644 index 0000000000000000000000000000000000000000..8455dd6e83d8aaeb39c2a15b684e95d3ccfd6d0e --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/queries.py @@ -0,0 +1,2263 @@ +from __future__ import annotations + +import sys +from collections.abc import Sequence +from copy import copy +from functools import reduce +from typing import TYPE_CHECKING, Any, Generic, TypeVar + +from pypika.enums import Dialects, JoinType, ReferenceOption, SetOperation +from pypika.terms import ( + ArithmeticExpression, + Criterion, + EmptyCriterion, + Field, + Function, + Index, + Node, + PeriodCriterion, + Rollup, + Star, + Term, + Tuple, + ValueWrapper, +) +from pypika.utils import ( + JoinException, + QueryException, + RollupException, + SetOperationException, + builder, + format_alias_sql, + format_quotes, + ignore_copy, +) + +if TYPE_CHECKING: + if sys.version_info >= (3, 11): + from typing import Self + else: + from typing_extensions import Self + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" + + +QB = TypeVar("QB", bound="QueryBuilder") + + +class Selectable(Node): + def __init__(self, alias: str) -> None: + self.alias = alias + + @builder + def as_(self, alias: str) -> None: + self.alias = alias + + def field(self, name: str) -> Field: + return Field(name, table=self) + + @property + def star(self) -> Star: + return Star(self) + + @ignore_copy + def __getattr__(self, name: str) -> Field: + return self.field(name) + + @ignore_copy + def __getitem__(self, name: str) -> Field: + return self.field(name) + + def get_table_name(self) -> str: + return self.alias + + +class AliasedQuery(Selectable): + def __init__(self, name: str, query: Selectable | None = None) -> None: + super().__init__(alias=name) + self.name = name + self.query = query + + def get_sql(self, **kwargs: Any) -> str: + if self.query is None: + return self.name + return self.query.get_sql(**kwargs) + + def __eq__(self, other: AliasedQuery) -> bool: + return isinstance(other, AliasedQuery) and self.name == other.name + + def __hash__(self) -> int: + return hash(str(self.name)) + + +class Schema: + def __init__(self, name: str, parent: Schema | None = None) -> None: + self._name = name + self._parent = parent + + def __eq__(self, other: Schema) -> bool: + return isinstance(other, Schema) and self._name == other._name and self._parent == other._parent + + def __ne__(self, other: Schema) -> bool: + return not self.__eq__(other) + + @ignore_copy + def __getattr__(self, item: str) -> Table: + return Table(item, schema=self) + + def get_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + schema_sql = format_quotes(self._name, quote_char) + + if self._parent is not None: + return "{parent}.{schema}".format( + parent=self._parent.get_sql(quote_char=quote_char, **kwargs), + schema=schema_sql, + ) + + return schema_sql + + +class Database(Schema): + @ignore_copy + def __getattr__(self, item: str) -> Schema: + return Schema(item, parent=self) + + +class Table(Selectable): + @staticmethod + def _init_schema(schema: str | list | tuple | Schema | None) -> str | list | tuple | Schema | None: + # This is a bit complicated in order to support backwards compatibility. It should probably be cleaned up for + # the next major release. Schema is accepted as a string, list/tuple, Schema instance, or None + if isinstance(schema, Schema): + return schema + if isinstance(schema, (list, tuple)): + return reduce(lambda obj, s: Schema(s, parent=obj), schema[1:], Schema(schema[0])) + if schema is not None: + return Schema(schema) + return None + + def __init__( + self, + name: str, + schema: Schema | str | None = None, + alias: str | None = None, + query_cls: type[Query] | None = None, + ) -> None: + super().__init__(alias) + self._table_name = name + self._schema = self._init_schema(schema) + self._query_cls = query_cls or Query + self._for = None + self._for_portion = None + if not issubclass(self._query_cls, Query): + raise TypeError("Expected 'query_cls' to be subclass of Query") + + def get_table_name(self) -> str: + return self.alias or self._table_name + + def get_sql(self, **kwargs: Any) -> str: + quote_char = kwargs.get("quote_char") + table_sql = format_quotes(self._table_name, quote_char) + + if self._schema is not None: + table_sql = "{schema}.{table}".format(schema=self._schema.get_sql(**kwargs), table=table_sql) + + if self._for: + table_sql = "{table} FOR {criterion}".format(table=table_sql, criterion=self._for.get_sql(**kwargs)) + elif self._for_portion: + table_sql = "{table} FOR PORTION OF {criterion}".format( + table=table_sql, criterion=self._for_portion.get_sql(**kwargs) + ) + + return format_alias_sql(table_sql, self.alias, **kwargs) + + @builder + def for_(self, temporal_criterion: Criterion) -> None: + if self._for: + raise AttributeError("'Query' object already has attribute for_") + if self._for_portion: + raise AttributeError("'Query' object already has attribute for_portion") + self._for = temporal_criterion + + @builder + def for_portion(self, period_criterion: PeriodCriterion) -> None: + if self._for_portion: + raise AttributeError("'Query' object already has attribute for_portion") + if self._for: + raise AttributeError("'Query' object already has attribute for_") + self._for_portion = period_criterion + + def __str__(self) -> str: + return self.get_sql(quote_char='"') + + def __eq__(self, other) -> bool: + if not isinstance(other, Table): + return False + + if self._table_name != other._table_name: + return False + + if self._schema != other._schema: + return False + + if self.alias != other.alias: + return False + + return True + + def __repr__(self) -> str: + if self._schema: + return "Table('{}', schema='{}')".format(self._table_name, self._schema) + return "Table('{}')".format(self._table_name) + + def __ne__(self, other: Any) -> bool: + return not self.__eq__(other) + + def __hash__(self) -> int: + return hash(str(self)) + + def select(self, *terms: int | float | str | bool | Term | Field) -> QueryBuilder: + """ + Perform a SELECT operation on the current table + + :param terms: + Type: list[expression] + + A list of terms to select. These can be any type of int, float, str, bool or Term or a Field. + + :return: QueryBuilder + """ + return self._query_cls.from_(self).select(*terms) + + def update(self) -> QueryBuilder: + """ + Perform an UPDATE operation on the current table + + :return: QueryBuilder + """ + return self._query_cls.update(self) + + def insert(self, *terms: int | float | str | bool | Term | Field) -> QueryBuilder: + """ + Perform an INSERT operation on the current table + + :param terms: + Type: list[expression] + + A list of terms to select. These can be any type of int, float, str, bool or any other valid data + + :return: QueryBuilder + """ + return self._query_cls.into(self).insert(*terms) + + +def make_tables(*names: tuple[str, str] | str, **kwargs: Any) -> list[Table]: + """ + Shortcut to create many tables. If `names` param is a tuple, the first + position will refer to the `_table_name` while the second will be its `alias`. + Any other data structure will be treated as a whole as the `_table_name`. + """ + tables = [] + for name in names: + if isinstance(name, tuple) and len(name) == 2: + t = Table( + name=name[0], + alias=name[1], + schema=kwargs.get("schema"), + query_cls=kwargs.get("query_cls"), + ) + else: + t = Table( + name=name, + schema=kwargs.get("schema"), + query_cls=kwargs.get("query_cls"), + ) + tables.append(t) + return tables + + +class Column: + """Represents a column.""" + + def __init__( + self, + column_name: str, + column_type: str | None = None, + nullable: bool | None = None, + default: Any | Term | None = None, + ) -> None: + self.name = column_name + self.type = column_type + self.nullable = nullable + self.default = default if default is None or isinstance(default, Term) else ValueWrapper(default) + + def get_name_sql(self, **kwargs: Any) -> str: + quote_char = kwargs.get("quote_char") + + column_sql = "{name}".format( + name=format_quotes(self.name, quote_char), + ) + + return column_sql + + def get_sql(self, **kwargs: Any) -> str: + column_sql = "{name}{type}{nullable}{default}".format( + name=self.get_name_sql(**kwargs), + type=" {}".format(self.type) if self.type else "", + nullable=" {}".format("NULL" if self.nullable else "NOT NULL") if self.nullable is not None else "", + default=" {}".format("DEFAULT " + self.default.get_sql(**kwargs)) if self.default else "", + ) + + return column_sql + + def __str__(self) -> str: + return self.get_sql(quote_char='"') + + +def make_columns(*names: tuple[str, str] | str) -> list[Column]: + """ + Shortcut to create many columns. If `names` param is a tuple, the first + position will refer to the `name` while the second will be its `type`. + Any other data structure will be treated as a whole as the `name`. + """ + columns = [] + for name in names: + if isinstance(name, tuple) and len(name) == 2: + column = Column(column_name=name[0], column_type=name[1]) + else: + column = Column(column_name=name) + columns.append(column) + + return columns + + +class PeriodFor: + def __init__(self, name: str, start_column: str | Column, end_column: str | Column) -> None: + self.name = name + self.start_column = start_column if isinstance(start_column, Column) else Column(start_column) + self.end_column = end_column if isinstance(end_column, Column) else Column(end_column) + + def get_sql(self, **kwargs: Any) -> str: + quote_char = kwargs.get("quote_char") + + period_for_sql = "PERIOD FOR {name} ({start_column_name},{end_column_name})".format( + name=format_quotes(self.name, quote_char), + start_column_name=self.start_column.get_name_sql(**kwargs), + end_column_name=self.end_column.get_name_sql(**kwargs), + ) + + return period_for_sql + + +# for typing in Query's methods +_TableClass = Table + + +class Query: + """ + Query is the primary class and entry point in pypika. It is used to build queries iteratively using the builder + design + pattern. + + This class is immutable. + + Examples + -------- + Simple query + + .. code-block:: python + + from pypika import Query, Field + q = Query.from_('customers').select('*').where(Field("id") == 1) + """ + + @classmethod + def _builder(cls, **kwargs: Any) -> QueryBuilder: + return QueryBuilder(**kwargs) + + @classmethod + def from_(cls, table: Selectable | str, **kwargs: Any) -> QueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table to select from. When using this + function, the query becomes a SELECT query. + + :param table: + Type: Table or str + + An instance of a Table object or a string table name. + + :return: QueryBuilder + """ + return cls._builder(**kwargs).from_(table) + + @classmethod + def create_table(cls, table: str | Table) -> CreateQueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table name to be created. When using this + function, the query becomes a CREATE statement. + + :param table: An instance of a Table object or a string table name. + + :return: CreateQueryBuilder + """ + return CreateQueryBuilder().create_table(table) + + @classmethod + def create_index(cls, index: str | Index) -> CreateIndexBuilder: + """ + Query builder entry point. Initializes query building and sets the index name to be created. When using this + function, the query becomes a CREATE statement. + """ + return CreateIndexBuilder().create_index(index) + + @classmethod + def drop_database(cls, database: Database | Table) -> DropQueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table name to be dropped. When using this + function, the query becomes a DROP statement. + + :param database: An instance of a Database object or a string database name. + + :return: DropQueryBuilder + """ + return DropQueryBuilder().drop_database(database) + + @classmethod + def drop_table(cls, table: str | Table) -> DropQueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table name to be dropped. When using this + function, the query becomes a DROP statement. + + :param table: An instance of a Table object or a string table name. + + :return: DropQueryBuilder + """ + return DropQueryBuilder().drop_table(table) + + @classmethod + def drop_user(cls, user: str) -> DropQueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table name to be dropped. When using this + function, the query becomes a DROP statement. + + :param user: String user name. + + :return: DropQueryBuilder + """ + return DropQueryBuilder().drop_user(user) + + @classmethod + def drop_view(cls, view: str) -> DropQueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table name to be dropped. When using this + function, the query becomes a DROP statement. + + :param view: String view name. + + :return: DropQueryBuilder + """ + return DropQueryBuilder().drop_view(view) + + @classmethod + def drop_index(cls, index: str | Index) -> DropQueryBuilder: + """ + Query builder entry point. Initializes query building and sets the index name to be dropped. When using this + function, the query becomes a DROP statement. + """ + return DropQueryBuilder().drop_index(index) + + @classmethod + def into(cls, table: Table | str, **kwargs: Any) -> QueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table to insert into. When using this + function, the query becomes an INSERT query. + + :param table: + Type: Table or str + + An instance of a Table object or a string table name. + + :return QueryBuilder + """ + return cls._builder(**kwargs).into(table) + + @classmethod + def with_(cls, table: str | Selectable, name: str, **kwargs: Any) -> QueryBuilder: + return cls._builder(**kwargs).with_(table, name) + + @classmethod + def select(cls, *terms: int | float | str | bool | Term, **kwargs: Any) -> QueryBuilder: + """ + Query builder entry point. Initializes query building without a table and selects fields. Useful when testing + SQL functions. + + :param terms: + Type: list[expression] + + A list of terms to select. These can be any type of int, float, str, bool, or Term. They cannot be a Field + unless the function ``Query.from_`` is called first. + + :return: QueryBuilder + """ + return cls._builder(**kwargs).select(*terms) + + @classmethod + def update(cls, table: str | Table, **kwargs) -> QueryBuilder: + """ + Query builder entry point. Initializes query building and sets the table to update. When using this + function, the query becomes an UPDATE query. + + :param table: + Type: Table or str + + An instance of a Table object or a string table name. + + :return: QueryBuilder + """ + return cls._builder(**kwargs).update(table) + + @classmethod + def Table(cls, table_name: str, **kwargs) -> _TableClass: + """ + Convenience method for creating a Table that uses this Query class. + + :param table_name: + Type: str + + A string table name. + + :return: Table + """ + kwargs["query_cls"] = cls + return Table(table_name, **kwargs) + + @classmethod + def Tables(cls, *names: tuple[str, str] | str, **kwargs: Any) -> list[_TableClass]: + """ + Convenience method for creating many tables that uses this Query class. + See ``Query.make_tables`` for details. + + :param names: + Type: list[str or tuple] + + A list of string table names, or name and alias tuples. + + :return: Table + """ + kwargs["query_cls"] = cls + return make_tables(*names, **kwargs) + + +class _SetOperation(Selectable, Term): + """ + A Query class wrapper for a all set operations, Union DISTINCT or ALL, Intersect, Except or Minus + + Created via the functions `Query.union`,`Query.union_all`,`Query.intersect`, `Query.except_of`,`Query.minus`. + + This class should not be instantiated directly. + """ + + def __init__( + self, + base_query: QueryBuilder, + set_operation_query: QueryBuilder, + set_operation: SetOperation, + alias: str | None = None, + wrapper_cls: type[ValueWrapper] = ValueWrapper, + ): + super().__init__(alias) + self.base_query = base_query + self._set_operation = [(set_operation, set_operation_query)] + self._orderbys = [] + + self._limit = None + self._offset = None + + self._wrapper_cls = wrapper_cls + + @builder + def orderby(self, *fields: Field, **kwargs: Any) -> None: + for field in fields: + field = ( + Field(field, table=self.base_query._from[0]) + if isinstance(field, str) + else self.base_query.wrap_constant(field) + ) + + self._orderbys.append((field, kwargs.get("order"))) + + @builder + def limit(self, limit: int) -> None: + self._limit = limit + + @builder + def offset(self, offset: int) -> None: + self._offset = offset + + @builder + def union(self, other: Selectable) -> None: + self._set_operation.append((SetOperation.union, other)) + + @builder + def union_all(self, other: Selectable) -> None: + self._set_operation.append((SetOperation.union_all, other)) + + @builder + def intersect(self, other: Selectable) -> None: + self._set_operation.append((SetOperation.intersect, other)) + + @builder + def except_of(self, other: Selectable) -> None: + self._set_operation.append((SetOperation.except_of, other)) + + @builder + def minus(self, other: Selectable) -> None: + self._set_operation.append((SetOperation.minus, other)) + + def __add__(self, other: Selectable) -> _SetOperation: + return self.union(other) + + def __mul__(self, other: Selectable) -> _SetOperation: + return self.union_all(other) + + def __sub__(self, other: QueryBuilder) -> _SetOperation: + return self.minus(other) + + def __str__(self) -> str: + return self.get_sql() + + def get_sql(self, with_alias: bool = False, subquery: bool = False, **kwargs: Any) -> str: + set_operation_template = " {type} {query_string}" + + kwargs.setdefault("dialect", self.base_query.dialect) + # This initializes the quote char based on the base query, which could be a dialect specific query class + # This might be overridden if quote_char is set explicitly in kwargs + kwargs.setdefault("quote_char", self.base_query.QUOTE_CHAR) + + base_querystring = self.base_query.get_sql(subquery=self.base_query.wrap_set_operation_queries, **kwargs) + + querystring = base_querystring + for set_operation, set_operation_query in self._set_operation: + set_operation_querystring = set_operation_query.get_sql( + subquery=self.base_query.wrap_set_operation_queries, **kwargs + ) + + if len(self.base_query._selects) != len(set_operation_query._selects): + raise SetOperationException( + "Queries must have an equal number of select statements in a set operation." + "\n\nMain Query:\n{query1}\n\nSet Operations Query:\n{query2}".format( + query1=base_querystring, query2=set_operation_querystring + ) + ) + + querystring += set_operation_template.format( + type=set_operation.value, query_string=set_operation_querystring + ) + + if self._orderbys: + querystring += self._orderby_sql(**kwargs) + + if self._limit is not None: + querystring += self._limit_sql() + + if self._offset: + querystring += self._offset_sql() + + if subquery: + querystring = "({query})".format(query=querystring, **kwargs) + + if with_alias: + return format_alias_sql(querystring, self.alias or self._table_name, **kwargs) + + return querystring + + def _orderby_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + """ + Produces the ORDER BY part of the query. This is a list of fields and possibly their directionality, ASC or + DESC. The clauses are stored in the query under self._orderbys as a list of tuples containing the field and + directionality (which can be None). + + If an order by field is used in the select clause, determined by a matching , then the ORDER BY clause will use + the alias, otherwise the field will be rendered as SQL. + """ + clauses = [] + selected_aliases = {s.alias for s in self.base_query._selects} + for field, directionality in self._orderbys: + term = ( + format_quotes(field.alias, quote_char) + if field.alias and field.alias in selected_aliases + else field.get_sql(quote_char=quote_char, **kwargs) + ) + + clauses.append( + "{term} {orient}".format(term=term, orient=directionality.value) if directionality is not None else term + ) + + return " ORDER BY {orderby}".format(orderby=",".join(clauses)) + + def _offset_sql(self) -> str: + return " OFFSET {offset}".format(offset=self._offset) + + def _limit_sql(self) -> str: + return " LIMIT {limit}".format(limit=self._limit) + + +class QueryBuilder(Selectable, Term): + """ + Query Builder is the main class in pypika which stores the state of a query and offers functions which allow the + state to be branched immutably. + """ + + QUOTE_CHAR = '"' + SECONDARY_QUOTE_CHAR = "'" + ALIAS_QUOTE_CHAR = None + QUERY_ALIAS_QUOTE_CHAR = None + QUERY_CLS = Query + + def __init__( + self, + dialect: Dialects | None = None, + wrap_set_operation_queries: bool = True, + wrapper_cls: type[ValueWrapper] = ValueWrapper, + immutable: bool = True, + as_keyword: bool = False, + ): + super().__init__(None) + + self._from = [] + self._insert_table = None + self._update_table = None + self._delete_from = False + self._replace = False + + self._with = [] + self._selects = [] + self._force_indexes = [] + self._use_indexes = [] + self._columns = [] + self._values = [] + self._distinct = False + self._ignore = False + + self._for_update = False + + self._wheres = None + self._prewheres = None + self._groupbys = [] + self._with_totals = False + self._havings = None + self._qualifys = None + self._orderbys = [] + self._joins = [] + self._unions = [] + self._using = [] + + self._limit = None + self._offset = None + + self._updates = [] + + self._select_star = False + self._select_star_tables = set() + self._mysql_rollup = False + self._select_into = False + + self._subquery_count = 0 + self._foreign_table = False + + self.dialect = dialect + self.as_keyword = as_keyword + self.wrap_set_operation_queries = wrap_set_operation_queries + + self._wrapper_cls = wrapper_cls + + self.immutable = immutable + + def __copy__(self) -> QueryBuilder: + newone = type(self).__new__(type(self)) + newone.__dict__.update(self.__dict__) + newone._select_star_tables = copy(self._select_star_tables) + newone._from = copy(self._from) + newone._with = copy(self._with) + newone._selects = copy(self._selects) + newone._columns = copy(self._columns) + newone._values = copy(self._values) + newone._groupbys = copy(self._groupbys) + newone._orderbys = copy(self._orderbys) + newone._joins = copy(self._joins) + newone._unions = copy(self._unions) + newone._updates = copy(self._updates) + newone._force_indexes = copy(self._force_indexes) + newone._use_indexes = copy(self._use_indexes) + return newone + + @builder + def from_(self, selectable: Selectable | Query | str) -> None: + """ + Adds a table to the query. This function can only be called once and will raise an AttributeError if called a + second time. + + :param selectable: + Type: ``Table``, ``Query``, or ``str`` + + When a ``str`` is passed, a table with the name matching the ``str`` value is used. + + :returns + A copy of the query with the table added. + """ + + self._from.append(Table(selectable) if isinstance(selectable, str) else selectable) + + if isinstance(selectable, (QueryBuilder, _SetOperation)) and selectable.alias is None: + if isinstance(selectable, QueryBuilder): + sub_query_count = selectable._subquery_count + else: + sub_query_count = 0 + + sub_query_count = max(self._subquery_count, sub_query_count) + selectable.alias = "sq%d" % sub_query_count + self._subquery_count = sub_query_count + 1 + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across + queries. + + :param current_table: + The table instance to be replaces. + :param new_table: + The table instance to replace with. + :return: + A copy of the query with the tables replaced. + """ + self._from = [new_table if table == current_table else table for table in self._from] + self._insert_table = new_table if self._insert_table == current_table else self._insert_table + self._update_table = new_table if self._update_table == current_table else self._update_table + + self._with = [alias_query.replace_table(current_table, new_table) for alias_query in self._with] + self._selects = [select.replace_table(current_table, new_table) for select in self._selects] + self._columns = [column.replace_table(current_table, new_table) for column in self._columns] + self._values = [ + [value.replace_table(current_table, new_table) for value in value_list] for value_list in self._values + ] + + self._wheres = self._wheres.replace_table(current_table, new_table) if self._wheres else None + self._prewheres = self._prewheres.replace_table(current_table, new_table) if self._prewheres else None + self._groupbys = [groupby.replace_table(current_table, new_table) for groupby in self._groupbys] + self._havings = self._havings.replace_table(current_table, new_table) if self._havings else None + self._qualifys = self._qualifys.replace_table(current_table, new_table) if self._qualifys else None + self._orderbys = [ + (orderby[0].replace_table(current_table, new_table), orderby[1]) for orderby in self._orderbys + ] + self._joins = [join.replace_table(current_table, new_table) for join in self._joins] + + if current_table in self._select_star_tables: + self._select_star_tables.remove(current_table) + self._select_star_tables.add(new_table) + + @builder + def with_(self, selectable: Selectable, name: str) -> None: + t = AliasedQuery(name, selectable) + self._with.append(t) + + @builder + def into(self, table: str | Table) -> None: + if self._insert_table is not None: + raise AttributeError("'Query' object has no attribute '%s'" % "into") + + if self._selects: + self._select_into = True + + self._insert_table = table if isinstance(table, Table) else Table(table) + + @builder + def select(self, *terms: Any) -> None: + for term in terms: + if isinstance(term, Field): + self._select_field(term) + elif isinstance(term, str): + self._select_field_str(term) + elif isinstance(term, (Function, ArithmeticExpression)): + self._select_other(term) + else: + self._select_other(self.wrap_constant(term, wrapper_cls=self._wrapper_cls)) + + @builder + def delete(self) -> None: + if self._delete_from or self._selects or self._update_table: + raise AttributeError("'Query' object has no attribute '%s'" % "delete") + + self._delete_from = True + + @builder + def update(self, table: str | Table) -> None: + if self._update_table is not None or self._selects or self._delete_from: + raise AttributeError("'Query' object has no attribute '%s'" % "update") + + self._update_table = table if isinstance(table, Table) else Table(table) + + @builder + def columns(self, *terms: Any) -> None: + if self._insert_table is None: + raise AttributeError("'Query' object has no attribute '%s'" % "insert") + + if terms and isinstance(terms[0], (list, tuple)): + terms = terms[0] + + for term in terms: + if isinstance(term, str): + term = Field(term, table=self._insert_table) + self._columns.append(term) + + @builder + def insert(self, *terms: Any) -> None: + self._apply_terms(*terms) + self._replace = False + + @builder + def replace(self, *terms: Any) -> None: + self._apply_terms(*terms) + self._replace = True + + @builder + def force_index(self, term: str | Index, *terms: str | Index) -> None: + for t in (term, *terms): + if isinstance(t, Index): + self._force_indexes.append(t) + elif isinstance(t, str): + self._force_indexes.append(Index(t)) + + @builder + def use_index(self, term: str | Index, *terms: str | Index) -> None: + for t in (term, *terms): + if isinstance(t, Index): + self._use_indexes.append(t) + elif isinstance(t, str): + self._use_indexes.append(Index(t)) + + @builder + def distinct(self) -> None: + self._distinct = True + + @builder + def for_update(self) -> None: + self._for_update = True + + @builder + def ignore(self) -> None: + self._ignore = True + + @builder + def prewhere(self, criterion: Criterion) -> None: + if not self._validate_table(criterion): + self._foreign_table = True + + if self._prewheres: + self._prewheres &= criterion + else: + self._prewheres = criterion + + @builder + def where(self, criterion: Term | EmptyCriterion) -> None: + if isinstance(criterion, EmptyCriterion): + return + + if not self._validate_table(criterion): + self._foreign_table = True + + if self._wheres: + self._wheres &= criterion + else: + self._wheres = criterion + + @builder + def having(self, criterion: Term | EmptyCriterion) -> None: + if isinstance(criterion, EmptyCriterion): + return + + if self._havings: + self._havings &= criterion + else: + self._havings = criterion + + @builder + def qualify(self, criterion: Term | EmptyCriterion) -> None: + if isinstance(criterion, EmptyCriterion): + return + + if self._qualifys: + self._qualifys &= criterion + else: + self._qualifys = criterion + + @builder + def groupby(self, *terms: str | int | Term) -> None: + for term in terms: + if isinstance(term, str): + term = Field(term, table=self._from[0]) + elif isinstance(term, int): + term = Field(str(term), table=self._from[0]).wrap_constant(term) + + self._groupbys.append(term) + + @builder + def with_totals(self) -> None: + self._with_totals = True + + @builder + def rollup(self, *terms: list | tuple | set | Term, **kwargs: Any) -> None: + for_mysql = "mysql" == kwargs.get("vendor") + + if self._mysql_rollup: + raise AttributeError("'Query' object has no attribute '%s'" % "rollup") + + terms = [Tuple(*term) if isinstance(term, (list, tuple, set)) else term for term in terms] + + if for_mysql: + # MySQL rolls up all of the dimensions always + if not terms and not self._groupbys: + raise RollupException( + "At least one group is required. Call Query.groupby(term) or pass" "as parameter to rollup." + ) + + self._mysql_rollup = True + self._groupbys += terms + + elif 0 < len(self._groupbys) and isinstance(self._groupbys[-1], Rollup): + # If a rollup was added last, then append the new terms to the previous rollup + self._groupbys[-1].args += terms + + else: + self._groupbys.append(Rollup(*terms)) + + @builder + def orderby(self, *fields: Any, **kwargs: Any) -> None: + for field in fields: + field = Field(field, table=self._from[0]) if isinstance(field, str) else self.wrap_constant(field) + + self._orderbys.append((field, kwargs.get("order"))) + + @builder + def join( + self, item: Table | QueryBuilder | AliasedQuery | Selectable, how: JoinType = JoinType.inner + ) -> Joiner[Self]: + if isinstance(item, Table): + return Joiner(self, item, how, type_label="table") + + elif isinstance(item, QueryBuilder): + if item.alias is None: + self._tag_subquery(item) + return Joiner(self, item, how, type_label="subquery") + + elif isinstance(item, AliasedQuery): + return Joiner(self, item, how, type_label="table") + + elif isinstance(item, Selectable): + return Joiner(self, item, how, type_label="subquery") + + raise ValueError("Cannot join on type '%s'" % type(item)) + + def inner_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.inner) + + def left_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.left) + + def left_outer_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.left_outer) + + def right_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.right) + + def right_outer_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.right_outer) + + def outer_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.outer) + + def full_outer_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.full_outer) + + def cross_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.cross) + + def hash_join(self, item: Table | QueryBuilder | AliasedQuery) -> Joiner[Self]: + return self.join(item, JoinType.hash) + + @builder + def limit(self, limit: int) -> None: + self._limit = limit + + @builder + def offset(self, offset: int) -> None: + self._offset = offset + + @builder + def union(self, other: QueryBuilder) -> _SetOperation: + return _SetOperation(self, other, SetOperation.union, wrapper_cls=self._wrapper_cls) + + @builder + def union_all(self, other: QueryBuilder) -> _SetOperation: + return _SetOperation(self, other, SetOperation.union_all, wrapper_cls=self._wrapper_cls) + + @builder + def intersect(self, other: QueryBuilder) -> _SetOperation: + return _SetOperation(self, other, SetOperation.intersect, wrapper_cls=self._wrapper_cls) + + @builder + def except_of(self, other: QueryBuilder) -> _SetOperation: + return _SetOperation(self, other, SetOperation.except_of, wrapper_cls=self._wrapper_cls) + + @builder + def minus(self, other: QueryBuilder) -> _SetOperation: + return _SetOperation(self, other, SetOperation.minus, wrapper_cls=self._wrapper_cls) + + @builder + def set(self, field: Field | str, value: Any) -> None: + field = Field(field) if not isinstance(field, Field) else field + if not isinstance(value, Term): + value = self.wrap_constant(value, wrapper_cls=self._wrapper_cls) + self._updates.append((field, value)) + + def __add__(self, other: QueryBuilder) -> _SetOperation: + return self.union(other) + + def __mul__(self, other: QueryBuilder) -> _SetOperation: + return self.union_all(other) + + def __sub__(self, other: QueryBuilder) -> _SetOperation: + return self.minus(other) + + @builder + def slice(self, slice: slice) -> None: + self._offset = slice.start + self._limit = slice.stop + + def __getitem__(self, item: Any) -> QueryBuilder | Field: + if not isinstance(item, slice): + return super().__getitem__(item) + return self.slice(item) + + @staticmethod + def _list_aliases(field_set: Sequence[Field], quote_char: str | None = None) -> list[str]: + return [field.alias or field.get_sql(quote_char=quote_char) for field in field_set] + + def _select_field_str(self, term: str) -> None: + if 0 == len(self._from): + raise QueryException(f"Cannot select {term}, no FROM table specified.") + + if term == "*": + self._select_star = True + self._selects = [Star()] + return + + self._select_field(Field(term, table=self._from[0])) + + def _select_field(self, term: Field) -> None: + if self._select_star: + # Do not add select terms after a star is selected + return + + if term.table in self._select_star_tables: + # Do not add select terms for table after a table star is selected + return + + if isinstance(term, Star): + self._selects = [ + select for select in self._selects if not hasattr(select, "table") or term.table != select.table + ] + self._select_star_tables.add(term.table) + + self._selects.append(term) + + def _select_other(self, function: Function) -> None: + self._selects.append(function) + + def fields_(self) -> list[Field]: + # Don't return anything here. Subqueries have their own fields. + return [] + + def do_join(self, join: Join) -> None: + base_tables = self._from + [self._update_table] + self._with + join.validate(base_tables, self._joins) + + table_in_query = any(isinstance(clause, Table) and join.item in base_tables for clause in base_tables) + if isinstance(join.item, Table) and join.item.alias is None and table_in_query: + # On the odd chance that we join the same table as the FROM table and don't set an alias + # FIXME only works once + join.item.alias = join.item._table_name + "2" + + self._joins.append(join) + + def is_joined(self, table: Table) -> bool: + return any(table == join.item for join in self._joins) + + def _validate_table(self, term: Term) -> bool: + """ + Returns False if the term references a table not already part of the + FROM clause or JOINS and True otherwise. + """ + base_tables = self._from + [self._update_table] + + for field in term.fields_(): + table_in_base_tables = field.table in base_tables + table_in_joins = field.table in [join.item for join in self._joins] + if all( + [ + field.table is not None, + not table_in_base_tables, + not table_in_joins, + field.table != self._update_table, + ] + ): + return False + return True + + def _tag_subquery(self, subquery: QueryBuilder) -> None: + subquery.alias = "sq%d" % self._subquery_count + self._subquery_count += 1 + + def _apply_terms(self, *terms: Any) -> None: + """ + Handy function for INSERT and REPLACE statements in order to check if + terms are introduced and how append them to `self._values` + """ + if self._insert_table is None: + raise AttributeError("'Query' object has no attribute '%s'" % "insert") + + if not terms: + return + + if not isinstance(terms[0], (list, tuple, set)): + terms = [terms] + + for values in terms: + self._values.append([value if isinstance(value, Term) else self.wrap_constant(value) for value in values]) + + def __str__(self) -> str: + return self.get_sql(dialect=self.dialect) + + def __repr__(self) -> str: + return self.__str__() + + def __eq__(self, other: QueryBuilder) -> bool: + if not isinstance(other, QueryBuilder): + return False + + if not self.alias == other.alias: + return False + + return True + + def __ne__(self, other: QueryBuilder) -> bool: + return not self.__eq__(other) + + def __hash__(self) -> int: + return hash(self.alias) + sum(hash(clause) for clause in self._from) + + def _set_kwargs_defaults(self, kwargs: dict) -> None: + kwargs.setdefault("quote_char", self.QUOTE_CHAR) + kwargs.setdefault("secondary_quote_char", self.SECONDARY_QUOTE_CHAR) + kwargs.setdefault("alias_quote_char", self.ALIAS_QUOTE_CHAR) + kwargs.setdefault("as_keyword", self.as_keyword) + kwargs.setdefault("dialect", self.dialect) + + def get_sql(self, with_alias: bool = False, subquery: bool = False, **kwargs: Any) -> str: + self._set_kwargs_defaults(kwargs) + if not (self._selects or self._insert_table or self._delete_from or self._update_table): + return "" + if self._insert_table and not (self._selects or self._values): + return "" + if self._update_table and not self._updates: + return "" + + has_joins = bool(self._joins) + has_multiple_from_clauses = 1 < len(self._from) + has_subquery_from_clause = 0 < len(self._from) and isinstance(self._from[0], QueryBuilder) + has_reference_to_foreign_table = self._foreign_table + has_update_from = self._update_table and self._from + + kwargs["with_namespace"] = any( + [ + has_joins, + has_multiple_from_clauses, + has_subquery_from_clause, + has_reference_to_foreign_table, + has_update_from, + ] + ) + + if self._update_table: + querystring = self._with_sql(**kwargs) if self._with else "" + + querystring += self._update_sql(**kwargs) + + if self._joins: + querystring += " " + " ".join(join.get_sql(**kwargs) for join in self._joins) + + querystring += self._set_sql(**kwargs) + + if self._from: + querystring += self._from_sql(**kwargs) + + if self._wheres: + querystring += self._where_sql(**kwargs) + + if self._limit is not None: + querystring += self._limit_sql() + + return querystring + + if self._delete_from: + querystring = self._delete_sql(**kwargs) + + elif not self._select_into and self._insert_table: + querystring = self._with_sql(**kwargs) if self._with else "" + + if self._replace: + querystring += self._replace_sql(**kwargs) + else: + querystring += self._insert_sql(**kwargs) + + if self._columns: + querystring += self._columns_sql(**kwargs) + + if self._values: + querystring += self._values_sql(**kwargs) + return querystring + else: + querystring += " " + self._select_sql(**kwargs) + + else: + querystring = self._with_sql(**kwargs) if self._with else "" + + querystring += self._select_sql(**kwargs) + + if self._insert_table: + querystring += self._into_sql(**kwargs) + + if self._from: + querystring += self._from_sql(**kwargs) + + if self._using: + querystring += self._using_sql(**kwargs) + + if self._force_indexes: + querystring += self._force_index_sql(**kwargs) + + if self._use_indexes: + querystring += self._use_index_sql(**kwargs) + + if self._joins: + querystring += " " + " ".join(join.get_sql(**kwargs) for join in self._joins) + + if self._prewheres: + querystring += self._prewhere_sql(**kwargs) + + if self._wheres: + querystring += self._where_sql(**kwargs) + + if self._groupbys: + querystring += self._group_sql(**kwargs) + if self._mysql_rollup: + querystring += self._rollup_sql() + + if self._havings: + querystring += self._having_sql(**kwargs) + + if self._qualifys: + querystring += self._qualify_sql(**kwargs) + + if self._orderbys: + querystring += self._orderby_sql(**kwargs) + + querystring = self._apply_pagination(querystring, **kwargs) + + if self._for_update: + querystring += self._for_update_sql(**kwargs) + + if subquery: + querystring = "({query})".format(query=querystring) + + if with_alias: + kwargs['alias_quote_char'] = ( + self.ALIAS_QUOTE_CHAR if self.QUERY_ALIAS_QUOTE_CHAR is None else self.QUERY_ALIAS_QUOTE_CHAR + ) + return format_alias_sql(querystring, self.alias, **kwargs) + + return querystring + + def _apply_pagination(self, querystring: str, **kwargs) -> str: + if self._limit is not None: + querystring += self._limit_sql() + + if self._offset: + querystring += self._offset_sql() + + return querystring + + def _with_sql(self, **kwargs: Any) -> str: + return "WITH " + ",".join( + clause.name + " AS (" + clause.get_sql(subquery=False, with_alias=False, **kwargs) + ") " + for clause in self._with + ) + + def _distinct_sql(self, **kwargs: Any) -> str: + distinct = 'DISTINCT ' if self._distinct else '' + + return distinct + + def _for_update_sql(self, **kwargs) -> str: + for_update = ' FOR UPDATE' if self._for_update else '' + + return for_update + + def _select_sql(self, **kwargs: Any) -> str: + return "SELECT {distinct}{select}".format( + distinct=self._distinct_sql(**kwargs), + select=",".join(term.get_sql(with_alias=True, subquery=True, **kwargs) for term in self._selects), + ) + + def _insert_sql(self, **kwargs: Any) -> str: + return "INSERT {ignore}INTO {table}".format( + table=self._insert_table.get_sql(**kwargs), + ignore="IGNORE " if self._ignore else "", + ) + + def _replace_sql(self, **kwargs: Any) -> str: + return "REPLACE INTO {table}".format( + table=self._insert_table.get_sql(**kwargs), + ) + + @staticmethod + def _delete_sql(**kwargs: Any) -> str: + return "DELETE" + + def _update_sql(self, **kwargs: Any) -> str: + return "UPDATE {table}".format(table=self._update_table.get_sql(**kwargs)) + + def _columns_sql(self, with_namespace: bool = False, **kwargs: Any) -> str: + """ + SQL for Columns clause for INSERT queries + :param with_namespace: + Remove from kwargs, never format the column terms with namespaces since only one table can be inserted into + """ + return " ({columns})".format( + columns=",".join(term.get_sql(with_namespace=False, **kwargs) for term in self._columns) + ) + + def _values_sql(self, **kwargs: Any) -> str: + return " VALUES ({values})".format( + values="),(".join( + ",".join(term.get_sql(with_alias=True, subquery=True, **kwargs) for term in row) for row in self._values + ) + ) + + def _into_sql(self, **kwargs: Any) -> str: + return " INTO {table}".format( + table=self._insert_table.get_sql(with_alias=False, **kwargs), + ) + + def _from_sql(self, with_namespace: bool = False, **kwargs: Any) -> str: + return " FROM {selectable}".format( + selectable=",".join(clause.get_sql(subquery=True, with_alias=True, **kwargs) for clause in self._from) + ) + + def _using_sql(self, with_namespace: bool = False, **kwargs: Any) -> str: + return " USING {selectable}".format( + selectable=",".join(clause.get_sql(subquery=True, with_alias=True, **kwargs) for clause in self._using) + ) + + def _force_index_sql(self, **kwargs: Any) -> str: + return " FORCE INDEX ({indexes})".format( + indexes=",".join(index.get_sql(**kwargs) for index in self._force_indexes), + ) + + def _use_index_sql(self, **kwargs: Any) -> str: + return " USE INDEX ({indexes})".format( + indexes=",".join(index.get_sql(**kwargs) for index in self._use_indexes), + ) + + def _prewhere_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + return " PREWHERE {prewhere}".format( + prewhere=self._prewheres.get_sql(quote_char=quote_char, subquery=True, **kwargs) + ) + + def _where_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + return " WHERE {where}".format(where=self._wheres.get_sql(quote_char=quote_char, subquery=True, **kwargs)) + + def _group_sql( + self, + quote_char: str | None = None, + alias_quote_char: str | None = None, + groupby_alias: bool = True, + **kwargs: Any, + ) -> str: + """ + Produces the GROUP BY part of the query. This is a list of fields. The clauses are stored in the query under + self._groupbys as a list fields. + + If an groupby field is used in the select clause, + determined by a matching alias, and the groupby_alias is set True + then the GROUP BY clause will use the alias, + otherwise the entire field will be rendered as SQL. + """ + clauses = [] + selected_aliases = {s.alias for s in self._selects} + for field in self._groupbys: + if groupby_alias and field.alias and field.alias in selected_aliases: + clauses.append(format_quotes(field.alias, alias_quote_char or quote_char)) + else: + clauses.append(field.get_sql(quote_char=quote_char, alias_quote_char=alias_quote_char, **kwargs)) + + sql = " GROUP BY {groupby}".format(groupby=",".join(clauses)) + + if self._with_totals: + return sql + " WITH TOTALS" + + return sql + + def _orderby_sql( + self, + quote_char: str | None = None, + alias_quote_char: str | None = None, + orderby_alias: bool = True, + **kwargs: Any, + ) -> str: + """ + Produces the ORDER BY part of the query. This is a list of fields and possibly their directionality, ASC or + DESC. The clauses are stored in the query under self._orderbys as a list of tuples containing the field and + directionality (which can be None). + + If an order by field is used in the select clause, + determined by a matching, and the orderby_alias + is set True then the ORDER BY clause will use + the alias, otherwise the field will be rendered as SQL. + """ + clauses = [] + selected_aliases = {s.alias for s in self._selects} + for field, directionality in self._orderbys: + term = ( + format_quotes(field.alias, alias_quote_char or quote_char) + if orderby_alias and field.alias and field.alias in selected_aliases + else field.get_sql(quote_char=quote_char, alias_quote_char=alias_quote_char, **kwargs) + ) + + clauses.append( + "{term} {orient}".format(term=term, orient=directionality.value) if directionality is not None else term + ) + + return " ORDER BY {orderby}".format(orderby=",".join(clauses)) + + def _rollup_sql(self) -> str: + return " WITH ROLLUP" + + def _having_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + return " HAVING {having}".format(having=self._havings.get_sql(quote_char=quote_char, **kwargs)) + + def _qualify_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + return " QUALIFY {qualify}".format(qualify=self._qualifys.get_sql(quote_char=quote_char, **kwargs)) + + def _offset_sql(self) -> str: + return f" OFFSET {self._offset}" + + def _limit_sql(self) -> str: + return f" LIMIT {self._limit}" + + def _set_sql(self, **kwargs: Any) -> str: + return " SET {set}".format( + set=",".join( + "{field}={value}".format( + field=field.get_sql(**dict(kwargs, with_namespace=False)), value=value.get_sql(**kwargs) + ) + for field, value in self._updates + ) + ) + + def pipe(self, func, *args, **kwargs): + """Call a function on the current object and return the result. + + Example usage: + + .. code-block:: python + + from pypika import Query, functions as fn + from pypika.queries import QueryBuilder + + def rows_by_group(query: QueryBuilder, *groups) -> QueryBuilder: + return ( + query + .select(*groups, fn.Count("*").as_("n_rows")) + .groupby(*groups) + ) + + base_query = Query.from_("table") + + col1_agg = base_query.pipe(rows_by_group, "col1") + col2_agg = base_query.pipe(rows_by_group, "col2") + col1_col2_agg = base_query.pipe(rows_by_group, "col1", "col2") + + Makes chaining functions together easier, especially when the functions are + defined elsewhere. For example, you could define a function that filters + rows by a date range and then group by a set of columns: + + + .. code-block:: python + + from datetime import datetime, timedelta + + from pypika import Field + + def days_since(query: QueryBuilder, n_days: int) -> QueryBuilder: + return ( + query + .where("date" > fn.Date(datetime.now().date() - timedelta(days=n_days))) + ) + + ( + base_query + .pipe(days_since, n_days=7) + .pipe(rows_by_group, "col1", "col2") + ) + """ + return func(self, *args, **kwargs) + + +class Joiner(Generic[QB]): + def __init__(self, query: QB, item: Table | QueryBuilder | AliasedQuery, how: JoinType, type_label: str) -> None: + self.query = query + self.item = item + self.how = how + self.type_label = type_label + + def on(self, criterion: Criterion | None, collate: str | None = None) -> QB: + if criterion is None: + raise JoinException( + "Parameter 'criterion' is required for a " + "{type} JOIN but was not supplied.".format(type=self.type_label) + ) + + self.query.do_join(JoinOn(self.item, self.how, criterion, collate)) + return self.query + + def on_field(self, *fields: Any) -> QB: + if not fields: + raise JoinException( + "Parameter 'fields' is required for a " "{type} JOIN but was not supplied.".format(type=self.type_label) + ) + + criterion = None + for field in fields: + constituent = Field(field, table=self.query._from[0]) == Field(field, table=self.item) + criterion = constituent if criterion is None else criterion & constituent + + self.query.do_join(JoinOn(self.item, self.how, criterion)) + return self.query + + def using(self, *fields: Any) -> QB: + if not fields: + raise JoinException("Parameter 'fields' is required when joining with a using clause but was not supplied.") + + self.query.do_join(JoinUsing(self.item, self.how, [Field(field) for field in fields])) + return self.query + + def cross(self) -> QB: + """Return cross join""" + self.query.do_join(Join(self.item, JoinType.cross)) + + return self.query + + +class Join: + def __init__(self, item: Term, how: JoinType) -> None: + self.item = item + self.how = how + + def get_sql(self, **kwargs: Any) -> str: + sql = "JOIN {table}".format( + table=self.item.get_sql(subquery=True, with_alias=True, **kwargs), + ) + + if self.how.value: + return "{type} {join}".format(join=sql, type=self.how.value) + return sql + + def validate(self, _from: Sequence[Table], _joins: Sequence[Table]) -> None: + pass + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing + fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the join with the tables replaced. + """ + self.item = self.item.replace_table(current_table, new_table) + + +class JoinOn(Join): + def __init__(self, item: Term, how: JoinType, criteria: QueryBuilder, collate: str | None = None) -> None: + super().__init__(item, how) + self.criterion = criteria + self.collate = collate + + def get_sql(self, **kwargs: Any) -> str: + join_sql = super().get_sql(**kwargs) + return "{join} ON {criterion}{collate}".format( + join=join_sql, + criterion=self.criterion.get_sql(subquery=True, **kwargs), + collate=f" COLLATE {self.collate}" if self.collate else "", + ) + + def validate(self, _from: Sequence[Table], _joins: Sequence[Table]) -> None: + criterion_tables = set([f.table for f in self.criterion.fields_()]) + available_tables = set(_from) | {join.item for join in _joins} | {self.item} + missing_tables = criterion_tables - available_tables + if missing_tables: + raise JoinException( + "Invalid join criterion. One field is required from the joined item and " + "another from the selected table or an existing join. Found [{tables}]".format( + tables=", ".join(map(str, missing_tables)) + ) + ) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing + fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the join with the tables replaced. + """ + self.item = new_table if self.item == current_table else self.item + self.criterion = self.criterion.replace_table(current_table, new_table) + + +class JoinUsing(Join): + def __init__(self, item: Term, how: JoinType, fields: Sequence[Field]) -> None: + super().__init__(item, how) + self.fields = fields + + def get_sql(self, **kwargs: Any) -> str: + join_sql = super().get_sql(**kwargs) + return "{join} USING ({fields})".format( + join=join_sql, + fields=",".join(field.get_sql(**kwargs) for field in self.fields), + ) + + def validate(self, _from: Sequence[Table], _joins: Sequence[Table]) -> None: + pass + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing + fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the join with the tables replaced. + """ + self.item = new_table if self.item == current_table else self.item + self.fields = [field.replace_table(current_table, new_table) for field in self.fields] + + +class CreateQueryBuilder: + """ + Query builder used to build CREATE queries. + """ + + QUOTE_CHAR = '"' + SECONDARY_QUOTE_CHAR = "'" + ALIAS_QUOTE_CHAR = None + QUERY_CLS = Query + + def __init__(self, dialect: Dialects | None = None) -> None: + self._create_table = None + self._temporary = False + self._unlogged = False + self._as_select = None + self._columns = [] + self._period_fors = [] + self._with_system_versioning = False + self._primary_key = None + self._uniques = [] + self._if_not_exists = False + self.dialect = dialect + self._foreign_key = None + self._foreign_key_reference_table = None + self._foreign_key_reference = None + self._foreign_key_on_update: ReferenceOption = None + self._foreign_key_on_delete: ReferenceOption = None + + def _set_kwargs_defaults(self, kwargs: dict) -> None: + kwargs.setdefault("quote_char", self.QUOTE_CHAR) + kwargs.setdefault("secondary_quote_char", self.SECONDARY_QUOTE_CHAR) + kwargs.setdefault("dialect", self.dialect) + + @builder + def create_table(self, table: Table | str) -> None: + """ + Creates the table. + + :param table: + An instance of a Table object or a string table name. + + :raises AttributeError: + If the table is already created. + + :return: + CreateQueryBuilder. + """ + if self._create_table: + raise AttributeError("'Query' object already has attribute create_table") + + self._create_table = table if isinstance(table, Table) else Table(table) + + @builder + def temporary(self) -> None: + """ + Makes the table temporary. + + :return: + CreateQueryBuilder. + """ + self._temporary = True + + @builder + def unlogged(self) -> None: + """ + Makes the table unlogged. + + :return: + CreateQueryBuilder. + """ + self._unlogged = True + + @builder + def with_system_versioning(self) -> None: + """ + Adds system versioning. + + :return: + CreateQueryBuilder. + """ + self._with_system_versioning = True + + @builder + def columns(self, *columns: str | tuple[str, str] | Column) -> None: + """ + Adds the columns. + + :param columns: + Type: Union[str, TypedTuple[str, str], Column] + + A list of columns. + + :raises AttributeError: + If the table is an as_select table. + + :return: + CreateQueryBuilder. + """ + if self._as_select: + raise AttributeError("'Query' object already has attribute as_select") + + for column in columns: + if isinstance(column, str): + column = Column(column) + elif isinstance(column, tuple): + column = Column(column_name=column[0], column_type=column[1]) + self._columns.append(column) + + @builder + def period_for(self, name, start_column: str | Column, end_column: str | Column) -> None: + """ + Adds a PERIOD FOR clause. + + :param name: + The period name. + + :param start_column: + The column that starts the period. + + :param end_column: + The column that ends the period. + + :return: + CreateQueryBuilder. + """ + self._period_fors.append(PeriodFor(name, start_column, end_column)) + + @builder + def unique(self, *columns: str | Column) -> None: + """ + Adds a UNIQUE constraint. + + :param columns: + Type: Union[str, Column] + + A list of columns. + + :return: + CreateQueryBuilder. + """ + self._uniques.append(self._prepare_columns_input(columns)) + + @builder + def primary_key(self, *columns: str | Column) -> None: + """ + Adds a primary key constraint. + + :param columns: + Type: Union[str, Column] + + A list of columns. + + :raises AttributeError: + If the primary key is already defined. + + :return: + CreateQueryBuilder. + """ + if self._primary_key: + raise AttributeError("'Query' object already has attribute primary_key") + self._primary_key = self._prepare_columns_input(columns) + + @builder + def foreign_key( + self, + columns: list[str | Column], + reference_table: str | Table, + reference_columns: list[str | Column], + on_delete: ReferenceOption = None, + on_update: ReferenceOption = None, + ) -> None: + """ + Adds a foreign key constraint. + + :param columns: + Type: List[Union[str, Column]] + + A list of foreign key columns. + + :param reference_table: + Type: Union[str, Table] + + The parent table name. + + :param reference_columns: + Type: List[Union[str, Column]] + + Parent key columns. + + :param on_delete: + Type: ReferenceOption + + Delete action. + + :param on_update: + Type: ReferenceOption + + Update option. + + :raises AttributeError: + If the foreign key is already defined. + + :return: + CreateQueryBuilder. + """ + if self._foreign_key: + raise AttributeError("'Query' object already has attribute foreign_key") + self._foreign_key = self._prepare_columns_input(columns) + self._foreign_key_reference_table = reference_table + self._foreign_key_reference = self._prepare_columns_input(reference_columns) + self._foreign_key_on_delete = on_delete + self._foreign_key_on_update = on_update + + @builder + def as_select(self, query_builder: QueryBuilder) -> None: + """ + Creates the table from a select statement. + + :param query_builder: + The query. + + :raises AttributeError: + If columns have been defined for the table. + + :return: + CreateQueryBuilder. + """ + if self._columns: + raise AttributeError("'Query' object already has attribute columns") + + if not isinstance(query_builder, QueryBuilder): + raise TypeError("Expected 'item' to be instance of QueryBuilder") + + self._as_select = query_builder + + @builder + def if_not_exists(self) -> None: + self._if_not_exists = True + + def get_sql(self, **kwargs: Any) -> str: + """ + Gets the sql statement string. + + :return: The create table statement. + :rtype: str + """ + self._set_kwargs_defaults(kwargs) + + if not self._create_table: + return "" + + if not self._columns and not self._as_select: + return "" + + create_table = self._create_table_sql(**kwargs) + + if self._as_select: + return create_table + self._as_select_sql(**kwargs) + + body = self._body_sql(**kwargs) + table_options = self._table_options_sql(**kwargs) + + return f"{create_table} ({body}){table_options}" + + def _create_table_sql(self, **kwargs: Any) -> str: + table_type = '' + if self._temporary: + table_type = 'TEMPORARY ' + elif self._unlogged: + table_type = 'UNLOGGED ' + + if_not_exists = '' + if self._if_not_exists: + if_not_exists = 'IF NOT EXISTS ' + + return "CREATE {table_type}TABLE {if_not_exists}{table}".format( + table_type=table_type, + if_not_exists=if_not_exists, + table=self._create_table.get_sql(**kwargs), + ) + + def _table_options_sql(self, **kwargs) -> str: + table_options = "" + + if self._with_system_versioning: + table_options += ' WITH SYSTEM VERSIONING' + + return table_options + + def _column_clauses(self, **kwargs) -> list[str]: + return [column.get_sql(**kwargs) for column in self._columns] + + def _period_for_clauses(self, **kwargs) -> list[str]: + return [period_for.get_sql(**kwargs) for period_for in self._period_fors] + + def _unique_key_clauses(self, **kwargs) -> list[str]: + return [ + "UNIQUE ({unique})".format(unique=",".join(column.get_name_sql(**kwargs) for column in unique)) + for unique in self._uniques + ] + + def _primary_key_clause(self, **kwargs) -> str: + return "PRIMARY KEY ({columns})".format( + columns=",".join(column.get_name_sql(**kwargs) for column in self._primary_key) + ) + + def _foreign_key_clause(self, **kwargs) -> str: + clause = "FOREIGN KEY ({columns}) REFERENCES {table_name} ({reference_columns})".format( + columns=",".join(column.get_name_sql(**kwargs) for column in self._foreign_key), + table_name=self._foreign_key_reference_table.get_sql(**kwargs), + reference_columns=",".join(column.get_name_sql(**kwargs) for column in self._foreign_key_reference), + ) + if self._foreign_key_on_delete: + clause += " ON DELETE " + self._foreign_key_on_delete.value + if self._foreign_key_on_update: + clause += " ON UPDATE " + self._foreign_key_on_update.value + + return clause + + def _body_sql(self, **kwargs) -> str: + clauses = self._column_clauses(**kwargs) + clauses += self._period_for_clauses(**kwargs) + clauses += self._unique_key_clauses(**kwargs) + + if self._primary_key: + clauses.append(self._primary_key_clause(**kwargs)) + if self._foreign_key: + clauses.append(self._foreign_key_clause(**kwargs)) + + return ",".join(clauses) + + def _as_select_sql(self, **kwargs: Any) -> str: + return " AS ({query})".format( + query=self._as_select.get_sql(**kwargs), + ) + + def _prepare_columns_input(self, columns: list[str | Column]) -> list[Column]: + return [(column if isinstance(column, Column) else Column(column)) for column in columns] + + def __str__(self) -> str: + return self.get_sql() + + def __repr__(self) -> str: + return self.__str__() + + +class CreateIndexBuilder: + def __init__(self) -> None: + self._index = None + self._columns = [] + self._table = None + self._wheres = None + self._is_unique = False + self._if_not_exists = False + + @builder + def create_index(self, index: str | Index) -> None: + self._index = index + + @builder + def columns(self, *columns: str | tuple[str, str] | Column) -> None: + for column in columns: + if isinstance(column, str): + column = Column(column) + elif isinstance(column, tuple): + column = Column(column_name=column[0], column_type=column[1]) + self._columns.append(column) + + @builder + def on(self, table: Table | str) -> None: + self._table = table + + @builder + def where(self, criterion: Term | EmptyCriterion) -> None: + """ + Partial index where clause. + """ + if self._wheres: + self._wheres &= criterion + else: + self._wheres = criterion + + @builder + def unique(self) -> None: + self._is_unique = True + + @builder + def if_not_exists(self) -> None: + self._if_not_exists = True + + def get_sql(self) -> str: + if not self._columns or len(self._columns) == 0: + raise AttributeError("Cannot create index without columns") + if not self._table: + raise AttributeError("Cannot create index without table") + columns_str = ", ".join([c.name for c in self._columns]) + unique_str = "UNIQUE" if self._is_unique else "" + if_not_exists_str = "IF NOT EXISTS" if self._if_not_exists else "" + base_sql = f"CREATE {unique_str} INDEX {if_not_exists_str} {self._index} ON {self._table}({columns_str})" + if self._wheres: + base_sql += f" WHERE {self._wheres}" + return base_sql.replace(" ", " ") + + def __str__(self) -> str: + return self.get_sql() + + def __repr__(self) -> str: + return self.__str__() + + +class DropQueryBuilder: + """ + Query builder used to build DROP queries. + """ + + QUOTE_CHAR = '"' + SECONDARY_QUOTE_CHAR = "'" + ALIAS_QUOTE_CHAR = None + QUERY_CLS = Query + + def __init__(self, dialect: Dialects | None = None) -> None: + self._drop_target_kind = None + self._drop_target: Database | Table | str = "" + self._if_exists = None + self.dialect = dialect + + def _set_kwargs_defaults(self, kwargs: dict) -> None: + kwargs.setdefault("quote_char", self.QUOTE_CHAR) + kwargs.setdefault("secondary_quote_char", self.SECONDARY_QUOTE_CHAR) + kwargs.setdefault("dialect", self.dialect) + + @builder + def drop_database(self, database: Database | str) -> None: + target = database if isinstance(database, Database) else Database(database) + self._set_target('DATABASE', target) + + @builder + def drop_table(self, table: Table | str) -> None: + target = table if isinstance(table, Table) else Table(table) + self._set_target('TABLE', target) + + @builder + def drop_user(self, user: str) -> None: + self._set_target('USER', user) + + @builder + def drop_view(self, view: str) -> None: + self._set_target('VIEW', view) + + @builder + def drop_index(self, index: str) -> None: + self._set_target('INDEX', index) + + @builder + def if_exists(self) -> None: + self._if_exists = True + + def _set_target(self, kind: str, target: Database | Table | str) -> None: + if self._drop_target: + raise AttributeError("'DropQuery' object already has attribute drop_target") + self._drop_target_kind = kind + self._drop_target = target + + def get_sql(self, **kwargs: Any) -> str: + self._set_kwargs_defaults(kwargs) + + if_exists = 'IF EXISTS ' if self._if_exists else '' + target_name: str = "" + + if isinstance(self._drop_target, (Database, Table)): + target_name = self._drop_target.get_sql(**kwargs) + else: + target_name = format_quotes(self._drop_target, self.QUOTE_CHAR) + + return "DROP {kind} {if_exists}{name}".format( + kind=self._drop_target_kind, if_exists=if_exists, name=target_name + ) + + def __str__(self) -> str: + return self.get_sql() + + def __repr__(self) -> str: + return self.__str__() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/terms.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/terms.py new file mode 100644 index 0000000000000000000000000000000000000000..431f598fc2b1bf87a059d8f3c997e21762b580d4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/terms.py @@ -0,0 +1,1800 @@ +from __future__ import annotations + +import inspect +import re +import sys +import uuid +from collections.abc import Callable, Iterable, Iterator, Sequence +from datetime import date, datetime, time +from enum import Enum +from typing import TYPE_CHECKING, Any, TypeVar, overload + +from pypika.enums import Arithmetic, Boolean, Comparator, Dialects, Equality, JSONOperators, Matching, Order +from pypika.utils import ( + CaseException, + FunctionException, + builder, + format_alias_sql, + format_quotes, + ignore_copy, + resolve_is_aggregate, +) + +if TYPE_CHECKING: + if sys.version_info < (3, 11): + from typing_extensions import Self + else: + from typing import Self + from pypika.queries import QueryBuilder, Selectable, Table + + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" + + +NodeT = TypeVar("NodeT", bound="Node") + + +class Node: + is_aggregate = None + + def nodes_(self) -> Iterator[NodeT]: + yield self + + def find_(self, type: type[NodeT]) -> list[NodeT]: + return [node for node in self.nodes_() if isinstance(node, type)] + + +class Term(Node): + is_aggregate = False + + def __init__(self, alias: str | None = None) -> None: + self.alias = alias + + @builder + def as_(self, alias: str) -> None: + self.alias = alias + + @property + def tables_(self) -> set[Table]: + from pypika import Table + + return set(self.find_(Table)) + + def fields_(self) -> set[Field]: + return set(self.find_(Field)) + + @staticmethod + def wrap_constant( + val, wrapper_cls: type[Term] | None = None + ) -> ValueError | NodeT | LiteralValue | Array | Tuple | ValueWrapper: + """ + Used for wrapping raw inputs such as numbers in Criterions and Operator. + + For example, the expression F('abc')+1 stores the integer part in a ValueWrapper object. + + :param val: + Any value. + :param wrapper_cls: + A pypika class which wraps a constant value so it can be handled as a component of the query. + :return: + Raw string, number, or decimal values will be returned in a ValueWrapper. Fields and other parts of the + querybuilder will be returned as inputted. + + """ + + if isinstance(val, Node): + return val + if val is None: + return NullValue() + if isinstance(val, list): + return Array(*val) + if isinstance(val, tuple): + return Tuple(*val) + + # Need to default here to avoid the recursion. ValueWrapper extends this class. + wrapper_cls = wrapper_cls or ValueWrapper + return wrapper_cls(val) + + @staticmethod + def wrap_json( + val: Term | QueryBuilder | None | str | int | bool, wrapper_cls=None + ) -> Term | QueryBuilder | NullValue | ValueWrapper | JSON: + from .queries import QueryBuilder + + if isinstance(val, (Term, QueryBuilder)): + return val + if val is None: + return NullValue() + if isinstance(val, (str, int, bool)): + wrapper_cls = wrapper_cls or ValueWrapper + return wrapper_cls(val) + + return JSON(val) + + def replace_table(self, current_table: Table | None, new_table: Table | None) -> Term: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + The base implementation returns self because not all terms have a table property. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + Self. + """ + return self + + def eq(self, other: Any) -> BasicCriterion: + return self == other + + def isnull(self) -> NullCriterion: + return NullCriterion(self) + + def notnull(self) -> Not: + return self.isnull().negate() + + def isnotnull(self) -> NotNullCriterion: + return NotNullCriterion(self) + + def bitwiseand(self, value: int) -> BitwiseAndCriterion: + return BitwiseAndCriterion(self, self.wrap_constant(value)) + + def bitwiseor(self, value: int) -> BitwiseOrCriterion: + return BitwiseOrCriterion(self, self.wrap_constant(value)) + + def gt(self, other: Any) -> BasicCriterion: + return self > other + + def gte(self, other: Any) -> BasicCriterion: + return self >= other + + def lt(self, other: Any) -> BasicCriterion: + return self < other + + def lte(self, other: Any) -> BasicCriterion: + return self <= other + + def ne(self, other: Any) -> BasicCriterion: + return self != other + + def glob(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.glob, self, self.wrap_constant(expr)) + + def like(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.like, self, self.wrap_constant(expr)) + + def not_like(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.not_like, self, self.wrap_constant(expr)) + + def ilike(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.ilike, self, self.wrap_constant(expr)) + + def not_ilike(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.not_ilike, self, self.wrap_constant(expr)) + + def rlike(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.rlike, self, self.wrap_constant(expr)) + + def regex(self, pattern: str) -> BasicCriterion: + return BasicCriterion(Matching.regex, self, self.wrap_constant(pattern)) + + def regexp(self, pattern: str) -> BasicCriterion: + return BasicCriterion(Matching.regexp, self, self.wrap_constant(pattern)) + + def between(self, lower: Any, upper: Any) -> BetweenCriterion: + return BetweenCriterion(self, self.wrap_constant(lower), self.wrap_constant(upper)) + + def from_to(self, start: Any, end: Any) -> PeriodCriterion: + return PeriodCriterion(self, self.wrap_constant(start), self.wrap_constant(end)) + + def as_of(self, expr: str) -> BasicCriterion: + return BasicCriterion(Matching.as_of, self, self.wrap_constant(expr)) + + def all_(self) -> All: + return All(self) + + def isin(self, arg: list | tuple | set | frozenset | Term) -> ContainsCriterion: + if isinstance(arg, (list, tuple, set, frozenset)): + return ContainsCriterion(self, Tuple(*[self.wrap_constant(value) for value in arg])) + return ContainsCriterion(self, arg) + + def notin(self, arg: list | tuple | set | frozenset | Term) -> ContainsCriterion: + return self.isin(arg).negate() + + def bin_regex(self, pattern: str) -> BasicCriterion: + return BasicCriterion(Matching.bin_regex, self, self.wrap_constant(pattern)) + + def negate(self) -> Not: + return Not(self) + + def lshift(self, other: Any) -> ArithmeticExpression: + return self << other + + def rshift(self, other: Any) -> ArithmeticExpression: + return self >> other + + def __invert__(self) -> Not: + return Not(self) + + def __pos__(self) -> Term: + return self + + def __neg__(self) -> Negative: + return Negative(self) + + def __add__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.add, self, self.wrap_constant(other)) + + def __sub__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.sub, self, self.wrap_constant(other)) + + def __mul__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.mul, self, self.wrap_constant(other)) + + def __truediv__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.div, self, self.wrap_constant(other)) + + def __pow__(self, other: Any) -> Pow: + return Pow(self, other) + + def __mod__(self, other: Any) -> Mod: + return Mod(self, other) + + def __radd__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.add, self.wrap_constant(other), self) + + def __rsub__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.sub, self.wrap_constant(other), self) + + def __rmul__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.mul, self.wrap_constant(other), self) + + def __rtruediv__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.div, self.wrap_constant(other), self) + + def __lshift__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.lshift, self, self.wrap_constant(other)) + + def __rshift__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.rshift, self, self.wrap_constant(other)) + + def __rlshift__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.lshift, self.wrap_constant(other), self) + + def __rrshift__(self, other: Any) -> ArithmeticExpression: + return ArithmeticExpression(Arithmetic.rshift, self.wrap_constant(other), self) + + def __eq__(self, other: Any) -> BasicCriterion: + return BasicCriterion(Equality.eq, self, self.wrap_constant(other)) + + def __ne__(self, other: Any) -> BasicCriterion: + return BasicCriterion(Equality.ne, self, self.wrap_constant(other)) + + def __gt__(self, other: Any) -> BasicCriterion: + return BasicCriterion(Equality.gt, self, self.wrap_constant(other)) + + def __ge__(self, other: Any) -> BasicCriterion: + return BasicCriterion(Equality.gte, self, self.wrap_constant(other)) + + def __lt__(self, other: Any) -> BasicCriterion: + return BasicCriterion(Equality.lt, self, self.wrap_constant(other)) + + def __le__(self, other: Any) -> BasicCriterion: + return BasicCriterion(Equality.lte, self, self.wrap_constant(other)) + + def __getitem__(self, item: slice) -> BetweenCriterion: + if not isinstance(item, slice): + raise TypeError("Field' object is not subscriptable") + return self.between(item.start, item.stop) + + def __str__(self) -> str: + return self.get_sql(quote_char='"', secondary_quote_char="'") + + def __hash__(self) -> int: + return hash(self.get_sql(with_alias=True, with_namespace=True)) + + def get_sql(self, **kwargs: Any) -> str: + raise NotImplementedError() + + +def idx_placeholder_gen(idx: int) -> str: + return str(idx + 1) + + +def named_placeholder_gen(idx: int) -> str: + return f'param{idx + 1}' + + +class Parameter(Term): + is_aggregate = None + + def __init__(self, placeholder: str | int) -> None: + super().__init__() + self._placeholder = placeholder + + @property + def placeholder(self): + return self._placeholder + + def get_sql(self, **kwargs: Any) -> str: + return str(self.placeholder) + + def update_parameters(self, param_key: Any, param_value: Any, **kwargs): + pass + + def get_param_key(self, placeholder: Any, **kwargs): + return placeholder + + +class ListParameter(Parameter): + def __init__(self, placeholder: str | int | Callable[[int], str] = idx_placeholder_gen) -> None: + super().__init__(placeholder=placeholder) + self._parameters = list() + + @property + def placeholder(self) -> str: + if callable(self._placeholder): + return self._placeholder(len(self._parameters)) + + return str(self._placeholder) + + def get_parameters(self, **kwargs): + return self._parameters + + def update_parameters(self, value: Any, **kwargs): + self._parameters.append(value) + + +class DictParameter(Parameter): + def __init__(self, placeholder: str | int | Callable[[int], str] = named_placeholder_gen) -> None: + super().__init__(placeholder=placeholder) + self._parameters = dict() + + @property + def placeholder(self) -> str: + if callable(self._placeholder): + return self._placeholder(len(self._parameters)) + + return str(self._placeholder) + + def get_parameters(self, **kwargs): + return self._parameters + + def get_param_key(self, placeholder: Any, **kwargs): + return placeholder[1:] + + def update_parameters(self, param_key: Any, value: Any, **kwargs): + self._parameters[param_key] = value + + +class QmarkParameter(ListParameter): + def get_sql(self, **kwargs): + return '?' + + +class NumericParameter(ListParameter): + """Numeric, positional style, e.g. ...WHERE name=:1""" + + def get_sql(self, **kwargs: Any) -> str: + return ":{placeholder}".format(placeholder=self.placeholder) + + +class FormatParameter(ListParameter): + """ANSI C printf format codes, e.g. ...WHERE name=%s""" + + def get_sql(self, **kwargs: Any) -> str: + return "%s" + + +class NamedParameter(DictParameter): + """Named style, e.g. ...WHERE name=:name""" + + def get_sql(self, **kwargs: Any) -> str: + return ":{placeholder}".format(placeholder=self.placeholder) + + +class PyformatParameter(DictParameter): + """Python extended format codes, e.g. ...WHERE name=%(name)s""" + + def get_sql(self, **kwargs: Any) -> str: + return "%({placeholder})s".format(placeholder=self.placeholder) + + def get_param_key(self, placeholder: Any, **kwargs): + return placeholder[2:-2] + + +class Negative(Term): + def __init__(self, term: Term) -> None: + super().__init__() + self.term = term + + @property + def is_aggregate(self) -> bool | None: + return self.term.is_aggregate + + def get_sql(self, **kwargs: Any) -> str: + return "-{term}".format(term=self.term.get_sql(**kwargs)) + + +class ValueWrapper(Term): + is_aggregate = None + + def __init__(self, value: Any, alias: str | None = None) -> None: + super().__init__(alias) + self.value = value + + def get_value_sql(self, **kwargs: Any) -> str: + return self.get_formatted_value(self.value, **kwargs) + + @classmethod + def get_formatted_value(cls, value: Any, **kwargs): + quote_char = kwargs.get("secondary_quote_char") or "" + + if isinstance(value, Term): + return value.get_sql(**kwargs) + if isinstance(value, Enum): + return cls.get_formatted_value(value.value, **kwargs) + if isinstance(value, (date, datetime, time)): + return cls.get_formatted_value(value.isoformat(), **kwargs) + if isinstance(value, str): + return format_quotes(value, quote_char) + if isinstance(value, bool): + return str.lower(str(value)) + if isinstance(value, uuid.UUID): + return cls.get_formatted_value(str(value), **kwargs) + if value is None: + return "null" + return str(value) + + def _get_param_data(self, parameter: Parameter, **kwargs) -> tuple[str, str]: + param_sql = parameter.get_sql(**kwargs) + param_key = parameter.get_param_key(placeholder=param_sql) + + return param_sql, param_key + + def get_sql( + self, + quote_char: str | None = None, + secondary_quote_char: str = "'", + parameter: Parameter = None, + **kwargs: Any, + ) -> str: + if parameter is None: + sql = self.get_value_sql(quote_char=quote_char, secondary_quote_char=secondary_quote_char, **kwargs) + return format_alias_sql(sql, self.alias, quote_char=quote_char, **kwargs) + + # Don't stringify numbers when using a parameter + if isinstance(self.value, (int, float)): + value_sql = self.value + else: + value_sql = self.get_value_sql(quote_char=quote_char, **kwargs) + param_sql, param_key = self._get_param_data(parameter, **kwargs) + parameter.update_parameters(param_key=param_key, value=value_sql, **kwargs) + + return format_alias_sql(param_sql, self.alias, quote_char=quote_char, **kwargs) + + +class ParameterValueWrapper(ValueWrapper): + def __init__(self, parameter: Parameter, value: Any, alias: str | None = None) -> None: + super().__init__(value, alias) + self._parameter = parameter + + def _get_param_data(self, parameter: Parameter, **kwargs) -> tuple[str, str]: + param_sql = self._parameter.get_sql(**kwargs) + param_key = self._parameter.get_param_key(placeholder=param_sql) + + return param_sql, param_key + + +class JSON(Term): + table: str | Selectable | None = None + + def __init__(self, value: Any = None, alias: str | None = None) -> None: + super().__init__(alias) + self.value = value + + def _recursive_get_sql(self, value: Any, **kwargs: Any) -> str: + if isinstance(value, dict): + return self._get_dict_sql(value, **kwargs) + if isinstance(value, list): + return self._get_list_sql(value, **kwargs) + if isinstance(value, str): + return self._get_str_sql(value, **kwargs) + return str(value) + + def _get_dict_sql(self, value: dict, **kwargs: Any) -> str: + pairs = [ + "{key}:{value}".format(key=self._recursive_get_sql(k, **kwargs), value=self._recursive_get_sql(v, **kwargs)) + for k, v in value.items() + ] + return "".join(["{", ",".join(pairs), "}"]) + + def _get_list_sql(self, value: list, **kwargs: Any) -> str: + pairs = [self._recursive_get_sql(v, **kwargs) for v in value] + return "".join(["[", ",".join(pairs), "]"]) + + @staticmethod + def _get_str_sql(value: str, quote_char: str = '"', **kwargs: Any) -> str: + return format_quotes(value, quote_char) + + def get_sql(self, secondary_quote_char: str = "'", **kwargs: Any) -> str: + sql = format_quotes(self._recursive_get_sql(self.value), secondary_quote_char) + return format_alias_sql(sql, self.alias, **kwargs) + + def get_json_value(self, key_or_index: str | int) -> BasicCriterion: + return BasicCriterion(JSONOperators.GET_JSON_VALUE, self, self.wrap_constant(key_or_index)) + + def get_text_value(self, key_or_index: str | int) -> BasicCriterion: + return BasicCriterion(JSONOperators.GET_TEXT_VALUE, self, self.wrap_constant(key_or_index)) + + def get_path_json_value(self, path_json: str) -> BasicCriterion: + return BasicCriterion(JSONOperators.GET_PATH_JSON_VALUE, self, self.wrap_json(path_json)) + + def get_path_text_value(self, path_json: str) -> BasicCriterion: + return BasicCriterion(JSONOperators.GET_PATH_TEXT_VALUE, self, self.wrap_json(path_json)) + + def has_key(self, other: Any) -> BasicCriterion: + return BasicCriterion(JSONOperators.HAS_KEY, self, self.wrap_json(other)) + + def contains(self, other: Any) -> BasicCriterion: + return BasicCriterion(JSONOperators.CONTAINS, self, self.wrap_json(other)) + + def contained_by(self, other: Any) -> BasicCriterion: + return BasicCriterion(JSONOperators.CONTAINED_BY, self, self.wrap_json(other)) + + def has_keys(self, other: Iterable) -> BasicCriterion: + return BasicCriterion(JSONOperators.HAS_KEYS, self, Array(*other)) + + def has_any_keys(self, other: Iterable) -> BasicCriterion: + return BasicCriterion(JSONOperators.HAS_ANY_KEYS, self, Array(*other)) + + +class Values(Term): + def __init__(self, field: str | Field) -> None: + super().__init__(None) + self.field = Field(field) if not isinstance(field, Field) else field + + def get_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + return "VALUES({value})".format(value=self.field.get_sql(quote_char=quote_char, **kwargs)) + + +class LiteralValue(Term): + def __init__(self, value, alias: str | None = None) -> None: + super().__init__(alias) + self._value = value + + def get_sql(self, **kwargs: Any) -> str: + return format_alias_sql(self._value, self.alias, **kwargs) + + +class NullValue(LiteralValue): + def __init__(self, alias: str | None = None) -> None: + super().__init__("null", alias) + + +class SystemTimeValue(LiteralValue): + def __init__(self, alias: str | None = None) -> None: + super().__init__("SYSTEM_TIME", alias) + + +class Criterion(Term): + @overload + def _compare(self, comparator: Comparator, other: EmptyCriterion) -> Self: ... + + @overload + def _compare(self, comparator: Comparator, other: Any) -> ComplexCriterion: ... + + def _compare(self, comparator: Comparator, other: Any) -> Self | ComplexCriterion: + if isinstance(other, EmptyCriterion): + return self + return ComplexCriterion(comparator, self, other) + + def __and__(self, other: Any) -> Self | ComplexCriterion: + return self._compare(Boolean.and_, other) + + def __or__(self, other: Any) -> Self | ComplexCriterion: + return self._compare(Boolean.or_, other) + + def __xor__(self, other: Any) -> Self | ComplexCriterion: + return self._compare(Boolean.xor_, other) + + @staticmethod + def any(terms: Iterable[Term] = ()) -> EmptyCriterion | Term | ComplexCriterion: + crit = EmptyCriterion() + + for term in terms: + crit |= term + + return crit + + @staticmethod + def all(terms: Iterable[Any] = ()) -> EmptyCriterion | Any | ComplexCriterion: + crit = EmptyCriterion() + + for term in terms: + crit &= term + + return crit + + def get_sql(self) -> str: + raise NotImplementedError() + + +class EmptyCriterion(Criterion): + is_aggregate = None + tables_ = set() + + def fields_(self) -> set[Field]: + return set() + + def __and__(self, other: Any) -> Any: + return other + + def __or__(self, other: Any) -> Any: + return other + + def __xor__(self, other: Any) -> Any: + return other + + def __invert__(self) -> Any: + return self + + +class Field(Criterion, JSON): + def __init__(self, name: str, alias: str | None = None, table: str | Selectable | None = None) -> None: + super().__init__(alias=alias) + self.name = name + if isinstance(table, str): + # avoid circular import at load time + from pypika.queries import Table + + table = Table(table) + self.table: str | Selectable | None = table + + def nodes_(self) -> Iterator[NodeT]: + yield self + if self.table is not None: + yield from self.table.nodes_() + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the field with the tables replaced. + """ + self.table = new_table if self.table == current_table else self.table + + def get_sql(self, **kwargs: Any) -> str: + with_alias = kwargs.pop("with_alias", False) + with_namespace = kwargs.pop("with_namespace", False) + quote_char = kwargs.pop("quote_char", None) + + field_sql = format_quotes(self.name, quote_char) + + # Need to add namespace if the table has an alias + if self.table and (with_namespace or self.table.alias): + table_name = self.table.get_table_name() + field_sql = "{namespace}.{name}".format( + namespace=format_quotes(table_name, quote_char), + name=field_sql, + ) + + field_alias = getattr(self, "alias", None) + if with_alias: + return format_alias_sql(field_sql, field_alias, quote_char=quote_char, **kwargs) + return field_sql + + +class Index(Term): + def __init__(self, name: str, alias: str | None = None) -> None: + super().__init__(alias) + self.name = name + + def get_sql(self, quote_char: str | None = None, **kwargs: Any) -> str: + return format_quotes(self.name, quote_char) + + +class Star(Field): + def __init__(self, table: str | Selectable | None = None) -> None: + super().__init__("*", table=table) + + def nodes_(self) -> Iterator[NodeT]: + yield self + if self.table is not None: + yield from self.table.nodes_() + + def get_sql( + self, with_alias: bool = False, with_namespace: bool = False, quote_char: str | None = None, **kwargs: Any + ) -> str: + if self.table and (with_namespace or self.table.alias): + namespace = self.table.alias or getattr(self.table, "_table_name") + return "{}.*".format(format_quotes(namespace, quote_char)) + + return "*" + + +class Tuple(Criterion): + def __init__(self, *values: Any) -> None: + super().__init__() + self.values = [self.wrap_constant(value) for value in values] + + def nodes_(self) -> Iterator[NodeT]: + yield self + for value in self.values: + yield from value.nodes_() + + def get_sql(self, **kwargs: Any) -> str: + sql = "({})".format(",".join(term.get_sql(**kwargs) for term in self.values)) + return format_alias_sql(sql, self.alias, **kwargs) + + @property + def is_aggregate(self) -> bool: + return resolve_is_aggregate([val.is_aggregate for val in self.values]) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the field with the tables replaced. + """ + self.values = [value.replace_table(current_table, new_table) for value in self.values] + + +class Array(Tuple): + def get_sql(self, **kwargs: Any) -> str: + dialect = kwargs.get("dialect") + values = ",".join(term.get_sql(**kwargs) for term in self.values) + + sql = "[{}]".format(values) + if dialect in (Dialects.POSTGRESQL, Dialects.REDSHIFT): + sql = "ARRAY[{}]".format(values) if len(values) > 0 else "'{}'" + + return format_alias_sql(sql, self.alias, **kwargs) + + +class Bracket(Tuple): + def __init__(self, term: Any) -> None: + super().__init__(term) + + +class NestedCriterion(Criterion): + def __init__( + self, + comparator: Comparator, + nested_comparator: ComplexCriterion, + left: Any, + right: Any, + nested: Any, + alias: str | None = None, + ) -> None: + super().__init__(alias) + self.left = left + self.comparator = comparator + self.nested_comparator = nested_comparator + self.right = right + self.nested = nested + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.right.nodes_() + yield from self.left.nodes_() + yield from self.nested.nodes_() + + @property + def is_aggregate(self) -> bool | None: + return resolve_is_aggregate([term.is_aggregate for term in [self.left, self.right, self.nested]]) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.left = self.left.replace_table(current_table, new_table) + self.right = self.right.replace_table(current_table, new_table) + self.nested = self.right.replace_table(current_table, new_table) + + def get_sql(self, with_alias: bool = False, **kwargs: Any) -> str: + sql = "{left}{comparator}{right}{nested_comparator}{nested}".format( + left=self.left.get_sql(**kwargs), + comparator=self.comparator.value, + right=self.right.get_sql(**kwargs), + nested_comparator=self.nested_comparator.value, + nested=self.nested.get_sql(**kwargs), + ) + + if with_alias: + return format_alias_sql(sql=sql, alias=self.alias, **kwargs) + + return sql + + +class BasicCriterion(Criterion): + def __init__(self, comparator: Comparator, left: Term, right: Term, alias: str | None = None) -> None: + """ + A wrapper for a basic criterion such as equality or inequality. This wraps three parts, a left and right term + and a comparator which defines the type of comparison. + + + :param comparator: + Type: Comparator + This defines the type of comparison, such as {quote}={quote} or {quote}>{quote}. + :param left: + The term on the left side of the expression. + :param right: + The term on the right side of the expression. + """ + super().__init__(alias) + self.comparator = comparator + self.left = left + self.right = right + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.right.nodes_() + yield from self.left.nodes_() + + @property + def is_aggregate(self) -> bool | None: + return resolve_is_aggregate([term.is_aggregate for term in [self.left, self.right]]) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.left = self.left.replace_table(current_table, new_table) + self.right = self.right.replace_table(current_table, new_table) + + def get_sql(self, quote_char: str = '"', with_alias: bool = False, **kwargs: Any) -> str: + sql = "{left}{comparator}{right}".format( + comparator=self.comparator.value, + left=self.left.get_sql(quote_char=quote_char, **kwargs), + right=self.right.get_sql(quote_char=quote_char, **kwargs), + ) + if with_alias: + return format_alias_sql(sql, self.alias, **kwargs) + return sql + + +class ContainsCriterion(Criterion): + def __init__(self, term: Any, container: Term, alias: str | None = None) -> None: + """ + A wrapper for a "IN" criterion. This wraps two parts, a term and a container. The term is the part of the + expression that is checked for membership in the container. The container can either be a list or a subquery. + + + :param term: + The term to assert membership for within the container. + :param container: + A list or subquery. + """ + super().__init__(alias) + self.term = term + self.container = container + self._is_negated = False + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + yield from self.container.nodes_() + + @property + def is_aggregate(self) -> bool | None: + return self.term.is_aggregate + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.term = self.term.replace_table(current_table, new_table) + + def get_sql(self, subquery: Any = None, **kwargs: Any) -> str: + sql = "{term} {not_}IN {container}".format( + term=self.term.get_sql(**kwargs), + container=self.container.get_sql(subquery=True, **kwargs), + not_="NOT " if self._is_negated else "", + ) + return format_alias_sql(sql, self.alias, **kwargs) + + @builder + def negate(self) -> ContainsCriterion: + self._is_negated = True + + +class ExistsCriterion(Criterion): + def __init__(self, container, alias=None): + super().__init__(alias) + self.container = container + self._is_negated = False + + def get_sql(self, **kwargs): + return "{not_}EXISTS {container}".format( + container=self.container.get_sql(**kwargs), not_='NOT ' if self._is_negated else '' + ) + + def negate(self): + self._is_negated = True + return self + + +class RangeCriterion(Criterion): + def __init__(self, term: Term, start: Any, end: Any, alias: str | None = None) -> str: + super().__init__(alias) + self.term = term + self.start = start + self.end = end + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + yield from self.start.nodes_() + yield from self.end.nodes_() + + @property + def is_aggregate(self) -> bool | None: + return self.term.is_aggregate + + +class BetweenCriterion(RangeCriterion): + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.term = self.term.replace_table(current_table, new_table) + + def get_sql(self, **kwargs: Any) -> str: + sql = "{term} BETWEEN {start} AND {end}".format( + term=self.term.get_sql(**kwargs), + start=self.start.get_sql(**kwargs), + end=self.end.get_sql(**kwargs), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class PeriodCriterion(RangeCriterion): + def get_sql(self, **kwargs: Any) -> str: + sql = "{term} FROM {start} TO {end}".format( + term=self.term.get_sql(**kwargs), + start=self.start.get_sql(**kwargs), + end=self.end.get_sql(**kwargs), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class BitwiseAndCriterion(Criterion): + def __init__(self, term: Term, value: Any, alias: str | None = None) -> None: + super().__init__(alias) + self.term = term + self.value = value + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + yield from self.value.nodes_() + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.term = self.term.replace_table(current_table, new_table) + + def get_sql(self, **kwargs: Any) -> str: + sql = "({term} & {value})".format( + term=self.term.get_sql(**kwargs), + value=self.value, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class BitwiseOrCriterion(Criterion): + def __init__(self, term: Term, value: Any, alias: str | None = None) -> None: + super().__init__(alias) + self.term = term + self.value = value + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + yield from self.value.nodes_() + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.term = self.term.replace_table(current_table, new_table) + + def get_sql(self, **kwargs: Any) -> str: + sql = "({term} | {value})".format( + term=self.term.get_sql(**kwargs), + value=self.value, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class NullCriterion(Criterion): + def __init__(self, term: Term, alias: str | None = None) -> None: + super().__init__(alias) + self.term = term + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.term = self.term.replace_table(current_table, new_table) + + def get_sql(self, with_alias: bool = False, **kwargs: Any) -> str: + sql = "{term} IS NULL".format( + term=self.term.get_sql(**kwargs), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class NotNullCriterion(NullCriterion): + def get_sql(self, with_alias: bool = False, **kwargs: Any) -> str: + sql = "{term} IS NOT NULL".format( + term=self.term.get_sql(**kwargs), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class ComplexCriterion(BasicCriterion): + def get_sql(self, subcriterion: bool = False, **kwargs: Any) -> str: + sql = "{left} {comparator} {right}".format( + comparator=self.comparator.value, + left=self.left.get_sql(subcriterion=self.needs_brackets(self.left), **kwargs), + right=self.right.get_sql(subcriterion=self.needs_brackets(self.right), **kwargs), + ) + + if subcriterion: + return "({criterion})".format(criterion=sql) + + return sql + + def needs_brackets(self, term: Term) -> bool: + return isinstance(term, ComplexCriterion) and not term.comparator == self.comparator + + +class ArithmeticExpression(Term): + """ + Wrapper for an arithmetic function. Can be simple with two terms or complex with nested terms. Order of operations + are also preserved. + """ + + add_order = [Arithmetic.add, Arithmetic.sub] + + def __init__(self, operator: Arithmetic, left: Any, right: Any, alias: str | None = None) -> None: + """ + Wrapper for an arithmetic expression. + + :param operator: + Type: Arithmetic + An operator for the expression such as {quote}+{quote} or {quote}/{quote} + + :param left: + The term on the left side of the expression. + :param right: + The term on the right side of the expression. + :param alias: + (Optional) an alias for the term which can be used inside a select statement. + :return: + """ + super().__init__(alias) + self.operator = operator + self.left = left + self.right = right + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.left.nodes_() + yield from self.right.nodes_() + + @property + def is_aggregate(self) -> bool | None: + # True if both left and right terms are True or None. None if both terms are None. Otherwise, False + return resolve_is_aggregate([self.left.is_aggregate, self.right.is_aggregate]) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the term with the tables replaced. + """ + self.left = self.left.replace_table(current_table, new_table) + self.right = self.right.replace_table(current_table, new_table) + + def left_needs_parens(self, curr_op, left_op) -> bool: + """ + Returns true if the expression on the left of the current operator needs to be enclosed in parentheses. + + :param current_op: + The current operator. + :param left_op: + The highest level operator of the left expression. + """ + if left_op is None: + # If the left expression is a single item. + return False + if curr_op in self.add_order: + # If the current operator is '+' or '-'. + return False + # The current operator is '*' or '/'. If the left operator is '+' or '-', we need to add parentheses: + # e.g. (A + B) / ..., (A - B) / ... + # Otherwise, no parentheses are necessary: + # e.g. A * B / ..., A / B / ... + return left_op in self.add_order + + def right_needs_parens(self, curr_op, right_op) -> bool: + """ + Returns true if the expression on the right of the current operator needs to be enclosed in parentheses. + + :param current_op: + The current operator. + :param right_op: + The highest level operator of the right expression. + """ + if right_op is None: + # If the right expression is a single item. + return False + if curr_op == Arithmetic.add: + return False + if curr_op == Arithmetic.div: + return True + # The current operator is '*' or '-. If the right operator is '+' or '-', we need to add parentheses: + # e.g. ... - (A + B), ... - (A - B) + # Otherwise, no parentheses are necessary: + # e.g. ... - A / B, ... - A * B + return right_op in self.add_order + + def get_sql(self, with_alias: bool = False, **kwargs: Any) -> str: + left_op, right_op = [getattr(side, "operator", None) for side in [self.left, self.right]] + + arithmetic_sql = "{left}{operator}{right}".format( + operator=self.operator.value, + left=("({})" if self.left_needs_parens(self.operator, left_op) else "{}").format( + self.left.get_sql(**kwargs) + ), + right=("({})" if self.right_needs_parens(self.operator, right_op) else "{}").format( + self.right.get_sql(**kwargs) + ), + ) + + if with_alias: + return format_alias_sql(arithmetic_sql, self.alias, **kwargs) + + return arithmetic_sql + + +class Case(Criterion): + def __init__(self, alias: str | None = None) -> None: + super().__init__(alias=alias) + self._cases = [] + self._else = None + + def nodes_(self) -> Iterator[NodeT]: + yield self + + for criterion, term in self._cases: + yield from criterion.nodes_() + yield from term.nodes_() + + if self._else is not None: + yield from self._else.nodes_() + + @property + def is_aggregate(self) -> bool | None: + # True if all criterions/cases are True or None. None all cases are None. Otherwise, False + return resolve_is_aggregate( + [criterion.is_aggregate or term.is_aggregate for criterion, term in self._cases] + + [self._else.is_aggregate if self._else else None] + ) + + @builder + def when(self, criterion: Any, term: Any) -> None: + self._cases.append((criterion, self.wrap_constant(term))) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the term with the tables replaced. + """ + self._cases = [ + [ + criterion.replace_table(current_table, new_table), + term.replace_table(current_table, new_table), + ] + for criterion, term in self._cases + ] + self._else = self._else.replace_table(current_table, new_table) if self._else else None + + @builder + def else_(self, term: Any) -> Case: + self._else = self.wrap_constant(term) + return self + + def get_sql(self, with_alias: bool = False, **kwargs: Any) -> str: + if not self._cases: + raise CaseException("At least one 'when' case is required for a CASE statement.") + + cases = " ".join( + "WHEN {when} THEN {then}".format(when=criterion.get_sql(**kwargs), then=term.get_sql(**kwargs)) + for criterion, term in self._cases + ) + else_ = " ELSE {}".format(self._else.get_sql(**kwargs)) if self._else else "" + + case_sql = f"CASE {cases}{else_} END" + + if with_alias: + return format_alias_sql(case_sql, self.alias, **kwargs) + + return case_sql + + +class Not(Criterion): + def __init__(self, term: Any, alias: str | None = None) -> None: + super().__init__(alias=alias) + self.term = term + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + + def get_sql(self, **kwargs: Any) -> str: + kwargs["subcriterion"] = True + sql = "NOT {term}".format(term=self.term.get_sql(**kwargs)) + return format_alias_sql(sql, self.alias, **kwargs) + + @ignore_copy + def __getattr__(self, name: str) -> Any: + """ + Delegate method calls to the class wrapped by Not(). + Re-wrap methods on child classes of Term (e.g. isin, eg...) to retain 'NOT ' output. + """ + item_func = getattr(self.term, name) + + if not inspect.ismethod(item_func): + return item_func + + def inner(inner_self, *args, **kwargs): + result = item_func(inner_self, *args, **kwargs) + if isinstance(result, (Term,)): + return Not(result) + return result + + return inner + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.term = self.term.replace_table(current_table, new_table) + + +class All(Criterion): + def __init__(self, term: Any, alias: str | None = None) -> None: + super().__init__(alias=alias) + self.term = term + + def nodes_(self) -> Iterator[NodeT]: + yield self + yield from self.term.nodes_() + + def get_sql(self, **kwargs: Any) -> str: + sql = "{term} ALL".format(term=self.term.get_sql(**kwargs)) + return format_alias_sql(sql, self.alias, **kwargs) + + +class CustomFunction: + def __init__(self, name: str, params: Sequence | None = None) -> None: + self.name = name + self.params = params + + def __call__(self, *args: Any, **kwargs: Any) -> Function: + if not self._has_params(): + return Function(self.name, alias=kwargs.get("alias")) + + if not self._is_valid_function_call(*args): + raise FunctionException( + "Function {name} require these arguments ({params}), ({args}) passed".format( + name=self.name, + params=", ".join(str(p) for p in self.params), + args=", ".join(str(p) for p in args), + ) + ) + + return Function(self.name, *args, alias=kwargs.get("alias")) + + def _has_params(self): + return self.params is not None + + def _is_valid_function_call(self, *args): + return len(args) == len(self.params) + + +class Function(Criterion): + def __init__(self, name: str, *args: Any, **kwargs: Any) -> None: + super().__init__(kwargs.get("alias")) + self.name = name + self.args = [self.wrap_constant(param) for param in args] + self.schema = kwargs.get("schema") + + def nodes_(self) -> Iterator[NodeT]: + yield self + for arg in self.args: + yield from arg.nodes_() + + @property + def is_aggregate(self) -> bool | None: + """ + This is a shortcut that assumes if a function has a single argument and that argument is aggregated, then this + function is also aggregated. A more sophisticated approach is needed, however it is unclear how that might work. + :returns: + True if the function accepts one argument and that argument is aggregate. + """ + return resolve_is_aggregate([arg.is_aggregate for arg in self.args]) + + @builder + def replace_table(self, current_table: Table | None, new_table: Table | None) -> None: + """ + Replaces all occurrences of the specified table with the new table. Useful when reusing fields across queries. + + :param current_table: + The table to be replaced. + :param new_table: + The table to replace with. + :return: + A copy of the criterion with the tables replaced. + """ + self.args = [param.replace_table(current_table, new_table) for param in self.args] + + def get_special_params_sql(self, **kwargs: Any) -> Any: + pass + + @staticmethod + def get_arg_sql(arg, **kwargs): + return arg.get_sql(with_alias=False, **kwargs) if hasattr(arg, "get_sql") else str(arg) + + def get_function_sql(self, **kwargs: Any) -> str: + special_params_sql = self.get_special_params_sql(**kwargs) + + return "{name}({args}{special})".format( + name=self.name, + args=",".join( + ( + p.get_sql(with_alias=False, subquery=True, **kwargs) + if hasattr(p, "get_sql") + else self.get_arg_sql(p, **kwargs) + ) + for p in self.args + ), + special=(" " + special_params_sql) if special_params_sql else "", + ) + + def get_sql(self, **kwargs: Any) -> str: + with_alias = kwargs.pop("with_alias", False) + with_namespace = kwargs.pop("with_namespace", False) + quote_char = kwargs.pop("quote_char", None) + dialect = kwargs.pop("dialect", None) + + # FIXME escape + function_sql = self.get_function_sql(with_namespace=with_namespace, quote_char=quote_char, dialect=dialect) + + if self.schema is not None: + function_sql = "{schema}.{function}".format( + schema=self.schema.get_sql(quote_char=quote_char, dialect=dialect, **kwargs), + function=function_sql, + ) + + if with_alias: + return format_alias_sql(function_sql, self.alias, quote_char=quote_char, **kwargs) + + return function_sql + + +class AggregateFunction(Function): + is_aggregate = True + + def __init__(self, name, *args, **kwargs): + super().__init__(name, *args, **kwargs) + + self._filters = [] + self._include_filter = False + + @builder + def filter(self, *filters: Any) -> None: + self._include_filter = True + self._filters += filters + + def get_filter_sql(self, **kwargs: Any) -> str: + if self._include_filter: + return "WHERE {criterions}".format(criterions=Criterion.all(self._filters).get_sql(**kwargs)) + + def get_function_sql(self, **kwargs: Any): + sql = super().get_function_sql(**kwargs) + filter_sql = self.get_filter_sql(**kwargs) + + if self._include_filter: + sql += " FILTER({filter_sql})".format(filter_sql=filter_sql) + + return sql + + +class AnalyticFunction(AggregateFunction): + is_aggregate = False + is_analytic = True + + def __init__(self, name: str, *args: Any, **kwargs: Any) -> None: + super().__init__(name, *args, **kwargs) + self._filters = [] + self._partition = [] + self._orderbys = [] + self._include_filter = False + self._include_over = False + + @builder + def over(self, *terms: Any) -> None: + self._include_over = True + self._partition += terms + + @builder + def orderby(self, *terms: Any, **kwargs: Any) -> None: + self._include_over = True + self._orderbys += [(term, kwargs.get("order")) for term in terms] + + def _orderby_field(self, field: Field, orient: Order | None, **kwargs: Any) -> str: + if orient is None: + return field.get_sql(**kwargs) + + return "{field} {orient}".format( + field=field.get_sql(**kwargs), + orient=orient.value, + ) + + def get_partition_sql(self, **kwargs: Any) -> str: + terms = [] + if self._partition: + terms.append( + "PARTITION BY {args}".format( + args=",".join(p.get_sql(**kwargs) if hasattr(p, "get_sql") else str(p) for p in self._partition) + ) + ) + + if self._orderbys: + terms.append( + "ORDER BY {orderby}".format( + orderby=",".join(self._orderby_field(field, orient, **kwargs) for field, orient in self._orderbys) + ) + ) + + return " ".join(terms) + + def get_function_sql(self, **kwargs: Any) -> str: + function_sql = super().get_function_sql(**kwargs) + partition_sql = self.get_partition_sql(**kwargs) + + sql = function_sql + if self._include_over: + sql += f" OVER({partition_sql})" + + return sql + + +EdgeT = TypeVar("EdgeT", bound="WindowFrameAnalyticFunction.Edge") + + +class WindowFrameAnalyticFunction(AnalyticFunction): + class Edge: + def __init__(self, value: str | int | None = None) -> None: + self.value = value + + def __str__(self) -> str: + return "{value} {modifier}".format( + value=self.value or "UNBOUNDED", + modifier=self.modifier, + ) + + def __init__(self, name: str, *args: Any, **kwargs: Any) -> None: + super().__init__(name, *args, **kwargs) + self.frame = None + self.bound = None + + def _set_frame_and_bounds(self, frame: str, bound: str, and_bound: EdgeT | None) -> None: + if self.frame or self.bound: + raise AttributeError() + + self.frame = frame + self.bound = (bound, and_bound) if and_bound else bound + + @builder + def rows(self, bound: str | EdgeT, and_bound: EdgeT | None = None) -> None: + self._set_frame_and_bounds("ROWS", bound, and_bound) + + @builder + def range(self, bound: str | EdgeT, and_bound: EdgeT | None = None) -> None: + self._set_frame_and_bounds("RANGE", bound, and_bound) + + def get_frame_sql(self) -> str: + if not isinstance(self.bound, tuple): + return "{frame} {bound}".format(frame=self.frame, bound=self.bound) + + lower, upper = self.bound + return "{frame} BETWEEN {lower} AND {upper}".format( + frame=self.frame, + lower=lower, + upper=upper, + ) + + def get_partition_sql(self, **kwargs: Any) -> str: + partition_sql = super().get_partition_sql(**kwargs) + + if not self.frame and not self.bound: + return partition_sql + + return "{over} {frame}".format(over=partition_sql, frame=self.get_frame_sql()) + + +class IgnoreNullsAnalyticFunction(AnalyticFunction): + def __init__(self, name: str, *args: Any, **kwargs: Any) -> None: + super().__init__(name, *args, **kwargs) + self._ignore_nulls = False + + @builder + def ignore_nulls(self) -> None: + self._ignore_nulls = True + + def get_special_params_sql(self, **kwargs: Any) -> str | None: + if self._ignore_nulls: + return "IGNORE NULLS" + + # No special params unless ignoring nulls + return None + + +class Interval(Term): + templates = { + # PostgreSQL, Redshift and Vertica require quotes around the expr and unit e.g. INTERVAL '1 week' + Dialects.POSTGRESQL: "INTERVAL '{expr} {unit}'", + Dialects.REDSHIFT: "INTERVAL '{expr} {unit}'", + Dialects.VERTICA: "INTERVAL '{expr} {unit}'", + # Oracle and MySQL requires just single quotes around the expr + Dialects.ORACLE: "INTERVAL '{expr}' {unit}", + Dialects.MYSQL: "INTERVAL '{expr}' {unit}", + } + + units = ["years", "months", "days", "hours", "minutes", "seconds", "microseconds"] + labels = ["YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "MICROSECOND"] + + trim_pattern = re.compile(r"(^0+\.)|(\.0+$)|(^[0\-.: ]+[\-: ])|([\-:. ][0\-.: ]+$)") + + def __init__( + self, + years: int = 0, + months: int = 0, + days: int = 0, + hours: int = 0, + minutes: int = 0, + seconds: int = 0, + microseconds: int = 0, + quarters: int = 0, + weeks: int = 0, + dialect: Dialects | None = None, + ): + self.dialect = dialect + self.largest = None + self.smallest = None + self.is_negative = False + + if quarters: + self.quarters = quarters + return + + if weeks: + self.weeks = weeks + return + + for unit, label, value in zip( + self.units, + self.labels, + [years, months, days, hours, minutes, seconds, microseconds], + ): + if value: + int_value = int(value) + setattr(self, unit, abs(int_value)) + if self.largest is None: + self.largest = label + self.is_negative = int_value < 0 + self.smallest = label + + def __str__(self) -> str: + return self.get_sql() + + def get_sql(self, **kwargs: Any) -> str: + dialect = self.dialect or kwargs.get("dialect") + + if self.largest == "MICROSECOND": + expr = getattr(self, "microseconds") + unit = "MICROSECOND" + + elif hasattr(self, "quarters"): + expr = getattr(self, "quarters") + unit = "QUARTER" + + elif hasattr(self, "weeks"): + expr = getattr(self, "weeks") + unit = "WEEK" + + else: + # Create the whole expression but trim out the unnecessary fields + expr = "{years}-{months}-{days} {hours}:{minutes}:{seconds}.{microseconds}".format( + years=getattr(self, "years", 0), + months=getattr(self, "months", 0), + days=getattr(self, "days", 0), + hours=getattr(self, "hours", 0), + minutes=getattr(self, "minutes", 0), + seconds=getattr(self, "seconds", 0), + microseconds=getattr(self, "microseconds", 0), + ) + expr = self.trim_pattern.sub("", expr) + if self.is_negative: + expr = "-" + expr + + unit = ( + "{largest}_{smallest}".format( + largest=self.largest, + smallest=self.smallest, + ) + if self.largest != self.smallest + else self.largest + ) + + # Set default unit with DAY + if unit is None: + unit = "DAY" + + return self.templates.get(dialect, "INTERVAL '{expr} {unit}'").format(expr=expr, unit=unit) + + +class Pow(Function): + def __init__(self, term: Term, exponent: float, alias: str | None = None) -> None: + super().__init__("POW", term, exponent, alias=alias) + + +class Mod(Function): + def __init__(self, term: Term, modulus: float, alias: str | None = None) -> None: + super().__init__("MOD", term, modulus, alias=alias) + + +class Rollup(Function): + def __init__(self, *terms: Any) -> None: + super().__init__("ROLLUP", *terms) + + +class PseudoColumn(Term): + """ + Represents a pseudo column (a "column" which yields a value when selected + but is not actually a real table column). + """ + + def __init__(self, name: str) -> None: + super().__init__(alias=None) + self.name = name + + def get_sql(self, **kwargs: Any) -> str: + return self.name + + +class AtTimezone(Term): + """ + Generates AT TIME ZONE SQL. + Examples: + AT TIME ZONE 'US/Eastern' + AT TIME ZONE INTERVAL '-06:00' + """ + + is_aggregate = None + + def __init__(self, field, zone, interval=False, alias=None): + super().__init__(alias) + self.field = Field(field) if not isinstance(field, Field) else field + self.zone = zone + self.interval = interval + + def get_sql(self, **kwargs): + sql = '{name} AT TIME ZONE {interval}\'{zone}\''.format( + name=self.field.get_sql(**kwargs), + interval='INTERVAL ' if self.interval else '', + zone=self.zone, + ) + return format_alias_sql(sql, self.alias, **kwargs) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/utils.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..15984e042e4c924717b58ad9af63f7f5a257d0c4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pypika/utils.py @@ -0,0 +1,154 @@ +from __future__ import annotations + +import sys +from collections.abc import Callable +from functools import wraps +from typing import Any, TypeVar, overload + +if sys.version_info >= (3, 10): + from typing import Concatenate, ParamSpec +else: + from typing_extensions import Concatenate, ParamSpec + + +__author__ = "Timothy Heys" +__email__ = "theys@kayak.com" + + +class QueryException(Exception): + pass + + +class GroupingException(Exception): + pass + + +class CaseException(Exception): + pass + + +class JoinException(Exception): + pass + + +class SetOperationException(Exception): + pass + + +class RollupException(Exception): + pass + + +class DialectNotSupported(Exception): + pass + + +class FunctionException(Exception): + pass + + +_Self = TypeVar("_Self") +P = ParamSpec("P") +R = TypeVar("R") + + +@overload +def builder(func: Callable[Concatenate[_Self, P], None]) -> Callable[Concatenate[_Self, P], _Self]: ... + + +@overload +def builder(func: Callable[Concatenate[_Self, P], R]) -> Callable[Concatenate[_Self, P], R]: ... + + +def builder(func: Callable[Concatenate[_Self, P], R | None]) -> Callable[Concatenate[_Self, P], _Self | R]: + """ + Decorator for wrapper "builder" functions. These are functions on the Query class or other classes used for + building queries which mutate the query and return self. To make the build functions immutable, this decorator is + used which will deepcopy the current instance. This decorator will return the return value of the inner function + or the new copy of the instance. The inner function does not need to return self. + """ + import copy + + @wraps(func) + def _copy(self: _Self, *args: P.args, **kwargs: P.kwargs) -> _Self | R: + self_copy = copy.copy(self) if getattr(self, "immutable", True) else self + result = func(self_copy, *args, **kwargs) + + # Return self if the inner function returns None. This way the inner function can return something + # different (for example when creating joins, a different builder is returned). + if result is None: + return self_copy + + return result + + return _copy + + +def ignore_copy(func: Callable[[_Self, str], R]) -> Callable[[_Self, str], R]: + """ + Decorator for wrapping the __getattr__ function for classes that are copied via deepcopy. This prevents infinite + recursion caused by deepcopy looking for magic functions in the class. Any class implementing __getattr__ that is + meant to be deepcopy'd should use this decorator. + + deepcopy is used by pypika in builder functions (decorated by @builder) to make the results immutable. Any data + model type class (stored in the Query instance) is copied. + """ + + @wraps(func) + def _getattr(self, name: str) -> R: + if name in [ + "__copy__", + "__deepcopy__", + "__getstate__", + "__setstate__", + "__getnewargs__", + ]: + raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name)) + + return func(self, name) + + return _getattr + + +def resolve_is_aggregate(values: list[bool | None]) -> bool | None: + """ + Resolves the is_aggregate flag for an expression that contains multiple terms. This works like a voter system, + each term votes True or False or abstains with None. + + :param values: A list of booleans (or None) for each term in the expression + :return: If all values are True or None, True is returned. If all values are None, None is returned. Otherwise, + False is returned. + """ + result = [x for x in values if x is not None] + if result: + return all(result) + return None + + +def format_quotes(value: Any, quote_char: str | None) -> str: + if quote_char: + value = str(value).replace(quote_char, quote_char * 2) + + return "{quote}{value}{quote}".format(value=value, quote=quote_char or "") + + +def format_alias_sql( + sql: str, + alias: str | None, + quote_char: str | None = None, + alias_quote_char: str | None = None, + as_keyword: bool = False, + **kwargs: Any, +) -> str: + if alias is None: + return sql + return "{sql}{_as}{alias}".format( + sql=sql, _as=' AS ' if as_keyword else ' ', alias=format_quotes(alias, alias_quote_char or quote_char) + ) + + +def validate(*args: Any, exc: Exception | None = None, type: type | None = None) -> None: + if type is not None: + for arg in args: + if not isinstance(arg, type): + raise exc diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/LICENSE b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b0ae9dbc262b5f7ed4cb6f964cfb5eb5c0d0b0be --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Thomas Kluyver + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5a4dbf188f7c2c5b1625a1483477a0d60eb43264 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/METADATA @@ -0,0 +1,25 @@ +Metadata-Version: 2.1 +Name: pyproject_hooks +Version: 1.2.0 +Summary: Wrappers to call pyproject.toml-based build backend hooks. +Author-email: Thomas Kluyver +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Project-URL: Changelog, https://pyproject-hooks.readthedocs.io/en/latest/changelog.html +Project-URL: Documentation, https://pyproject-hooks.readthedocs.io/ +Project-URL: Source, https://github.com/pypa/pyproject-hooks + +``pyproject-hooks`` +=================== + +This is a low-level library for calling build-backends in ``pyproject.toml``-based project. It provides the basic functionality to help write tooling that generates distribution files from Python projects. + +If you want a tool that builds Python packages, you'll want to use https://github.com/pypa/build instead. This is an underlying piece for `pip`, `build` and other "build frontends" use to call "build backends" within them. + +You can read more in the `documentation `_. + + Note: The ``pep517`` project has been replaced by this project (low level) and the ``build`` project (high level). + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..7290aa319d625b7958012ac11a979b3cf190a11a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/RECORD @@ -0,0 +1,14 @@ +pyproject_hooks-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pyproject_hooks-1.2.0.dist-info/LICENSE,sha256=GyKwSbUmfW38I6Z79KhNjsBLn9-xpR02DkK0NCyLQVQ,1081 +pyproject_hooks-1.2.0.dist-info/METADATA,sha256=O_2BjlqJjiwB2EniNCkgE22CK1lFS1ma1VwNKTQoZUw,1288 +pyproject_hooks-1.2.0.dist-info/RECORD,, +pyproject_hooks-1.2.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 +pyproject_hooks/__init__.py,sha256=cPB_a9LXz5xvsRbX1o2qyAdjLatZJdQ_Lc5McNX-X7Y,691 +pyproject_hooks/__pycache__/__init__.cpython-311.pyc,, +pyproject_hooks/__pycache__/_impl.cpython-311.pyc,, +pyproject_hooks/_impl.py,sha256=jY-raxnmyRyB57ruAitrJRUzEexuAhGTpgMygqx67Z4,14936 +pyproject_hooks/_in_process/__init__.py,sha256=MJNPpfIxcO-FghxpBbxkG1rFiQf6HOUbV4U5mq0HFns,557 +pyproject_hooks/_in_process/__pycache__/__init__.cpython-311.pyc,, +pyproject_hooks/_in_process/__pycache__/_in_process.cpython-311.pyc,, +pyproject_hooks/_in_process/_in_process.py,sha256=qcXMhmx__MIJq10gGHW3mA4Tl8dy8YzHMccwnNoKlw0,12216 +pyproject_hooks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..3b5e64b5e6c4a210201d1676a891fd57b15cda99 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks-1.2.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.9.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..746b89f7e71ed14565d18aa97ccc62d5df1bed82 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__init__.py @@ -0,0 +1,31 @@ +"""Wrappers to call pyproject.toml-based build backend hooks. +""" + +from typing import TYPE_CHECKING + +from ._impl import ( + BackendUnavailable, + BuildBackendHookCaller, + HookMissing, + UnsupportedOperation, + default_subprocess_runner, + quiet_subprocess_runner, +) + +__version__ = "1.2.0" +__all__ = [ + "BackendUnavailable", + "BackendInvalid", + "HookMissing", + "UnsupportedOperation", + "default_subprocess_runner", + "quiet_subprocess_runner", + "BuildBackendHookCaller", +] + +BackendInvalid = BackendUnavailable # Deprecated alias, previously a separate exception + +if TYPE_CHECKING: + from ._impl import SubprocessRunner + + __all__ += ["SubprocessRunner"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c81077172c4bf339a535d464f9b84ce173f8bee3 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__pycache__/_impl.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__pycache__/_impl.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71e9e9b72e8772cfc9f52e73429fc93df72eaa31 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/__pycache__/_impl.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_impl.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_impl.py new file mode 100644 index 0000000000000000000000000000000000000000..d1e9d7bb8c62e2fda5a9fd395899175142eb9b04 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_impl.py @@ -0,0 +1,410 @@ +import json +import os +import sys +import tempfile +from contextlib import contextmanager +from os.path import abspath +from os.path import join as pjoin +from subprocess import STDOUT, check_call, check_output +from typing import TYPE_CHECKING, Any, Iterator, Mapping, Optional, Sequence + +from ._in_process import _in_proc_script_path + +if TYPE_CHECKING: + from typing import Protocol + + class SubprocessRunner(Protocol): + """A protocol for the subprocess runner.""" + + def __call__( + self, + cmd: Sequence[str], + cwd: Optional[str] = None, + extra_environ: Optional[Mapping[str, str]] = None, + ) -> None: + ... + + +def write_json(obj: Mapping[str, Any], path: str, **kwargs) -> None: + with open(path, "w", encoding="utf-8") as f: + json.dump(obj, f, **kwargs) + + +def read_json(path: str) -> Mapping[str, Any]: + with open(path, encoding="utf-8") as f: + return json.load(f) + + +class BackendUnavailable(Exception): + """Will be raised if the backend cannot be imported in the hook process.""" + + def __init__( + self, + traceback: str, + message: Optional[str] = None, + backend_name: Optional[str] = None, + backend_path: Optional[Sequence[str]] = None, + ) -> None: + # Preserving arg order for the sake of API backward compatibility. + self.backend_name = backend_name + self.backend_path = backend_path + self.traceback = traceback + super().__init__(message or "Error while importing backend") + + +class HookMissing(Exception): + """Will be raised on missing hooks (if a fallback can't be used).""" + + def __init__(self, hook_name: str) -> None: + super().__init__(hook_name) + self.hook_name = hook_name + + +class UnsupportedOperation(Exception): + """May be raised by build_sdist if the backend indicates that it can't.""" + + def __init__(self, traceback: str) -> None: + self.traceback = traceback + + +def default_subprocess_runner( + cmd: Sequence[str], + cwd: Optional[str] = None, + extra_environ: Optional[Mapping[str, str]] = None, +) -> None: + """The default method of calling the wrapper subprocess. + + This uses :func:`subprocess.check_call` under the hood. + """ + env = os.environ.copy() + if extra_environ: + env.update(extra_environ) + + check_call(cmd, cwd=cwd, env=env) + + +def quiet_subprocess_runner( + cmd: Sequence[str], + cwd: Optional[str] = None, + extra_environ: Optional[Mapping[str, str]] = None, +) -> None: + """Call the subprocess while suppressing output. + + This uses :func:`subprocess.check_output` under the hood. + """ + env = os.environ.copy() + if extra_environ: + env.update(extra_environ) + + check_output(cmd, cwd=cwd, env=env, stderr=STDOUT) + + +def norm_and_check(source_tree: str, requested: str) -> str: + """Normalise and check a backend path. + + Ensure that the requested backend path is specified as a relative path, + and resolves to a location under the given source tree. + + Return an absolute version of the requested path. + """ + if os.path.isabs(requested): + raise ValueError("paths must be relative") + + abs_source = os.path.abspath(source_tree) + abs_requested = os.path.normpath(os.path.join(abs_source, requested)) + # We have to use commonprefix for Python 2.7 compatibility. So we + # normalise case to avoid problems because commonprefix is a character + # based comparison :-( + norm_source = os.path.normcase(abs_source) + norm_requested = os.path.normcase(abs_requested) + if os.path.commonprefix([norm_source, norm_requested]) != norm_source: + raise ValueError("paths must be inside source tree") + + return abs_requested + + +class BuildBackendHookCaller: + """A wrapper to call the build backend hooks for a source directory.""" + + def __init__( + self, + source_dir: str, + build_backend: str, + backend_path: Optional[Sequence[str]] = None, + runner: Optional["SubprocessRunner"] = None, + python_executable: Optional[str] = None, + ) -> None: + """ + :param source_dir: The source directory to invoke the build backend for + :param build_backend: The build backend spec + :param backend_path: Additional path entries for the build backend spec + :param runner: The :ref:`subprocess runner ` to use + :param python_executable: + The Python executable used to invoke the build backend + """ + if runner is None: + runner = default_subprocess_runner + + self.source_dir = abspath(source_dir) + self.build_backend = build_backend + if backend_path: + backend_path = [norm_and_check(self.source_dir, p) for p in backend_path] + self.backend_path = backend_path + self._subprocess_runner = runner + if not python_executable: + python_executable = sys.executable + self.python_executable = python_executable + + @contextmanager + def subprocess_runner(self, runner: "SubprocessRunner") -> Iterator[None]: + """A context manager for temporarily overriding the default + :ref:`subprocess runner `. + + :param runner: The new subprocess runner to use within the context. + + .. code-block:: python + + hook_caller = BuildBackendHookCaller(...) + with hook_caller.subprocess_runner(quiet_subprocess_runner): + ... + """ + prev = self._subprocess_runner + self._subprocess_runner = runner + try: + yield + finally: + self._subprocess_runner = prev + + def _supported_features(self) -> Sequence[str]: + """Return the list of optional features supported by the backend.""" + return self._call_hook("_supported_features", {}) + + def get_requires_for_build_wheel( + self, + config_settings: Optional[Mapping[str, Any]] = None, + ) -> Sequence[str]: + """Get additional dependencies required for building a wheel. + + :param config_settings: The configuration settings for the build backend + :returns: A list of :pep:`dependency specifiers <508>`. + + .. admonition:: Fallback + + If the build backend does not defined a hook with this name, an + empty list will be returned. + """ + return self._call_hook( + "get_requires_for_build_wheel", {"config_settings": config_settings} + ) + + def prepare_metadata_for_build_wheel( + self, + metadata_directory: str, + config_settings: Optional[Mapping[str, Any]] = None, + _allow_fallback: bool = True, + ) -> str: + """Prepare a ``*.dist-info`` folder with metadata for this project. + + :param metadata_directory: The directory to write the metadata to + :param config_settings: The configuration settings for the build backend + :param _allow_fallback: + Whether to allow the fallback to building a wheel and extracting + the metadata from it. Should be passed as a keyword argument only. + + :returns: Name of the newly created subfolder within + ``metadata_directory``, containing the metadata. + + .. admonition:: Fallback + + If the build backend does not define a hook with this name and + ``_allow_fallback`` is truthy, the backend will be asked to build a + wheel via the ``build_wheel`` hook and the dist-info extracted from + that will be returned. + """ + return self._call_hook( + "prepare_metadata_for_build_wheel", + { + "metadata_directory": abspath(metadata_directory), + "config_settings": config_settings, + "_allow_fallback": _allow_fallback, + }, + ) + + def build_wheel( + self, + wheel_directory: str, + config_settings: Optional[Mapping[str, Any]] = None, + metadata_directory: Optional[str] = None, + ) -> str: + """Build a wheel from this project. + + :param wheel_directory: The directory to write the wheel to + :param config_settings: The configuration settings for the build backend + :param metadata_directory: The directory to reuse existing metadata from + :returns: + The name of the newly created wheel within ``wheel_directory``. + + .. admonition:: Interaction with fallback + + If the ``build_wheel`` hook was called in the fallback for + :meth:`prepare_metadata_for_build_wheel`, the build backend would + not be invoked. Instead, the previously built wheel will be copied + to ``wheel_directory`` and the name of that file will be returned. + """ + if metadata_directory is not None: + metadata_directory = abspath(metadata_directory) + return self._call_hook( + "build_wheel", + { + "wheel_directory": abspath(wheel_directory), + "config_settings": config_settings, + "metadata_directory": metadata_directory, + }, + ) + + def get_requires_for_build_editable( + self, + config_settings: Optional[Mapping[str, Any]] = None, + ) -> Sequence[str]: + """Get additional dependencies required for building an editable wheel. + + :param config_settings: The configuration settings for the build backend + :returns: A list of :pep:`dependency specifiers <508>`. + + .. admonition:: Fallback + + If the build backend does not defined a hook with this name, an + empty list will be returned. + """ + return self._call_hook( + "get_requires_for_build_editable", {"config_settings": config_settings} + ) + + def prepare_metadata_for_build_editable( + self, + metadata_directory: str, + config_settings: Optional[Mapping[str, Any]] = None, + _allow_fallback: bool = True, + ) -> Optional[str]: + """Prepare a ``*.dist-info`` folder with metadata for this project. + + :param metadata_directory: The directory to write the metadata to + :param config_settings: The configuration settings for the build backend + :param _allow_fallback: + Whether to allow the fallback to building a wheel and extracting + the metadata from it. Should be passed as a keyword argument only. + :returns: Name of the newly created subfolder within + ``metadata_directory``, containing the metadata. + + .. admonition:: Fallback + + If the build backend does not define a hook with this name and + ``_allow_fallback`` is truthy, the backend will be asked to build a + wheel via the ``build_editable`` hook and the dist-info + extracted from that will be returned. + """ + return self._call_hook( + "prepare_metadata_for_build_editable", + { + "metadata_directory": abspath(metadata_directory), + "config_settings": config_settings, + "_allow_fallback": _allow_fallback, + }, + ) + + def build_editable( + self, + wheel_directory: str, + config_settings: Optional[Mapping[str, Any]] = None, + metadata_directory: Optional[str] = None, + ) -> str: + """Build an editable wheel from this project. + + :param wheel_directory: The directory to write the wheel to + :param config_settings: The configuration settings for the build backend + :param metadata_directory: The directory to reuse existing metadata from + :returns: + The name of the newly created wheel within ``wheel_directory``. + + .. admonition:: Interaction with fallback + + If the ``build_editable`` hook was called in the fallback for + :meth:`prepare_metadata_for_build_editable`, the build backend + would not be invoked. Instead, the previously built wheel will be + copied to ``wheel_directory`` and the name of that file will be + returned. + """ + if metadata_directory is not None: + metadata_directory = abspath(metadata_directory) + return self._call_hook( + "build_editable", + { + "wheel_directory": abspath(wheel_directory), + "config_settings": config_settings, + "metadata_directory": metadata_directory, + }, + ) + + def get_requires_for_build_sdist( + self, + config_settings: Optional[Mapping[str, Any]] = None, + ) -> Sequence[str]: + """Get additional dependencies required for building an sdist. + + :returns: A list of :pep:`dependency specifiers <508>`. + """ + return self._call_hook( + "get_requires_for_build_sdist", {"config_settings": config_settings} + ) + + def build_sdist( + self, + sdist_directory: str, + config_settings: Optional[Mapping[str, Any]] = None, + ) -> str: + """Build an sdist from this project. + + :returns: + The name of the newly created sdist within ``wheel_directory``. + """ + return self._call_hook( + "build_sdist", + { + "sdist_directory": abspath(sdist_directory), + "config_settings": config_settings, + }, + ) + + def _call_hook(self, hook_name: str, kwargs: Mapping[str, Any]) -> Any: + extra_environ = {"_PYPROJECT_HOOKS_BUILD_BACKEND": self.build_backend} + + if self.backend_path: + backend_path = os.pathsep.join(self.backend_path) + extra_environ["_PYPROJECT_HOOKS_BACKEND_PATH"] = backend_path + + with tempfile.TemporaryDirectory() as td: + hook_input = {"kwargs": kwargs} + write_json(hook_input, pjoin(td, "input.json"), indent=2) + + # Run the hook in a subprocess + with _in_proc_script_path() as script: + python = self.python_executable + self._subprocess_runner( + [python, abspath(str(script)), hook_name, td], + cwd=self.source_dir, + extra_environ=extra_environ, + ) + + data = read_json(pjoin(td, "output.json")) + if data.get("unsupported"): + raise UnsupportedOperation(data.get("traceback", "")) + if data.get("no_backend"): + raise BackendUnavailable( + data.get("traceback", ""), + message=data.get("backend_error", ""), + backend_name=self.build_backend, + backend_path=self.backend_path, + ) + if data.get("hook_missing"): + raise HookMissing(data.get("missing_hook_name") or hook_name) + return data["return_val"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..906d0ba20e1f3e10b35456c2db1f207a071ce246 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__init__.py @@ -0,0 +1,21 @@ +"""This is a subpackage because the directory is on sys.path for _in_process.py + +The subpackage should stay as empty as possible to avoid shadowing modules that +the backend might import. +""" + +import importlib.resources as resources + +try: + resources.files +except AttributeError: + # Python 3.8 compatibility + def _in_proc_script_path(): + return resources.path(__package__, "_in_process.py") + +else: + + def _in_proc_script_path(): + return resources.as_file( + resources.files(__package__).joinpath("_in_process.py") + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..651db1438296f10113ead71ab9eeda2fb3b396e8 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..adc01210e6edffafed03a3e887b0ed8888952b19 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/_in_process.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/_in_process.py new file mode 100644 index 0000000000000000000000000000000000000000..d689bab7219b0d2abf8b127d3ddd1eb0a61eb997 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/_in_process/_in_process.py @@ -0,0 +1,389 @@ +"""This is invoked in a subprocess to call the build backend hooks. + +It expects: +- Command line args: hook_name, control_dir +- Environment variables: + _PYPROJECT_HOOKS_BUILD_BACKEND=entry.point:spec + _PYPROJECT_HOOKS_BACKEND_PATH=paths (separated with os.pathsep) +- control_dir/input.json: + - {"kwargs": {...}} + +Results: +- control_dir/output.json + - {"return_val": ...} +""" +import json +import os +import os.path +import re +import shutil +import sys +import traceback +from glob import glob +from importlib import import_module +from importlib.machinery import PathFinder +from os.path import join as pjoin + +# This file is run as a script, and `import wrappers` is not zip-safe, so we +# include write_json() and read_json() from wrappers.py. + + +def write_json(obj, path, **kwargs): + with open(path, "w", encoding="utf-8") as f: + json.dump(obj, f, **kwargs) + + +def read_json(path): + with open(path, encoding="utf-8") as f: + return json.load(f) + + +class BackendUnavailable(Exception): + """Raised if we cannot import the backend""" + + def __init__(self, message, traceback=None): + super().__init__(message) + self.message = message + self.traceback = traceback + + +class HookMissing(Exception): + """Raised if a hook is missing and we are not executing the fallback""" + + def __init__(self, hook_name=None): + super().__init__(hook_name) + self.hook_name = hook_name + + +def _build_backend(): + """Find and load the build backend""" + backend_path = os.environ.get("_PYPROJECT_HOOKS_BACKEND_PATH") + ep = os.environ["_PYPROJECT_HOOKS_BUILD_BACKEND"] + mod_path, _, obj_path = ep.partition(":") + + if backend_path: + # Ensure in-tree backend directories have the highest priority when importing. + extra_pathitems = backend_path.split(os.pathsep) + sys.meta_path.insert(0, _BackendPathFinder(extra_pathitems, mod_path)) + + try: + obj = import_module(mod_path) + except ImportError: + msg = f"Cannot import {mod_path!r}" + raise BackendUnavailable(msg, traceback.format_exc()) + + if obj_path: + for path_part in obj_path.split("."): + obj = getattr(obj, path_part) + return obj + + +class _BackendPathFinder: + """Implements the MetaPathFinder interface to locate modules in ``backend-path``. + + Since the environment provided by the frontend can contain all sorts of + MetaPathFinders, the only way to ensure the backend is loaded from the + right place is to prepend our own. + """ + + def __init__(self, backend_path, backend_module): + self.backend_path = backend_path + self.backend_module = backend_module + self.backend_parent, _, _ = backend_module.partition(".") + + def find_spec(self, fullname, _path, _target=None): + if "." in fullname: + # Rely on importlib to find nested modules based on parent's path + return None + + # Ignore other items in _path or sys.path and use backend_path instead: + spec = PathFinder.find_spec(fullname, path=self.backend_path) + if spec is None and fullname == self.backend_parent: + # According to the spec, the backend MUST be loaded from backend-path. + # Therefore, we can halt the import machinery and raise a clean error. + msg = f"Cannot find module {self.backend_module!r} in {self.backend_path!r}" + raise BackendUnavailable(msg) + + return spec + + if sys.version_info >= (3, 8): + + def find_distributions(self, context=None): + # Delayed import: Python 3.7 does not contain importlib.metadata + from importlib.metadata import DistributionFinder, MetadataPathFinder + + context = DistributionFinder.Context(path=self.backend_path) + return MetadataPathFinder.find_distributions(context=context) + + +def _supported_features(): + """Return the list of options features supported by the backend. + + Returns a list of strings. + The only possible value is 'build_editable'. + """ + backend = _build_backend() + features = [] + if hasattr(backend, "build_editable"): + features.append("build_editable") + return features + + +def get_requires_for_build_wheel(config_settings): + """Invoke the optional get_requires_for_build_wheel hook + + Returns [] if the hook is not defined. + """ + backend = _build_backend() + try: + hook = backend.get_requires_for_build_wheel + except AttributeError: + return [] + else: + return hook(config_settings) + + +def get_requires_for_build_editable(config_settings): + """Invoke the optional get_requires_for_build_editable hook + + Returns [] if the hook is not defined. + """ + backend = _build_backend() + try: + hook = backend.get_requires_for_build_editable + except AttributeError: + return [] + else: + return hook(config_settings) + + +def prepare_metadata_for_build_wheel( + metadata_directory, config_settings, _allow_fallback +): + """Invoke optional prepare_metadata_for_build_wheel + + Implements a fallback by building a wheel if the hook isn't defined, + unless _allow_fallback is False in which case HookMissing is raised. + """ + backend = _build_backend() + try: + hook = backend.prepare_metadata_for_build_wheel + except AttributeError: + if not _allow_fallback: + raise HookMissing() + else: + return hook(metadata_directory, config_settings) + # fallback to build_wheel outside the try block to avoid exception chaining + # which can be confusing to users and is not relevant + whl_basename = backend.build_wheel(metadata_directory, config_settings) + return _get_wheel_metadata_from_wheel( + whl_basename, metadata_directory, config_settings + ) + + +def prepare_metadata_for_build_editable( + metadata_directory, config_settings, _allow_fallback +): + """Invoke optional prepare_metadata_for_build_editable + + Implements a fallback by building an editable wheel if the hook isn't + defined, unless _allow_fallback is False in which case HookMissing is + raised. + """ + backend = _build_backend() + try: + hook = backend.prepare_metadata_for_build_editable + except AttributeError: + if not _allow_fallback: + raise HookMissing() + try: + build_hook = backend.build_editable + except AttributeError: + raise HookMissing(hook_name="build_editable") + else: + whl_basename = build_hook(metadata_directory, config_settings) + return _get_wheel_metadata_from_wheel( + whl_basename, metadata_directory, config_settings + ) + else: + return hook(metadata_directory, config_settings) + + +WHEEL_BUILT_MARKER = "PYPROJECT_HOOKS_ALREADY_BUILT_WHEEL" + + +def _dist_info_files(whl_zip): + """Identify the .dist-info folder inside a wheel ZipFile.""" + res = [] + for path in whl_zip.namelist(): + m = re.match(r"[^/\\]+-[^/\\]+\.dist-info/", path) + if m: + res.append(path) + if res: + return res + raise Exception("No .dist-info folder found in wheel") + + +def _get_wheel_metadata_from_wheel(whl_basename, metadata_directory, config_settings): + """Extract the metadata from a wheel. + + Fallback for when the build backend does not + define the 'get_wheel_metadata' hook. + """ + from zipfile import ZipFile + + with open(os.path.join(metadata_directory, WHEEL_BUILT_MARKER), "wb"): + pass # Touch marker file + + whl_file = os.path.join(metadata_directory, whl_basename) + with ZipFile(whl_file) as zipf: + dist_info = _dist_info_files(zipf) + zipf.extractall(path=metadata_directory, members=dist_info) + return dist_info[0].split("/")[0] + + +def _find_already_built_wheel(metadata_directory): + """Check for a wheel already built during the get_wheel_metadata hook.""" + if not metadata_directory: + return None + metadata_parent = os.path.dirname(metadata_directory) + if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)): + return None + + whl_files = glob(os.path.join(metadata_parent, "*.whl")) + if not whl_files: + print("Found wheel built marker, but no .whl files") + return None + if len(whl_files) > 1: + print( + "Found multiple .whl files; unspecified behaviour. " + "Will call build_wheel." + ) + return None + + # Exactly one .whl file + return whl_files[0] + + +def build_wheel(wheel_directory, config_settings, metadata_directory=None): + """Invoke the mandatory build_wheel hook. + + If a wheel was already built in the + prepare_metadata_for_build_wheel fallback, this + will copy it rather than rebuilding the wheel. + """ + prebuilt_whl = _find_already_built_wheel(metadata_directory) + if prebuilt_whl: + shutil.copy2(prebuilt_whl, wheel_directory) + return os.path.basename(prebuilt_whl) + + return _build_backend().build_wheel( + wheel_directory, config_settings, metadata_directory + ) + + +def build_editable(wheel_directory, config_settings, metadata_directory=None): + """Invoke the optional build_editable hook. + + If a wheel was already built in the + prepare_metadata_for_build_editable fallback, this + will copy it rather than rebuilding the wheel. + """ + backend = _build_backend() + try: + hook = backend.build_editable + except AttributeError: + raise HookMissing() + else: + prebuilt_whl = _find_already_built_wheel(metadata_directory) + if prebuilt_whl: + shutil.copy2(prebuilt_whl, wheel_directory) + return os.path.basename(prebuilt_whl) + + return hook(wheel_directory, config_settings, metadata_directory) + + +def get_requires_for_build_sdist(config_settings): + """Invoke the optional get_requires_for_build_wheel hook + + Returns [] if the hook is not defined. + """ + backend = _build_backend() + try: + hook = backend.get_requires_for_build_sdist + except AttributeError: + return [] + else: + return hook(config_settings) + + +class _DummyException(Exception): + """Nothing should ever raise this exception""" + + +class GotUnsupportedOperation(Exception): + """For internal use when backend raises UnsupportedOperation""" + + def __init__(self, traceback): + self.traceback = traceback + + +def build_sdist(sdist_directory, config_settings): + """Invoke the mandatory build_sdist hook.""" + backend = _build_backend() + try: + return backend.build_sdist(sdist_directory, config_settings) + except getattr(backend, "UnsupportedOperation", _DummyException): + raise GotUnsupportedOperation(traceback.format_exc()) + + +HOOK_NAMES = { + "get_requires_for_build_wheel", + "prepare_metadata_for_build_wheel", + "build_wheel", + "get_requires_for_build_editable", + "prepare_metadata_for_build_editable", + "build_editable", + "get_requires_for_build_sdist", + "build_sdist", + "_supported_features", +} + + +def main(): + if len(sys.argv) < 3: + sys.exit("Needs args: hook_name, control_dir") + hook_name = sys.argv[1] + control_dir = sys.argv[2] + if hook_name not in HOOK_NAMES: + sys.exit("Unknown hook: %s" % hook_name) + + # Remove the parent directory from sys.path to avoid polluting the backend + # import namespace with this directory. + here = os.path.dirname(__file__) + if here in sys.path: + sys.path.remove(here) + + hook = globals()[hook_name] + + hook_input = read_json(pjoin(control_dir, "input.json")) + + json_out = {"unsupported": False, "return_val": None} + try: + json_out["return_val"] = hook(**hook_input["kwargs"]) + except BackendUnavailable as e: + json_out["no_backend"] = True + json_out["traceback"] = e.traceback + json_out["backend_error"] = e.message + except GotUnsupportedOperation as e: + json_out["unsupported"] = True + json_out["traceback"] = e.traceback + except HookMissing as e: + json_out["hook_missing"] = True + json_out["missing_hook_name"] = e.hook_name or hook_name + + write_json(json_out, pjoin(control_dir, "output.json"), indent=2) + + +if __name__ == "__main__": + main() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyproject_hooks/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/LICENSE b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1e65815cf0b3132689485874a93034ede7206bf4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/LICENSE @@ -0,0 +1,54 @@ +Copyright 2017- Paul Ganssle +Copyright 2017- dateutil contributors (see AUTHORS file) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +The above license applies to all contributions after 2017-12-01, as well as +all contributions that have been re-licensed (see AUTHORS file for the list of +contributors who have re-licensed their code). +-------------------------------------------------------------------------------- +dateutil - Extensions to the standard Python datetime module. + +Copyright (c) 2003-2011 - Gustavo Niemeyer +Copyright (c) 2012-2014 - Tomi Pieviläinen +Copyright (c) 2014-2016 - Yaron de Leeuw +Copyright (c) 2015- - Paul Ganssle +Copyright (c) 2015- - dateutil contributors (see AUTHORS file) + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The above BSD License Applies to all code, even that also covered by Apache 2.0. \ No newline at end of file diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..577f2bf2b7749e1b123b8225d610b1b257e430cc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/METADATA @@ -0,0 +1,204 @@ +Metadata-Version: 2.1 +Name: python-dateutil +Version: 2.9.0.post0 +Summary: Extensions to the standard Python datetime module +Home-page: https://github.com/dateutil/dateutil +Author: Gustavo Niemeyer +Author-email: gustavo@niemeyer.net +Maintainer: Paul Ganssle +Maintainer-email: dateutil@python.org +License: Dual License +Project-URL: Documentation, https://dateutil.readthedocs.io/en/stable/ +Project-URL: Source, https://github.com/dateutil/dateutil +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: BSD License +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Topic :: Software Development :: Libraries +Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,>=2.7 +Description-Content-Type: text/x-rst +License-File: LICENSE +Requires-Dist: six >=1.5 + +dateutil - powerful extensions to datetime +========================================== + +|pypi| |support| |licence| + +|gitter| |readthedocs| + +|travis| |appveyor| |pipelines| |coverage| + +.. |pypi| image:: https://img.shields.io/pypi/v/python-dateutil.svg?style=flat-square + :target: https://pypi.org/project/python-dateutil/ + :alt: pypi version + +.. |support| image:: https://img.shields.io/pypi/pyversions/python-dateutil.svg?style=flat-square + :target: https://pypi.org/project/python-dateutil/ + :alt: supported Python version + +.. |travis| image:: https://img.shields.io/travis/dateutil/dateutil/master.svg?style=flat-square&label=Travis%20Build + :target: https://travis-ci.org/dateutil/dateutil + :alt: travis build status + +.. |appveyor| image:: https://img.shields.io/appveyor/ci/dateutil/dateutil/master.svg?style=flat-square&logo=appveyor + :target: https://ci.appveyor.com/project/dateutil/dateutil + :alt: appveyor build status + +.. |pipelines| image:: https://dev.azure.com/pythondateutilazure/dateutil/_apis/build/status/dateutil.dateutil?branchName=master + :target: https://dev.azure.com/pythondateutilazure/dateutil/_build/latest?definitionId=1&branchName=master + :alt: azure pipelines build status + +.. |coverage| image:: https://codecov.io/gh/dateutil/dateutil/branch/master/graphs/badge.svg?branch=master + :target: https://codecov.io/gh/dateutil/dateutil?branch=master + :alt: Code coverage + +.. |gitter| image:: https://badges.gitter.im/dateutil/dateutil.svg + :alt: Join the chat at https://gitter.im/dateutil/dateutil + :target: https://gitter.im/dateutil/dateutil + +.. |licence| image:: https://img.shields.io/pypi/l/python-dateutil.svg?style=flat-square + :target: https://pypi.org/project/python-dateutil/ + :alt: licence + +.. |readthedocs| image:: https://img.shields.io/readthedocs/dateutil/latest.svg?style=flat-square&label=Read%20the%20Docs + :alt: Read the documentation at https://dateutil.readthedocs.io/en/latest/ + :target: https://dateutil.readthedocs.io/en/latest/ + +The `dateutil` module provides powerful extensions to +the standard `datetime` module, available in Python. + +Installation +============ +`dateutil` can be installed from PyPI using `pip` (note that the package name is +different from the importable name):: + + pip install python-dateutil + +Download +======== +dateutil is available on PyPI +https://pypi.org/project/python-dateutil/ + +The documentation is hosted at: +https://dateutil.readthedocs.io/en/stable/ + +Code +==== +The code and issue tracker are hosted on GitHub: +https://github.com/dateutil/dateutil/ + +Features +======== + +* Computing of relative deltas (next month, next year, + next Monday, last week of month, etc); +* Computing of relative deltas between two given + date and/or datetime objects; +* Computing of dates based on very flexible recurrence rules, + using a superset of the `iCalendar `_ + specification. Parsing of RFC strings is supported as well. +* Generic parsing of dates in almost any string format; +* Timezone (tzinfo) implementations for tzfile(5) format + files (/etc/localtime, /usr/share/zoneinfo, etc), TZ + environment string (in all known formats), iCalendar + format files, given ranges (with help from relative deltas), + local machine timezone, fixed offset timezone, UTC timezone, + and Windows registry-based time zones. +* Internal up-to-date world timezone information based on + Olson's database. +* Computing of Easter Sunday dates for any given year, + using Western, Orthodox or Julian algorithms; +* A comprehensive test suite. + +Quick example +============= +Here's a snapshot, just to give an idea about the power of the +package. For more examples, look at the documentation. + +Suppose you want to know how much time is left, in +years/months/days/etc, before the next easter happening on a +year with a Friday 13th in August, and you want to get today's +date out of the "date" unix system command. Here is the code: + +.. code-block:: python3 + + >>> from dateutil.relativedelta import * + >>> from dateutil.easter import * + >>> from dateutil.rrule import * + >>> from dateutil.parser import * + >>> from datetime import * + >>> now = parse("Sat Oct 11 17:13:46 UTC 2003") + >>> today = now.date() + >>> year = rrule(YEARLY,dtstart=now,bymonth=8,bymonthday=13,byweekday=FR)[0].year + >>> rdelta = relativedelta(easter(year), today) + >>> print("Today is: %s" % today) + Today is: 2003-10-11 + >>> print("Year with next Aug 13th on a Friday is: %s" % year) + Year with next Aug 13th on a Friday is: 2004 + >>> print("How far is the Easter of that year: %s" % rdelta) + How far is the Easter of that year: relativedelta(months=+6) + >>> print("And the Easter of that year is: %s" % (today+rdelta)) + And the Easter of that year is: 2004-04-11 + +Being exactly 6 months ahead was **really** a coincidence :) + +Contributing +============ + +We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For more information about how to contribute to the project, see the ``CONTRIBUTING.md`` file in the repository. + + +Author +====== +The dateutil module was written by Gustavo Niemeyer +in 2003. + +It is maintained by: + +* Gustavo Niemeyer 2003-2011 +* Tomi Pieviläinen 2012-2014 +* Yaron de Leeuw 2014-2016 +* Paul Ganssle 2015- + +Starting with version 2.4.1 and running until 2.8.2, all source and binary +distributions will be signed by a PGP key that has, at the very least, been +signed by the key which made the previous release. A table of release signing +keys can be found below: + +=========== ============================ +Releases Signing key fingerprint +=========== ============================ +2.4.1-2.8.2 `6B49 ACBA DCF6 BD1C A206 67AB CD54 FCE3 D964 BEFB`_ +=========== ============================ + +New releases *may* have signed tags, but binary and source distributions +uploaded to PyPI will no longer have GPG signatures attached. + +Contact +======= +Our mailing list is available at `dateutil@python.org `_. As it is hosted by the PSF, it is subject to the `PSF code of +conduct `_. + +License +======= + +All contributions after December 1, 2017 released under dual license - either `Apache 2.0 License `_ or the `BSD 3-Clause License `_. Contributions before December 1, 2017 - except those those explicitly relicensed - are released only under the BSD 3-Clause License. + + +.. _6B49 ACBA DCF6 BD1C A206 67AB CD54 FCE3 D964 BEFB: + https://pgp.mit.edu/pks/lookup?op=vindex&search=0xCD54FCE3D964BEFB diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..2b874cbef466122222e9d5eccaaf11b042a30ede --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/RECORD @@ -0,0 +1,44 @@ +dateutil/__init__.py,sha256=Mqam67WO9IkTmUFyI66vS6IoSXTp9G388DadH2LCMLY,620 +dateutil/__pycache__/__init__.cpython-311.pyc,, +dateutil/__pycache__/_common.cpython-311.pyc,, +dateutil/__pycache__/_version.cpython-311.pyc,, +dateutil/__pycache__/easter.cpython-311.pyc,, +dateutil/__pycache__/relativedelta.cpython-311.pyc,, +dateutil/__pycache__/rrule.cpython-311.pyc,, +dateutil/__pycache__/tzwin.cpython-311.pyc,, +dateutil/__pycache__/utils.cpython-311.pyc,, +dateutil/_common.py,sha256=77w0yytkrxlYbSn--lDVPUMabUXRR9I3lBv_vQRUqUY,932 +dateutil/_version.py,sha256=BV031OxDDAmy58neUg5yyqLkLaqIw7ibK9As3jiMib0,166 +dateutil/easter.py,sha256=dyBi-lKvimH1u_k6p7Z0JJK72QhqVtVBsqByvpEPKvc,2678 +dateutil/parser/__init__.py,sha256=wWk6GFuxTpjoggCGtgkceJoti4pVjl4_fHQXpNOaSYg,1766 +dateutil/parser/__pycache__/__init__.cpython-311.pyc,, +dateutil/parser/__pycache__/_parser.cpython-311.pyc,, +dateutil/parser/__pycache__/isoparser.cpython-311.pyc,, +dateutil/parser/_parser.py,sha256=7klDdyicksQB_Xgl-3UAmBwzCYor1AIZqklIcT6dH_8,58796 +dateutil/parser/isoparser.py,sha256=8Fy999bnCd1frSdOYuOraWfJTtd5W7qQ51NwNuH_hXM,13233 +dateutil/relativedelta.py,sha256=IY_mglMjoZbYfrvloTY2ce02aiVjPIkiZfqgNTZRfuA,24903 +dateutil/rrule.py,sha256=KJzKlaCd1jEbu4A38ZltslaoAUh9nSbdbOFdjp70Kew,66557 +dateutil/tz/__init__.py,sha256=F-Mz13v6jYseklQf9Te9J6nzcLDmq47gORa61K35_FA,444 +dateutil/tz/__pycache__/__init__.cpython-311.pyc,, +dateutil/tz/__pycache__/_common.cpython-311.pyc,, +dateutil/tz/__pycache__/_factories.cpython-311.pyc,, +dateutil/tz/__pycache__/tz.cpython-311.pyc,, +dateutil/tz/__pycache__/win.cpython-311.pyc,, +dateutil/tz/_common.py,sha256=cgzDTANsOXvEc86cYF77EsliuSab8Puwpsl5-bX3_S4,12977 +dateutil/tz/_factories.py,sha256=unb6XQNXrPMveksTCU-Ag8jmVZs4SojoPUcAHpWnrvU,2569 +dateutil/tz/tz.py,sha256=EUnEdMfeThXiY6l4sh9yBabZ63_POzy01zSsh9thn1o,62855 +dateutil/tz/win.py,sha256=xJszWgSwE1xPx_HJj4ZkepyukC_hNy016WMcXhbRaB8,12935 +dateutil/tzwin.py,sha256=7Ar4vdQCnnM0mKR3MUjbIKsZrBVfHgdwsJZc_mGYRew,59 +dateutil/utils.py,sha256=dKCchEw8eObi0loGTx91unBxm_7UGlU3v_FjFMdqwYM,1965 +dateutil/zoneinfo/__init__.py,sha256=KYg0pthCMjcp5MXSEiBJn3nMjZeNZav7rlJw5-tz1S4,5889 +dateutil/zoneinfo/__pycache__/__init__.cpython-311.pyc,, +dateutil/zoneinfo/__pycache__/rebuild.cpython-311.pyc,, +dateutil/zoneinfo/dateutil-zoneinfo.tar.gz,sha256=0-pS57bpaN4NiE3xKIGTWW-pW4A9tPkqGCeac5gARHU,156400 +dateutil/zoneinfo/rebuild.py,sha256=MiqYzCIHvNbMH-LdRYLv-4T0EIA7hDKt5GLR0IRTLdI,2392 +python_dateutil-2.9.0.post0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +python_dateutil-2.9.0.post0.dist-info/LICENSE,sha256=ugD1Gg2SgjtaHN4n2LW50jIeZ-2NqbwWPv-W1eF-V34,2889 +python_dateutil-2.9.0.post0.dist-info/METADATA,sha256=qdQ22jIr6AgzL5jYgyWZjofLaTpniplp_rTPrXKabpM,8354 +python_dateutil-2.9.0.post0.dist-info/RECORD,, +python_dateutil-2.9.0.post0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110 +python_dateutil-2.9.0.post0.dist-info/top_level.txt,sha256=4tjdWkhRZvF7LA_BYe_L9gB2w_p2a-z5y6ArjaRkot8,9 +python_dateutil-2.9.0.post0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..4724c45738f6ac125bb3a21787855562e6870440 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.42.0) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/top_level.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..66501480ba5b63f98ee9a59c1f99e5e6917da6d9 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/top_level.txt @@ -0,0 +1 @@ +dateutil diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/zip-safe b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dateutil-2.9.0.post0.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..1af0ca52cf6bc3d2ba147cf51ca3937dc0c3c99b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/METADATA @@ -0,0 +1,794 @@ +Metadata-Version: 2.4 +Name: python-dotenv +Version: 1.2.2 +Summary: Read key-value pairs from a .env file and set them as environment variables +Author-email: Saurabh Kumar +License: BSD-3-Clause +Project-URL: Source, https://github.com/theskumar/python-dotenv +Keywords: environment variables,deployments,settings,env,dotenv,configurations,python +Classifier: Development Status :: 5 - Production/Stable +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: System Administrators +Classifier: Operating System :: OS Independent +Classifier: Topic :: System :: Systems Administration +Classifier: Topic :: Utilities +Classifier: Environment :: Web Environment +Requires-Python: >=3.10 +Description-Content-Type: text/markdown +License-File: LICENSE +Provides-Extra: cli +Requires-Dist: click>=5.0; extra == "cli" +Dynamic: license-file + +# python-dotenv + +[![Build Status][build_status_badge]][build_status_link] +[![PyPI version][pypi_badge]][pypi_link] + +python-dotenv reads key-value pairs from a `.env` file and can set them as +environment variables. It helps in the development of applications following the +[12-factor](https://12factor.net/) principles. + +- [Getting Started](#getting-started) +- [Other Use Cases](#other-use-cases) + - [Load configuration without altering the environment](#load-configuration-without-altering-the-environment) + - [Parse configuration as a stream](#parse-configuration-as-a-stream) + - [Load .env files in IPython](#load-env-files-in-ipython) +- [Command-line Interface](#command-line-interface) +- [File format](#file-format) + - [Multiline values](#multiline-values) + - [Variable expansion](#variable-expansion) +- [Related Projects](#related-projects) +- [Acknowledgements](#acknowledgements) + +## Getting Started + +```shell +pip install python-dotenv +``` + +If your application takes its configuration from environment variables, like a +12-factor application, launching it in development is not very practical because +you have to set those environment variables yourself. + +To help you with that, you can add python-dotenv to your application to make it +load the configuration from a `.env` file when it is present (e.g. in +development) while remaining configurable via the environment: + +```python +from dotenv import load_dotenv + +load_dotenv() # reads variables from a .env file and sets them in os.environ + +# Code of your application, which uses environment variables (e.g. from `os.environ` or +# `os.getenv`) as if they came from the actual environment. +``` + +By default, `load_dotenv()` will: + +- Look for a `.env` file in the same directory as the Python script (or higher up the directory tree). +- Read each key-value pair and add it to `os.environ`. +- **Not override** existing environment variables (`override=False`). Pass `override=True` to override existing variables. + +To configure the development environment, add a `.env` in the root directory of +your project: + +``` +. +├── .env +└── foo.py +``` + +The syntax of `.env` files supported by python-dotenv is similar to that of +Bash: + +```bash +# Development settings +DOMAIN=example.org +ADMIN_EMAIL=admin@${DOMAIN} +ROOT_URL=${DOMAIN}/app +``` + +If you use variables in values, ensure they are surrounded with `{` and `}`, +like `${DOMAIN}`, as bare variables such as `$DOMAIN` are not expanded. + +You will probably want to add `.env` to your `.gitignore`, especially if it +contains secrets like a password. + +See the section "[File format](#file-format)" below for more information about what you can write in a `.env` file. + +## Other Use Cases + +### Load configuration without altering the environment + +The function `dotenv_values` works more or less the same way as `load_dotenv`, +except it doesn't touch the environment, it just returns a `dict` with the +values parsed from the `.env` file. + +```python +from dotenv import dotenv_values + +config = dotenv_values(".env") # config = {"USER": "foo", "EMAIL": "foo@example.org"} +``` + +This notably enables advanced configuration management: + +```python +import os +from dotenv import dotenv_values + +config = { + **dotenv_values(".env.shared"), # load shared development variables + **dotenv_values(".env.secret"), # load sensitive variables + **os.environ, # override loaded values with environment variables +} +``` + +### Parse configuration as a stream + +`load_dotenv` and `dotenv_values` accept [streams][python_streams] via their +`stream` argument. It is thus possible to load the variables from sources other +than the filesystem (e.g. the network). + +```python +from io import StringIO + +from dotenv import load_dotenv + +config = StringIO("USER=foo\nEMAIL=foo@example.org") +load_dotenv(stream=config) +``` + +### Load .env files in IPython + +You can use dotenv in IPython. By default, it will use `find_dotenv` to search for a +`.env` file: + +```python +%load_ext dotenv +%dotenv +``` + +You can also specify a path: + +```python +%dotenv relative/or/absolute/path/to/.env +``` + +Optional flags: + +- `-o` to override existing variables. +- `-v` for increased verbosity. + +### Disable load_dotenv + +Set `PYTHON_DOTENV_DISABLED=1` to disable `load_dotenv()` from loading .env +files or streams. Useful when you can't modify third-party package calls or in +production. + +## Command-line Interface + +A CLI interface `dotenv` is also included, which helps you manipulate the `.env` +file without manually opening it. + +```shell +$ pip install "python-dotenv[cli]" +$ dotenv set USER foo +$ dotenv set EMAIL foo@example.org +$ dotenv list +USER=foo +EMAIL=foo@example.org +$ dotenv list --format=json +{ + "USER": "foo", + "EMAIL": "foo@example.org" +} +$ dotenv run -- python foo.py +``` + +Run `dotenv --help` for more information about the options and subcommands. + +## File format + +The format is not formally specified and still improves over time. That being +said, `.env` files should mostly look like Bash files. Reading from FIFOs (named +pipes) on Unix systems is also supported. + +Keys can be unquoted or single-quoted. Values can be unquoted, single- or +double-quoted. Spaces before and after keys, equal signs, and values are +ignored. Values can be followed by a comment. Lines can start with the `export` +directive, which does not affect their interpretation. + +Allowed escape sequences: + +- in single-quoted values: `\\`, `\'` +- in double-quoted values: `\\`, `\'`, `\"`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v` + +### Multiline values + +It is possible for single- or double-quoted values to span multiple lines. The +following examples are equivalent: + +```bash +FOO="first line +second line" +``` + +```bash +FOO="first line\nsecond line" +``` + +### Variable without a value + +A variable can have no value: + +```bash +FOO +``` + +It results in `dotenv_values` associating that variable name with the value +`None` (e.g. `{"FOO": None}`. `load_dotenv`, on the other hand, simply ignores +such variables. + +This shouldn't be confused with `FOO=`, in which case the variable is associated +with the empty string. + +### Variable expansion + +python-dotenv can interpolate variables using POSIX variable expansion. + +With `load_dotenv(override=True)` or `dotenv_values()`, the value of a variable +is the first of the values defined in the following list: + +- Value of that variable in the `.env` file. +- Value of that variable in the environment. +- Default value, if provided. +- Empty string. + +With `load_dotenv(override=False)`, the value of a variable is the first of the +values defined in the following list: + +- Value of that variable in the environment. +- Value of that variable in the `.env` file. +- Default value, if provided. +- Empty string. + +## Related Projects + +- [environs](https://github.com/sloria/environs) +- [Honcho](https://github.com/nickstenning/honcho) +- [dump-env](https://github.com/sobolevn/dump-env) +- [dynaconf](https://github.com/dynaconf/dynaconf) +- [parse_it](https://github.com/naorlivne/parse_it) +- [django-dotenv](https://github.com/jpadilla/django-dotenv) +- [django-environ](https://github.com/joke2k/django-environ) +- [python-decouple](https://github.com/HBNetwork/python-decouple) +- [django-configuration](https://github.com/jezdez/django-configurations) + +## Acknowledgements + +This project is currently maintained by [Saurabh Kumar][saurabh-homepage] and +[Bertrand Bonnefoy-Claudet][gh-bbc2] and would not have been possible without +the support of these [awesome people][contributors]. + +[gh-bbc2]: https://github.com/bbc2 +[saurabh-homepage]: https://saurabh-kumar.com +[pypi_link]: https://badge.fury.io/py/python-dotenv +[pypi_badge]: https://badge.fury.io/py/python-dotenv.svg +[python_streams]: https://docs.python.org/3/library/io.html +[contributors]: https://github.com/theskumar/python-dotenv/graphs/contributors +[build_status_link]: https://github.com/theskumar/python-dotenv/actions/workflows/test.yml +[build_status_badge]: https://github.com/theskumar/python-dotenv/actions/workflows/test.yml/badge.svg + +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this +project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.2] - 2026-03-01 + +### Added + +- Support for Python 3.14, including the free-threaded (3.14t) build. (#) + +### Changed + +- The `dotenv run` command now forwards flags directly to the specified command by [@bbc2] in [#607] +- Improved documentation clarity regarding override behavior and the reference page. +- Updated PyPy support to version 3.11. +- Documentation for FIFO file support. +- Dropped Support for Python 3.9. + +### Fixed + +- Improved `set_key` and `unset_key` behavior when interacting with symlinks by [@bbc2] in [#790c5](https://github.com/theskumar/python-dotenv/commit/790c5c02991100aa1bf41ee5330aca75edc51311) +- Corrected the license specifier and added missing Python 3.14 classifiers in package metadata by [@JYOuyang] in [#590] + +### Breaking Changes + +- `dotenv.set_key` and `dotenv.unset_key` used to follow symlinks in some + situations. This is no longer the case. For that behavior to be restored in + all cases, `follow_symlinks=True` should be used. + +- In the CLI, `set` and `unset` used to follow symlinks in some situations. This + is no longer the case. + +- `dotenv.set_key`, `dotenv.unset_key` and the CLI commands `set` and `unset` + used to reset the file mode of the modified .env file to `0o600` in some + situations. This is no longer the case: The original mode of the file is now + preserved. Is the file needed to be created or wasn't a regular file, mode + `0o600` is used. + +## [1.2.1] - 2025-10-26 + +- Move more config to `pyproject.toml`, removed `setup.cfg` +- Add support for reading `.env` from FIFOs (Unix) by [@sidharth-sudhir] in [#586] + +## [1.2.0] - 2025-10-26 + +- Upgrade build system to use PEP 517 & PEP 518 to use `build` and `pyproject.toml` by [@EpicWink] in [#583] +- Add support for Python 3.14 by [@23f3001135] in [#579](https://github.com/theskumar/python-dotenv/pull/563) +- Add support for disabling of `load_dotenv()` using `PYTHON_DOTENV_DISABLED` env var. by [@matthewfranglen] in [#569] + +## [1.1.1] - 2025-06-24 + +### Fixed + +- CLI: Ensure `find_dotenv` work reliably on python 3.13 by [@theskumar] in [#563](https://github.com/theskumar/python-dotenv/pull/563) +- CLI: revert the use of execvpe on Windows by [@wrongontheinternet] in [#566](https://github.com/theskumar/python-dotenv/pull/566) + +## [1.1.0] - 2025-03-25 + +**Feature** + +- Add support for python 3.13 +- Enhance `dotenv run`, switch to `execvpe` for better resource management and signal handling ([#523]) by [@eekstunt] + +**Fixed** + +- `find_dotenv` and `load_dotenv` now correctly looks up at the current directory when running in debugger or pdb ([#553] by [@randomseed42]) + +**Misc** + +- Drop support for Python 3.8 + +## [1.0.1] - 2024-01-23 + +**Fixed** + +- Gracefully handle code which has been imported from a zipfile ([#456] by [@samwyma]) +- Allow modules using `load_dotenv` to be reloaded when launched in a separate thread ([#497] by [@freddyaboulton]) +- Fix file not closed after deletion, handle error in the rewrite function ([#469] by [@Qwerty-133]) + +**Misc** + +- Use pathlib.Path in tests ([#466] by [@eumiro]) +- Fix year in release date in changelog.md ([#454] by [@jankislinger]) +- Use https in README links ([#474] by [@Nicals]) + +## [1.0.0] - 2023-02-24 + +**Fixed** + +- Drop support for python 3.7, add python 3.12-dev (#449 by [@theskumar]) +- Handle situations where the cwd does not exist. (#446 by [@jctanner]) + +## [0.21.1] - 2023-01-21 + +**Added** + +- Use Python 3.11 non-beta in CI (#438 by [@bbc2]) +- Modernize variables code (#434 by [@Nougat-Waffle]) +- Modernize main.py and parser.py code (#435 by [@Nougat-Waffle]) +- Improve conciseness of cli.py and **init**.py (#439 by [@Nougat-Waffle]) +- Improve error message for `get` and `list` commands when env file can't be opened (#441 by [@bbc2]) +- Updated License to align with BSD OSI template (#433 by [@lsmith77]) + +**Fixed** + +- Fix Out-of-scope error when "dest" variable is undefined (#413 by [@theGOTOguy]) +- Fix IPython test warning about deprecated `magic` (#440 by [@bbc2]) +- Fix type hint for dotenv_path var, add StrPath alias (#432 by [@eaf]) + +## [0.21.0] - 2022-09-03 + +**Added** + +- CLI: add support for invocations via 'python -m'. (#395 by [@theskumar]) +- `load_dotenv` function now returns `False`. (#388 by [@larsks]) +- CLI: add --format= option to list command. (#407 by [@sammck]) + +**Fixed** + +- Drop Python 3.5 and 3.6 and upgrade GA (#393 by [@eggplants]) +- Use `open` instead of `io.open`. (#389 by [@rabinadk1]) +- Improve documentation for variables without a value (#390 by [@bbc2]) +- Add `parse_it` to Related Projects (#410 by [@naorlivne]) +- Update README.md (#415 by [@harveer07]) +- Improve documentation with direct use of MkDocs (#398 by [@bbc2]) + +## [0.20.0] - 2022-03-24 + +**Added** + +- Add `encoding` (`Optional[str]`) parameter to `get_key`, `set_key` and `unset_key`. + (#379 by [@bbc2]) + +**Fixed** + +- Use dict to specify the `entry_points` parameter of `setuptools.setup` (#376 by + [@mgorny]). +- Don't build universal wheels (#387 by [@bbc2]). + +## [0.19.2] - 2021-11-11 + +**Fixed** + +- In `set_key`, add missing newline character before new entry if necessary. (#361 by + [@bbc2]) + +## [0.19.1] - 2021-08-09 + +**Added** + +- Add support for Python 3.10. (#359 by [@theskumar]) + +## [0.19.0] - 2021-07-24 + +**Changed** + +- Require Python 3.5 or a later version. Python 2 and 3.4 are no longer supported. (#341 + by [@bbc2]). + +**Added** + +- The `dotenv_path` argument of `set_key` and `unset_key` now has a type of `Union[str, +os.PathLike]` instead of just `os.PathLike` (#347 by [@bbc2]). +- The `stream` argument of `load_dotenv` and `dotenv_values` can now be a text stream + (`IO[str]`), which includes values like `io.StringIO("foo")` and `open("file.env", +"r")` (#348 by [@bbc2]). + +## [0.18.0] - 2021-06-20 + +**Changed** + +- Raise `ValueError` if `quote_mode` isn't one of `always`, `auto` or `never` in + `set_key` (#330 by [@bbc2]). +- When writing a value to a .env file with `set_key` or `dotenv set ` (#330 + by [@bbc2]): + - Use single quotes instead of double quotes. + - Don't strip surrounding quotes. + - In `auto` mode, don't add quotes if the value is only made of alphanumeric characters + (as determined by `string.isalnum`). + +## [0.17.1] - 2021-04-29 + +**Fixed** + +- Fixed tests for build environments relying on `PYTHONPATH` (#318 by [@befeleme]). + +## [0.17.0] - 2021-04-02 + +**Changed** + +- Make `dotenv get ` only show the value, not `key=value` (#313 by [@bbc2]). + +**Added** + +- Add `--override`/`--no-override` option to `dotenv run` (#312 by [@zueve] and [@bbc2]). + +## [0.16.0] - 2021-03-27 + +**Changed** + +- The default value of the `encoding` parameter for `load_dotenv` and `dotenv_values` is + now `"utf-8"` instead of `None` (#306 by [@bbc2]). +- Fix resolution order in variable expansion with `override=False` (#287 by [@bbc2]). + +## [0.15.0] - 2020-10-28 + +**Added** + +- Add `--export` option to `set` to make it prepend the binding with `export` (#270 by + [@jadutter]). + +**Changed** + +- Make `set` command create the `.env` file in the current directory if no `.env` file was + found (#270 by [@jadutter]). + +**Fixed** + +- Fix potentially empty expanded value for duplicate key (#260 by [@bbc2]). +- Fix import error on Python 3.5.0 and 3.5.1 (#267 by [@gongqingkui]). +- Fix parsing of unquoted values containing several adjacent space or tab characters + (#277 by [@bbc2], review by [@x-yuri]). + +## [0.14.0] - 2020-07-03 + +**Changed** + +- Privilege definition in file over the environment in variable expansion (#256 by + [@elbehery95]). + +**Fixed** + +- Improve error message for when file isn't found (#245 by [@snobu]). +- Use HTTPS URL in package meta data (#251 by [@ekohl]). + +## [0.13.0] - 2020-04-16 + +**Added** + +- Add support for a Bash-like default value in variable expansion (#248 by [@bbc2]). + +## [0.12.0] - 2020-02-28 + +**Changed** + +- Use current working directory to find `.env` when bundled by PyInstaller (#213 by + [@gergelyk]). + +**Fixed** + +- Fix escaping of quoted values written by `set_key` (#236 by [@bbc2]). +- Fix `dotenv run` crashing on environment variables without values (#237 by [@yannham]). +- Remove warning when last line is empty (#238 by [@bbc2]). + +## [0.11.0] - 2020-02-07 + +**Added** + +- Add `interpolate` argument to `load_dotenv` and `dotenv_values` to disable interpolation + (#232 by [@ulyssessouza]). + +**Changed** + +- Use logging instead of warnings (#231 by [@bbc2]). + +**Fixed** + +- Fix installation in non-UTF-8 environments (#225 by [@altendky]). +- Fix PyPI classifiers (#228 by [@bbc2]). + +## [0.10.5] - 2020-01-19 + +**Fixed** + +- Fix handling of malformed lines and lines without a value (#222 by [@bbc2]): + - Don't print warning when key has no value. + - Reject more malformed lines (e.g. "A: B", "a='b',c"). +- Fix handling of lines with just a comment (#224 by [@bbc2]). + +## [0.10.4] - 2020-01-17 + +**Added** + +- Make typing optional (#179 by [@techalchemy]). +- Print a warning on malformed line (#211 by [@bbc2]). +- Support keys without a value (#220 by [@ulyssessouza]). + +## 0.10.3 + +- Improve interactive mode detection ([@andrewsmith])([#183]). +- Refactor parser to fix parsing inconsistencies ([@bbc2])([#170]). + - Interpret escapes as control characters only in double-quoted strings. + - Interpret `#` as start of comment only if preceded by whitespace. + +## 0.10.2 + +- Add type hints and expose them to users ([@qnighy])([#172]) +- `load_dotenv` and `dotenv_values` now accept an `encoding` parameter, defaults to `None` + ([@theskumar])([@earlbread])([#161]) +- Fix `str`/`unicode` inconsistency in Python 2: values are always `str` now. ([@bbc2])([#121]) +- Fix Unicode error in Python 2, introduced in 0.10.0. ([@bbc2])([#176]) + +## 0.10.1 + +- Fix parsing of variable without a value ([@asyncee])([@bbc2])([#158]) + +## 0.10.0 + +- Add support for UTF-8 in unquoted values ([@bbc2])([#148]) +- Add support for trailing comments ([@bbc2])([#148]) +- Add backslashes support in values ([@bbc2])([#148]) +- Add support for newlines in values ([@bbc2])([#148]) +- Force environment variables to str with Python2 on Windows ([@greyli]) +- Drop Python 3.3 support ([@greyli]) +- Fix stderr/-out/-in redirection ([@venthur]) + +## 0.9.0 + +- Add `--version` parameter to cli ([@venthur]) +- Enable loading from current directory ([@cjauvin]) +- Add 'dotenv run' command for calling arbitrary shell script with .env ([@venthur]) + +## 0.8.1 + +- Add tests for docs ([@Flimm]) +- Make 'cli' support optional. Use `pip install python-dotenv[cli]`. ([@theskumar]) + +## 0.8.0 + +- `set_key` and `unset_key` only modified the affected file instead of + parsing and re-writing file, this causes comments and other file + entact as it is. +- Add support for `export` prefix in the line. +- Internal refractoring ([@theskumar]) +- Allow `load_dotenv` and `dotenv_values` to work with `StringIO())` ([@alanjds])([@theskumar])([#78]) + +## 0.7.1 + +- Remove hard dependency on iPython ([@theskumar]) + +## 0.7.0 + +- Add support to override system environment variable via .env. + ([@milonimrod](https://github.com/milonimrod)) + ([\#63](https://github.com/theskumar/python-dotenv/issues/63)) +- Disable ".env not found" warning by default + ([@maxkoryukov](https://github.com/maxkoryukov)) + ([\#57](https://github.com/theskumar/python-dotenv/issues/57)) + +## 0.6.5 + +- Add support for special characters `\`. + ([@pjona](https://github.com/pjona)) + ([\#60](https://github.com/theskumar/python-dotenv/issues/60)) + +## 0.6.4 + +- Fix issue with single quotes ([@Flimm]) + ([\#52](https://github.com/theskumar/python-dotenv/issues/52)) + +## 0.6.3 + +- Handle unicode exception in setup.py + ([\#46](https://github.com/theskumar/python-dotenv/issues/46)) + +## 0.6.2 + +- Fix dotenv list command ([@ticosax](https://github.com/ticosax)) +- Add iPython Support + ([@tillahoffmann](https://github.com/tillahoffmann)) + +## 0.6.0 + +- Drop support for Python 2.6 +- Handle escaped characters and newlines in quoted values. (Thanks + [@iameugenejo](https://github.com/iameugenejo)) +- Remove any spaces around unquoted key/value. (Thanks + [@paulochf](https://github.com/paulochf)) +- Added POSIX variable expansion. (Thanks + [@hugochinchilla](https://github.com/hugochinchilla)) + +## 0.5.1 + +- Fix `find_dotenv` - it now start search from the file where this + function is called from. + +## 0.5.0 + +- Add `find_dotenv` method that will try to find a `.env` file. + (Thanks [@isms](https://github.com/isms)) + +## 0.4.0 + +- cli: Added `-q/--quote` option to control the behaviour of quotes + around values in `.env`. (Thanks + [@hugochinchilla](https://github.com/hugochinchilla)). +- Improved test coverage. + + + +[#78]: https://github.com/theskumar/python-dotenv/issues/78 +[#121]: https://github.com/theskumar/python-dotenv/issues/121 +[#148]: https://github.com/theskumar/python-dotenv/issues/148 +[#158]: https://github.com/theskumar/python-dotenv/issues/158 +[#170]: https://github.com/theskumar/python-dotenv/issues/170 +[#172]: https://github.com/theskumar/python-dotenv/issues/172 +[#176]: https://github.com/theskumar/python-dotenv/issues/176 +[#183]: https://github.com/theskumar/python-dotenv/issues/183 +[#359]: https://github.com/theskumar/python-dotenv/issues/359 +[#469]: https://github.com/theskumar/python-dotenv/issues/469 +[#456]: https://github.com/theskumar/python-dotenv/issues/456 +[#466]: https://github.com/theskumar/python-dotenv/issues/466 +[#454]: https://github.com/theskumar/python-dotenv/issues/454 +[#474]: https://github.com/theskumar/python-dotenv/issues/474 +[#523]: https://github.com/theskumar/python-dotenv/issues/523 +[#553]: https://github.com/theskumar/python-dotenv/issues/553 +[#569]: https://github.com/theskumar/python-dotenv/issues/569 +[#583]: https://github.com/theskumar/python-dotenv/issues/583 +[#586]: https://github.com/theskumar/python-dotenv/issues/586 +[#590]: https://github.com/theskumar/python-dotenv/issues/590 +[#607]: https://github.com/theskumar/python-dotenv/issues/607 + + + +[@23f3001135]: https://github.com/23f3001135 +[@EpicWink]: https://github.com/EpicWink +[@Flimm]: https://github.com/Flimm +[@Nicals]: https://github.com/Nicals +[@Nougat-Waffle]: https://github.com/Nougat-Waffle +[@Qwerty-133]: https://github.com/Qwerty-133 +[@alanjds]: https://github.com/alanjds +[@altendky]: https://github.com/altendky +[@andrewsmith]: https://github.com/andrewsmith +[@asyncee]: https://github.com/asyncee +[@bbc2]: https://github.com/bbc2 +[@befeleme]: https://github.com/befeleme +[@cjauvin]: https://github.com/cjauvin +[@eaf]: https://github.com/eaf +[@earlbread]: https://github.com/earlbread +[@eekstunt]: https://github.com/eekstunt +[@eggplants]: https://github.com/@eggplants +[@ekohl]: https://github.com/ekohl +[@elbehery95]: https://github.com/elbehery95 +[@eumiro]: https://github.com/eumiro +[@freddyaboulton]: https://github.com/freddyaboulton +[@gergelyk]: https://github.com/gergelyk +[@gongqingkui]: https://github.com/gongqingkui +[@greyli]: https://github.com/greyli +[@harveer07]: https://github.com/@harveer07 +[@jadutter]: https://github.com/jadutter +[@jankislinger]: https://github.com/jankislinger +[@jctanner]: https://github.com/jctanner +[@larsks]: https://github.com/@larsks +[@lsmith77]: https://github.com/lsmith77 +[@matthewfranglen]: https://github.com/matthewfranglen +[@mgorny]: https://github.com/mgorny +[@naorlivne]: https://github.com/@naorlivne +[@qnighy]: https://github.com/qnighy +[@rabinadk1]: https://github.com/@rabinadk1 +[@randomseed42]: https://github.com/zueve +[@sammck]: https://github.com/@sammck +[@samwyma]: https://github.com/samwyma +[@sidharth-sudhir]: https://github.com/sidharth-sudhir +[@snobu]: https://github.com/snobu +[@techalchemy]: https://github.com/techalchemy +[@theGOTOguy]: https://github.com/theGOTOguy +[@theskumar]: https://github.com/theskumar +[@ulyssessouza]: https://github.com/ulyssessouza +[@venthur]: https://github.com/venthur +[@wrongontheinternet]: https://github.com/wrongontheinternet +[@x-yuri]: https://github.com/x-yuri +[@yannham]: https://github.com/yannham +[@zueve]: https://github.com/zueve +[@JYOuyang]: https://github.com/JYOuyang +[@burnout-projects]: https://github.com/burnout-projects +[@cpackham-atlnz]: https://github.com/cpackham-atlnz +[Unreleased]: https://github.com/theskumar/python-dotenv/compare/v1.2.2...HEAD +[1.2.2]: https://github.com/theskumar/python-dotenv/compare/v1.2.1...v1.2.2 +[1.2.1]: https://github.com/theskumar/python-dotenv/compare/v1.2.0...v1.2.1 +[1.2.0]: https://github.com/theskumar/python-dotenv/compare/v1.1.1...v1.2.0 +[1.1.1]: https://github.com/theskumar/python-dotenv/compare/v1.1.0...v1.1.1 +[1.1.0]: https://github.com/theskumar/python-dotenv/compare/v1.0.1...v1.1.0 +[1.0.1]: https://github.com/theskumar/python-dotenv/compare/v1.0.0...v1.0.1 +[1.0.0]: https://github.com/theskumar/python-dotenv/compare/v0.21.0...v1.0.0 +[0.21.1]: https://github.com/theskumar/python-dotenv/compare/v0.21.0...v0.21.1 +[0.21.0]: https://github.com/theskumar/python-dotenv/compare/v0.20.0...v0.21.0 +[0.20.0]: https://github.com/theskumar/python-dotenv/compare/v0.19.2...v0.20.0 +[0.19.2]: https://github.com/theskumar/python-dotenv/compare/v0.19.1...v0.19.2 +[0.19.1]: https://github.com/theskumar/python-dotenv/compare/v0.19.0...v0.19.1 +[0.19.0]: https://github.com/theskumar/python-dotenv/compare/v0.18.0...v0.19.0 +[0.18.0]: https://github.com/theskumar/python-dotenv/compare/v0.17.1...v0.18.0 +[0.17.1]: https://github.com/theskumar/python-dotenv/compare/v0.17.0...v0.17.1 +[0.17.0]: https://github.com/theskumar/python-dotenv/compare/v0.16.0...v0.17.0 +[0.16.0]: https://github.com/theskumar/python-dotenv/compare/v0.15.0...v0.16.0 +[0.15.0]: https://github.com/theskumar/python-dotenv/compare/v0.14.0...v0.15.0 +[0.14.0]: https://github.com/theskumar/python-dotenv/compare/v0.13.0...v0.14.0 +[0.13.0]: https://github.com/theskumar/python-dotenv/compare/v0.12.0...v0.13.0 +[0.12.0]: https://github.com/theskumar/python-dotenv/compare/v0.11.0...v0.12.0 +[0.11.0]: https://github.com/theskumar/python-dotenv/compare/v0.10.5...v0.11.0 +[0.10.5]: https://github.com/theskumar/python-dotenv/compare/v0.10.4...v0.10.5 +[0.10.4]: https://github.com/theskumar/python-dotenv/compare/v0.10.3...v0.10.4 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..94870db1a58a495ab036ce0c332a839b9ecfe7be --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/RECORD @@ -0,0 +1,25 @@ +../../Scripts/dotenv.exe,sha256=qWQMjPK64rL1X4hrY7Rs6x6UT5pihuNhh5imqwsLcAI,108361 +dotenv/__init__.py,sha256=bhY-iK6wwHZamWII6eSCuCAWXUNdn2TQFmEOuXSU7SM,1230 +dotenv/__main__.py,sha256=N0RhLG7nHIqtlJHwwepIo-zbJPNx9sewCCRGY528h_4,129 +dotenv/__pycache__/__init__.cpython-311.pyc,, +dotenv/__pycache__/__main__.cpython-311.pyc,, +dotenv/__pycache__/cli.cpython-311.pyc,, +dotenv/__pycache__/ipython.cpython-311.pyc,, +dotenv/__pycache__/main.cpython-311.pyc,, +dotenv/__pycache__/parser.cpython-311.pyc,, +dotenv/__pycache__/variables.cpython-311.pyc,, +dotenv/__pycache__/version.cpython-311.pyc,, +dotenv/cli.py,sha256=tiUqzTj1QfFqrn3SG0acZ7nckI_0T6oIf76Plg8hHHM,6542 +dotenv/ipython.py,sha256=dHQBd9PcdCUphGb67Xwy3GkUqMSdf9XUUiNYxTZ3tYU,1326 +dotenv/main.py,sha256=p9mexbu8E1sit8uBwPKSzjKkYOrIJE51AsTLiS5Fd4o,14683 +dotenv/parser.py,sha256=JSJpd94tGhvnzOv4PL3DreU1Lt5v6rTK7pp8G6RnfL4,5179 +dotenv/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26 +dotenv/variables.py,sha256=CD0qXOvvpB3q5RpBQMD9qX6vHX7SyW-SuiwGMFSlt08,2348 +dotenv/version.py,sha256=uuf4VNtTNA93fMhoAur9YafzaKJFnczY-H1SSCSuRVQ,22 +python_dotenv-1.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +python_dotenv-1.2.2.dist-info/METADATA,sha256=WUMKne6PgRjb9pPkHEo-UVBibRmQH0cnUD2pSZ9aZKE,27524 +python_dotenv-1.2.2.dist-info/RECORD,, +python_dotenv-1.2.2.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91 +python_dotenv-1.2.2.dist-info/entry_points.txt,sha256=yRl1rCbswb1nQTQ_gZRlCw5QfabztUGnfGWLhlXFNdI,47 +python_dotenv-1.2.2.dist-info/licenses/LICENSE,sha256=gGGbcEnwjIFoOtDgHwjyV6hAZS3XHugxRtNmWMfSwrk,1556 +python_dotenv-1.2.2.dist-info/top_level.txt,sha256=eyqUH4SHJNr6ahOYlxIunTr4XinE8Z5ajWLdrK3r0D8,7 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..1ef5583317a5e59140e3f1c85c2db91aec0961e8 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (82.0.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/entry_points.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a8682329417cc65dc220a0a7ec7a8efb1f221e4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +dotenv = dotenv.__main__:cli diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/licenses/LICENSE b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..3a97119010ac82e15e917a69b7b8f9f59b5a4601 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/licenses/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2014, Saurabh Kumar (python-dotenv), 2013, Ted Tieken (django-dotenv-rw), 2013, Jacob Kaplan-Moss (django-dotenv) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of django-dotenv nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/top_level.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe7c01aa90e2b2c3c1794c9e1c00aaa360b25358 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/python_dotenv-1.2.2.dist-info/top_level.txt @@ -0,0 +1 @@ +dotenv diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..ea62a9bf4d748acfc9f936f09234369b43f46630 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/METADATA @@ -0,0 +1,59 @@ +Metadata-Version: 2.4 +Name: PyYAML +Version: 6.0.3 +Summary: YAML parser and emitter for Python +Home-page: https://pyyaml.org/ +Download-URL: https://pypi.org/project/PyYAML/ +Author: Kirill Simonov +Author-email: xi@resolvent.net +License: MIT +Project-URL: Bug Tracker, https://github.com/yaml/pyyaml/issues +Project-URL: CI, https://github.com/yaml/pyyaml/actions +Project-URL: Documentation, https://pyyaml.org/wiki/PyYAMLDocumentation +Project-URL: Mailing lists, http://lists.sourceforge.net/lists/listinfo/yaml-core +Project-URL: Source Code, https://github.com/yaml/pyyaml +Platform: Any +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Text Processing :: Markup +Requires-Python: >=3.8 +License-File: LICENSE +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: download-url +Dynamic: home-page +Dynamic: license +Dynamic: license-file +Dynamic: platform +Dynamic: project-url +Dynamic: requires-python +Dynamic: summary + +YAML is a data serialization format designed for human readability +and interaction with scripting languages. PyYAML is a YAML parser +and emitter for Python. + +PyYAML features a complete YAML 1.1 parser, Unicode support, pickle +support, capable extension API, and sensible error messages. PyYAML +supports standard YAML tags and provides Python-specific tags that +allow to represent an arbitrary Python object. + +PyYAML is applicable for a broad range of tasks from complex +configuration files to object serialization and persistence. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..b4745d1410dbc43a0e95ecc180f1a42adf858825 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/RECORD @@ -0,0 +1,43 @@ +_yaml/__init__.py,sha256=04Ae_5osxahpJHa3XBZUAf4wi6XX32gR8D6X6p64GEA,1402 +_yaml/__pycache__/__init__.cpython-311.pyc,, +pyyaml-6.0.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pyyaml-6.0.3.dist-info/METADATA,sha256=hHpwECAzQ4aFK24HutEFPLDOPanuGEbn6dArJOi7P40,2410 +pyyaml-6.0.3.dist-info/RECORD,, +pyyaml-6.0.3.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101 +pyyaml-6.0.3.dist-info/licenses/LICENSE,sha256=jTko-dxEkP1jVwfLiOsmvXZBAqcoKVQwfT5RZ6V36KQ,1101 +pyyaml-6.0.3.dist-info/top_level.txt,sha256=rpj0IVMTisAjh_1vG3Ccf9v5jpCQwAz6cD1IVU5ZdhQ,11 +yaml/__init__.py,sha256=sZ38wzPWp139cwc5ARZFByUvJxtB07X32FUQAzoFR6c,12311 +yaml/__pycache__/__init__.cpython-311.pyc,, +yaml/__pycache__/composer.cpython-311.pyc,, +yaml/__pycache__/constructor.cpython-311.pyc,, +yaml/__pycache__/cyaml.cpython-311.pyc,, +yaml/__pycache__/dumper.cpython-311.pyc,, +yaml/__pycache__/emitter.cpython-311.pyc,, +yaml/__pycache__/error.cpython-311.pyc,, +yaml/__pycache__/events.cpython-311.pyc,, +yaml/__pycache__/loader.cpython-311.pyc,, +yaml/__pycache__/nodes.cpython-311.pyc,, +yaml/__pycache__/parser.cpython-311.pyc,, +yaml/__pycache__/reader.cpython-311.pyc,, +yaml/__pycache__/representer.cpython-311.pyc,, +yaml/__pycache__/resolver.cpython-311.pyc,, +yaml/__pycache__/scanner.cpython-311.pyc,, +yaml/__pycache__/serializer.cpython-311.pyc,, +yaml/__pycache__/tokens.cpython-311.pyc,, +yaml/_yaml.cp311-win_amd64.pyd,sha256=7n34P6XcoUZ7_YQdwIGJsQNh8xcAz1emqs3a8MBXBvQ,258560 +yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883 +yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639 +yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851 +yaml/dumper.py,sha256=PLctZlYwZLp7XmeUdwRuv4nYOZ2UBnDIUy8-lKfLF-o,2837 +yaml/emitter.py,sha256=jghtaU7eFwg31bG0B7RZea_29Adi9CKmXq_QjgQpCkQ,43006 +yaml/error.py,sha256=Ah9z-toHJUbE9j-M8YpxgSRM5CgLCcwVzJgLLRF2Fxo,2533 +yaml/events.py,sha256=50_TksgQiE4up-lKo_V-nBy-tAIxkIPQxY5qDhKCeHw,2445 +yaml/loader.py,sha256=UVa-zIqmkFSCIYq_PgSGm4NSJttHY2Rf_zQ4_b1fHN0,2061 +yaml/nodes.py,sha256=gPKNj8pKCdh2d4gr3gIYINnPOaOxGhJAUiYhGRnPE84,1440 +yaml/parser.py,sha256=ilWp5vvgoHFGzvOZDItFoGjD6D42nhlZrZyjAwa0oJo,25495 +yaml/reader.py,sha256=0dmzirOiDG4Xo41RnuQS7K9rkY3xjHiVasfDMNTqCNw,6794 +yaml/representer.py,sha256=IuWP-cAW9sHKEnS0gCqSa894k1Bg4cgTxaDwIcbRQ-Y,14190 +yaml/resolver.py,sha256=9L-VYfm4mWHxUD1Vg4X7rjDRK_7VZd6b92wzq7Y2IKY,9004 +yaml/scanner.py,sha256=YEM3iLZSaQwXcQRg2l2R4MdT0zGP2F9eHkKGKnHyWQY,51279 +yaml/serializer.py,sha256=ChuFgmhU01hj4xgI8GaKv6vfM2Bujwa9i7d2FAHj7cA,4165 +yaml/tokens.py,sha256=lTQIzSVw8Mg9wv459-TjiOQe6wVziqaRlqX2_89rp54,2573 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..8f98e0aeebdc2c0a3b9b5f83d43db0ef8dbc186b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp311-cp311-win_amd64 + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/licenses/LICENSE b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..2f1b8e15e5627d92f0521605c9870bc8e5505cb4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/licenses/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2017-2021 Ingy döt Net +Copyright (c) 2006-2016 Kirill Simonov + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/top_level.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6475e911f628412049bc4090d86f23ac403adde --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/pyyaml-6.0.3.dist-info/top_level.txt @@ -0,0 +1,2 @@ +_yaml +yaml diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..9a6abbc83beb35659b354df6e9951043c6b10b42 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/METADATA @@ -0,0 +1,64 @@ +Metadata-Version: 2.4 +Name: referencing +Version: 0.37.0 +Summary: JSON Referencing + Python +Project-URL: Documentation, https://referencing.readthedocs.io/ +Project-URL: Homepage, https://github.com/python-jsonschema/referencing +Project-URL: Issues, https://github.com/python-jsonschema/referencing/issues/ +Project-URL: Funding, https://github.com/sponsors/Julian +Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-referencing?utm_source=pypi-referencing&utm_medium=referral&utm_campaign=pypi-link +Project-URL: Changelog, https://referencing.readthedocs.io/en/stable/changes/ +Project-URL: Source, https://github.com/python-jsonschema/referencing +Author-email: Julian Berman +License-Expression: MIT +License-File: COPYING +Keywords: asyncapi,json,jsonschema,openapi,referencing +Classifier: Development Status :: 3 - Alpha +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: File Formats :: JSON +Classifier: Topic :: File Formats :: JSON :: JSON Schema +Requires-Python: >=3.10 +Requires-Dist: attrs>=22.2.0 +Requires-Dist: rpds-py>=0.7.0 +Requires-Dist: typing-extensions>=4.4.0; python_version < '3.13' +Description-Content-Type: text/x-rst + +=============== +``referencing`` +=============== + +|PyPI| |Pythons| |CI| |ReadTheDocs| |pre-commit| + +.. |PyPI| image:: https://img.shields.io/pypi/v/referencing.svg + :alt: PyPI version + :target: https://pypi.org/project/referencing/ + +.. |Pythons| image:: https://img.shields.io/pypi/pyversions/referencing.svg + :alt: Supported Python versions + :target: https://pypi.org/project/referencing/ + +.. |CI| image:: https://github.com/python-jsonschema/referencing/workflows/CI/badge.svg + :alt: Build status + :target: https://github.com/python-jsonschema/referencing/actions?query=workflow%3ACI + +.. |ReadTheDocs| image:: https://readthedocs.org/projects/referencing/badge/?version=stable&style=flat + :alt: ReadTheDocs status + :target: https://referencing.readthedocs.io/en/stable/ + +.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/python-jsonschema/referencing/main.svg + :alt: pre-commit.ci status + :target: https://results.pre-commit.ci/latest/github/python-jsonschema/referencing/main + + +An implementation-agnostic implementation of JSON reference resolution. + +See `the documentation `_ for more details. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..53b55c40c2da01d2d0c18a0028ffe45369e71569 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/RECORD @@ -0,0 +1,33 @@ +referencing-0.37.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +referencing-0.37.0.dist-info/METADATA,sha256=yTsA5qsVJP1ghIN2YEwYmhFDdHdkdcJaMdV75Hsp3mo,2845 +referencing-0.37.0.dist-info/RECORD,, +referencing-0.37.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87 +referencing-0.37.0.dist-info/licenses/COPYING,sha256=QtzWNJX4e063x3V6-jebtVpT-Ur9el9lfZrfVyNuUVw,1057 +referencing/__init__.py,sha256=5IZKXaAH_FWyCJRkaTn1XcptLfg9cveLb9u5nYUxJKs,207 +referencing/__pycache__/__init__.cpython-311.pyc,, +referencing/__pycache__/_attrs.cpython-311.pyc,, +referencing/__pycache__/_core.cpython-311.pyc,, +referencing/__pycache__/exceptions.cpython-311.pyc,, +referencing/__pycache__/jsonschema.cpython-311.pyc,, +referencing/__pycache__/retrieval.cpython-311.pyc,, +referencing/__pycache__/typing.cpython-311.pyc,, +referencing/_attrs.py,sha256=bgT-KMhDVLeGtWxM_SGKYeLaZBFzT2kUVFdAkOcXi8g,791 +referencing/_attrs.pyi,sha256=g2wX-aLEqQAvWU-s0qIN2OMGAqjOA0R72R_uSffO8_M,573 +referencing/_core.py,sha256=2SPGfaTvzA3sRqbj_4R2wC--fiXolCUVpLFLJJ6zdZ8,24732 +referencing/exceptions.py,sha256=zFgaEg6WiKeT58MQuKNsgGDnHszp26c4oReC6sF9gHM,4176 +referencing/jsonschema.py,sha256=jXZ6t6x9oTvTHMIC0tRyaFjW5r2qeHObYuu7UhSfK3Q,18615 +referencing/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +referencing/retrieval.py,sha256=cn9EeAdaaTbnMDdC4JRIhiEpXDjflRdHCOLFrw1ZhLA,2729 +referencing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +referencing/tests/__pycache__/__init__.cpython-311.pyc,, +referencing/tests/__pycache__/test_core.cpython-311.pyc,, +referencing/tests/__pycache__/test_exceptions.cpython-311.pyc,, +referencing/tests/__pycache__/test_jsonschema.cpython-311.pyc,, +referencing/tests/__pycache__/test_referencing_suite.cpython-311.pyc,, +referencing/tests/__pycache__/test_retrieval.cpython-311.pyc,, +referencing/tests/test_core.py,sha256=eap0CAaI23vjMIbVyEj92qLddp3iHH3AxC55CKUN4LU,37854 +referencing/tests/test_exceptions.py,sha256=7eOdHyobXMt7-h5AnnH7u8iw2uHPaH7U4Bs9JhLgjWo,934 +referencing/tests/test_jsonschema.py,sha256=4QnjUWOAMAn5yeA8ZtldJkhI54vwKWJWB0LDzNdx5xc,11687 +referencing/tests/test_referencing_suite.py,sha256=wD6veMfLsUu0s4MLjm7pS8cg4cIfL7FMBENngk73zCI,2335 +referencing/tests/test_retrieval.py,sha256=vcbnfA4TqVeqUzW073wO-nLeqVIv0rQZWNWv0z9km48,3719 +referencing/typing.py,sha256=WjUbnZ6jPAd31cnCFAaeWIVENzyHtHdJyOlelv1GY70,1445 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..12228d414b6cfed7c39d3781c85c63256a1d7fb5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.27.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/licenses/COPYING b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/licenses/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..a9f853e43069b8e3f8a156a4af2b1198a004230d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing-0.37.0.dist-info/licenses/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2022 Julian Berman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e09207d7e4b90aba221181d87886fd4f54038abf --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__init__.py @@ -0,0 +1,7 @@ +""" +Cross-specification, implementation-agnostic JSON referencing. +""" + +from referencing._core import Anchor, Registry, Resource, Specification + +__all__ = ["Anchor", "Registry", "Resource", "Specification"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b395ee10b3f23d3925abcd73ab05cb431b1a7f7 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/_attrs.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/_attrs.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc10a555a2898b89e7c42b3adda696a0d1075752 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/_attrs.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/_core.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/_core.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ffbf7678de6ff7686211f84beeb9f7688fb02a1b Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/_core.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/exceptions.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d2c5f4c6f3995c87a8e93a129681bfcd6088934b Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/exceptions.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/jsonschema.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/jsonschema.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..200dc9ba3924b4ae748c305a0b61c6dcf3f4c932 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/jsonschema.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/retrieval.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/retrieval.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..faf7061cab920c71f47aedf198c626de94e29506 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/retrieval.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/typing.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/typing.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..667d11eebd8071eaa10f2d543ee3f62bfb2c7065 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/__pycache__/typing.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_attrs.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_attrs.py new file mode 100644 index 0000000000000000000000000000000000000000..ae85b865fed622afe83e8d6b7b17a1f0d174aba3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_attrs.py @@ -0,0 +1,31 @@ +from __future__ import annotations + +from typing import NoReturn, TypeVar + +from attrs import define as _define, frozen as _frozen + +_T = TypeVar("_T") + + +def define(cls: type[_T]) -> type[_T]: # pragma: no cover + cls.__init_subclass__ = _do_not_subclass + return _define(cls) + + +def frozen(cls: type[_T]) -> type[_T]: + cls.__init_subclass__ = _do_not_subclass + return _frozen(cls) + + +class UnsupportedSubclassing(Exception): + def __str__(self): + return ( + "Subclassing is not part of referencing's public API. " + "If no other suitable API exists for what you're trying to do, " + "feel free to file an issue asking for one." + ) + + +@staticmethod +def _do_not_subclass() -> NoReturn: # pragma: no cover + raise UnsupportedSubclassing() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_attrs.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_attrs.pyi new file mode 100644 index 0000000000000000000000000000000000000000..eca6db2bc88efb8c0183f260e8a34af6701ffbd2 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_attrs.pyi @@ -0,0 +1,21 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +from attr import attrib, field + +class UnsupportedSubclassing(Exception): ... + +_T = TypeVar("_T") + +def __dataclass_transform__( + *, + frozen_default: bool = False, + field_descriptors: tuple[type | Callable[..., Any], ...] = ..., +) -> Callable[[_T], _T]: ... +@__dataclass_transform__(field_descriptors=(attrib, field)) +def define(cls: type[_T]) -> type[_T]: ... +@__dataclass_transform__( + frozen_default=True, + field_descriptors=(attrib, field), +) +def frozen(cls: type[_T]) -> type[_T]: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_core.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_core.py new file mode 100644 index 0000000000000000000000000000000000000000..42068451afb4b52ab885d9098b7ec66765282d3e --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/_core.py @@ -0,0 +1,739 @@ +from __future__ import annotations + +from collections.abc import Callable, Iterable, Iterator, Sequence +from enum import Enum +from typing import Any, ClassVar, Generic, Protocol +from urllib.parse import unquote, urldefrag, urljoin + +from attrs import evolve, field +from rpds import HashTrieMap, HashTrieSet, List + +try: + from typing_extensions import TypeVar +except ImportError: # pragma: no cover + from typing import TypeVar + +from referencing import exceptions +from referencing._attrs import frozen +from referencing.typing import URI, Anchor as AnchorType, D, Mapping, Retrieve + +EMPTY_UNCRAWLED: HashTrieSet[URI] = HashTrieSet() +EMPTY_PREVIOUS_RESOLVERS: List[URI] = List() + + +class _Unset(Enum): + """ + What sillyness... + """ + + SENTINEL = 1 + + +_UNSET = _Unset.SENTINEL + + +class _MaybeInSubresource(Protocol[D]): + def __call__( + self, + segments: Sequence[int | str], + resolver: Resolver[D], + subresource: Resource[D], + ) -> Resolver[D]: ... + + +def _detect_or_error(contents: D) -> Specification[D]: + if not isinstance(contents, Mapping): + raise exceptions.CannotDetermineSpecification(contents) + + jsonschema_dialect_id = contents.get("$schema") # type: ignore[reportUnknownMemberType] + if not isinstance(jsonschema_dialect_id, str): + raise exceptions.CannotDetermineSpecification(contents) + + from referencing.jsonschema import specification_with + + return specification_with(jsonschema_dialect_id) + + +def _detect_or_default( + default: Specification[D], +) -> Callable[[D], Specification[D]]: + def _detect(contents: D) -> Specification[D]: + if not isinstance(contents, Mapping): + return default + + jsonschema_dialect_id = contents.get("$schema") # type: ignore[reportUnknownMemberType] + if jsonschema_dialect_id is None: + return default + + from referencing.jsonschema import specification_with + + return specification_with( + jsonschema_dialect_id, # type: ignore[reportUnknownArgumentType] + default=default, + ) + + return _detect + + +class _SpecificationDetector: + def __get__( + self, + instance: Specification[D] | None, + cls: type[Specification[D]], + ) -> Callable[[D], Specification[D]]: + if instance is None: + return _detect_or_error + else: + return _detect_or_default(instance) + + +@frozen +class Specification(Generic[D]): + """ + A specification which defines referencing behavior. + + The various methods of a `Specification` allow for varying referencing + behavior across JSON Schema specification versions, etc. + """ + + #: A short human-readable name for the specification, used for debugging. + name: str + + #: Find the ID of a given document. + id_of: Callable[[D], URI | None] + + #: Retrieve the subresources of the given document (without traversing into + #: the subresources themselves). + subresources_of: Callable[[D], Iterable[D]] + + #: While resolving a JSON pointer, conditionally enter a subresource + #: (if e.g. we have just entered a keyword whose value is a subresource) + maybe_in_subresource: _MaybeInSubresource[D] + + #: Retrieve the anchors contained in the given document. + _anchors_in: Callable[ + [Specification[D], D], + Iterable[AnchorType[D]], + ] = field(alias="anchors_in") + + #: An opaque specification where resources have no subresources + #: nor internal identifiers. + OPAQUE: ClassVar[Specification[Any]] + + #: Attempt to discern which specification applies to the given contents. + #: + #: May be called either as an instance method or as a class method, with + #: slightly different behavior in the following case: + #: + #: Recall that not all contents contains enough internal information about + #: which specification it is written for -- the JSON Schema ``{}``, + #: for instance, is valid under many different dialects and may be + #: interpreted as any one of them. + #: + #: When this method is used as an instance method (i.e. called on a + #: specific specification), that specification is used as the default + #: if the given contents are unidentifiable. + #: + #: On the other hand when called as a class method, an error is raised. + #: + #: To reiterate, ``DRAFT202012.detect({})`` will return ``DRAFT202012`` + #: whereas the class method ``Specification.detect({})`` will raise an + #: error. + #: + #: (Note that of course ``DRAFT202012.detect(...)`` may return some other + #: specification when given a schema which *does* identify as being for + #: another version). + #: + #: Raises: + #: + #: `CannotDetermineSpecification` + #: + #: if the given contents don't have any discernible + #: information which could be used to guess which + #: specification they identify as + detect = _SpecificationDetector() + + def __repr__(self) -> str: + return f"" + + def anchors_in(self, contents: D): + """ + Retrieve the anchors contained in the given document. + """ + return self._anchors_in(self, contents) + + def create_resource(self, contents: D) -> Resource[D]: + """ + Create a resource which is interpreted using this specification. + """ + return Resource(contents=contents, specification=self) + + +Specification.OPAQUE = Specification( + name="opaque", + id_of=lambda contents: None, + subresources_of=lambda contents: [], + anchors_in=lambda specification, contents: [], + maybe_in_subresource=lambda segments, resolver, subresource: resolver, +) + + +@frozen +class Resource(Generic[D]): + r""" + A document (deserialized JSON) with a concrete interpretation under a spec. + + In other words, a Python object, along with an instance of `Specification` + which describes how the document interacts with referencing -- both + internally (how it refers to other `Resource`\ s) and externally (how it + should be identified such that it is referenceable by other documents). + """ + + contents: D + _specification: Specification[D] = field(alias="specification") + + @classmethod + def from_contents( + cls, + contents: D, + default_specification: ( + type[Specification[D]] | Specification[D] + ) = Specification, + ) -> Resource[D]: + """ + Create a resource guessing which specification applies to the contents. + + Raises: + + `CannotDetermineSpecification` + + if the given contents don't have any discernible + information which could be used to guess which + specification they identify as + + """ + specification = default_specification.detect(contents) + return specification.create_resource(contents=contents) + + @classmethod + def opaque(cls, contents: D) -> Resource[D]: + """ + Create an opaque `Resource` -- i.e. one with opaque specification. + + See `Specification.OPAQUE` for details. + """ + return Specification.OPAQUE.create_resource(contents=contents) + + def id(self) -> URI | None: + """ + Retrieve this resource's (specification-specific) identifier. + """ + id = self._specification.id_of(self.contents) + if id is None: + return + return id.rstrip("#") + + def subresources(self) -> Iterable[Resource[D]]: + """ + Retrieve this resource's subresources. + """ + return ( + Resource.from_contents( + each, + default_specification=self._specification, + ) + for each in self._specification.subresources_of(self.contents) + ) + + def anchors(self) -> Iterable[AnchorType[D]]: + """ + Retrieve this resource's (specification-specific) identifier. + """ + return self._specification.anchors_in(self.contents) + + def pointer(self, pointer: str, resolver: Resolver[D]) -> Resolved[D]: + """ + Resolve the given JSON pointer. + + Raises: + + `exceptions.PointerToNowhere` + + if the pointer points to a location not present in the document + + """ + if not pointer: + return Resolved(contents=self.contents, resolver=resolver) + + contents = self.contents + segments: list[int | str] = [] + for segment in unquote(pointer[1:]).split("/"): + if isinstance(contents, Sequence): + segment = int(segment) + else: + segment = segment.replace("~1", "/").replace("~0", "~") + try: + contents = contents[segment] # type: ignore[reportUnknownArgumentType] + except LookupError as lookup_error: + error = exceptions.PointerToNowhere(ref=pointer, resource=self) + raise error from lookup_error + + segments.append(segment) + last = resolver + resolver = self._specification.maybe_in_subresource( + segments=segments, + resolver=resolver, + subresource=self._specification.create_resource(contents), + ) + if resolver is not last: + segments = [] + return Resolved(contents=contents, resolver=resolver) # type: ignore[reportUnknownArgumentType] + + +def _fail_to_retrieve(uri: URI): + raise exceptions.NoSuchResource(ref=uri) + + +@frozen +class Registry(Mapping[URI, Resource[D]]): + r""" + A registry of `Resource`\ s, each identified by their canonical URIs. + + Registries store a collection of in-memory resources, and optionally + enable additional resources which may be stored elsewhere (e.g. in a + database, a separate set of files, over the network, etc.). + + They also lazily walk their known resources, looking for subresources + within them. In other words, subresources contained within any added + resources will be retrievable via their own IDs (though this discovery of + subresources will be delayed until necessary). + + Registries are immutable, and their methods return new instances of the + registry with the additional resources added to them. + + The ``retrieve`` argument can be used to configure retrieval of resources + dynamically, either over the network, from a database, or the like. + Pass it a callable which will be called if any URI not present in the + registry is accessed. It must either return a `Resource` or else raise a + `NoSuchResource` exception indicating that the resource does not exist + even according to the retrieval logic. + """ + + _resources: HashTrieMap[URI, Resource[D]] = field( + default=HashTrieMap(), + converter=HashTrieMap.convert, # type: ignore[reportGeneralTypeIssues] + alias="resources", + ) + _anchors: HashTrieMap[tuple[URI, str], AnchorType[D]] = HashTrieMap() + _uncrawled: HashTrieSet[URI] = EMPTY_UNCRAWLED + _retrieve: Retrieve[D] = field(default=_fail_to_retrieve, alias="retrieve") + + def __getitem__(self, uri: URI) -> Resource[D]: + """ + Return the (already crawled) `Resource` identified by the given URI. + """ + try: + return self._resources[uri.rstrip("#")] + except KeyError: + raise exceptions.NoSuchResource(ref=uri) from None + + def __iter__(self) -> Iterator[URI]: + """ + Iterate over all crawled URIs in the registry. + """ + return iter(self._resources) + + def __len__(self) -> int: + """ + Count the total number of fully crawled resources in this registry. + """ + return len(self._resources) + + def __rmatmul__( + self, + new: Resource[D] | Iterable[Resource[D]], + ) -> Registry[D]: + """ + Create a new registry with resource(s) added using their internal IDs. + + Resources must have a internal IDs (e.g. the :kw:`$id` keyword in + modern JSON Schema versions), otherwise an error will be raised. + + Both a single resource as well as an iterable of resources works, i.e.: + + * ``resource @ registry`` or + + * ``[iterable, of, multiple, resources] @ registry`` + + which -- again, assuming the resources have internal IDs -- is + equivalent to calling `Registry.with_resources` as such: + + .. code:: python + + registry.with_resources( + (resource.id(), resource) for resource in new_resources + ) + + Raises: + + `NoInternalID` + + if the resource(s) in fact do not have IDs + + """ + if isinstance(new, Resource): + new = (new,) + + resources = self._resources + uncrawled = self._uncrawled + for resource in new: + id = resource.id() + if id is None: + raise exceptions.NoInternalID(resource=resource) + uncrawled = uncrawled.insert(id) + resources = resources.insert(id, resource) + return evolve(self, resources=resources, uncrawled=uncrawled) + + def __repr__(self) -> str: + size = len(self) + pluralized = "resource" if size == 1 else "resources" + if self._uncrawled: + uncrawled = len(self._uncrawled) + if uncrawled == size: + summary = f"uncrawled {pluralized}" + else: + summary = f"{pluralized}, {uncrawled} uncrawled" + else: + summary = f"{pluralized}" + return f"" + + def get_or_retrieve(self, uri: URI) -> Retrieved[D, Resource[D]]: + """ + Get a resource from the registry, crawling or retrieving if necessary. + + May involve crawling to find the given URI if it is not already known, + so the returned object is a `Retrieved` object which contains both the + resource value as well as the registry which ultimately contained it. + """ + resource = self._resources.get(uri) + if resource is not None: + return Retrieved(registry=self, value=resource) + + registry = self.crawl() + resource = registry._resources.get(uri) + if resource is not None: + return Retrieved(registry=registry, value=resource) + + try: + resource = registry._retrieve(uri) + except ( + exceptions.CannotDetermineSpecification, + exceptions.NoSuchResource, + ): + raise + except Exception as error: + raise exceptions.Unretrievable(ref=uri) from error + else: + registry = registry.with_resource(uri, resource) + return Retrieved(registry=registry, value=resource) + + def remove(self, uri: URI): + """ + Return a registry with the resource identified by a given URI removed. + """ + if uri not in self._resources: + raise exceptions.NoSuchResource(ref=uri) + + return evolve( + self, + resources=self._resources.remove(uri), + uncrawled=self._uncrawled.discard(uri), + anchors=HashTrieMap( + (k, v) for k, v in self._anchors.items() if k[0] != uri + ), + ) + + def anchor(self, uri: URI, name: str): + """ + Retrieve a given anchor from a resource which must already be crawled. + """ + value = self._anchors.get((uri, name)) + if value is not None: + return Retrieved(value=value, registry=self) + + registry = self.crawl() + value = registry._anchors.get((uri, name)) + if value is not None: + return Retrieved(value=value, registry=registry) + + resource = self[uri] + canonical_uri = resource.id() + if canonical_uri is not None: + value = registry._anchors.get((canonical_uri, name)) + if value is not None: + return Retrieved(value=value, registry=registry) + + if "/" in name: + raise exceptions.InvalidAnchor( + ref=uri, + resource=resource, + anchor=name, + ) + raise exceptions.NoSuchAnchor(ref=uri, resource=resource, anchor=name) + + def contents(self, uri: URI) -> D: + """ + Retrieve the (already crawled) contents identified by the given URI. + """ + return self[uri].contents + + def crawl(self) -> Registry[D]: + """ + Crawl all added resources, discovering subresources. + """ + resources = self._resources + anchors = self._anchors + uncrawled = [(uri, resources[uri]) for uri in self._uncrawled] + while uncrawled: + uri, resource = uncrawled.pop() + + id = resource.id() + if id is not None: + uri = urljoin(uri, id) + resources = resources.insert(uri, resource) + for each in resource.anchors(): + anchors = anchors.insert((uri, each.name), each) + uncrawled.extend((uri, each) for each in resource.subresources()) + return evolve( + self, + resources=resources, + anchors=anchors, + uncrawled=EMPTY_UNCRAWLED, + ) + + def with_resource(self, uri: URI, resource: Resource[D]): + """ + Add the given `Resource` to the registry, without crawling it. + """ + return self.with_resources([(uri, resource)]) + + def with_resources( + self, + pairs: Iterable[tuple[URI, Resource[D]]], + ) -> Registry[D]: + r""" + Add the given `Resource`\ s to the registry, without crawling them. + """ + resources = self._resources + uncrawled = self._uncrawled + for uri, resource in pairs: + # Empty fragment URIs are equivalent to URIs without the fragment. + # TODO: Is this true for non JSON Schema resources? Probably not. + uri = uri.rstrip("#") + uncrawled = uncrawled.insert(uri) + resources = resources.insert(uri, resource) + return evolve(self, resources=resources, uncrawled=uncrawled) + + def with_contents( + self, + pairs: Iterable[tuple[URI, D]], + **kwargs: Any, + ) -> Registry[D]: + r""" + Add the given contents to the registry, autodetecting when necessary. + """ + return self.with_resources( + (uri, Resource.from_contents(each, **kwargs)) + for uri, each in pairs + ) + + def combine(self, *registries: Registry[D]) -> Registry[D]: + """ + Combine together one or more other registries, producing a unified one. + """ + if registries == (self,): + return self + resources = self._resources + anchors = self._anchors + uncrawled = self._uncrawled + retrieve = self._retrieve + for registry in registries: + resources = resources.update(registry._resources) + anchors = anchors.update(registry._anchors) + uncrawled = uncrawled.update(registry._uncrawled) + + if registry._retrieve is not _fail_to_retrieve: + if registry._retrieve is not retrieve is not _fail_to_retrieve: + raise ValueError( # noqa: TRY003 + "Cannot combine registries with conflicting retrieval " + "functions.", + ) + retrieve = registry._retrieve + return evolve( + self, + anchors=anchors, + resources=resources, + uncrawled=uncrawled, + retrieve=retrieve, + ) + + def resolver(self, base_uri: URI = "") -> Resolver[D]: + """ + Return a `Resolver` which resolves references against this registry. + """ + return Resolver(base_uri=base_uri, registry=self) + + def resolver_with_root(self, resource: Resource[D]) -> Resolver[D]: + """ + Return a `Resolver` with a specific root resource. + """ + uri = resource.id() or "" + return Resolver( + base_uri=uri, + registry=self.with_resource(uri, resource), + ) + + +#: An anchor or resource. +AnchorOrResource = TypeVar( + "AnchorOrResource", + AnchorType[Any], + Resource[Any], + default=Resource[Any], +) + + +@frozen +class Retrieved(Generic[D, AnchorOrResource]): + """ + A value retrieved from a `Registry`. + """ + + value: AnchorOrResource + registry: Registry[D] + + +@frozen +class Resolved(Generic[D]): + """ + A reference resolved to its contents by a `Resolver`. + """ + + contents: D + resolver: Resolver[D] + + +@frozen +class Resolver(Generic[D]): + """ + A reference resolver. + + Resolvers help resolve references (including relative ones) by + pairing a fixed base URI with a `Registry`. + + This object, under normal circumstances, is expected to be used by + *implementers of libraries* built on top of `referencing` (e.g. JSON Schema + implementations or other libraries resolving JSON references), + not directly by end-users populating registries or while writing + schemas or other resources. + + References are resolved against the base URI, and the combined URI + is then looked up within the registry. + + The process of resolving a reference may itself involve calculating + a *new* base URI for future reference resolution (e.g. if an + intermediate resource sets a new base URI), or may involve encountering + additional subresources and adding them to a new registry. + """ + + _base_uri: URI = field(alias="base_uri") + _registry: Registry[D] = field(alias="registry") + _previous: List[URI] = field(default=List(), repr=False, alias="previous") + + def lookup(self, ref: URI) -> Resolved[D]: + """ + Resolve the given reference to the resource it points to. + + Raises: + + `exceptions.Unresolvable` + + or a subclass thereof (see below) if the reference isn't + resolvable + + `exceptions.NoSuchAnchor` + + if the reference is to a URI where a resource exists but + contains a plain name fragment which does not exist within + the resource + + `exceptions.PointerToNowhere` + + if the reference is to a URI where a resource exists but + contains a JSON pointer to a location within the resource + that does not exist + + """ + if ref.startswith("#"): + uri, fragment = self._base_uri, ref[1:] + else: + uri, fragment = urldefrag(urljoin(self._base_uri, ref)) + try: + retrieved = self._registry.get_or_retrieve(uri) + except exceptions.NoSuchResource: + raise exceptions.Unresolvable(ref=ref) from None + except exceptions.Unretrievable as error: + raise exceptions.Unresolvable(ref=ref) from error + + if fragment.startswith("/"): + resolver = self._evolve(registry=retrieved.registry, base_uri=uri) + return retrieved.value.pointer(pointer=fragment, resolver=resolver) + + if fragment: + retrieved = retrieved.registry.anchor(uri, fragment) + resolver = self._evolve(registry=retrieved.registry, base_uri=uri) + return retrieved.value.resolve(resolver=resolver) + + resolver = self._evolve(registry=retrieved.registry, base_uri=uri) + return Resolved(contents=retrieved.value.contents, resolver=resolver) + + def in_subresource(self, subresource: Resource[D]) -> Resolver[D]: + """ + Create a resolver for a subresource (which may have a new base URI). + """ + id = subresource.id() + if id is None: + return self + return evolve(self, base_uri=urljoin(self._base_uri, id)) + + def dynamic_scope(self) -> Iterable[tuple[URI, Registry[D]]]: + """ + In specs with such a notion, return the URIs in the dynamic scope. + """ + for uri in self._previous: + yield uri, self._registry + + def _evolve(self, base_uri: URI, **kwargs: Any): + """ + Evolve, appending to the dynamic scope. + """ + previous = self._previous + if self._base_uri and (not previous or base_uri != self._base_uri): + previous = previous.push_front(self._base_uri) + return evolve(self, base_uri=base_uri, previous=previous, **kwargs) + + +@frozen +class Anchor(Generic[D]): + """ + A simple anchor in a `Resource`. + """ + + name: str + resource: Resource[D] + + def resolve(self, resolver: Resolver[D]): + """ + Return the resource for this anchor. + """ + return Resolved(contents=self.resource.contents, resolver=resolver) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/exceptions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..3267fc70732e73c0a888d9f60551ad9373ed6d16 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/exceptions.py @@ -0,0 +1,165 @@ +""" +Errors, oh no! +""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +import attrs + +from referencing._attrs import frozen + +if TYPE_CHECKING: + from referencing import Resource + from referencing.typing import URI + + +@frozen +class NoSuchResource(KeyError): + """ + The given URI is not present in a registry. + + Unlike most exceptions, this class *is* intended to be publicly + instantiable and *is* part of the public API of the package. + """ + + ref: URI + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return NotImplemented + return attrs.astuple(self) == attrs.astuple(other) + + def __hash__(self) -> int: + return hash(attrs.astuple(self)) + + +@frozen +class NoInternalID(Exception): + """ + A resource has no internal ID, but one is needed. + + E.g. in modern JSON Schema drafts, this is the :kw:`$id` keyword. + + One might be needed if a resource was to-be added to a registry but no + other URI is available, and the resource doesn't declare its canonical URI. + """ + + resource: Resource[Any] + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return NotImplemented + return attrs.astuple(self) == attrs.astuple(other) + + def __hash__(self) -> int: + return hash(attrs.astuple(self)) + + +@frozen +class Unretrievable(KeyError): + """ + The given URI is not present in a registry, and retrieving it failed. + """ + + ref: URI + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return NotImplemented + return attrs.astuple(self) == attrs.astuple(other) + + def __hash__(self) -> int: + return hash(attrs.astuple(self)) + + +@frozen +class CannotDetermineSpecification(Exception): + """ + Attempting to detect the appropriate `Specification` failed. + + This happens if no discernible information is found in the contents of the + new resource which would help identify it. + """ + + contents: Any + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return NotImplemented + return attrs.astuple(self) == attrs.astuple(other) + + def __hash__(self) -> int: + return hash(attrs.astuple(self)) + + +@attrs.frozen # Because here we allow subclassing below. +class Unresolvable(Exception): + """ + A reference was unresolvable. + """ + + ref: URI + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return NotImplemented + return attrs.astuple(self) == attrs.astuple(other) + + def __hash__(self) -> int: + return hash(attrs.astuple(self)) + + +@frozen +class PointerToNowhere(Unresolvable): + """ + A JSON Pointer leads to a part of a document that does not exist. + """ + + resource: Resource[Any] + + def __str__(self) -> str: + msg = f"{self.ref!r} does not exist within {self.resource.contents!r}" + if self.ref == "/": + msg += ( + ". The pointer '/' is a valid JSON Pointer but it points to " + "an empty string property ''. If you intended to point " + "to the entire resource, you should use '#'." + ) + return msg + + +@frozen +class NoSuchAnchor(Unresolvable): + """ + An anchor does not exist within a particular resource. + """ + + resource: Resource[Any] + anchor: str + + def __str__(self) -> str: + return ( + f"{self.anchor!r} does not exist within {self.resource.contents!r}" + ) + + +@frozen +class InvalidAnchor(Unresolvable): + """ + An anchor which could never exist in a resource was dereferenced. + + It is somehow syntactically invalid. + """ + + resource: Resource[Any] + anchor: str + + def __str__(self) -> str: + return ( + f"'#{self.anchor}' is not a valid anchor, neither as a " + "plain name anchor nor as a JSON Pointer. You may have intended " + f"to use '#/{self.anchor}', as the slash is required *before each " + "segment* of a JSON pointer." + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/jsonschema.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/jsonschema.py new file mode 100644 index 0000000000000000000000000000000000000000..93e77a78717183c3290427a448993e0bb997cfe4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/jsonschema.py @@ -0,0 +1,642 @@ +""" +Referencing implementations for JSON Schema specs (historic & current). +""" + +from __future__ import annotations + +from collections.abc import Iterable, Sequence, Set +from typing import Any + +from referencing import Anchor, Registry, Resource, Specification, exceptions +from referencing._attrs import frozen +from referencing._core import ( + _UNSET, # type: ignore[reportPrivateUsage] + Resolved as _Resolved, + Resolver as _Resolver, + _Unset, # type: ignore[reportPrivateUsage] +) +from referencing.typing import URI, Anchor as AnchorType, Mapping + +#: A JSON Schema which is a JSON object +ObjectSchema = Mapping[str, Any] + +#: A JSON Schema of any kind +Schema = bool | ObjectSchema + +#: A Resource whose contents are JSON Schemas +SchemaResource = Resource[Schema] + +#: A JSON Schema Registry +SchemaRegistry = Registry[Schema] + +#: The empty JSON Schema Registry +EMPTY_REGISTRY: SchemaRegistry = Registry() + + +@frozen +class UnknownDialect(Exception): + """ + A dialect identifier was found for a dialect unknown by this library. + + If it's a custom ("unofficial") dialect, be sure you've registered it. + """ + + uri: URI + + +def _dollar_id(contents: Schema) -> URI | None: + if isinstance(contents, bool): + return + return contents.get("$id") + + +def _legacy_dollar_id(contents: Schema) -> URI | None: + if isinstance(contents, bool) or "$ref" in contents: + return + id = contents.get("$id") + if id is not None and not id.startswith("#"): + return id + + +def _legacy_id(contents: ObjectSchema) -> URI | None: + if "$ref" in contents: + return + id = contents.get("id") + if id is not None and not id.startswith("#"): + return id + + +def _anchor( + specification: Specification[Schema], + contents: Schema, +) -> Iterable[AnchorType[Schema]]: + if isinstance(contents, bool): + return + anchor = contents.get("$anchor") + if anchor is not None: + yield Anchor( + name=anchor, + resource=specification.create_resource(contents), + ) + + dynamic_anchor = contents.get("$dynamicAnchor") + if dynamic_anchor is not None: + yield DynamicAnchor( + name=dynamic_anchor, + resource=specification.create_resource(contents), + ) + + +def _anchor_2019( + specification: Specification[Schema], + contents: Schema, +) -> Iterable[Anchor[Schema]]: + if isinstance(contents, bool): + return [] + anchor = contents.get("$anchor") + if anchor is None: + return [] + return [ + Anchor( + name=anchor, + resource=specification.create_resource(contents), + ), + ] + + +def _legacy_anchor_in_dollar_id( + specification: Specification[Schema], + contents: Schema, +) -> Iterable[Anchor[Schema]]: + if isinstance(contents, bool): + return [] + id = contents.get("$id", "") + if not id.startswith("#"): + return [] + return [ + Anchor( + name=id[1:], + resource=specification.create_resource(contents), + ), + ] + + +def _legacy_anchor_in_id( + specification: Specification[ObjectSchema], + contents: ObjectSchema, +) -> Iterable[Anchor[ObjectSchema]]: + id = contents.get("id", "") + if not id.startswith("#"): + return [] + return [ + Anchor( + name=id[1:], + resource=specification.create_resource(contents), + ), + ] + + +def _subresources_of( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + """ + Create a callable returning JSON Schema specification-style subschemas. + + Relies on specifying the set of keywords containing subschemas in their + values, in a subobject's values, or in a subarray. + """ + + def subresources_of(contents: Schema) -> Iterable[ObjectSchema]: + if isinstance(contents, bool): + return + for each in in_value: + if each in contents: + yield contents[each] + for each in in_subarray: + if each in contents: + yield from contents[each] + for each in in_subvalues: + if each in contents: + yield from contents[each].values() + + return subresources_of + + +def _subresources_of_with_crazy_items( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + """ + Specifically handle older drafts where there are some funky keywords. + """ + + def subresources_of(contents: Schema) -> Iterable[ObjectSchema]: + if isinstance(contents, bool): + return + for each in in_value: + if each in contents: + yield contents[each] + for each in in_subarray: + if each in contents: + yield from contents[each] + for each in in_subvalues: + if each in contents: + yield from contents[each].values() + + items = contents.get("items") + if items is not None: + if isinstance(items, Sequence): + yield from items + else: + yield items + + return subresources_of + + +def _subresources_of_with_crazy_items_dependencies( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + """ + Specifically handle older drafts where there are some funky keywords. + """ + + def subresources_of(contents: Schema) -> Iterable[ObjectSchema]: + if isinstance(contents, bool): + return + for each in in_value: + if each in contents: + yield contents[each] + for each in in_subarray: + if each in contents: + yield from contents[each] + for each in in_subvalues: + if each in contents: + yield from contents[each].values() + + items = contents.get("items") + if items is not None: + if isinstance(items, Sequence): + yield from items + else: + yield items + dependencies = contents.get("dependencies") + if dependencies is not None: + values = iter(dependencies.values()) + value = next(values, None) + if isinstance(value, Mapping): + yield value + yield from values + + return subresources_of + + +def _subresources_of_with_crazy_aP_items_dependencies( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + """ + Specifically handle even older drafts where there are some funky keywords. + """ + + def subresources_of(contents: ObjectSchema) -> Iterable[ObjectSchema]: + for each in in_value: + if each in contents: + yield contents[each] + for each in in_subarray: + if each in contents: + yield from contents[each] + for each in in_subvalues: + if each in contents: + yield from contents[each].values() + + items = contents.get("items") + if items is not None: + if isinstance(items, Sequence): + yield from items + else: + yield items + dependencies = contents.get("dependencies") + if dependencies is not None: + values = iter(dependencies.values()) + value = next(values, None) + if isinstance(value, Mapping): + yield value + yield from values + + for each in "additionalItems", "additionalProperties": + value = contents.get(each) + if isinstance(value, Mapping): + yield value + + return subresources_of + + +def _maybe_in_subresource( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + in_child = in_subvalues | in_subarray + + def maybe_in_subresource( + segments: Sequence[int | str], + resolver: _Resolver[Any], + subresource: Resource[Any], + ) -> _Resolver[Any]: + _segments = iter(segments) + for segment in _segments: + if segment not in in_value and ( + segment not in in_child or next(_segments, None) is None + ): + return resolver + return resolver.in_subresource(subresource) + + return maybe_in_subresource + + +def _maybe_in_subresource_crazy_items( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + in_child = in_subvalues | in_subarray + + def maybe_in_subresource( + segments: Sequence[int | str], + resolver: _Resolver[Any], + subresource: Resource[Any], + ) -> _Resolver[Any]: + _segments = iter(segments) + for segment in _segments: + if segment == "items" and isinstance( + subresource.contents, + Mapping, + ): + return resolver.in_subresource(subresource) + if segment not in in_value and ( + segment not in in_child or next(_segments, None) is None + ): + return resolver + return resolver.in_subresource(subresource) + + return maybe_in_subresource + + +def _maybe_in_subresource_crazy_items_dependencies( + in_value: Set[str] = frozenset(), + in_subvalues: Set[str] = frozenset(), + in_subarray: Set[str] = frozenset(), +): + in_child = in_subvalues | in_subarray + + def maybe_in_subresource( + segments: Sequence[int | str], + resolver: _Resolver[Any], + subresource: Resource[Any], + ) -> _Resolver[Any]: + _segments = iter(segments) + for segment in _segments: + if segment in {"items", "dependencies"} and isinstance( + subresource.contents, + Mapping, + ): + return resolver.in_subresource(subresource) + if segment not in in_value and ( + segment not in in_child or next(_segments, None) is None + ): + return resolver + return resolver.in_subresource(subresource) + + return maybe_in_subresource + + +#: JSON Schema draft 2020-12 +DRAFT202012 = Specification( + name="draft2020-12", + id_of=_dollar_id, + subresources_of=_subresources_of( + in_value={ + "additionalProperties", + "contains", + "contentSchema", + "else", + "if", + "items", + "not", + "propertyNames", + "then", + "unevaluatedItems", + "unevaluatedProperties", + }, + in_subarray={"allOf", "anyOf", "oneOf", "prefixItems"}, + in_subvalues={ + "$defs", + "definitions", + "dependentSchemas", + "patternProperties", + "properties", + }, + ), + anchors_in=_anchor, + maybe_in_subresource=_maybe_in_subresource( + in_value={ + "additionalProperties", + "contains", + "contentSchema", + "else", + "if", + "items", + "not", + "propertyNames", + "then", + "unevaluatedItems", + "unevaluatedProperties", + }, + in_subarray={"allOf", "anyOf", "oneOf", "prefixItems"}, + in_subvalues={ + "$defs", + "definitions", + "dependentSchemas", + "patternProperties", + "properties", + }, + ), +) +#: JSON Schema draft 2019-09 +DRAFT201909 = Specification( + name="draft2019-09", + id_of=_dollar_id, + subresources_of=_subresources_of_with_crazy_items( + in_value={ + "additionalItems", + "additionalProperties", + "contains", + "contentSchema", + "else", + "if", + "not", + "propertyNames", + "then", + "unevaluatedItems", + "unevaluatedProperties", + }, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={ + "$defs", + "definitions", + "dependentSchemas", + "patternProperties", + "properties", + }, + ), + anchors_in=_anchor_2019, + maybe_in_subresource=_maybe_in_subresource_crazy_items( + in_value={ + "additionalItems", + "additionalProperties", + "contains", + "contentSchema", + "else", + "if", + "not", + "propertyNames", + "then", + "unevaluatedItems", + "unevaluatedProperties", + }, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={ + "$defs", + "definitions", + "dependentSchemas", + "patternProperties", + "properties", + }, + ), +) +#: JSON Schema draft 7 +DRAFT7 = Specification( + name="draft-07", + id_of=_legacy_dollar_id, + subresources_of=_subresources_of_with_crazy_items_dependencies( + in_value={ + "additionalItems", + "additionalProperties", + "contains", + "else", + "if", + "not", + "propertyNames", + "then", + }, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), + anchors_in=_legacy_anchor_in_dollar_id, + maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies( + in_value={ + "additionalItems", + "additionalProperties", + "contains", + "else", + "if", + "not", + "propertyNames", + "then", + }, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), +) +#: JSON Schema draft 6 +DRAFT6 = Specification( + name="draft-06", + id_of=_legacy_dollar_id, + subresources_of=_subresources_of_with_crazy_items_dependencies( + in_value={ + "additionalItems", + "additionalProperties", + "contains", + "not", + "propertyNames", + }, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), + anchors_in=_legacy_anchor_in_dollar_id, + maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies( + in_value={ + "additionalItems", + "additionalProperties", + "contains", + "not", + "propertyNames", + }, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), +) +#: JSON Schema draft 4 +DRAFT4 = Specification( + name="draft-04", + id_of=_legacy_id, + subresources_of=_subresources_of_with_crazy_aP_items_dependencies( + in_value={"not"}, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), + anchors_in=_legacy_anchor_in_id, + maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies( + in_value={"additionalItems", "additionalProperties", "not"}, + in_subarray={"allOf", "anyOf", "oneOf"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), +) +#: JSON Schema draft 3 +DRAFT3 = Specification( + name="draft-03", + id_of=_legacy_id, + subresources_of=_subresources_of_with_crazy_aP_items_dependencies( + in_subarray={"extends"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), + anchors_in=_legacy_anchor_in_id, + maybe_in_subresource=_maybe_in_subresource_crazy_items_dependencies( + in_value={"additionalItems", "additionalProperties"}, + in_subarray={"extends"}, + in_subvalues={"definitions", "patternProperties", "properties"}, + ), +) + + +_SPECIFICATIONS: Registry[Specification[Schema]] = Registry( + { + dialect_id: Resource.opaque(specification) + for dialect_id, specification in [ + ("https://json-schema.org/draft/2020-12/schema", DRAFT202012), + ("https://json-schema.org/draft/2019-09/schema", DRAFT201909), + ("http://json-schema.org/draft-07/schema", DRAFT7), + ("http://json-schema.org/draft-06/schema", DRAFT6), + ("http://json-schema.org/draft-04/schema", DRAFT4), + ("http://json-schema.org/draft-03/schema", DRAFT3), + ] + }, +) + + +def specification_with( + dialect_id: URI, + default: Specification[Any] | _Unset = _UNSET, +) -> Specification[Any]: + """ + Retrieve the `Specification` with the given dialect identifier. + + Raises: + + `UnknownDialect` + + if the given ``dialect_id`` isn't known + + """ + resource = _SPECIFICATIONS.get(dialect_id.rstrip("#")) + if resource is not None: + return resource.contents + if default is _UNSET: + raise UnknownDialect(dialect_id) + return default + + +@frozen +class DynamicAnchor: + """ + Dynamic anchors, introduced in draft 2020. + """ + + name: str + resource: SchemaResource + + def resolve(self, resolver: _Resolver[Schema]) -> _Resolved[Schema]: + """ + Resolve this anchor dynamically. + """ + last = self.resource + for uri, registry in resolver.dynamic_scope(): + try: + anchor = registry.anchor(uri, self.name).value + except exceptions.NoSuchAnchor: + continue + if isinstance(anchor, DynamicAnchor): + last = anchor.resource + return _Resolved( + contents=last.contents, + resolver=resolver.in_subresource(last), + ) + + +def lookup_recursive_ref(resolver: _Resolver[Schema]) -> _Resolved[Schema]: + """ + Recursive references (via recursive anchors), present only in draft 2019. + + As per the 2019 specification (§ 8.2.4.2.1), only the ``#`` recursive + reference is supported (and is therefore assumed to be the relevant + reference). + """ + resolved = resolver.lookup("#") + if isinstance(resolved.contents, Mapping) and resolved.contents.get( + "$recursiveAnchor", + ): + for uri, _ in resolver.dynamic_scope(): + next_resolved = resolver.lookup(uri) + if not isinstance( + next_resolved.contents, + Mapping, + ) or not next_resolved.contents.get("$recursiveAnchor"): + break + resolved = next_resolved + return resolved diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/retrieval.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/retrieval.py new file mode 100644 index 0000000000000000000000000000000000000000..ac5a65bd604abb7548778f1f3331d3514d57b363 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/retrieval.py @@ -0,0 +1,94 @@ +""" +Helpers related to (dynamic) resource retrieval. +""" + +from __future__ import annotations + +from functools import lru_cache +from typing import TYPE_CHECKING +import json + +try: + from typing_extensions import TypeVar +except ImportError: # pragma: no cover + from typing import TypeVar + +from referencing import Resource + +if TYPE_CHECKING: + from collections.abc import Callable + + from referencing.typing import URI, D, Retrieve + +#: A serialized document (e.g. a JSON string) +_T = TypeVar("_T", default=str) + + +def to_cached_resource( + cache: Callable[[Retrieve[D]], Retrieve[D]] | None = None, + loads: Callable[[_T], D] = json.loads, + from_contents: Callable[[D], Resource[D]] = Resource.from_contents, +) -> Callable[[Callable[[URI], _T]], Retrieve[D]]: + """ + Create a retriever which caches its return values from a simpler callable. + + Takes a function which returns things like serialized JSON (strings) and + returns something suitable for passing to `Registry` as a retrieve + function. + + This decorator both reduces a small bit of boilerplate for a common case + (deserializing JSON from strings and creating `Resource` objects from the + result) as well as makes the probable need for caching a bit easier. + Retrievers which otherwise do expensive operations (like hitting the + network) might otherwise be called repeatedly. + + Examples + -------- + + .. testcode:: + + from referencing import Registry + from referencing.typing import URI + import referencing.retrieval + + + @referencing.retrieval.to_cached_resource() + def retrieve(uri: URI): + print(f"Retrieved {uri}") + + # Normally, go get some expensive JSON from the network, a file ... + return ''' + { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "foo": "bar" + } + ''' + + one = Registry(retrieve=retrieve).get_or_retrieve("urn:example:foo") + print(one.value.contents["foo"]) + + # Retrieving the same URI again reuses the same value (and thus doesn't + # print another retrieval message here) + two = Registry(retrieve=retrieve).get_or_retrieve("urn:example:foo") + print(two.value.contents["foo"]) + + .. testoutput:: + + Retrieved urn:example:foo + bar + bar + + """ + if cache is None: + cache = lru_cache(maxsize=None) + + def decorator(retrieve: Callable[[URI], _T]): + @cache + def cached_retrieve(uri: URI): + response = retrieve(uri) + contents = loads(response) + return from_contents(contents) + + return cached_retrieve + + return decorator diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ba5d91faa547da41804ea96e198950d643f3bd28 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_core.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_core.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8ea9bd3a446058796434347044586949d8a25e0 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_core.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e836e66b483a0c403f1e7a96f4fb47055c8713c2 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e09e76fb07b04da0308eb57b74dbed1982ce44d Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b89f932081497a5934797a82e451df8ba1b17719 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3bd9b7b2ed8c5ef667247cde8b2b1925ee06b256 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_core.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_core.py new file mode 100644 index 0000000000000000000000000000000000000000..3edddbc3d96581e1c74069baa873900495366bab --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_core.py @@ -0,0 +1,1057 @@ +from rpds import HashTrieMap +import pytest + +from referencing import Anchor, Registry, Resource, Specification, exceptions +from referencing.jsonschema import DRAFT202012 + +ID_AND_CHILDREN = Specification( + name="id-and-children", + id_of=lambda contents: contents.get("ID"), + subresources_of=lambda contents: contents.get("children", []), + anchors_in=lambda specification, contents: [ + Anchor( + name=name, + resource=specification.create_resource(contents=each), + ) + for name, each in contents.get("anchors", {}).items() + ], + maybe_in_subresource=lambda segments, resolver, subresource: ( + resolver.in_subresource(subresource) + if not len(segments) % 2 + and all(each == "children" for each in segments[::2]) + else resolver + ), +) + + +def blow_up(uri): # pragma: no cover + """ + A retriever suitable for use in tests which expect it never to be used. + """ + raise RuntimeError("This retrieve function expects to never be called!") + + +class TestRegistry: + def test_with_resource(self): + """ + Adding a resource to the registry then allows re-retrieving it. + """ + + resource = Resource.opaque(contents={"foo": "bar"}) + uri = "urn:example" + registry = Registry().with_resource(uri=uri, resource=resource) + assert registry[uri] is resource + + def test_with_resources(self): + """ + Adding multiple resources to the registry is like adding each one. + """ + + one = Resource.opaque(contents={}) + two = Resource(contents={"foo": "bar"}, specification=ID_AND_CHILDREN) + registry = Registry().with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + assert registry == Registry().with_resource( + uri="http://example.com/1", + resource=one, + ).with_resource( + uri="http://example.com/foo/bar", + resource=two, + ) + + def test_matmul_resource(self): + uri = "urn:example:resource" + resource = ID_AND_CHILDREN.create_resource({"ID": uri, "foo": 12}) + registry = resource @ Registry() + assert registry == Registry().with_resource(uri, resource) + + def test_matmul_many_resources(self): + one_uri = "urn:example:one" + one = ID_AND_CHILDREN.create_resource({"ID": one_uri, "foo": 12}) + + two_uri = "urn:example:two" + two = ID_AND_CHILDREN.create_resource({"ID": two_uri, "foo": 12}) + + registry = [one, two] @ Registry() + assert registry == Registry().with_resources( + [(one_uri, one), (two_uri, two)], + ) + + def test_matmul_resource_without_id(self): + resource = Resource.opaque(contents={"foo": "bar"}) + with pytest.raises(exceptions.NoInternalID) as e: + resource @ Registry() + assert e.value == exceptions.NoInternalID(resource=resource) + + def test_with_contents_from_json_schema(self): + uri = "urn:example" + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + registry = Registry().with_contents([(uri, schema)]) + + expected = Resource(contents=schema, specification=DRAFT202012) + assert registry[uri] == expected + + def test_with_contents_and_default_specification(self): + uri = "urn:example" + registry = Registry().with_contents( + [(uri, {"foo": "bar"})], + default_specification=Specification.OPAQUE, + ) + assert registry[uri] == Resource.opaque({"foo": "bar"}) + + def test_len(self): + total = 5 + registry = Registry().with_contents( + [(str(i), {"foo": "bar"}) for i in range(total)], + default_specification=Specification.OPAQUE, + ) + assert len(registry) == total + + def test_bool_empty(self): + assert not Registry() + + def test_bool_not_empty(self): + registry = Registry().with_contents( + [(str(i), {"foo": "bar"}) for i in range(3)], + default_specification=Specification.OPAQUE, + ) + assert registry + + def test_iter(self): + registry = Registry().with_contents( + [(str(i), {"foo": "bar"}) for i in range(8)], + default_specification=Specification.OPAQUE, + ) + assert set(registry) == {str(i) for i in range(8)} + + def test_crawl_still_has_top_level_resource(self): + resource = Resource.opaque({"foo": "bar"}) + uri = "urn:example" + registry = Registry({uri: resource}).crawl() + assert registry[uri] is resource + + def test_crawl_finds_a_subresource(self): + child_id = "urn:child" + root = ID_AND_CHILDREN.create_resource( + {"ID": "urn:root", "children": [{"ID": child_id, "foo": 12}]}, + ) + registry = root @ Registry() + with pytest.raises(LookupError): + registry[child_id] + + expected = ID_AND_CHILDREN.create_resource({"ID": child_id, "foo": 12}) + assert registry.crawl()[child_id] == expected + + def test_crawl_finds_anchors_with_id(self): + resource = ID_AND_CHILDREN.create_resource( + {"ID": "urn:bar", "anchors": {"foo": 12}}, + ) + registry = resource @ Registry() + + assert registry.crawl().anchor(resource.id(), "foo").value == Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource(12), + ) + + def test_crawl_finds_anchors_no_id(self): + resource = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}}) + registry = Registry().with_resource("urn:root", resource) + + assert registry.crawl().anchor("urn:root", "foo").value == Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource(12), + ) + + def test_contents(self): + resource = Resource.opaque({"foo": "bar"}) + uri = "urn:example" + registry = Registry().with_resource(uri, resource) + assert registry.contents(uri) == {"foo": "bar"} + + def test_getitem_strips_empty_fragments(self): + uri = "http://example.com/" + resource = ID_AND_CHILDREN.create_resource({"ID": uri + "#"}) + registry = resource @ Registry() + assert registry[uri] == registry[uri + "#"] == resource + + def test_contents_strips_empty_fragments(self): + uri = "http://example.com/" + resource = ID_AND_CHILDREN.create_resource({"ID": uri + "#"}) + registry = resource @ Registry() + assert ( + registry.contents(uri) + == registry.contents(uri + "#") + == {"ID": uri + "#"} + ) + + def test_contents_nonexistent_resource(self): + registry = Registry() + with pytest.raises(exceptions.NoSuchResource) as e: + registry.contents("urn:example") + assert e.value == exceptions.NoSuchResource(ref="urn:example") + + def test_crawled_anchor(self): + resource = ID_AND_CHILDREN.create_resource({"anchors": {"foo": "bar"}}) + registry = Registry().with_resource("urn:example", resource) + retrieved = registry.anchor("urn:example", "foo") + assert retrieved.value == Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource("bar"), + ) + assert retrieved.registry == registry.crawl() + + def test_anchor_in_nonexistent_resource(self): + registry = Registry() + with pytest.raises(exceptions.NoSuchResource) as e: + registry.anchor("urn:example", "foo") + assert e.value == exceptions.NoSuchResource(ref="urn:example") + + def test_init(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry( + { + "http://example.com/1": one, + "http://example.com/foo/bar": two, + }, + ) + assert ( + registry + == Registry() + .with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + .crawl() + ) + + def test_dict_conversion(self): + """ + Passing a `dict` to `Registry` gets converted to a `HashTrieMap`. + + So continuing to use the registry works. + """ + + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry( + {"http://example.com/1": one}, + ).with_resource("http://example.com/foo/bar", two) + assert ( + registry.crawl() + == Registry() + .with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + .crawl() + ) + + def test_no_such_resource(self): + registry = Registry() + with pytest.raises(exceptions.NoSuchResource) as e: + registry["urn:bigboom"] + assert e.value == exceptions.NoSuchResource(ref="urn:bigboom") + + def test_combine(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + four = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}}) + + first = Registry({"http://example.com/1": one}) + second = Registry().with_resource("http://example.com/foo/bar", two) + third = Registry( + { + "http://example.com/1": one, + "http://example.com/baz": three, + }, + ) + fourth = ( + Registry() + .with_resource( + "http://example.com/foo/quux", + four, + ) + .crawl() + ) + assert first.combine(second, third, fourth) == Registry( + [ + ("http://example.com/1", one), + ("http://example.com/baz", three), + ("http://example.com/foo/quux", four), + ], + anchors=HashTrieMap( + { + ("http://example.com/foo/quux", "foo"): Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource(12), + ), + }, + ), + ).with_resource("http://example.com/foo/bar", two) + + def test_combine_self(self): + """ + Combining a registry with itself short-circuits. + + This is a performance optimization -- otherwise we do lots more work + (in jsonschema this seems to correspond to making the test suite take + *3x* longer). + """ + + registry = Registry({"urn:foo": "bar"}) + assert registry.combine(registry) is registry + + def test_combine_with_uncrawled_resources(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + first = Registry().with_resource("http://example.com/1", one) + second = Registry().with_resource("http://example.com/foo/bar", two) + third = Registry( + { + "http://example.com/1": one, + "http://example.com/baz": three, + }, + ) + expected = Registry( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ("http://example.com/baz", three), + ], + ) + combined = first.combine(second, third) + assert combined != expected + assert combined.crawl() == expected + + def test_combine_with_single_retrieve(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + def retrieve(uri): # pragma: no cover + pass + + first = Registry().with_resource("http://example.com/1", one) + second = Registry( + retrieve=retrieve, + ).with_resource("http://example.com/2", two) + third = Registry().with_resource("http://example.com/3", three) + + assert first.combine(second, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + assert second.combine(first, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + + def test_combine_with_common_retrieve(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + def retrieve(uri): # pragma: no cover + pass + + first = Registry(retrieve=retrieve).with_resource( + "http://example.com/1", + one, + ) + second = Registry( + retrieve=retrieve, + ).with_resource("http://example.com/2", two) + third = Registry(retrieve=retrieve).with_resource( + "http://example.com/3", + three, + ) + + assert first.combine(second, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + assert second.combine(first, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + + def test_combine_conflicting_retrieve(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + def foo_retrieve(uri): # pragma: no cover + pass + + def bar_retrieve(uri): # pragma: no cover + pass + + first = Registry(retrieve=foo_retrieve).with_resource( + "http://example.com/1", + one, + ) + second = Registry().with_resource("http://example.com/2", two) + third = Registry(retrieve=bar_retrieve).with_resource( + "http://example.com/3", + three, + ) + + with pytest.raises(Exception, match="conflict.*retriev"): + first.combine(second, third) + + def test_remove(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry({"urn:foo": one, "urn:bar": two}) + assert registry.remove("urn:foo") == Registry({"urn:bar": two}) + + def test_remove_uncrawled(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry().with_resources( + [("urn:foo", one), ("urn:bar", two)], + ) + assert registry.remove("urn:foo") == Registry().with_resource( + "urn:bar", + two, + ) + + def test_remove_with_anchors(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"anchors": {"foo": "bar"}}) + registry = ( + Registry() + .with_resources( + [("urn:foo", one), ("urn:bar", two)], + ) + .crawl() + ) + assert ( + registry.remove("urn:bar") + == Registry() + .with_resource( + "urn:foo", + one, + ) + .crawl() + ) + + def test_remove_nonexistent_uri(self): + with pytest.raises(exceptions.NoSuchResource) as e: + Registry().remove("urn:doesNotExist") + assert e.value == exceptions.NoSuchResource(ref="urn:doesNotExist") + + def test_retrieve(self): + foo = Resource.opaque({"foo": "bar"}) + registry = Registry(retrieve=lambda uri: foo) + assert registry.get_or_retrieve("urn:example").value == foo + + def test_retrieve_arbitrary_exception(self): + foo = Resource.opaque({"foo": "bar"}) + + def retrieve(uri): + if uri == "urn:succeed": + return foo + raise Exception("Oh no!") + + registry = Registry(retrieve=retrieve) + assert registry.get_or_retrieve("urn:succeed").value == foo + with pytest.raises(exceptions.Unretrievable): + registry.get_or_retrieve("urn:uhoh") + + def test_retrieve_no_such_resource(self): + foo = Resource.opaque({"foo": "bar"}) + + def retrieve(uri): + if uri == "urn:succeed": + return foo + raise exceptions.NoSuchResource(ref=uri) + + registry = Registry(retrieve=retrieve) + assert registry.get_or_retrieve("urn:succeed").value == foo + with pytest.raises(exceptions.NoSuchResource): + registry.get_or_retrieve("urn:uhoh") + + def test_retrieve_cannot_determine_specification(self): + def retrieve(uri): + return Resource.from_contents({}) + + registry = Registry(retrieve=retrieve) + with pytest.raises(exceptions.CannotDetermineSpecification): + registry.get_or_retrieve("urn:uhoh") + + def test_retrieve_already_available_resource(self): + foo = Resource.opaque({"foo": "bar"}) + registry = Registry({"urn:example": foo}, retrieve=blow_up) + assert registry["urn:example"] == foo + assert registry.get_or_retrieve("urn:example").value == foo + + def test_retrieve_first_checks_crawlable_resource(self): + child = ID_AND_CHILDREN.create_resource({"ID": "urn:child", "foo": 12}) + root = ID_AND_CHILDREN.create_resource({"children": [child.contents]}) + registry = Registry(retrieve=blow_up).with_resource("urn:root", root) + assert registry.crawl()["urn:child"] == child + + def test_resolver(self): + one = Resource.opaque(contents={}) + registry = Registry({"http://example.com": one}) + resolver = registry.resolver(base_uri="http://example.com") + assert resolver.lookup("#").contents == {} + + def test_resolver_with_root_identified(self): + root = ID_AND_CHILDREN.create_resource({"ID": "http://example.com"}) + resolver = Registry().resolver_with_root(root) + assert resolver.lookup("http://example.com").contents == root.contents + assert resolver.lookup("#").contents == root.contents + + def test_resolver_with_root_unidentified(self): + root = Resource.opaque(contents={}) + resolver = Registry().resolver_with_root(root) + assert resolver.lookup("#").contents == root.contents + + def test_repr(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry().with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + assert repr(registry) == "" + assert repr(registry.crawl()) == "" + + def test_repr_mixed_crawled(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = ( + Registry( + {"http://example.com/1": one}, + ) + .crawl() + .with_resource(uri="http://example.com/foo/bar", resource=two) + ) + assert repr(registry) == "" + + def test_repr_one_resource(self): + registry = Registry().with_resource( + uri="http://example.com/1", + resource=Resource.opaque(contents={}), + ) + assert repr(registry) == "" + + def test_repr_empty(self): + assert repr(Registry()) == "" + + +class TestResource: + def test_from_contents_from_json_schema(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + resource = Resource.from_contents(schema) + assert resource == Resource(contents=schema, specification=DRAFT202012) + + def test_from_contents_with_no_discernible_information(self): + """ + Creating a resource with no discernible way to see what + specification it belongs to (e.g. no ``$schema`` keyword for JSON + Schema) raises an error. + """ + + with pytest.raises(exceptions.CannotDetermineSpecification): + Resource.from_contents({"foo": "bar"}) + + def test_from_contents_with_no_discernible_information_and_default(self): + resource = Resource.from_contents( + {"foo": "bar"}, + default_specification=Specification.OPAQUE, + ) + assert resource == Resource.opaque(contents={"foo": "bar"}) + + def test_from_contents_unneeded_default(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + resource = Resource.from_contents( + schema, + default_specification=Specification.OPAQUE, + ) + assert resource == Resource( + contents=schema, + specification=DRAFT202012, + ) + + def test_non_mapping_from_contents(self): + resource = Resource.from_contents( + True, + default_specification=ID_AND_CHILDREN, + ) + assert resource == Resource( + contents=True, + specification=ID_AND_CHILDREN, + ) + + def test_from_contents_with_fallback(self): + resource = Resource.from_contents( + {"foo": "bar"}, + default_specification=Specification.OPAQUE, + ) + assert resource == Resource.opaque(contents={"foo": "bar"}) + + def test_id_delegates_to_specification(self): + specification = Specification( + name="", + id_of=lambda contents: "urn:fixedID", + subresources_of=lambda contents: [], + anchors_in=lambda specification, contents: [], + maybe_in_subresource=( + lambda segments, resolver, subresource: resolver + ), + ) + resource = Resource( + contents={"foo": "baz"}, + specification=specification, + ) + assert resource.id() == "urn:fixedID" + + def test_id_strips_empty_fragment(self): + uri = "http://example.com/" + root = ID_AND_CHILDREN.create_resource({"ID": uri + "#"}) + assert root.id() == uri + + def test_subresources_delegates_to_specification(self): + resource = ID_AND_CHILDREN.create_resource({"children": [{}, 12]}) + assert list(resource.subresources()) == [ + ID_AND_CHILDREN.create_resource(each) for each in [{}, 12] + ] + + def test_subresource_with_different_specification(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + resource = ID_AND_CHILDREN.create_resource({"children": [schema]}) + assert list(resource.subresources()) == [ + DRAFT202012.create_resource(schema), + ] + + def test_anchors_delegates_to_specification(self): + resource = ID_AND_CHILDREN.create_resource( + {"anchors": {"foo": {}, "bar": 1, "baz": ""}}, + ) + assert list(resource.anchors()) == [ + Anchor(name="foo", resource=ID_AND_CHILDREN.create_resource({})), + Anchor(name="bar", resource=ID_AND_CHILDREN.create_resource(1)), + Anchor(name="baz", resource=ID_AND_CHILDREN.create_resource("")), + ] + + def test_pointer_to_mapping(self): + resource = Resource.opaque(contents={"foo": "baz"}) + resolver = Registry().resolver() + assert resource.pointer("/foo", resolver=resolver).contents == "baz" + + def test_pointer_to_array(self): + resource = Resource.opaque(contents={"foo": {"bar": [3]}}) + resolver = Registry().resolver() + assert resource.pointer("/foo/bar/0", resolver=resolver).contents == 3 + + def test_root_pointer(self): + contents = {"foo": "baz"} + resource = Resource.opaque(contents=contents) + resolver = Registry().resolver() + assert resource.pointer("", resolver=resolver).contents == contents + + def test_opaque(self): + contents = {"foo": "bar"} + assert Resource.opaque(contents) == Resource( + contents=contents, + specification=Specification.OPAQUE, + ) + + +class TestResolver: + def test_lookup_exact_uri(self): + resource = Resource.opaque(contents={"foo": "baz"}) + resolver = Registry({"http://example.com/1": resource}).resolver() + resolved = resolver.lookup("http://example.com/1") + assert resolved.contents == resource.contents + + def test_lookup_subresource(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + {"ID": "http://example.com/a", "foo": 12}, + ], + }, + ) + registry = root @ Registry() + resolved = registry.resolver().lookup("http://example.com/a") + assert resolved.contents == {"ID": "http://example.com/a", "foo": 12} + + def test_lookup_anchor_with_id(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "anchors": {"foo": 12}, + }, + ) + registry = root @ Registry() + resolved = registry.resolver().lookup("http://example.com/#foo") + assert resolved.contents == 12 + + def test_lookup_anchor_without_id(self): + root = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}}) + resolver = Registry().with_resource("urn:example", root).resolver() + resolved = resolver.lookup("urn:example#foo") + assert resolved.contents == 12 + + def test_lookup_unknown_reference(self): + resolver = Registry().resolver() + ref = "http://example.com/does/not/exist" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert e.value == exceptions.Unresolvable(ref=ref) + + def test_lookup_non_existent_pointer(self): + resource = Resource.opaque({"foo": {}}) + resolver = Registry({"http://example.com/1": resource}).resolver() + ref = "http://example.com/1#/foo/bar" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert e.value == exceptions.PointerToNowhere( + ref="/foo/bar", + resource=resource, + ) + assert str(e.value) == "'/foo/bar' does not exist within {'foo': {}}" + + def test_lookup_non_existent_pointer_to_array_index(self): + resource = Resource.opaque([1, 2, 4, 8]) + resolver = Registry({"http://example.com/1": resource}).resolver() + ref = "http://example.com/1#/10" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert e.value == exceptions.PointerToNowhere( + ref="/10", + resource=resource, + ) + + def test_lookup_pointer_to_empty_string(self): + resolver = Registry().resolver_with_root(Resource.opaque({"": {}})) + assert resolver.lookup("#/").contents == {} + + def test_lookup_non_existent_pointer_to_empty_string(self): + resource = Resource.opaque({"foo": {}}) + resolver = Registry().resolver_with_root(resource) + with pytest.raises( + exceptions.Unresolvable, + match="^'/' does not exist within {'foo': {}}.*'#'", + ) as e: + resolver.lookup("#/") + assert e.value == exceptions.PointerToNowhere( + ref="/", + resource=resource, + ) + + def test_lookup_non_existent_anchor(self): + root = ID_AND_CHILDREN.create_resource({"anchors": {}}) + resolver = Registry().with_resource("urn:example", root).resolver() + resolved = resolver.lookup("urn:example") + assert resolved.contents == root.contents + + ref = "urn:example#noSuchAnchor" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert "'noSuchAnchor' does not exist" in str(e.value) + assert e.value == exceptions.NoSuchAnchor( + ref="urn:example", + resource=root, + anchor="noSuchAnchor", + ) + + def test_lookup_invalid_JSON_pointerish_anchor(self): + resolver = Registry().resolver_with_root( + ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "foo": {"bar": 12}, + }, + ), + ) + + valid = resolver.lookup("#/foo/bar") + assert valid.contents == 12 + + with pytest.raises(exceptions.InvalidAnchor) as e: + resolver.lookup("#foo/bar") + assert " '#/foo/bar'" in str(e.value) + + def test_lookup_retrieved_resource(self): + resource = Resource.opaque(contents={"foo": "baz"}) + resolver = Registry(retrieve=lambda uri: resource).resolver() + resolved = resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + def test_lookup_failed_retrieved_resource(self): + """ + Unretrievable exceptions are also wrapped in Unresolvable. + """ + + uri = "http://example.com/" + + registry = Registry(retrieve=blow_up) + with pytest.raises(exceptions.Unretrievable): + registry.get_or_retrieve(uri) + + resolver = registry.resolver() + with pytest.raises(exceptions.Unresolvable): + resolver.lookup(uri) + + def test_repeated_lookup_from_retrieved_resource(self): + """ + A (custom-)retrieved resource is added to the registry returned by + looking it up. + """ + resource = Resource.opaque(contents={"foo": "baz"}) + once = [resource] + + def retrieve(uri): + return once.pop() + + resolver = Registry(retrieve=retrieve).resolver() + resolved = resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + resolved = resolved.resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + def test_repeated_anchor_lookup_from_retrieved_resource(self): + resource = Resource.opaque(contents={"foo": "baz"}) + once = [resource] + + def retrieve(uri): + return once.pop() + + resolver = Registry(retrieve=retrieve).resolver() + resolved = resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + resolved = resolved.resolver.lookup("#") + assert resolved.contents == resource.contents + + # FIXME: The tests below aren't really representable in the current + # suite, though we should probably think of ways to do so. + + def test_in_subresource(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + { + "ID": "child/", + "children": [{"ID": "grandchild"}], + }, + ], + }, + ) + registry = root @ Registry() + + resolver = registry.resolver() + first = resolver.lookup("http://example.com/") + assert first.contents == root.contents + + with pytest.raises(exceptions.Unresolvable): + first.resolver.lookup("grandchild") + + sub = first.resolver.in_subresource( + ID_AND_CHILDREN.create_resource(first.contents["children"][0]), + ) + second = sub.lookup("grandchild") + assert second.contents == {"ID": "grandchild"} + + def test_in_pointer_subresource(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + { + "ID": "child/", + "children": [{"ID": "grandchild"}], + }, + ], + }, + ) + registry = root @ Registry() + + resolver = registry.resolver() + first = resolver.lookup("http://example.com/") + assert first.contents == root.contents + + with pytest.raises(exceptions.Unresolvable): + first.resolver.lookup("grandchild") + + second = first.resolver.lookup("#/children/0") + third = second.resolver.lookup("grandchild") + assert third.contents == {"ID": "grandchild"} + + def test_dynamic_scope(self): + one = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + { + "ID": "child/", + "children": [{"ID": "grandchild"}], + }, + ], + }, + ) + two = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/two", + "children": [{"ID": "two-child/"}], + }, + ) + registry = [one, two] @ Registry() + + resolver = registry.resolver() + first = resolver.lookup("http://example.com/") + second = first.resolver.lookup("#/children/0") + third = second.resolver.lookup("grandchild") + fourth = third.resolver.lookup("http://example.com/two") + assert list(fourth.resolver.dynamic_scope()) == [ + ("http://example.com/child/grandchild", fourth.resolver._registry), + ("http://example.com/child/", fourth.resolver._registry), + ("http://example.com/", fourth.resolver._registry), + ] + assert list(third.resolver.dynamic_scope()) == [ + ("http://example.com/child/", third.resolver._registry), + ("http://example.com/", third.resolver._registry), + ] + assert list(second.resolver.dynamic_scope()) == [ + ("http://example.com/", second.resolver._registry), + ] + assert list(first.resolver.dynamic_scope()) == [] + + +class TestSpecification: + def test_create_resource(self): + specification = Specification( + name="", + id_of=lambda contents: "urn:fixedID", + subresources_of=lambda contents: [], + anchors_in=lambda specification, contents: [], + maybe_in_subresource=( + lambda segments, resolver, subresource: resolver + ), + ) + resource = specification.create_resource(contents={"foo": "baz"}) + assert resource == Resource( + contents={"foo": "baz"}, + specification=specification, + ) + assert resource.id() == "urn:fixedID" + + def test_detect_from_json_schema(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + specification = Specification.detect(schema) + assert specification == DRAFT202012 + + def test_detect_with_no_discernible_information(self): + with pytest.raises(exceptions.CannotDetermineSpecification): + Specification.detect({"foo": "bar"}) + + def test_detect_with_non_URI_schema(self): + with pytest.raises(exceptions.CannotDetermineSpecification): + Specification.detect({"$schema": 37}) + + def test_detect_with_no_discernible_information_and_default(self): + specification = Specification.OPAQUE.detect({"foo": "bar"}) + assert specification is Specification.OPAQUE + + def test_detect_unneeded_default(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + specification = Specification.OPAQUE.detect(schema) + assert specification == DRAFT202012 + + def test_non_mapping_detect(self): + with pytest.raises(exceptions.CannotDetermineSpecification): + Specification.detect(True) + + def test_non_mapping_detect_with_default(self): + specification = ID_AND_CHILDREN.detect(True) + assert specification is ID_AND_CHILDREN + + def test_detect_with_fallback(self): + specification = Specification.OPAQUE.detect({"foo": "bar"}) + assert specification is Specification.OPAQUE + + def test_repr(self): + assert ( + repr(ID_AND_CHILDREN) == "" + ) + + +class TestOpaqueSpecification: + THINGS = [{"foo": "bar"}, True, 37, "foo", object()] + + @pytest.mark.parametrize("thing", THINGS) + def test_no_id(self, thing): + """ + An arbitrary thing has no ID. + """ + + assert Specification.OPAQUE.id_of(thing) is None + + @pytest.mark.parametrize("thing", THINGS) + def test_no_subresources(self, thing): + """ + An arbitrary thing has no subresources. + """ + + assert list(Specification.OPAQUE.subresources_of(thing)) == [] + + @pytest.mark.parametrize("thing", THINGS) + def test_no_anchors(self, thing): + """ + An arbitrary thing has no anchors. + """ + + assert list(Specification.OPAQUE.anchors_in(thing)) == [] + + +@pytest.mark.parametrize( + "cls", + [Anchor, Registry, Resource, Specification, exceptions.PointerToNowhere], +) +def test_nonsubclassable(cls): + with pytest.raises(Exception, match="(?i)subclassing"): + + class Boom(cls): # pragma: no cover + pass diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_exceptions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..85cf99ecdd86c86e84df0b64f24aec6c447f4c08 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_exceptions.py @@ -0,0 +1,34 @@ +import itertools + +import pytest + +from referencing import Resource, exceptions + + +def pairs(choices): + return itertools.combinations(choices, 2) + + +TRUE = Resource.opaque(True) + + +thunks = ( + lambda: exceptions.CannotDetermineSpecification(TRUE), + lambda: exceptions.NoSuchResource("urn:example:foo"), + lambda: exceptions.NoInternalID(TRUE), + lambda: exceptions.InvalidAnchor(resource=TRUE, anchor="foo", ref="a#b"), + lambda: exceptions.NoSuchAnchor(resource=TRUE, anchor="foo", ref="a#b"), + lambda: exceptions.PointerToNowhere(resource=TRUE, ref="urn:example:foo"), + lambda: exceptions.Unresolvable("urn:example:foo"), + lambda: exceptions.Unretrievable("urn:example:foo"), +) + + +@pytest.mark.parametrize("one, two", pairs(each() for each in thunks)) +def test_eq_incompatible_types(one, two): + assert one != two + + +@pytest.mark.parametrize("thunk", thunks) +def test_hash(thunk): + assert thunk() in {thunk()} diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_jsonschema.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_jsonschema.py new file mode 100644 index 0000000000000000000000000000000000000000..c80714d0132bebbec33401f42a2e06aee3fed9c6 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_jsonschema.py @@ -0,0 +1,382 @@ +import pytest + +from referencing import Registry, Resource, Specification +import referencing.jsonschema + + +@pytest.mark.parametrize( + "uri, expected", + [ + ( + "https://json-schema.org/draft/2020-12/schema", + referencing.jsonschema.DRAFT202012, + ), + ( + "https://json-schema.org/draft/2019-09/schema", + referencing.jsonschema.DRAFT201909, + ), + ( + "http://json-schema.org/draft-07/schema#", + referencing.jsonschema.DRAFT7, + ), + ( + "http://json-schema.org/draft-06/schema#", + referencing.jsonschema.DRAFT6, + ), + ( + "http://json-schema.org/draft-04/schema#", + referencing.jsonschema.DRAFT4, + ), + ( + "http://json-schema.org/draft-03/schema#", + referencing.jsonschema.DRAFT3, + ), + ], +) +def test_schemas_with_explicit_schema_keywords_are_detected(uri, expected): + """ + The $schema keyword in JSON Schema is a dialect identifier. + """ + contents = {"$schema": uri} + resource = Resource.from_contents(contents) + assert resource == Resource(contents=contents, specification=expected) + + +def test_unknown_dialect(): + dialect_id = "http://example.com/unknown-json-schema-dialect-id" + with pytest.raises(referencing.jsonschema.UnknownDialect) as excinfo: + Resource.from_contents({"$schema": dialect_id}) + assert excinfo.value.uri == dialect_id + + +@pytest.mark.parametrize( + "id, specification", + [ + ("$id", referencing.jsonschema.DRAFT202012), + ("$id", referencing.jsonschema.DRAFT201909), + ("$id", referencing.jsonschema.DRAFT7), + ("$id", referencing.jsonschema.DRAFT6), + ("id", referencing.jsonschema.DRAFT4), + ("id", referencing.jsonschema.DRAFT3), + ], +) +def test_id_of_mapping(id, specification): + uri = "http://example.com/some-schema" + assert specification.id_of({id: uri}) == uri + + +@pytest.mark.parametrize( + "specification", + [ + referencing.jsonschema.DRAFT202012, + referencing.jsonschema.DRAFT201909, + referencing.jsonschema.DRAFT7, + referencing.jsonschema.DRAFT6, + ], +) +@pytest.mark.parametrize("value", [True, False]) +def test_id_of_bool(specification, value): + assert specification.id_of(value) is None + + +@pytest.mark.parametrize( + "specification", + [ + referencing.jsonschema.DRAFT202012, + referencing.jsonschema.DRAFT201909, + referencing.jsonschema.DRAFT7, + referencing.jsonschema.DRAFT6, + ], +) +@pytest.mark.parametrize("value", [True, False]) +def test_anchors_in_bool(specification, value): + assert list(specification.anchors_in(value)) == [] + + +@pytest.mark.parametrize( + "specification", + [ + referencing.jsonschema.DRAFT202012, + referencing.jsonschema.DRAFT201909, + referencing.jsonschema.DRAFT7, + referencing.jsonschema.DRAFT6, + ], +) +@pytest.mark.parametrize("value", [True, False]) +def test_subresources_of_bool(specification, value): + assert list(specification.subresources_of(value)) == [] + + +@pytest.mark.parametrize( + "uri, expected", + [ + ( + "https://json-schema.org/draft/2020-12/schema", + referencing.jsonschema.DRAFT202012, + ), + ( + "https://json-schema.org/draft/2019-09/schema", + referencing.jsonschema.DRAFT201909, + ), + ( + "http://json-schema.org/draft-07/schema#", + referencing.jsonschema.DRAFT7, + ), + ( + "http://json-schema.org/draft-06/schema#", + referencing.jsonschema.DRAFT6, + ), + ( + "http://json-schema.org/draft-04/schema#", + referencing.jsonschema.DRAFT4, + ), + ( + "http://json-schema.org/draft-03/schema#", + referencing.jsonschema.DRAFT3, + ), + ], +) +def test_specification_with(uri, expected): + assert referencing.jsonschema.specification_with(uri) == expected + + +@pytest.mark.parametrize( + "uri, expected", + [ + ( + "http://json-schema.org/draft-07/schema", + referencing.jsonschema.DRAFT7, + ), + ( + "http://json-schema.org/draft-06/schema", + referencing.jsonschema.DRAFT6, + ), + ( + "http://json-schema.org/draft-04/schema", + referencing.jsonschema.DRAFT4, + ), + ( + "http://json-schema.org/draft-03/schema", + referencing.jsonschema.DRAFT3, + ), + ], +) +def test_specification_with_no_empty_fragment(uri, expected): + assert referencing.jsonschema.specification_with(uri) == expected + + +def test_specification_with_unknown_dialect(): + dialect_id = "http://example.com/unknown-json-schema-dialect-id" + with pytest.raises(referencing.jsonschema.UnknownDialect) as excinfo: + referencing.jsonschema.specification_with(dialect_id) + assert excinfo.value.uri == dialect_id + + +def test_specification_with_default(): + dialect_id = "http://example.com/unknown-json-schema-dialect-id" + specification = referencing.jsonschema.specification_with( + dialect_id, + default=Specification.OPAQUE, + ) + assert specification is Specification.OPAQUE + + +# FIXME: The tests below should move to the referencing suite but I haven't yet +# figured out how to represent dynamic (& recursive) ref lookups in it. +def test_lookup_trivial_dynamic_ref(): + one = referencing.jsonschema.DRAFT202012.create_resource( + {"$dynamicAnchor": "foo"}, + ) + resolver = Registry().with_resource("http://example.com", one).resolver() + resolved = resolver.lookup("http://example.com#foo") + assert resolved.contents == one.contents + + +def test_multiple_lookup_trivial_dynamic_ref(): + TRUE = referencing.jsonschema.DRAFT202012.create_resource(True) + root = referencing.jsonschema.DRAFT202012.create_resource( + { + "$id": "http://example.com", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "foo": { + "$id": "foo", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "bar": True, + "baz": { + "$dynamicAnchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", root), + ("http://example.com/foo/", TRUE), + ("http://example.com/foo/bar", root), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = resolver.lookup("#fooAnchor") + assert fourth.contents == root.contents + + +def test_multiple_lookup_dynamic_ref_to_nondynamic_ref(): + one = referencing.jsonschema.DRAFT202012.create_resource( + {"$anchor": "fooAnchor"}, + ) + two = referencing.jsonschema.DRAFT202012.create_resource( + { + "$id": "http://example.com", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "foo": { + "$id": "foo", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "bar": True, + "baz": { + "$dynamicAnchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", two), + ("http://example.com/foo/", one), + ("http://example.com/foo/bar", two), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = resolver.lookup("#fooAnchor") + assert fourth.contents == two.contents + + +def test_lookup_trivial_recursive_ref(): + one = referencing.jsonschema.DRAFT201909.create_resource( + {"$recursiveAnchor": True}, + ) + resolver = Registry().with_resource("http://example.com", one).resolver() + first = resolver.lookup("http://example.com") + resolved = referencing.jsonschema.lookup_recursive_ref( + resolver=first.resolver, + ) + assert resolved.contents == one.contents + + +def test_lookup_recursive_ref_to_bool(): + TRUE = referencing.jsonschema.DRAFT201909.create_resource(True) + registry = Registry({"http://example.com": TRUE}) + resolved = referencing.jsonschema.lookup_recursive_ref( + resolver=registry.resolver(base_uri="http://example.com"), + ) + assert resolved.contents == TRUE.contents + + +def test_multiple_lookup_recursive_ref_to_bool(): + TRUE = referencing.jsonschema.DRAFT201909.create_resource(True) + root = referencing.jsonschema.DRAFT201909.create_resource( + { + "$id": "http://example.com", + "$recursiveAnchor": True, + "$defs": { + "foo": { + "$id": "foo", + "$recursiveAnchor": True, + "$defs": { + "bar": True, + "baz": { + "$recursiveAnchor": True, + "$anchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", root), + ("http://example.com/foo/", TRUE), + ("http://example.com/foo/bar", root), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver) + assert fourth.contents == root.contents + + +def test_multiple_lookup_recursive_ref_with_nonrecursive_ref(): + one = referencing.jsonschema.DRAFT201909.create_resource( + {"$recursiveAnchor": True}, + ) + two = referencing.jsonschema.DRAFT201909.create_resource( + { + "$id": "http://example.com", + "$recursiveAnchor": True, + "$defs": { + "foo": { + "$id": "foo", + "$recursiveAnchor": True, + "$defs": { + "bar": True, + "baz": { + "$recursiveAnchor": True, + "$anchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + three = referencing.jsonschema.DRAFT201909.create_resource( + {"$recursiveAnchor": False}, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", three), + ("http://example.com/foo/", two), + ("http://example.com/foo/bar", one), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver) + assert fourth.contents == two.contents + + +def test_empty_registry(): + assert referencing.jsonschema.EMPTY_REGISTRY == Registry() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_referencing_suite.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_referencing_suite.py new file mode 100644 index 0000000000000000000000000000000000000000..4b8ae9177c197456bb3bbd62d4c1875bc95ff28b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_referencing_suite.py @@ -0,0 +1,66 @@ +from pathlib import Path +import json +import os + +import pytest + +from referencing import Registry +from referencing.exceptions import Unresolvable +import referencing.jsonschema + + +class SuiteNotFound(Exception): + def __str__(self): # pragma: no cover + return ( + "Cannot find the referencing suite. " + "Set the REFERENCING_SUITE environment variable to the path to " + "the suite, or run the test suite from alongside a full checkout " + "of the git repository." + ) + + +if "REFERENCING_SUITE" in os.environ: # pragma: no cover + SUITE = Path(os.environ["REFERENCING_SUITE"]) / "tests" +else: + SUITE = Path(__file__).parent.parent.parent / "suite/tests" +if not SUITE.is_dir(): # pragma: no cover + raise SuiteNotFound() +DIALECT_IDS = json.loads(SUITE.joinpath("specifications.json").read_text()) + + +@pytest.mark.parametrize( + "test_path", + [ + pytest.param(each, id=f"{each.parent.name}-{each.stem}") + for each in SUITE.glob("*/**/*.json") + ], +) +def test_referencing_suite(test_path, subtests): + dialect_id = DIALECT_IDS[test_path.relative_to(SUITE).parts[0]] + specification = referencing.jsonschema.specification_with(dialect_id) + loaded = json.loads(test_path.read_text()) + registry = loaded["registry"] + registry = Registry().with_resources( + (uri, specification.create_resource(contents)) + for uri, contents in loaded["registry"].items() + ) + for test in loaded["tests"]: + with subtests.test(test=test): + if "normalization" in test_path.stem: + pytest.xfail("APIs need to change for proper URL support.") + + resolver = registry.resolver(base_uri=test.get("base_uri", "")) + + if test.get("error"): + with pytest.raises(Unresolvable): + resolver.lookup(test["ref"]) + else: + resolved = resolver.lookup(test["ref"]) + assert resolved.contents == test["target"] + + then = test.get("then") + while then: # pragma: no cover + with subtests.test(test=test, then=then): + resolved = resolved.resolver.lookup(then["ref"]) + assert resolved.contents == then["target"] + then = then.get("then") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_retrieval.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_retrieval.py new file mode 100644 index 0000000000000000000000000000000000000000..d0a8f8ad9975d1a760bca14dea7b60d41fb8ea75 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/tests/test_retrieval.py @@ -0,0 +1,106 @@ +from functools import lru_cache +import json + +import pytest + +from referencing import Registry, Resource, exceptions +from referencing.jsonschema import DRAFT202012 +from referencing.retrieval import to_cached_resource + + +class TestToCachedResource: + def test_it_caches_retrieved_resources(self): + contents = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + stack = [json.dumps(contents)] + + @to_cached_resource() + def retrieve(uri): + return stack.pop() + + registry = Registry(retrieve=retrieve) + + expected = Resource.from_contents(contents) + + got = registry.get_or_retrieve("urn:example:schema") + assert got.value == expected + + # And a second time we get the same value. + again = registry.get_or_retrieve("urn:example:schema") + assert again.value is got.value + + def test_custom_loader(self): + contents = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + stack = [json.dumps(contents)[::-1]] + + @to_cached_resource(loads=lambda s: json.loads(s[::-1])) + def retrieve(uri): + return stack.pop() + + registry = Registry(retrieve=retrieve) + + expected = Resource.from_contents(contents) + + got = registry.get_or_retrieve("urn:example:schema") + assert got.value == expected + + # And a second time we get the same value. + again = registry.get_or_retrieve("urn:example:schema") + assert again.value is got.value + + def test_custom_from_contents(self): + contents = {} + stack = [json.dumps(contents)] + + @to_cached_resource(from_contents=DRAFT202012.create_resource) + def retrieve(uri): + return stack.pop() + + registry = Registry(retrieve=retrieve) + + expected = DRAFT202012.create_resource(contents) + + got = registry.get_or_retrieve("urn:example:schema") + assert got.value == expected + + # And a second time we get the same value. + again = registry.get_or_retrieve("urn:example:schema") + assert again.value is got.value + + def test_custom_cache(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + mapping = { + "urn:example:1": dict(schema, foo=1), + "urn:example:2": dict(schema, foo=2), + "urn:example:3": dict(schema, foo=3), + } + + resources = { + uri: Resource.from_contents(contents) + for uri, contents in mapping.items() + } + + @to_cached_resource(cache=lru_cache(maxsize=2)) + def retrieve(uri): + return json.dumps(mapping.pop(uri)) + + registry = Registry(retrieve=retrieve) + + got = registry.get_or_retrieve("urn:example:1") + assert got.value == resources["urn:example:1"] + assert registry.get_or_retrieve("urn:example:1").value is got.value + assert registry.get_or_retrieve("urn:example:1").value is got.value + + got = registry.get_or_retrieve("urn:example:2") + assert got.value == resources["urn:example:2"] + assert registry.get_or_retrieve("urn:example:2").value is got.value + assert registry.get_or_retrieve("urn:example:2").value is got.value + + # This still succeeds, but evicts the first URI + got = registry.get_or_retrieve("urn:example:3") + assert got.value == resources["urn:example:3"] + assert registry.get_or_retrieve("urn:example:3").value is got.value + assert registry.get_or_retrieve("urn:example:3").value is got.value + + # And now this fails (as we popped the value out of `mapping`) + with pytest.raises(exceptions.Unretrievable): + registry.get_or_retrieve("urn:example:1") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/typing.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/typing.py new file mode 100644 index 0000000000000000000000000000000000000000..a61446417e68e8e397346b14e8525cc9062f1c59 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/referencing/typing.py @@ -0,0 +1,61 @@ +""" +Type-annotation related support for the referencing library. +""" + +from __future__ import annotations + +from collections.abc import Mapping as Mapping +from typing import TYPE_CHECKING, Any, Protocol + +try: + from typing_extensions import TypeVar +except ImportError: # pragma: no cover + from typing import TypeVar + +if TYPE_CHECKING: + from referencing._core import Resolved, Resolver, Resource + +#: A URI which identifies a `Resource`. +URI = str + +#: The type of documents within a registry. +D = TypeVar("D", default=Any) + + +class Retrieve(Protocol[D]): + """ + A retrieval callable, usable within a `Registry` for resource retrieval. + + Does not make assumptions about where the resource might be coming from. + """ + + def __call__(self, uri: URI) -> Resource[D]: + """ + Retrieve the resource with the given URI. + + Raise `referencing.exceptions.NoSuchResource` if you wish to indicate + the retriever cannot lookup the given URI. + """ + ... + + +class Anchor(Protocol[D]): + """ + An anchor within a `Resource`. + + Beyond "simple" anchors, some specifications like JSON Schema's 2020 + version have dynamic anchors. + """ + + @property + def name(self) -> str: + """ + Return the name of this anchor. + """ + ... + + def resolve(self, resolver: Resolver[D]) -> Resolved[D]: + """ + Return the resource for this anchor. + """ + ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..2cd94f0d6c138d4b84bf070e71cff2284512179d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/METADATA @@ -0,0 +1,1058 @@ +Metadata-Version: 2.4 +Name: regex +Version: 2026.5.9 +Summary: Alternative regular expression module, to replace re. +Author-email: Matthew Barnett +License-Expression: Apache-2.0 AND CNRI-Python +Project-URL: Homepage, https://github.com/mrabarnett/mrab-regex +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Topic :: Scientific/Engineering :: Information Analysis +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Text Processing +Classifier: Topic :: Text Processing :: General +Requires-Python: >=3.10 +Description-Content-Type: text/x-rst +License-File: LICENSE.txt +Dynamic: license-file + +Introduction +------------ + +This regex implementation is backwards-compatible with the standard 're' module, but offers additional functionality. + +Python 2 +-------- + +Python 2 is no longer supported. The last release that supported Python 2 was 2021.11.10. + +PyPy +---- + +This module is targeted at CPython. It expects that all codepoints are the same width, so it won't behave properly with PyPy outside U+0000..U+007F because PyPy stores strings as UTF-8. + +Multithreading +-------------- + +The regex module releases the GIL during matching on instances of the built-in (immutable) string classes, enabling other Python threads to run concurrently. It is also possible to force the regex module to release the GIL during matching by calling the matching methods with the keyword argument ``concurrent=True``. The behaviour is undefined if the string changes during matching, so use it *only* when it is guaranteed that that won't happen. + +Unicode +------- + +This module supports Unicode 17.0.0. Full Unicode case-folding is supported. + +Flags +----- + +There are 2 kinds of flag: scoped and global. Scoped flags can apply to only part of a pattern and can be turned on or off; global flags apply to the entire pattern and can only be turned on. + +The scoped flags are: ``ASCII (?a)``, ``FULLCASE (?f)``, ``IGNORECASE (?i)``, ``LOCALE (?L)``, ``MULTILINE (?m)``, ``DOTALL (?s)``, ``UNICODE (?u)``, ``VERBOSE (?x)``, ``WORD (?w)``. + +The global flags are: ``BESTMATCH (?b)``, ``ENHANCEMATCH (?e)``, ``POSIX (?p)``, ``REVERSE (?r)``, ``VERSION0 (?V0)``, ``VERSION1 (?V1)``. + +If neither the ``ASCII``, ``LOCALE`` nor ``UNICODE`` flag is specified, it will default to ``UNICODE`` if the regex pattern is a Unicode string and ``ASCII`` if it's a bytestring. + +The ``ENHANCEMATCH`` flag makes fuzzy matching attempt to improve the fit of the next match that it finds. + +The ``BESTMATCH`` flag makes fuzzy matching search for the best match instead of the next match. + +Old vs new behaviour +-------------------- + +In order to be compatible with the re module, this module has 2 behaviours: + +* **Version 0** behaviour (old behaviour, compatible with the re module): + + Please note that the re module's behaviour may change over time, and I'll endeavour to match that behaviour in version 0. + + * Indicated by the ``VERSION0`` flag. + + * Zero-width matches are not handled correctly in the re module before Python 3.7. The behaviour in those earlier versions is: + + * ``.split`` won't split a string at a zero-width match. + + * ``.sub`` will advance by one character after a zero-width match. + + * Inline flags apply to the entire pattern, and they can't be turned off. + + * Only simple sets are supported. + + * Case-insensitive matches in Unicode use simple case-folding by default. + +* **Version 1** behaviour (new behaviour, possibly different from the re module): + + * Indicated by the ``VERSION1`` flag. + + * Zero-width matches are handled correctly. + + * Inline flags apply to the end of the group or pattern, and they can be turned off. + + * Nested sets and set operations are supported. + + * Case-insensitive matches in Unicode use full case-folding by default. + +If no version is specified, the regex module will default to ``regex.DEFAULT_VERSION``. + +Case-insensitive matches in Unicode +----------------------------------- + +The regex module supports both simple and full case-folding for case-insensitive matches in Unicode. Use of full case-folding can be turned on using the ``FULLCASE`` flag. Please note that this flag affects how the ``IGNORECASE`` flag works; the ``FULLCASE`` flag itself does not turn on case-insensitive matching. + +Version 0 behaviour: the flag is off by default. + +Version 1 behaviour: the flag is on by default. + +Nested sets and set operations +------------------------------ + +It's not possible to support both simple sets, as used in the re module, and nested sets at the same time because of a difference in the meaning of an unescaped ``"["`` in a set. + +For example, the pattern ``[[a-z]--[aeiou]]`` is treated in the version 0 behaviour (simple sets, compatible with the re module) as: + +* Set containing "[" and the letters "a" to "z" + +* Literal "--" + +* Set containing letters "a", "e", "i", "o", "u" + +* Literal "]" + +but in the version 1 behaviour (nested sets, enhanced behaviour) as: + +* Set which is: + + * Set containing the letters "a" to "z" + +* but excluding: + + * Set containing the letters "a", "e", "i", "o", "u" + +Version 0 behaviour: only simple sets are supported. + +Version 1 behaviour: nested sets and set operations are supported. + +Notes on named groups +--------------------- + +All groups have a group number, starting from 1. + +Groups with the same group name will have the same group number, and groups with a different group name will have a different group number. + +The same name can be used by more than one group, with later captures 'overwriting' earlier captures. All the captures of the group will be available from the ``captures`` method of the match object. + +Group numbers will be reused across different branches of a branch reset, eg. ``(?|(first)|(second))`` has only group 1. If groups have different group names then they will, of course, have different group numbers, eg. ``(?|(?Pfirst)|(?Psecond))`` has group 1 ("foo") and group 2 ("bar"). + +In the regex ``(\s+)(?|(?P[A-Z]+)|(\w+) (?P[0-9]+)`` there are 2 groups: + +* ``(\s+)`` is group 1. + +* ``(?P[A-Z]+)`` is group 2, also called "foo". + +* ``(\w+)`` is group 2 because of the branch reset. + +* ``(?P[0-9]+)`` is group 2 because it's called "foo". + +If you want to prevent ``(\w+)`` from being group 2, you need to name it (different name, different group number). + +Additional features +------------------- + +The issue numbers relate to the Python bug tracker, except where listed otherwise. + +Added ``\p{Horiz_Space}`` and ``\p{Vert_Space}`` (`GitHub issue 477 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``\p{Horiz_Space}`` or ``\p{H}`` matches horizontal whitespace and ``\p{Vert_Space}`` or ``\p{V}`` matches vertical whitespace. + +Added support for lookaround in conditional pattern (`Hg issue 163 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The test of a conditional pattern can be a lookaround. + +.. sourcecode:: python + + >>> regex.match(r'(?(?=\d)\d+|\w+)', '123abc') + + >>> regex.match(r'(?(?=\d)\d+|\w+)', 'abc123') + + +This is not quite the same as putting a lookaround in the first branch of a pair of alternatives. + +.. sourcecode:: python + + >>> print(regex.match(r'(?:(?=\d)\d+\b|\w+)', '123abc')) + + >>> print(regex.match(r'(?(?=\d)\d+\b|\w+)', '123abc')) + None + +In the first example, the lookaround matched, but the remainder of the first branch failed to match, and so the second branch was attempted, whereas in the second example, the lookaround matched, and the first branch failed to match, but the second branch was **not** attempted. + +Added POSIX matching (leftmost longest) (`Hg issue 150 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The POSIX standard for regex is to return the leftmost longest match. This can be turned on using the ``POSIX`` flag. + +.. sourcecode:: python + + >>> # Normal matching. + >>> regex.search(r'Mr|Mrs', 'Mrs') + + >>> regex.search(r'one(self)?(selfsufficient)?', 'oneselfsufficient') + + >>> # POSIX matching. + >>> regex.search(r'(?p)Mr|Mrs', 'Mrs') + + >>> regex.search(r'(?p)one(self)?(selfsufficient)?', 'oneselfsufficient') + + +Note that it will take longer to find matches because when it finds a match at a certain position, it won't return that immediately, but will keep looking to see if there's another longer match there. + +Added ``(?(DEFINE)...)`` (`Hg issue 152 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If there's no group called "DEFINE", then ... will be ignored except that any groups defined within it can be called and that the normal rules for numbering groups still apply. + +.. sourcecode:: python + + >>> regex.search(r'(?(DEFINE)(?P\d+)(?P\w+))(?&quant) (?&item)', '5 elephants') + + +Added ``(*PRUNE)``, ``(*SKIP)`` and ``(*FAIL)`` (`Hg issue 153 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``(*PRUNE)`` discards the backtracking info up to that point. When used in an atomic group or a lookaround, it won't affect the enclosing pattern. + +``(*SKIP)`` is similar to ``(*PRUNE)``, except that it also sets where in the text the next attempt to match will start. When used in an atomic group or a lookaround, it won't affect the enclosing pattern. + +``(*FAIL)`` causes immediate backtracking. ``(*F)`` is a permitted abbreviation. + +Added ``\K`` (`Hg issue 151 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Keeps the part of the entire match after the position where ``\K`` occurred; the part before it is discarded. + +It does not affect what groups return. + +.. sourcecode:: python + + >>> m = regex.search(r'(\w\w\K\w\w\w)', 'abcdef') + >>> m[0] + 'cde' + >>> m[1] + 'abcde' + >>> + >>> m = regex.search(r'(?r)(\w\w\K\w\w\w)', 'abcdef') + >>> m[0] + 'bc' + >>> m[1] + 'bcdef' + +Added capture subscripting for ``expandf`` and ``subf``/``subfn`` (`Hg issue 133 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can use subscripting to get the captures of a repeated group. + +.. sourcecode:: python + + >>> m = regex.match(r"(\w)+", "abc") + >>> m.expandf("{1}") + 'c' + >>> m.expandf("{1[0]} {1[1]} {1[2]}") + 'a b c' + >>> m.expandf("{1[-1]} {1[-2]} {1[-3]}") + 'c b a' + >>> + >>> m = regex.match(r"(?P\w)+", "abc") + >>> m.expandf("{letter}") + 'c' + >>> m.expandf("{letter[0]} {letter[1]} {letter[2]}") + 'a b c' + >>> m.expandf("{letter[-1]} {letter[-2]} {letter[-3]}") + 'c b a' + +Added support for referring to a group by number using ``(?P=...)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This is in addition to the existing ``\g<...>``. + +Fixed the handling of locale-sensitive regexes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``LOCALE`` flag is intended for legacy code and has limited support. You're still recommended to use Unicode instead. + +Added partial matches (`Hg issue 102 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A partial match is one that matches up to the end of string, but that string has been truncated and you want to know whether a complete match could be possible if the string had not been truncated. + +Partial matches are supported by ``match``, ``search``, ``fullmatch`` and ``finditer`` with the ``partial`` keyword argument. + +Match objects have a ``partial`` attribute, which is ``True`` if it's a partial match. + +For example, if you wanted a user to enter a 4-digit number and check it character by character as it was being entered: + +.. sourcecode:: python + + >>> pattern = regex.compile(r'\d{4}') + + >>> # Initially, nothing has been entered: + >>> print(pattern.fullmatch('', partial=True)) + + + >>> # An empty string is OK, but it's only a partial match. + >>> # The user enters a letter: + >>> print(pattern.fullmatch('a', partial=True)) + None + >>> # It'll never match. + + >>> # The user deletes that and enters a digit: + >>> print(pattern.fullmatch('1', partial=True)) + + >>> # It matches this far, but it's only a partial match. + + >>> # The user enters 2 more digits: + >>> print(pattern.fullmatch('123', partial=True)) + + >>> # It matches this far, but it's only a partial match. + + >>> # The user enters another digit: + >>> print(pattern.fullmatch('1234', partial=True)) + + >>> # It's a complete match. + + >>> # If the user enters another digit: + >>> print(pattern.fullmatch('12345', partial=True)) + None + >>> # It's no longer a match. + + >>> # This is a partial match: + >>> pattern.match('123', partial=True).partial + True + + >>> # This is a complete match: + >>> pattern.match('1233', partial=True).partial + False + +``*`` operator not working correctly with sub() (`Hg issue 106 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Sometimes it's not clear how zero-width matches should be handled. For example, should ``.*`` match 0 characters directly after matching >0 characters? + +.. sourcecode:: python + + >>> regex.sub('.*', 'x', 'test') + 'xx' + >>> regex.sub('.*?', '|', 'test') + '|||||||||' + +Added ``capturesdict`` (`Hg issue 86 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``capturesdict`` is a combination of ``groupdict`` and ``captures``: + +``groupdict`` returns a dict of the named groups and the last capture of those groups. + +``captures`` returns a list of all the captures of a group + +``capturesdict`` returns a dict of the named groups and lists of all the captures of those groups. + +.. sourcecode:: python + + >>> m = regex.match(r"(?:(?P\w+) (?P\d+)\n)+", "one 1\ntwo 2\nthree 3\n") + >>> m.groupdict() + {'word': 'three', 'digits': '3'} + >>> m.captures("word") + ['one', 'two', 'three'] + >>> m.captures("digits") + ['1', '2', '3'] + >>> m.capturesdict() + {'word': ['one', 'two', 'three'], 'digits': ['1', '2', '3']} + +Added ``allcaptures`` and ``allspans`` (`Git issue 474 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``allcaptures`` returns a list of all the captures of all the groups. + +``allspans`` returns a list of all the spans of the all captures of all the groups. + +.. sourcecode:: python + + >>> m = regex.match(r"(?:(?P\w+) (?P\d+)\n)+", "one 1\ntwo 2\nthree 3\n") + >>> m.allcaptures() + (['one 1\ntwo 2\nthree 3\n'], ['one', 'two', 'three'], ['1', '2', '3']) + >>> m.allspans() + ([(0, 20)], [(0, 3), (6, 9), (12, 17)], [(4, 5), (10, 11), (18, 19)]) + +Allow duplicate names of groups (`Hg issue 87 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Group names can be duplicated. + +.. sourcecode:: python + + >>> # With optional groups: + >>> + >>> # Both groups capture, the second capture 'overwriting' the first. + >>> m = regex.match(r"(?P\w+)? or (?P\w+)?", "first or second") + >>> m.group("item") + 'second' + >>> m.captures("item") + ['first', 'second'] + >>> # Only the second group captures. + >>> m = regex.match(r"(?P\w+)? or (?P\w+)?", " or second") + >>> m.group("item") + 'second' + >>> m.captures("item") + ['second'] + >>> # Only the first group captures. + >>> m = regex.match(r"(?P\w+)? or (?P\w+)?", "first or ") + >>> m.group("item") + 'first' + >>> m.captures("item") + ['first'] + >>> + >>> # With mandatory groups: + >>> + >>> # Both groups capture, the second capture 'overwriting' the first. + >>> m = regex.match(r"(?P\w*) or (?P\w*)?", "first or second") + >>> m.group("item") + 'second' + >>> m.captures("item") + ['first', 'second'] + >>> # Again, both groups capture, the second capture 'overwriting' the first. + >>> m = regex.match(r"(?P\w*) or (?P\w*)", " or second") + >>> m.group("item") + 'second' + >>> m.captures("item") + ['', 'second'] + >>> # And yet again, both groups capture, the second capture 'overwriting' the first. + >>> m = regex.match(r"(?P\w*) or (?P\w*)", "first or ") + >>> m.group("item") + '' + >>> m.captures("item") + ['first', ''] + +Added ``fullmatch`` (`issue #16203 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``fullmatch`` behaves like ``match``, except that it must match all of the string. + +.. sourcecode:: python + + >>> print(regex.fullmatch(r"abc", "abc").span()) + (0, 3) + >>> print(regex.fullmatch(r"abc", "abcx")) + None + >>> print(regex.fullmatch(r"abc", "abcx", endpos=3).span()) + (0, 3) + >>> print(regex.fullmatch(r"abc", "xabcy", pos=1, endpos=4).span()) + (1, 4) + >>> + >>> regex.match(r"a.*?", "abcd").group(0) + 'a' + >>> regex.fullmatch(r"a.*?", "abcd").group(0) + 'abcd' + +Added ``subf`` and ``subfn`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``subf`` and ``subfn`` are alternatives to ``sub`` and ``subn`` respectively. When passed a replacement string, they treat it as a format string. + +.. sourcecode:: python + + >>> regex.subf(r"(\w+) (\w+)", "{0} => {2} {1}", "foo bar") + 'foo bar => bar foo' + >>> regex.subf(r"(?P\w+) (?P\w+)", "{word2} {word1}", "foo bar") + 'bar foo' + +Added ``expandf`` to match object +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``expandf`` is an alternative to ``expand``. When passed a replacement string, it treats it as a format string. + +.. sourcecode:: python + + >>> m = regex.match(r"(\w+) (\w+)", "foo bar") + >>> m.expandf("{0} => {2} {1}") + 'foo bar => bar foo' + >>> + >>> m = regex.match(r"(?P\w+) (?P\w+)", "foo bar") + >>> m.expandf("{word2} {word1}") + 'bar foo' + +Detach searched string +^^^^^^^^^^^^^^^^^^^^^^ + +A match object contains a reference to the string that was searched, via its ``string`` attribute. The ``detach_string`` method will 'detach' that string, making it available for garbage collection, which might save valuable memory if that string is very large. + +.. sourcecode:: python + + >>> m = regex.search(r"\w+", "Hello world") + >>> print(m.group()) + Hello + >>> print(m.string) + Hello world + >>> m.detach_string() + >>> print(m.group()) + Hello + >>> print(m.string) + None + +Recursive patterns (`Hg issue 27 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Recursive and repeated patterns are supported. + +``(?R)`` or ``(?0)`` tries to match the entire regex recursively. ``(?1)``, ``(?2)``, etc, try to match the relevant group. + +``(?&name)`` tries to match the named group. + +.. sourcecode:: python + + >>> regex.match(r"(Tarzan|Jane) loves (?1)", "Tarzan loves Jane").groups() + ('Tarzan',) + >>> regex.match(r"(Tarzan|Jane) loves (?1)", "Jane loves Tarzan").groups() + ('Jane',) + + >>> m = regex.search(r"(\w)(?:(?R)|(\w?))\1", "kayak") + >>> m.group(0, 1, 2) + ('kayak', 'k', None) + +The first two examples show how the subpattern within the group is reused, but is _not_ itself a group. In other words, ``"(Tarzan|Jane) loves (?1)"`` is equivalent to ``"(Tarzan|Jane) loves (?:Tarzan|Jane)"``. + +It's possible to backtrack into a recursed or repeated group. + +You can't call a group if there is more than one group with that group name or group number (``"ambiguous group reference"``). + +The alternative forms ``(?P>name)`` and ``(?P&name)`` are also supported. + +Full Unicode case-folding is supported +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In version 1 behaviour, the regex module uses full case-folding when performing case-insensitive matches in Unicode. + +.. sourcecode:: python + + >>> regex.match(r"(?iV1)strasse", "stra\N{LATIN SMALL LETTER SHARP S}e").span() + (0, 6) + >>> regex.match(r"(?iV1)stra\N{LATIN SMALL LETTER SHARP S}e", "STRASSE").span() + (0, 7) + +In version 0 behaviour, it uses simple case-folding for backward compatibility with the re module. + +Approximate "fuzzy" matching (`Hg issue 12 `_, `Hg issue 41 `_, `Hg issue 109 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Regex usually attempts an exact match, but sometimes an approximate, or "fuzzy", match is needed, for those cases where the text being searched may contain errors in the form of inserted, deleted or substituted characters. + +A fuzzy regex specifies which types of errors are permitted, and, optionally, either the minimum and maximum or only the maximum permitted number of each type. (You cannot specify only a minimum.) + +The 3 types of error are: + +* Insertion, indicated by "i" + +* Deletion, indicated by "d" + +* Substitution, indicated by "s" + +In addition, "e" indicates any type of error. + +The fuzziness of a regex item is specified between "{" and "}" after the item. + +Examples: + +* ``foo`` match "foo" exactly + +* ``(?:foo){i}`` match "foo", permitting insertions + +* ``(?:foo){d}`` match "foo", permitting deletions + +* ``(?:foo){s}`` match "foo", permitting substitutions + +* ``(?:foo){i,s}`` match "foo", permitting insertions and substitutions + +* ``(?:foo){e}`` match "foo", permitting errors + +If a certain type of error is specified, then any type not specified will **not** be permitted. + +In the following examples I'll omit the item and write only the fuzziness: + +* ``{d<=3}`` permit at most 3 deletions, but no other types + +* ``{i<=1,s<=2}`` permit at most 1 insertion and at most 2 substitutions, but no deletions + +* ``{1<=e<=3}`` permit at least 1 and at most 3 errors + +* ``{i<=2,d<=2,e<=3}`` permit at most 2 insertions, at most 2 deletions, at most 3 errors in total, but no substitutions + +It's also possible to state the costs of each type of error and the maximum permitted total cost. + +Examples: + +* ``{2i+2d+1s<=4}`` each insertion costs 2, each deletion costs 2, each substitution costs 1, the total cost must not exceed 4 + +* ``{i<=1,d<=1,s<=1,2i+2d+1s<=4}`` at most 1 insertion, at most 1 deletion, at most 1 substitution; each insertion costs 2, each deletion costs 2, each substitution costs 1, the total cost must not exceed 4 + +You can also use "<" instead of "<=" if you want an exclusive minimum or maximum. + +You can add a test to perform on a character that's substituted or inserted. + +Examples: + +* ``{s<=2:[a-z]}`` at most 2 substitutions, which must be in the character set ``[a-z]``. + +* ``{s<=2,i<=3:\d}`` at most 2 substitutions, at most 3 insertions, which must be digits. + +By default, fuzzy matching searches for the first match that meets the given constraints. The ``ENHANCEMATCH`` flag will cause it to attempt to improve the fit (i.e. reduce the number of errors) of the match that it has found. + +The ``BESTMATCH`` flag will make it search for the best match instead. + +Further examples to note: + +* ``regex.search("(dog){e}", "cat and dog")[1]`` returns ``"cat"`` because that matches ``"dog"`` with 3 errors (an unlimited number of errors is permitted). + +* ``regex.search("(dog){e<=1}", "cat and dog")[1]`` returns ``" dog"`` (with a leading space) because that matches ``"dog"`` with 1 error, which is within the limit. + +* ``regex.search("(?e)(dog){e<=1}", "cat and dog")[1]`` returns ``"dog"`` (without a leading space) because the fuzzy search matches ``" dog"`` with 1 error, which is within the limit, and the ``(?e)`` then it attempts a better fit. + +In the first two examples there are perfect matches later in the string, but in neither case is it the first possible match. + +The match object has an attribute ``fuzzy_counts`` which gives the total number of substitutions, insertions and deletions. + +.. sourcecode:: python + + >>> # A 'raw' fuzzy match: + >>> regex.fullmatch(r"(?:cats|cat){e<=1}", "cat").fuzzy_counts + (0, 0, 1) + >>> # 0 substitutions, 0 insertions, 1 deletion. + + >>> # A better match might be possible if the ENHANCEMATCH flag used: + >>> regex.fullmatch(r"(?e)(?:cats|cat){e<=1}", "cat").fuzzy_counts + (0, 0, 0) + >>> # 0 substitutions, 0 insertions, 0 deletions. + +The match object also has an attribute ``fuzzy_changes`` which gives a tuple of the positions of the substitutions, insertions and deletions. + +.. sourcecode:: python + + >>> m = regex.search('(fuu){i<=2,d<=2,e<=5}', 'anaconda foo bar') + >>> m + + >>> m.fuzzy_changes + ([], [7, 8], [10, 11]) + +What this means is that if the matched part of the string had been: + +.. sourcecode:: python + + 'anacondfuuoo bar' + +it would've been an exact match. + +However, there were insertions at positions 7 and 8: + +.. sourcecode:: python + + 'anaconda fuuoo bar' + ^^ + +and deletions at positions 10 and 11: + +.. sourcecode:: python + + 'anaconda f~~oo bar' + ^^ + +So the actual string was: + +.. sourcecode:: python + + 'anaconda foo bar' + +Named lists ``\L`` (`Hg issue 11 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +There are occasions where you may want to include a list (actually, a set) of options in a regex. + +One way is to build the pattern like this: + +.. sourcecode:: python + + >>> p = regex.compile(r"first|second|third|fourth|fifth") + +but if the list is large, parsing the resulting regex can take considerable time, and care must also be taken that the strings are properly escaped and properly ordered, for example, "cats" before "cat". + +The new alternative is to use a named list: + +.. sourcecode:: python + + >>> option_set = ["first", "second", "third", "fourth", "fifth"] + >>> p = regex.compile(r"\L", options=option_set) + +The order of the items is irrelevant, they are treated as a set. The named lists are available as the ``.named_lists`` attribute of the pattern object : + +.. sourcecode:: python + + >>> print(p.named_lists) + {'options': frozenset({'third', 'first', 'fifth', 'fourth', 'second'})} + +If there are any unused keyword arguments, ``ValueError`` will be raised unless you tell it otherwise: + +.. sourcecode:: python + + >>> option_set = ["first", "second", "third", "fourth", "fifth"] + >>> p = regex.compile(r"\L", options=option_set, other_options=[]) + Traceback (most recent call last): + File "", line 1, in + File "C:\Python310\lib\site-packages\regex\regex.py", line 353, in compile + return _compile(pattern, flags, ignore_unused, kwargs, cache_pattern) + File "C:\Python310\lib\site-packages\regex\regex.py", line 500, in _compile + complain_unused_args() + File "C:\Python310\lib\site-packages\regex\regex.py", line 483, in complain_unused_args + raise ValueError('unused keyword argument {!a}'.format(any_one)) + ValueError: unused keyword argument 'other_options' + >>> p = regex.compile(r"\L", options=option_set, other_options=[], ignore_unused=True) + >>> p = regex.compile(r"\L", options=option_set, other_options=[], ignore_unused=False) + Traceback (most recent call last): + File "", line 1, in + File "C:\Python310\lib\site-packages\regex\regex.py", line 353, in compile + return _compile(pattern, flags, ignore_unused, kwargs, cache_pattern) + File "C:\Python310\lib\site-packages\regex\regex.py", line 500, in _compile + complain_unused_args() + File "C:\Python310\lib\site-packages\regex\regex.py", line 483, in complain_unused_args + raise ValueError('unused keyword argument {!a}'.format(any_one)) + ValueError: unused keyword argument 'other_options' + >>> + +Start and end of word +^^^^^^^^^^^^^^^^^^^^^ + +``\m`` matches at the start of a word. + +``\M`` matches at the end of a word. + +Compare with ``\b``, which matches at the start or end of a word. + +Unicode line separators +^^^^^^^^^^^^^^^^^^^^^^^ + +Normally the only line separator is ``\n`` (``\x0A``), but if the ``WORD`` flag is turned on then the line separators are ``\x0D\x0A``, ``\x0A``, ``\x0B``, ``\x0C`` and ``\x0D``, plus ``\x85``, ``\u2028`` and ``\u2029`` when working with Unicode. + +This affects the regex dot ``"."``, which, with the ``DOTALL`` flag turned off, matches any character except a line separator. It also affects the line anchors ``^`` and ``$`` (in multiline mode). + +Set operators +^^^^^^^^^^^^^ + +**Version 1 behaviour only** + +Set operators have been added, and a set ``[...]`` can include nested sets. + +The operators, in order of increasing precedence, are: + +* ``||`` for union ("x||y" means "x or y") + +* ``~~`` (double tilde) for symmetric difference ("x~~y" means "x or y, but not both") + +* ``&&`` for intersection ("x&&y" means "x and y") + +* ``--`` (double dash) for difference ("x--y" means "x but not y") + +Implicit union, ie, simple juxtaposition like in ``[ab]``, has the highest precedence. Thus, ``[ab&&cd]`` is the same as ``[[a||b]&&[c||d]]``. + +Examples: + +* ``[ab]`` # Set containing 'a' and 'b' + +* ``[a-z]`` # Set containing 'a' .. 'z' + +* ``[[a-z]--[qw]]`` # Set containing 'a' .. 'z', but not 'q' or 'w' + +* ``[a-z--qw]`` # Same as above + +* ``[\p{L}--QW]`` # Set containing all letters except 'Q' and 'W' + +* ``[\p{N}--[0-9]]`` # Set containing all numbers except '0' .. '9' + +* ``[\p{ASCII}&&\p{Letter}]`` # Set containing all characters which are ASCII and letter + +regex.escape (`issue #2650 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +regex.escape has an additional keyword parameter ``special_only``. When True, only 'special' regex characters, such as '?', are escaped. + +.. sourcecode:: python + + >>> regex.escape("foo!?", special_only=False) + 'foo\\!\\?' + >>> regex.escape("foo!?", special_only=True) + 'foo!\\?' + +regex.escape (`Hg issue 249 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +regex.escape has an additional keyword parameter ``literal_spaces``. When True, spaces are not escaped. + +.. sourcecode:: python + + >>> regex.escape("foo bar!?", literal_spaces=False) + 'foo\\ bar!\\?' + >>> regex.escape("foo bar!?", literal_spaces=True) + 'foo bar!\\?' + +Repeated captures (`issue #7132 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A match object has additional methods which return information on all the successful matches of a repeated group. These methods are: + +* ``matchobject.captures([group1, ...])`` + + * Returns a list of the strings matched in a group or groups. Compare with ``matchobject.group([group1, ...])``. + +* ``matchobject.starts([group])`` + + * Returns a list of the start positions. Compare with ``matchobject.start([group])``. + +* ``matchobject.ends([group])`` + + * Returns a list of the end positions. Compare with ``matchobject.end([group])``. + +* ``matchobject.spans([group])`` + + * Returns a list of the spans. Compare with ``matchobject.span([group])``. + +.. sourcecode:: python + + >>> m = regex.search(r"(\w{3})+", "123456789") + >>> m.group(1) + '789' + >>> m.captures(1) + ['123', '456', '789'] + >>> m.start(1) + 6 + >>> m.starts(1) + [0, 3, 6] + >>> m.end(1) + 9 + >>> m.ends(1) + [3, 6, 9] + >>> m.span(1) + (6, 9) + >>> m.spans(1) + [(0, 3), (3, 6), (6, 9)] + +Atomic grouping ``(?>...)`` (`issue #433030 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If the following pattern subsequently fails, then the subpattern as a whole will fail. + +Possessive quantifiers +^^^^^^^^^^^^^^^^^^^^^^ + +``(?:...)?+`` ; ``(?:...)*+`` ; ``(?:...)++`` ; ``(?:...){min,max}+`` + +The subpattern is matched up to 'max' times. If the following pattern subsequently fails, then all the repeated subpatterns will fail as a whole. For example, ``(?:...)++`` is equivalent to ``(?>(?:...)+)``. + +Scoped flags (`issue #433028 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``(?flags-flags:...)`` + +The flags will apply only to the subpattern. Flags can be turned on or off. + +Definition of 'word' character (`issue #1693050 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The definition of a 'word' character has been expanded for Unicode. It conforms to the Unicode specification at ``http://www.unicode.org/reports/tr29/``. + +Variable-length lookbehind +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A lookbehind can match a variable-length string. + +Flags argument for regex.split, regex.sub and regex.subn (`issue #3482 `_) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``regex.split``, ``regex.sub`` and ``regex.subn`` support a 'flags' argument. + +Pos and endpos arguments for regex.sub and regex.subn +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``regex.sub`` and ``regex.subn`` support 'pos' and 'endpos' arguments. + +'Overlapped' argument for regex.findall and regex.finditer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``regex.findall`` and ``regex.finditer`` support an 'overlapped' flag which permits overlapped matches. + +Splititer +^^^^^^^^^ + +``regex.splititer`` has been added. It's a generator equivalent of ``regex.split``. + +Subscripting match objects for groups +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A match object accepts access to the groups via subscripting and slicing: + +.. sourcecode:: python + + >>> m = regex.search(r"(?P.*?)(?P\d+)(?P.*)", "pqr123stu") + >>> print(m["before"]) + pqr + >>> print(len(m)) + 4 + >>> print(m[:]) + ('pqr123stu', 'pqr', '123', 'stu') + +Named groups +^^^^^^^^^^^^ + +Groups can be named with ``(?...)`` as well as the existing ``(?P...)``. + +Group references +^^^^^^^^^^^^^^^^ + +Groups can be referenced within a pattern with ``\g``. This also allows there to be more than 99 groups. + +Named characters ``\N{name}`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Named characters are supported. Note that only those known by Python's Unicode database will be recognised. + +Unicode codepoint properties, including scripts and blocks +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``\p{property=value}``; ``\P{property=value}``; ``\p{value}`` ; ``\P{value}`` + +Many Unicode properties are supported, including blocks and scripts. ``\p{property=value}`` or ``\p{property:value}`` matches a character whose property ``property`` has value ``value``. The inverse of ``\p{property=value}`` is ``\P{property=value}`` or ``\p{^property=value}``. + +If the short form ``\p{value}`` is used, the properties are checked in the order: ``General_Category``, ``Script``, ``Block``, binary property: + +* ``Latin``, the 'Latin' script (``Script=Latin``). + +* ``BasicLatin``, the 'BasicLatin' block (``Block=BasicLatin``). + +* ``Alphabetic``, the 'Alphabetic' binary property (``Alphabetic=Yes``). + +A short form starting with ``Is`` indicates a script or binary property: + +* ``IsLatin``, the 'Latin' script (``Script=Latin``). + +* ``IsAlphabetic``, the 'Alphabetic' binary property (``Alphabetic=Yes``). + +A short form starting with ``In`` indicates a block property: + +* ``InBasicLatin``, the 'BasicLatin' block (``Block=BasicLatin``). + +POSIX character classes +^^^^^^^^^^^^^^^^^^^^^^^ + +``[[:alpha:]]``; ``[[:^alpha:]]`` + +POSIX character classes are supported. These are normally treated as an alternative form of ``\p{...}``. + +The exceptions are ``alnum``, ``digit``, ``punct`` and ``xdigit``, whose definitions are different from those of Unicode. + +``[[:alnum:]]`` is equivalent to ``\p{posix_alnum}``. + +``[[:digit:]]`` is equivalent to ``\p{posix_digit}``. + +``[[:punct:]]`` is equivalent to ``\p{posix_punct}``. + +``[[:xdigit:]]`` is equivalent to ``\p{posix_xdigit}``. + +Search anchor ``\G`` +^^^^^^^^^^^^^^^^^^^^ + +A search anchor has been added. It matches at the position where each search started/continued and can be used for contiguous matches or in negative variable-length lookbehinds to limit how far back the lookbehind goes: + +.. sourcecode:: python + + >>> regex.findall(r"\w{2}", "abcd ef") + ['ab', 'cd', 'ef'] + >>> regex.findall(r"\G\w{2}", "abcd ef") + ['ab', 'cd'] + +* The search starts at position 0 and matches 'ab'. + +* The search continues at position 2 and matches 'cd'. + +* The search continues at position 4 and fails to match any letters. + +* The anchor stops the search start position from being advanced, so there are no more results. + +Reverse searching +^^^^^^^^^^^^^^^^^ + +Searches can also work backwards: + +.. sourcecode:: python + + >>> regex.findall(r".", "abc") + ['a', 'b', 'c'] + >>> regex.findall(r"(?r).", "abc") + ['c', 'b', 'a'] + +Note that the result of a reverse search is not necessarily the reverse of a forward search: + +.. sourcecode:: python + + >>> regex.findall(r"..", "abcde") + ['ab', 'cd'] + >>> regex.findall(r"(?r)..", "abcde") + ['de', 'bc'] + +Matching a single grapheme ``\X`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The grapheme matcher is supported. It conforms to the Unicode specification at ``http://www.unicode.org/reports/tr29/``. + +Branch reset ``(?|...|...)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Group numbers will be reused across the alternatives, but groups with different names will have different group numbers. + +.. sourcecode:: python + + >>> regex.match(r"(?|(first)|(second))", "first").groups() + ('first',) + >>> regex.match(r"(?|(first)|(second))", "second").groups() + ('second',) + +Note that there is only one group. + +Default Unicode word boundary +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``WORD`` flag changes the definition of a 'word boundary' to that of a default Unicode word boundary. This applies to ``\b`` and ``\B``. + +Timeout +^^^^^^^ + +The matching methods and functions support timeouts. The timeout (in seconds) applies to the entire operation: + +.. sourcecode:: python + + >>> from time import sleep + >>> + >>> def fast_replace(m): + ... return 'X' + ... + >>> def slow_replace(m): + ... sleep(0.5) + ... return 'X' + ... + >>> regex.sub(r'[a-z]', fast_replace, 'abcde', timeout=2) + 'XXXXX' + >>> regex.sub(r'[a-z]', slow_replace, 'abcde', timeout=2) + Traceback (most recent call last): + File "", line 1, in + File "C:\Python310\lib\site-packages\regex\regex.py", line 278, in sub + return pat.sub(repl, string, count, pos, endpos, concurrent, timeout) + TimeoutError: regex timed out diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..eb3a9c7597d34d5471808ba60e1b261a5b0fbc45 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/RECORD @@ -0,0 +1,15 @@ +regex-2026.5.9.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +regex-2026.5.9.dist-info/METADATA,sha256=zClpBqb8hpfsq6IATH51Ovzje0AzTpN7bQyCUvUD6K0,41475 +regex-2026.5.9.dist-info/RECORD,, +regex-2026.5.9.dist-info/WHEEL,sha256=XHXMKJU3yoVh1ZanBXTJ5bDGb67oEYtF1S6bd8a4izI,101 +regex-2026.5.9.dist-info/licenses/LICENSE.txt,sha256=PSIMBllLgmu6vxEDEvYPOF-Z5X5Sn6S55Tb3kJH4tMc,11792 +regex-2026.5.9.dist-info/top_level.txt,sha256=aQmiDMhNTF26cCK4_7D-qaVvhbxClG0wyCTnEhkzYBs,6 +regex/__init__.py,sha256=K0DzoWlqFh5039Pujrkm1NZ_rc2xhRenbfBthB06W48,78 +regex/__pycache__/__init__.cpython-311.pyc,, +regex/__pycache__/_main.cpython-311.pyc,, +regex/__pycache__/_regex_core.cpython-311.pyc,, +regex/_main.py,sha256=gSKX-L2SfBI5lkiCrbH9vg4osRb-9IRUgt3tMs7oVrU,34099 +regex/_regex.cp311-win_amd64.pyd,sha256=5Zv8OLr1xSTIyDVDrCCLo9CkysrrS8i8d6KMGA3tsvg,727040 +regex/_regex_core.py,sha256=JqytYkXE_iuuDc_nmNHlvOqyZU-Lr-u4FSki2zPzM8s,152050 +regex/tests/__pycache__/test_regex.cpython-311.pyc,, +regex/tests/test_regex.py,sha256=6eTTXBYB12CNVIklDLs4PpYhgzlV_7HysBgCBwqsato,230349 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..75a83ab128f69c4cd27d9a5be479a52a2597d3d1 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (82.0.1) +Root-Is-Purelib: false +Tag: cp311-cp311-win_amd64 + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/licenses/LICENSE.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..989a872fa6be338f3e91ddb87e107104d370f57a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/licenses/LICENSE.txt @@ -0,0 +1,208 @@ +This work was derived from the 're' module of CPython 2.6 and CPython 3.1, +copyright (c) 1998-2001 by Secret Labs AB and licensed under CNRI's Python 1.6 +license. + +All additions and alterations are licensed under the Apache 2.0 License. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Matthew Barnett + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/top_level.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f9256d62325c75de027d1cd48f1ff520117413e --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex-2026.5.9.dist-info/top_level.txt @@ -0,0 +1 @@ +regex diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a09c5be0ca624842db12ba39ce4f0d8d890b3a0f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__init__.py @@ -0,0 +1,3 @@ +import regex._main +from regex._main import * +__all__ = regex._main.__all__ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb3dd2d3d90bef86d8adf4174d4f010849668e6e Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__pycache__/_main.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__pycache__/_main.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09fa6d5d47a261f2e5dd325a4a5dd9e276b83528 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/__pycache__/_main.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/_main.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/_main.py new file mode 100644 index 0000000000000000000000000000000000000000..56c7a21dae35da605e32d2e97b35f0a0af4d11bd --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/_main.py @@ -0,0 +1,756 @@ +# +# Secret Labs' Regular Expression Engine +# +# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. +# +# This version of the SRE library can be redistributed under CNRI's +# Python 1.6 license. For any other use, please contact Secret Labs +# AB (info@pythonware.com). +# +# Portions of this engine have been developed in cooperation with +# CNRI. Hewlett-Packard provided funding for 1.6 integration and +# other compatibility work. +# +# 2010-01-16 mrab Python front-end re-written and extended + +r"""Support for regular expressions (RE). + +This module provides regular expression matching operations similar to those +found in Perl. It supports both 8-bit and Unicode strings; both the pattern and +the strings being processed can contain null bytes and characters outside the +US ASCII range. + +Regular expressions can contain both special and ordinary characters. Most +ordinary characters, like "A", "a", or "0", are the simplest regular +expressions; they simply match themselves. You can concatenate ordinary +characters, so last matches the string 'last'. + +There are a few differences between the old (legacy) behaviour and the new +(enhanced) behaviour, which are indicated by VERSION0 or VERSION1. + +The special characters are: + "." Matches any character except a newline. + "^" Matches the start of the string. + "$" Matches the end of the string or just before the + newline at the end of the string. + "*" Matches 0 or more (greedy) repetitions of the preceding + RE. Greedy means that it will match as many repetitions + as possible. + "+" Matches 1 or more (greedy) repetitions of the preceding + RE. + "?" Matches 0 or 1 (greedy) of the preceding RE. + *?,+?,?? Non-greedy versions of the previous three special + characters. + *+,++,?+ Possessive versions of the previous three special + characters. + {m,n} Matches from m to n repetitions of the preceding RE. + {m,n}? Non-greedy version of the above. + {m,n}+ Possessive version of the above. + {...} Fuzzy matching constraints. + "\\" Either escapes special characters or signals a special + sequence. + [...] Indicates a set of characters. A "^" as the first + character indicates a complementing set. + "|" A|B, creates an RE that will match either A or B. + (...) Matches the RE inside the parentheses. The contents are + captured and can be retrieved or matched later in the + string. + (?flags-flags) VERSION1: Sets/clears the flags for the remainder of + the group or pattern; VERSION0: Sets the flags for the + entire pattern. + (?:...) Non-capturing version of regular parentheses. + (?>...) Atomic non-capturing version of regular parentheses. + (?flags-flags:...) Non-capturing version of regular parentheses with local + flags. + (?P...) The substring matched by the group is accessible by + name. + (?...) The substring matched by the group is accessible by + name. + (?P=name) Matches the text matched earlier by the group named + name. + (?#...) A comment; ignored. + (?=...) Matches if ... matches next, but doesn't consume the + string. + (?!...) Matches if ... doesn't match next. + (?<=...) Matches if preceded by .... + (? Matches the text matched by the group named name. + \G Matches the empty string, but only at the position where + the search started. + \h Matches horizontal whitespace. + \K Keeps only what follows for the entire match. + \L Named list. The list is provided as a keyword argument. + \m Matches the empty string, but only at the start of a word. + \M Matches the empty string, but only at the end of a word. + \n Matches the newline character. + \N{name} Matches the named character. + \p{name=value} Matches the character if its property has the specified + value. + \P{name=value} Matches the character if its property hasn't the specified + value. + \r Matches the carriage-return character. + \s Matches any whitespace character; equivalent to + [ \t\n\r\f\v]. + \S Matches any non-whitespace character; equivalent to [^\s]. + \t Matches the tab character. + \uXXXX Matches the Unicode codepoint with 4-digit hex code XXXX. + \UXXXXXXXX Matches the Unicode codepoint with 8-digit hex code + XXXXXXXX. + \v Matches the vertical tab character. + \w Matches any alphanumeric character; equivalent to + [a-zA-Z0-9_] when matching a bytestring or a Unicode string + with the ASCII flag, or the whole range of Unicode + alphanumeric characters (letters plus digits plus + underscore) when matching a Unicode string. With LOCALE, it + will match the set [0-9_] plus characters defined as + letters for the current locale. + \W Matches the complement of \w; equivalent to [^\w]. + \xXX Matches the character with 2-digit hex code XX. + \X Matches a grapheme. + \Z Matches only at the end of the string. + \z Matches only at the end of the string. Alias of \Z. + \\ Matches a literal backslash. + +This module exports the following functions: + match Match a regular expression pattern at the beginning of a string. + prefixmatch Match a regular expression pattern at the beginning of a string. + Alias of match. + fullmatch Match a regular expression pattern against all of a string. + search Search a string for the presence of a pattern. + sub Substitute occurrences of a pattern found in a string using a + template string. + subf Substitute occurrences of a pattern found in a string using a + format string. + subn Same as sub, but also return the number of substitutions made. + subfn Same as subf, but also return the number of substitutions made. + split Split a string by the occurrences of a pattern. VERSION1: will + split at zero-width match; VERSION0: won't split at zero-width + match. + splititer Return an iterator yielding the parts of a split string. + findall Find all occurrences of a pattern in a string. + finditer Return an iterator yielding a match object for each match. + compile Compile a pattern into a Pattern object. + purge Clear the regular expression cache. + escape Backslash all non-alphanumerics or special characters in a + string. + +Most of the functions support a concurrent parameter: if True, the GIL will be +released during matching, allowing other Python threads to run concurrently. If +the string changes during matching, the behaviour is undefined. This parameter +is not needed when working on the builtin (immutable) string classes. + +Some of the functions in this module take flags as optional parameters. Most of +these flags can also be set within an RE: + A a ASCII Make \w, \W, \b, \B, \d, and \D match the + corresponding ASCII character categories. Default + when matching a bytestring. + B b BESTMATCH Find the best fuzzy match (default is first). + D DEBUG Print the parsed pattern. + E e ENHANCEMATCH Attempt to improve the fit after finding the first + fuzzy match. + F f FULLCASE Use full case-folding when performing + case-insensitive matching in Unicode. + I i IGNORECASE Perform case-insensitive matching. + L L LOCALE Make \w, \W, \b, \B, \d, and \D dependent on the + current locale. (One byte per character only.) + M m MULTILINE "^" matches the beginning of lines (after a newline) + as well as the string. "$" matches the end of lines + (before a newline) as well as the end of the string. + P p POSIX Perform POSIX-standard matching (leftmost longest). + R r REVERSE Searches backwards. + S s DOTALL "." matches any character at all, including the + newline. + U u UNICODE Make \w, \W, \b, \B, \d, and \D dependent on the + Unicode locale. Default when matching a Unicode + string. + V0 V0 VERSION0 Turn on the old legacy behaviour. + V1 V1 VERSION1 Turn on the new enhanced behaviour. This flag + includes the FULLCASE flag. + W w WORD Make \b and \B work with default Unicode word breaks + and make ".", "^" and "$" work with Unicode line + breaks. + X x VERBOSE Ignore whitespace and comments for nicer looking REs. + +This module also defines an exception 'error'. + +""" + +# Public symbols. +__all__ = ["cache_all", "compile", "DEFAULT_VERSION", "escape", "findall", + "finditer", "fullmatch", "match", "prefixmatch", "purge", "search", "split", "splititer", + "sub", "subf", "subfn", "subn", "template", "Scanner", "A", "ASCII", "B", + "BESTMATCH", "D", "DEBUG", "E", "ENHANCEMATCH", "S", "DOTALL", "F", + "FULLCASE", "I", "IGNORECASE", "L", "LOCALE", "M", "MULTILINE", "P", "POSIX", + "R", "REVERSE", "T", "TEMPLATE", "U", "UNICODE", "V0", "VERSION0", "V1", + "VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__", + "__doc__", "RegexFlag"] + +__version__ = "2026.5.9" + +# -------------------------------------------------------------------- +# Public interface. + +def match(pattern, string, flags=0, pos=None, endpos=None, partial=False, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Try to apply the pattern at the start of the string, returning a match + object, or None if no match was found.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.match(string, pos, endpos, concurrent, partial, timeout) + +def prefixmatch(pattern, string, flags=0, pos=None, endpos=None, partial=False, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Try to apply the pattern at the start of the string, returning a match + object, or None if no match was found. Alias of match().""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.match(string, pos, endpos, concurrent, partial, timeout) + +def fullmatch(pattern, string, flags=0, pos=None, endpos=None, partial=False, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Try to apply the pattern against all of the string, returning a match + object, or None if no match was found.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.fullmatch(string, pos, endpos, concurrent, partial, timeout) + +def search(pattern, string, flags=0, pos=None, endpos=None, partial=False, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Search through string looking for a match to the pattern, returning a + match object, or None if no match was found.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.search(string, pos, endpos, concurrent, partial, timeout) + +def sub(pattern, repl, string, count=0, flags=0, pos=None, endpos=None, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Return the string obtained by replacing the leftmost (or rightmost with a + reverse pattern) non-overlapping occurrences of the pattern in string by the + replacement repl. repl can be either a string or a callable; if a string, + backslash escapes in it are processed; if a callable, it's passed the match + object and must return a replacement string to be used.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.sub(repl, string, count, pos, endpos, concurrent, timeout) + +def subf(pattern, format, string, count=0, flags=0, pos=None, endpos=None, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Return the string obtained by replacing the leftmost (or rightmost with a + reverse pattern) non-overlapping occurrences of the pattern in string by the + replacement format. format can be either a string or a callable; if a string, + it's treated as a format string; if a callable, it's passed the match object + and must return a replacement string to be used.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.subf(format, string, count, pos, endpos, concurrent, timeout) + +def subn(pattern, repl, string, count=0, flags=0, pos=None, endpos=None, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Return a 2-tuple containing (new_string, number). new_string is the string + obtained by replacing the leftmost (or rightmost with a reverse pattern) + non-overlapping occurrences of the pattern in the source string by the + replacement repl. number is the number of substitutions that were made. repl + can be either a string or a callable; if a string, backslash escapes in it + are processed; if a callable, it's passed the match object and must return a + replacement string to be used.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.subn(repl, string, count, pos, endpos, concurrent, timeout) + +def subfn(pattern, format, string, count=0, flags=0, pos=None, endpos=None, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Return a 2-tuple containing (new_string, number). new_string is the string + obtained by replacing the leftmost (or rightmost with a reverse pattern) + non-overlapping occurrences of the pattern in the source string by the + replacement format. number is the number of substitutions that were made. format + can be either a string or a callable; if a string, it's treated as a format + string; if a callable, it's passed the match object and must return a + replacement string to be used.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.subfn(format, string, count, pos, endpos, concurrent, timeout) + +def split(pattern, string, maxsplit=0, flags=0, concurrent=None, timeout=None, + ignore_unused=False, **kwargs): + """Split the source string by the occurrences of the pattern, returning a + list containing the resulting substrings. If capturing parentheses are used + in pattern, then the text of all groups in the pattern are also returned as + part of the resulting list. If maxsplit is nonzero, at most maxsplit splits + occur, and the remainder of the string is returned as the final element of + the list.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.split(string, maxsplit, concurrent, timeout) + +def splititer(pattern, string, maxsplit=0, flags=0, concurrent=None, + timeout=None, ignore_unused=False, **kwargs): + "Return an iterator yielding the parts of a split string." + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.splititer(string, maxsplit, concurrent, timeout) + +def findall(pattern, string, flags=0, pos=None, endpos=None, overlapped=False, + concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Return a list of all matches in the string. The matches may be overlapped + if overlapped is True. If one or more groups are present in the pattern, + return a list of groups; this will be a list of tuples if the pattern has + more than one group. Empty matches are included in the result.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.findall(string, pos, endpos, overlapped, concurrent, timeout) + +def finditer(pattern, string, flags=0, pos=None, endpos=None, overlapped=False, + partial=False, concurrent=None, timeout=None, ignore_unused=False, **kwargs): + """Return an iterator over all matches in the string. The matches may be + overlapped if overlapped is True. For each match, the iterator returns a + match object. Empty matches are included in the result.""" + pat = _compile(pattern, flags, ignore_unused, kwargs, True) + return pat.finditer(string, pos, endpos, overlapped, concurrent, partial, + timeout) + +def compile(pattern, flags=0, ignore_unused=False, cache_pattern=None, **kwargs): + "Compile a regular expression pattern, returning a pattern object." + if cache_pattern is None: + cache_pattern = _cache_all + return _compile(pattern, flags, ignore_unused, kwargs, cache_pattern) + +def purge(): + "Clear the regular expression cache" + _cache.clear() + _locale_sensitive.clear() + +# Whether to cache all patterns. +_cache_all = True + +def cache_all(value=True): + """Sets whether to cache all patterns, even those are compiled explicitly. + Passing None has no effect, but returns the current setting.""" + global _cache_all + + if value is None: + return _cache_all + + _cache_all = value + +def template(pattern, flags=0): + "Compile a template pattern, returning a pattern object." + return _compile(pattern, flags | TEMPLATE, False, {}, False) + +def escape(pattern, special_only=True, literal_spaces=False): + """Escape a string for use as a literal in a pattern. If special_only is + True, escape only special characters, else escape all non-alphanumeric + characters. If literal_spaces is True, don't escape spaces.""" + # Convert it to Unicode. + if isinstance(pattern, bytes): + p = pattern.decode("latin-1") + else: + p = pattern + + s = [] + if special_only: + for c in p: + if c == " " and literal_spaces: + s.append(c) + elif c in _METACHARS or c.isspace(): + s.append("\\") + s.append(c) + else: + s.append(c) + else: + for c in p: + if c == " " and literal_spaces: + s.append(c) + elif c in _ALNUM: + s.append(c) + else: + s.append("\\") + s.append(c) + + r = "".join(s) + # Convert it back to bytes if necessary. + if isinstance(pattern, bytes): + r = r.encode("latin-1") + + return r + +# -------------------------------------------------------------------- +# Internals. + +from regex import _regex_core +from regex import _regex +from threading import RLock as _RLock +from locale import getpreferredencoding as _getpreferredencoding +from regex._regex_core import * +from regex._regex_core import (_ALL_VERSIONS, _ALL_ENCODINGS, _FirstSetError, + _UnscopedFlagSet, _check_group_features, _compile_firstset, + _compile_replacement, _flatten_code, _fold_case, _get_required_string, + _parse_pattern, _shrink_cache) +from regex._regex_core import (ALNUM as _ALNUM, Info as _Info, OP as _OP, Source + as _Source, Fuzzy as _Fuzzy) + +# Version 0 is the old behaviour, compatible with the original 're' module. +# Version 1 is the new behaviour, which differs slightly. + +DEFAULT_VERSION = RegexFlag.VERSION0 + +_METACHARS = frozenset("()[]{}?*+|^$\\.-#&~") + +_regex_core.DEFAULT_VERSION = DEFAULT_VERSION + +# Caches for the patterns and replacements. +_cache = {} +_cache_lock = _RLock() +_named_args = {} +_replacement_cache = {} +_locale_sensitive = {} + +# Maximum size of the cache. +_MAXCACHE = 500 +_MAXREPCACHE = 500 + +def _compile(pattern, flags, ignore_unused, kwargs, cache_it): + "Compiles a regular expression to a PatternObject." + + global DEFAULT_VERSION + try: + from regex import DEFAULT_VERSION + except ImportError: + pass + + # We won't bother to cache the pattern if we're debugging. + if (flags & DEBUG) != 0: + cache_it = False + + # What locale is this pattern using? + locale_key = (type(pattern), pattern) + if _locale_sensitive.get(locale_key, True) or (flags & LOCALE) != 0: + # This pattern is, or might be, locale-sensitive. + pattern_locale = _getpreferredencoding() + else: + # This pattern is definitely not locale-sensitive. + pattern_locale = None + + def complain_unused_args(): + if ignore_unused: + return + + # Complain about any unused keyword arguments, possibly resulting from a typo. + unused_kwargs = set(kwargs) - {k for k, v in args_needed} + if unused_kwargs: + any_one = next(iter(unused_kwargs)) + raise ValueError('unused keyword argument {!a}'.format(any_one)) + + if cache_it: + try: + # Do we know what keyword arguments are needed? + args_key = pattern, type(pattern), flags + args_needed = _named_args[args_key] + + # Are we being provided with its required keyword arguments? + args_supplied = set() + if args_needed: + for k, v in args_needed: + try: + args_supplied.add((k, frozenset(kwargs[k]))) + except KeyError: + raise error("missing named list: {!r}".format(k)) + + complain_unused_args() + + args_supplied = frozenset(args_supplied) + + # Have we already seen this regular expression and named list? + pattern_key = (pattern, type(pattern), flags, args_supplied, + DEFAULT_VERSION, pattern_locale) + return _cache[pattern_key] + except KeyError: + # It's a new pattern, or new named list for a known pattern. + pass + + # Guess the encoding from the class of the pattern string. + if isinstance(pattern, str): + guess_encoding = UNICODE + elif isinstance(pattern, bytes): + guess_encoding = ASCII + elif isinstance(pattern, Pattern): + if flags: + raise ValueError("cannot process flags argument with a compiled pattern") + + return pattern + else: + raise TypeError("first argument must be a string or compiled pattern") + + # Set the default version in the core code in case it has been changed. + _regex_core.DEFAULT_VERSION = DEFAULT_VERSION + + global_flags = flags + + while True: + caught_exception = None + try: + source = _Source(pattern) + info = _Info(global_flags, source.char_type, kwargs) + info.guess_encoding = guess_encoding + source.ignore_space = bool(info.flags & VERBOSE) + parsed = _parse_pattern(source, info) + break + except _UnscopedFlagSet: + # Remember the global flags for the next attempt. + global_flags = info.global_flags + except error as e: + caught_exception = e + + if caught_exception: + raise error(caught_exception.msg, caught_exception.pattern, + caught_exception.pos) + + if not source.at_end(): + raise error("unbalanced parenthesis", pattern, source.pos) + + # Check the global flags for conflicts. + version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION + if version not in (0, VERSION0, VERSION1): + raise ValueError("VERSION0 and VERSION1 flags are mutually incompatible") + + if (info.flags & _ALL_ENCODINGS) not in (0, ASCII, LOCALE, UNICODE): + raise ValueError("ASCII, LOCALE and UNICODE flags are mutually incompatible") + + if isinstance(pattern, bytes) and (info.flags & UNICODE): + raise ValueError("cannot use UNICODE flag with a bytes pattern") + + if not (info.flags & _ALL_ENCODINGS): + if isinstance(pattern, str): + info.flags |= UNICODE + else: + info.flags |= ASCII + + reverse = bool(info.flags & REVERSE) + fuzzy = isinstance(parsed, _Fuzzy) + + # Remember whether this pattern as an inline locale flag. + _locale_sensitive[locale_key] = info.inline_locale + + # Fix the group references. + caught_exception = None + try: + parsed.fix_groups(pattern, reverse, False) + except error as e: + caught_exception = e + + if caught_exception: + raise error(caught_exception.msg, caught_exception.pattern, + caught_exception.pos) + + # Should we print the parsed pattern? + if flags & DEBUG: + parsed.dump(indent=0, reverse=reverse) + + # Optimise the parsed pattern. + parsed = parsed.optimise(info, reverse) + parsed = parsed.pack_characters(info) + + # Get the required string. + req_offset, req_chars, req_flags = _get_required_string(parsed, info.flags) + + # Build the named lists. + named_lists = {} + named_list_indexes = [None] * len(info.named_lists_used) + args_needed = set() + for key, index in info.named_lists_used.items(): + name, case_flags = key + values = frozenset(kwargs[name]) + if case_flags: + items = frozenset(_fold_case(info, v) for v in values) + else: + items = values + named_lists[name] = values + named_list_indexes[index] = items + args_needed.add((name, values)) + + complain_unused_args() + + # Check the features of the groups. + _check_group_features(info, parsed) + + # Compile the parsed pattern. The result is a list of tuples. + code = parsed.compile(reverse) + + # Is there a group call to the pattern as a whole? + key = (0, reverse, fuzzy) + ref = info.call_refs.get(key) + if ref is not None: + code = [(_OP.CALL_REF, ref)] + code + [(_OP.END, )] + + # Add the final 'success' opcode. + code += [(_OP.SUCCESS, )] + + # Compile the additional copies of the groups that we need. + for group, rev, fuz in info.additional_groups: + code += group.compile(rev, fuz) + + # Flatten the code into a list of ints. + code = _flatten_code(code) + + if not parsed.has_simple_start(): + # Get the first set, if possible. + try: + fs_code = _compile_firstset(info, parsed.get_firstset(reverse)) + fs_code = _flatten_code(fs_code) + code = fs_code + code + except _FirstSetError: + pass + + # The named capture groups. + index_group = dict((v, n) for n, v in info.group_index.items()) + + # Create the PatternObject. + # + # Local flags like IGNORECASE affect the code generation, but aren't needed + # by the PatternObject itself. Conversely, global flags like LOCALE _don't_ + # affect the code generation but _are_ needed by the PatternObject. + compiled_pattern = _regex.compile(pattern, info.flags | version, code, + info.group_index, index_group, named_lists, named_list_indexes, + req_offset, req_chars, req_flags, info.group_count) + + # Do we need to reduce the size of the cache? + if len(_cache) >= _MAXCACHE: + with _cache_lock: + _shrink_cache(_cache, _named_args, _locale_sensitive, _MAXCACHE) + + if cache_it: + if (info.flags & LOCALE) == 0: + pattern_locale = None + + args_needed = frozenset(args_needed) + + # Store this regular expression and named list. + pattern_key = (pattern, type(pattern), flags, args_needed, + DEFAULT_VERSION, pattern_locale) + _cache[pattern_key] = compiled_pattern + + # Store what keyword arguments are needed. + _named_args[args_key] = args_needed + + return compiled_pattern + +def _compile_replacement_helper(pattern, template): + "Compiles a replacement template." + # This function is called by the _regex module. + + # Have we seen this before? + key = pattern.pattern, pattern.flags, template + compiled = _replacement_cache.get(key) + if compiled is not None: + return compiled + + if len(_replacement_cache) >= _MAXREPCACHE: + _replacement_cache.clear() + + is_unicode = isinstance(template, str) + source = _Source(template) + if is_unicode: + def make_string(char_codes): + return "".join(chr(c) for c in char_codes) + else: + def make_string(char_codes): + return bytes(char_codes) + + compiled = [] + literal = [] + while True: + ch = source.get() + if not ch: + break + if ch == "\\": + # '_compile_replacement' will return either an int group reference + # or a string literal. It returns items (plural) in order to handle + # a 2-character literal (an invalid escape sequence). + is_group, items = _compile_replacement(source, pattern, is_unicode) + if is_group: + # It's a group, so first flush the literal. + if literal: + compiled.append(make_string(literal)) + literal = [] + compiled.extend(items) + else: + literal.extend(items) + else: + literal.append(ord(ch)) + + # Flush the literal. + if literal: + compiled.append(make_string(literal)) + + _replacement_cache[key] = compiled + + return compiled + +# We define Pattern here after all the support objects have been defined. +_pat = _compile('', 0, False, {}, False) +Pattern = type(_pat) +Match = type(_pat.match('')) +del _pat + +# Make Pattern public for typing annotations. +__all__.append("Pattern") +__all__.append("Match") + +# We'll define an alias for the 'compile' function so that the repr of a +# pattern object is eval-able. +Regex = compile + +# Register myself for pickling. +import copyreg as _copy_reg + +def _pickle(pattern): + return _regex.compile, pattern._pickled_data + +_copy_reg.pickle(Pattern, _pickle) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/_regex_core.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/_regex_core.py new file mode 100644 index 0000000000000000000000000000000000000000..4f7bf12acddd4c5b7a4b4e7ca412548c459b8bf8 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/_regex_core.py @@ -0,0 +1,4676 @@ +# +# Secret Labs' Regular Expression Engine core module +# +# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. +# +# This version of the SRE library can be redistributed under CNRI's +# Python 1.6 license. For any other use, please contact Secret Labs +# AB (info@pythonware.com). +# +# Portions of this engine have been developed in cooperation with +# CNRI. Hewlett-Packard provided funding for 1.6 integration and +# other compatibility work. +# +# 2010-01-16 mrab Python front-end re-written and extended + +import enum +import string +import unicodedata +from collections import defaultdict + +from regex import _regex + +__all__ = ["A", "ASCII", "B", "BESTMATCH", "D", "DEBUG", "E", "ENHANCEMATCH", + "F", "FULLCASE", "I", "IGNORECASE", "L", "LOCALE", "M", "MULTILINE", "P", + "POSIX", "R", "REVERSE", "S", "DOTALL", "T", "TEMPLATE", "U", "UNICODE", + "V0", "VERSION0", "V1", "VERSION1", "W", "WORD", "X", "VERBOSE", "error", + "Scanner", "RegexFlag"] + +# The regex exception. +class error(Exception): + """Exception raised for invalid regular expressions. + + Attributes: + + msg: The unformatted error message + pattern: The regular expression pattern + pos: The position in the pattern where compilation failed, or None + lineno: The line number where compilation failed, unless pos is None + colno: The column number where compilation failed, unless pos is None + """ + + def __init__(self, message, pattern=None, pos=None): + newline = '\n' if isinstance(pattern, str) else b'\n' + self.msg = message + self.pattern = pattern + self.pos = pos + if pattern is not None and pos is not None: + self.lineno = pattern.count(newline, 0, pos) + 1 + self.colno = pos - pattern.rfind(newline, 0, pos) + + message = "{} at position {}".format(message, pos) + + if newline in pattern: + message += " (line {}, column {})".format(self.lineno, + self.colno) + + Exception.__init__(self, message) + +# The exception for when a positional flag has been turned on in the old +# behaviour. +class _UnscopedFlagSet(Exception): + pass + +# The exception for when parsing fails and we want to try something else. +class ParseError(Exception): + pass + +# The exception for when there isn't a valid first set. +class _FirstSetError(Exception): + pass + +# Flags. +class RegexFlag(enum.IntFlag): + A = ASCII = 0x80 # Assume ASCII locale. + B = BESTMATCH = 0x1000 # Best fuzzy match. + D = DEBUG = 0x200 # Print parsed pattern. + E = ENHANCEMATCH = 0x8000 # Attempt to improve the fit after finding the first + # fuzzy match. + F = FULLCASE = 0x4000 # Unicode full case-folding. + I = IGNORECASE = 0x2 # Ignore case. + L = LOCALE = 0x4 # Assume current 8-bit locale. + M = MULTILINE = 0x8 # Make anchors look for newline. + P = POSIX = 0x10000 # POSIX-style matching (leftmost longest). + R = REVERSE = 0x400 # Search backwards. + S = DOTALL = 0x10 # Make dot match newline. + U = UNICODE = 0x20 # Assume Unicode locale. + V0 = VERSION0 = 0x2000 # Old legacy behaviour. + V1 = VERSION1 = 0x100 # New enhanced behaviour. + W = WORD = 0x800 # Default Unicode word breaks. + X = VERBOSE = 0x40 # Ignore whitespace and comments. + T = TEMPLATE = 0x1 # Template (present because re module has it). + + def __repr__(self): + if self._name_ is not None: + return 'regex.%s' % self._name_ + + value = self._value_ + members = [] + negative = value < 0 + + if negative: + value = ~value + + for m in self.__class__: + if value & m._value_: + value &= ~m._value_ + members.append('regex.%s' % m._name_) + + if value: + members.append(hex(value)) + + res = '|'.join(members) + + if negative: + if len(members) > 1: + res = '~(%s)' % res + else: + res = '~%s' % res + + return res + + __str__ = object.__str__ + +# Put the flags into the module namespace. Being explicit here helps tools like +# linters and IDEs understand the code better. +ASCII = RegexFlag.ASCII +BESTMATCH = RegexFlag.BESTMATCH +DEBUG = RegexFlag.DEBUG +DOTALL = RegexFlag.DOTALL +ENHANCEMATCH = RegexFlag.ENHANCEMATCH +FULLCASE = RegexFlag.FULLCASE +IGNORECASE = RegexFlag.IGNORECASE +LOCALE = RegexFlag.LOCALE +MULTILINE = RegexFlag.MULTILINE +POSIX = RegexFlag.POSIX +REVERSE = RegexFlag.REVERSE +TEMPLATE = RegexFlag.TEMPLATE +UNICODE = RegexFlag.UNICODE +VERBOSE = RegexFlag.VERBOSE +VERSION0 = RegexFlag.VERSION0 +VERSION1 = RegexFlag.VERSION1 +WORD = RegexFlag.WORD +A = RegexFlag.A +B = RegexFlag.B +D = RegexFlag.D +E = RegexFlag.E +F = RegexFlag.F +I = RegexFlag.I +L = RegexFlag.L +M = RegexFlag.M +P = RegexFlag.P +R = RegexFlag.R +S = RegexFlag.S +U = RegexFlag.U +V0 = RegexFlag.V0 +V1 = RegexFlag.V1 +W = RegexFlag.W +X = RegexFlag.X +T = RegexFlag.T + +DEFAULT_VERSION = VERSION1 + +_ALL_VERSIONS = VERSION0 | VERSION1 +_ALL_ENCODINGS = ASCII | LOCALE | UNICODE + +# The default flags for the various versions. +DEFAULT_FLAGS = {VERSION0: 0, VERSION1: FULLCASE} + +# The mask for the flags. +GLOBAL_FLAGS = (_ALL_VERSIONS | BESTMATCH | DEBUG | ENHANCEMATCH | POSIX | + REVERSE) +SCOPED_FLAGS = (FULLCASE | IGNORECASE | MULTILINE | DOTALL | WORD | VERBOSE | + _ALL_ENCODINGS) + +ALPHA = frozenset(string.ascii_letters) +DIGITS = frozenset(string.digits) +ALNUM = ALPHA | DIGITS +OCT_DIGITS = frozenset(string.octdigits) +HEX_DIGITS = frozenset(string.hexdigits) +SPECIAL_CHARS = frozenset("()|?*+{^$.[\\#") | frozenset([""]) +NAMED_CHAR_PART = ALNUM | frozenset(" -") +PROPERTY_NAME_PART = ALNUM | frozenset(" &_-.") +SET_OPS = ("||", "~~", "&&", "--") + +# The width of the code words inside the regex engine. +BYTES_PER_CODE = _regex.get_code_size() +BITS_PER_CODE = BYTES_PER_CODE * 8 + +# The repeat count which represents infinity. +UNLIMITED = (1 << BITS_PER_CODE) - 1 + +# The regular expression flags. +REGEX_FLAGS = {"a": ASCII, "b": BESTMATCH, "e": ENHANCEMATCH, "f": FULLCASE, + "i": IGNORECASE, "L": LOCALE, "m": MULTILINE, "p": POSIX, "r": REVERSE, + "s": DOTALL, "u": UNICODE, "V0": VERSION0, "V1": VERSION1, "w": WORD, "x": + VERBOSE} + +# The case flags. +CASE_FLAGS = FULLCASE | IGNORECASE +NOCASE = 0 +FULLIGNORECASE = FULLCASE | IGNORECASE + +FULL_CASE_FOLDING = UNICODE | FULLIGNORECASE + +CASE_FLAGS_COMBINATIONS = {0: 0, FULLCASE: 0, IGNORECASE: IGNORECASE, + FULLIGNORECASE: FULLIGNORECASE} + +# The number of digits in hexadecimal escapes. +HEX_ESCAPES = {"x": 2, "u": 4, "U": 8} + +# The names of the opcodes. +OPCODES = """ +FAILURE +SUCCESS +ANY +ANY_ALL +ANY_ALL_REV +ANY_REV +ANY_U +ANY_U_REV +ATOMIC +BOUNDARY +BRANCH +CALL_REF +CHARACTER +CHARACTER_IGN +CHARACTER_IGN_REV +CHARACTER_REV +CONDITIONAL +DEFAULT_BOUNDARY +DEFAULT_END_OF_WORD +DEFAULT_START_OF_WORD +END +END_OF_LINE +END_OF_LINE_U +END_OF_STRING +END_OF_STRING_LINE +END_OF_STRING_LINE_U +END_OF_WORD +FUZZY +GRAPHEME_BOUNDARY +GREEDY_REPEAT +GROUP +GROUP_CALL +GROUP_EXISTS +KEEP +LAZY_REPEAT +LOOKAROUND +NEXT +PROPERTY +PROPERTY_IGN +PROPERTY_IGN_REV +PROPERTY_REV +PRUNE +RANGE +RANGE_IGN +RANGE_IGN_REV +RANGE_REV +REF_GROUP +REF_GROUP_FLD +REF_GROUP_FLD_REV +REF_GROUP_IGN +REF_GROUP_IGN_REV +REF_GROUP_REV +SEARCH_ANCHOR +SET_DIFF +SET_DIFF_IGN +SET_DIFF_IGN_REV +SET_DIFF_REV +SET_INTER +SET_INTER_IGN +SET_INTER_IGN_REV +SET_INTER_REV +SET_SYM_DIFF +SET_SYM_DIFF_IGN +SET_SYM_DIFF_IGN_REV +SET_SYM_DIFF_REV +SET_UNION +SET_UNION_IGN +SET_UNION_IGN_REV +SET_UNION_REV +SKIP +START_OF_LINE +START_OF_LINE_U +START_OF_STRING +START_OF_WORD +STRING +STRING_FLD +STRING_FLD_REV +STRING_IGN +STRING_IGN_REV +STRING_REV +FUZZY_EXT +""" + +# Define the opcodes in a namespace. +class Namespace: + pass + +OP = Namespace() +for i, op in enumerate(OPCODES.split()): + setattr(OP, op, i) + +def _shrink_cache(cache_dict, args_dict, locale_sensitive, max_length, divisor=5): + """Make room in the given cache. + + Args: + cache_dict: The cache dictionary to modify. + args_dict: The dictionary of named list args used by patterns. + max_length: Maximum # of entries in cache_dict before it is shrunk. + divisor: Cache will shrink to max_length - 1/divisor*max_length items. + """ + # Toss out a fraction of the entries at random to make room for new ones. + # A random algorithm was chosen as opposed to simply cache_dict.popitem() + # as popitem could penalize the same regular expression repeatedly based + # on its internal hash value. Being random should spread the cache miss + # love around. + cache_keys = tuple(cache_dict.keys()) + overage = len(cache_keys) - max_length + if overage < 0: + # Cache is already within limits. Normally this should not happen + # but it could due to multithreading. + return + + number_to_toss = max_length // divisor + overage + + # The import is done here to avoid a circular dependency. + import random + if not hasattr(random, 'sample'): + # Do nothing while resolving the circular dependency: + # re->random->warnings->tokenize->string->re + return + + for doomed_key in random.sample(cache_keys, number_to_toss): + try: + del cache_dict[doomed_key] + except KeyError: + # Ignore problems if the cache changed from another thread. + pass + + # Rebuild the arguments and locale-sensitivity dictionaries. + args_dict.clear() + sensitivity_dict = {} + for pattern, pattern_type, flags, args, default_version, locale in tuple(cache_dict): + args_dict[pattern, pattern_type, flags, default_version, locale] = args + try: + sensitivity_dict[pattern_type, pattern] = locale_sensitive[pattern_type, pattern] + except KeyError: + pass + + locale_sensitive.clear() + locale_sensitive.update(sensitivity_dict) + +def _fold_case(info, string): + "Folds the case of a string." + flags = info.flags + if (flags & _ALL_ENCODINGS) == 0: + flags |= info.guess_encoding + + return _regex.fold_case(flags, string) + +def is_cased_i(info, char): + "Checks whether a character is cased." + return len(_regex.get_all_cases(info.flags, char)) > 1 + +def is_cased_f(flags, char): + "Checks whether a character is cased." + return len(_regex.get_all_cases(flags, char)) > 1 + +def _compile_firstset(info, fs): + "Compiles the firstset for the pattern." + reverse = bool(info.flags & REVERSE) + fs = _check_firstset(info, reverse, fs) + if not fs or isinstance(fs, AnyAll): + return [] + + # Compile the firstset. + return fs.compile(reverse) + +def _check_firstset(info, reverse, fs): + "Checks the firstset for the pattern." + if not fs or None in fs: + return None + + # If we ignore the case, for simplicity we won't build a firstset. + members = set() + case_flags = NOCASE + for i in fs: + if isinstance(i, Character) and not i.positive: + return None + +# if i.case_flags: +# if isinstance(i, Character): +# if is_cased_i(info, i.value): +# return [] +# elif isinstance(i, SetBase): +# return [] + case_flags |= i.case_flags + members.add(i.with_flags(case_flags=NOCASE)) + + if case_flags == (FULLCASE | IGNORECASE): + return None + + # Build the firstset. + fs = SetUnion(info, list(members), case_flags=case_flags & ~FULLCASE, + zerowidth=True) + fs = fs.optimise(info, reverse, in_set=True) + + return fs + +def _flatten_code(code): + "Flattens the code from a list of tuples." + flat_code = [] + for c in code: + flat_code.extend(c) + + return flat_code + +def make_case_flags(info): + "Makes the case flags." + flags = info.flags & CASE_FLAGS + + # Turn off FULLCASE if ASCII is turned on. + if info.flags & ASCII: + flags &= ~FULLCASE + + return flags + +def make_character(info, value, in_set=False): + "Makes a character literal." + if in_set: + # A character set is built case-sensitively. + return Character(value) + + return Character(value, case_flags=make_case_flags(info)) + +def make_ref_group(info, name, position): + "Makes a group reference." + return RefGroup(info, name, position, case_flags=make_case_flags(info)) + +def make_string_set(info, name): + "Makes a string set." + return StringSet(info, name, case_flags=make_case_flags(info)) + +def make_property(info, prop, in_set): + "Makes a property." + if in_set: + return prop + + return prop.with_flags(case_flags=make_case_flags(info)) + +def _parse_pattern(source, info): + "Parses a pattern, eg. 'a|b|c'." + branches = [parse_sequence(source, info)] + while source.match("|"): + branches.append(parse_sequence(source, info)) + + if len(branches) == 1: + return branches[0] + return Branch(branches) + +def parse_sequence(source, info): + "Parses a sequence, eg. 'abc'." + sequence = [None] + case_flags = make_case_flags(info) + while True: + saved_pos = source.pos + ch = source.get() + if ch in SPECIAL_CHARS: + if ch in ")|": + # The end of a sequence. At the end of the pattern ch is "". + source.pos = saved_pos + break + elif ch == "\\": + # An escape sequence outside a set. + sequence.append(parse_escape(source, info, False)) + elif ch == "(": + # A parenthesised subpattern or a flag. + element = parse_paren(source, info) + if element is None: + case_flags = make_case_flags(info) + else: + sequence.append(element) + elif ch == ".": + # Any character. + if info.flags & DOTALL: + sequence.append(AnyAll()) + elif info.flags & WORD: + sequence.append(AnyU()) + else: + sequence.append(Any()) + elif ch == "[": + # A character set. + sequence.append(parse_set(source, info)) + elif ch == "^": + # The start of a line or the string. + if info.flags & MULTILINE: + if info.flags & WORD: + sequence.append(StartOfLineU()) + else: + sequence.append(StartOfLine()) + else: + sequence.append(StartOfString()) + elif ch == "$": + # The end of a line or the string. + if info.flags & MULTILINE: + if info.flags & WORD: + sequence.append(EndOfLineU()) + else: + sequence.append(EndOfLine()) + else: + if info.flags & WORD: + sequence.append(EndOfStringLineU()) + else: + sequence.append(EndOfStringLine()) + elif ch in "?*+{": + # Looks like a quantifier. + counts = parse_quantifier(source, info, ch) + if counts: + # It _is_ a quantifier. + apply_quantifier(source, info, counts, case_flags, ch, + saved_pos, sequence) + sequence.append(None) + else: + # It's not a quantifier. Maybe it's a fuzzy constraint. + constraints = parse_fuzzy(source, info, ch, case_flags) + + if constraints: + # It _is_ a fuzzy constraint. + if is_actually_fuzzy(constraints): + apply_constraint(source, info, constraints, case_flags, + saved_pos, sequence) + sequence.append(None) + else: + # The element was just a literal. + sequence.append(Character(ord(ch), + case_flags=case_flags)) + else: + # A literal. + sequence.append(Character(ord(ch), case_flags=case_flags)) + else: + # A literal. + sequence.append(Character(ord(ch), case_flags=case_flags)) + + sequence = [item for item in sequence if item is not None] + return Sequence(sequence) + +def is_actually_fuzzy(constraints): + "Checks whether a fuzzy constraint is actually fuzzy." + if constraints.get("e") == (0, 0): + return False + + if (constraints.get("s"), constraints.get("i"), constraints.get("d")) == ((0, 0), (0, 0), (0, 0)): + return False + + return True + +def apply_quantifier(source, info, counts, case_flags, ch, saved_pos, + sequence): + element = sequence.pop() + if element is None: + if sequence: + raise error("multiple repeat", source.string, saved_pos) + raise error("nothing to repeat", source.string, saved_pos) + + if isinstance(element, (GreedyRepeat, LazyRepeat, PossessiveRepeat)): + raise error("multiple repeat", source.string, saved_pos) + + min_count, max_count = counts + saved_pos = source.pos + ch = source.get() + if ch == "?": + # The "?" suffix that means it's a lazy repeat. + repeated = LazyRepeat + elif ch == "+": + # The "+" suffix that means it's a possessive repeat. + repeated = PossessiveRepeat + else: + # No suffix means that it's a greedy repeat. + source.pos = saved_pos + repeated = GreedyRepeat + + # Ignore the quantifier if it applies to a zero-width item or the number of + # repeats is fixed at 1. + if not element.is_empty() and (min_count != 1 or max_count != 1): + element = repeated(element, min_count, max_count) + + sequence.append(element) + +def apply_constraint(source, info, constraints, case_flags, saved_pos, + sequence): + element = sequence.pop() + if element is None: + raise error("nothing for fuzzy constraint", source.string, saved_pos) + + # If a group is marked as fuzzy then put all of the fuzzy part in the + # group. + if isinstance(element, Group): + element.subpattern = Fuzzy(element.subpattern, constraints) + sequence.append(element) + else: + sequence.append(Fuzzy(element, constraints)) + +_QUANTIFIERS = {"?": (0, 1), "*": (0, None), "+": (1, None)} + +def parse_quantifier(source, info, ch): + "Parses a quantifier." + q = _QUANTIFIERS.get(ch) + if q: + # It's a quantifier. + return q + + if ch == "{": + # Looks like a limited repeated element, eg. 'a{2,3}'. + counts = parse_limited_quantifier(source) + if counts: + return counts + + return None + +def is_above_limit(count): + "Checks whether a count is above the maximum." + return count is not None and count >= UNLIMITED + +def parse_limited_quantifier(source): + "Parses a limited quantifier." + saved_pos = source.pos + min_count = parse_count(source) + if source.match(","): + max_count = parse_count(source) + + # No minimum means 0 and no maximum means unlimited. + min_count = int(min_count or 0) + max_count = int(max_count) if max_count else None + else: + if not min_count: + source.pos = saved_pos + return None + + min_count = max_count = int(min_count) + + if not source.match ("}"): + source.pos = saved_pos + return None + + if is_above_limit(min_count) or is_above_limit(max_count): + raise error("repeat count too big", source.string, saved_pos) + + if max_count is not None and min_count > max_count: + raise error("min repeat greater than max repeat", source.string, + saved_pos) + + return min_count, max_count + +def parse_fuzzy(source, info, ch, case_flags): + "Parses a fuzzy setting, if present." + saved_pos = source.pos + + if ch != "{": + return None + + constraints = {} + try: + parse_fuzzy_item(source, constraints) + while source.match(","): + parse_fuzzy_item(source, constraints) + except ParseError: + source.pos = saved_pos + return None + + if source.match(":"): + constraints["test"] = parse_fuzzy_test(source, info, case_flags) + + if not source.match("}"): + raise error("expected }", source.string, source.pos) + + return constraints + +def parse_fuzzy_item(source, constraints): + "Parses a fuzzy setting item." + saved_pos = source.pos + try: + parse_cost_constraint(source, constraints) + except ParseError: + source.pos = saved_pos + + parse_cost_equation(source, constraints) + +def parse_cost_constraint(source, constraints): + "Parses a cost constraint." + saved_pos = source.pos + ch = source.get() + if ch in ALPHA: + # Syntax: constraint [("<=" | "<") cost] + constraint = parse_constraint(source, constraints, ch) + + max_inc = parse_fuzzy_compare(source) + + if max_inc is None: + # No maximum cost. + constraints[constraint] = 0, None + else: + # There's a maximum cost. + cost_pos = source.pos + max_cost = parse_cost_limit(source) + + # Inclusive or exclusive limit? + if not max_inc: + max_cost -= 1 + + if max_cost < 0: + raise error("bad fuzzy cost limit", source.string, cost_pos) + + constraints[constraint] = 0, max_cost + elif ch in DIGITS: + # Syntax: cost ("<=" | "<") constraint ("<=" | "<") cost + source.pos = saved_pos + + # Minimum cost. + cost_pos = source.pos + min_cost = parse_cost_limit(source) + + min_inc = parse_fuzzy_compare(source) + if min_inc is None: + raise ParseError() + + constraint = parse_constraint(source, constraints, source.get()) + + max_inc = parse_fuzzy_compare(source) + if max_inc is None: + raise ParseError() + + # Maximum cost. + cost_pos = source.pos + max_cost = parse_cost_limit(source) + + # Inclusive or exclusive limits? + if not min_inc: + min_cost += 1 + if not max_inc: + max_cost -= 1 + + if not 0 <= min_cost <= max_cost: + raise error("bad fuzzy cost limit", source.string, cost_pos) + + constraints[constraint] = min_cost, max_cost + else: + raise ParseError() + +def parse_cost_limit(source): + "Parses a cost limit." + cost_pos = source.pos + digits = parse_count(source) + + try: + return int(digits) + except ValueError: + pass + + raise error("bad fuzzy cost limit", source.string, cost_pos) + +def parse_constraint(source, constraints, ch): + "Parses a constraint." + if ch not in "deis": + raise ParseError() + + if ch in constraints: + raise ParseError() + + return ch + +def parse_fuzzy_compare(source): + "Parses a cost comparator." + if source.match("<="): + return True + elif source.match("<"): + return False + else: + return None + +def parse_cost_equation(source, constraints): + "Parses a cost equation." + if "cost" in constraints: + raise error("more than one cost equation", source.string, source.pos) + + cost = {} + + parse_cost_term(source, cost) + while source.match("+"): + parse_cost_term(source, cost) + + max_inc = parse_fuzzy_compare(source) + if max_inc is None: + raise ParseError() + + max_cost = int(parse_count(source)) + + if not max_inc: + max_cost -= 1 + + if max_cost < 0: + raise error("bad fuzzy cost limit", source.string, source.pos) + + cost["max"] = max_cost + + constraints["cost"] = cost + +def parse_cost_term(source, cost): + "Parses a cost equation term." + coeff = parse_count(source) + ch = source.get() + if ch not in "dis": + raise ParseError() + + if ch in cost: + raise error("repeated fuzzy cost", source.string, source.pos) + + cost[ch] = int(coeff or 1) + +def parse_fuzzy_test(source, info, case_flags): + saved_pos = source.pos + ch = source.get() + if ch in SPECIAL_CHARS: + if ch == "\\": + # An escape sequence outside a set. + return parse_escape(source, info, False) + elif ch == ".": + # Any character. + if info.flags & DOTALL: + return AnyAll() + elif info.flags & WORD: + return AnyU() + else: + return Any() + elif ch == "[": + # A character set. + return parse_set(source, info) + else: + raise error("expected character set", source.string, saved_pos) + elif ch: + # A literal. + return Character(ord(ch), case_flags=case_flags) + else: + raise error("expected character set", source.string, saved_pos) + +def parse_count(source): + "Parses a quantifier's count, which can be empty." + return source.get_while(DIGITS) + +def parse_paren(source, info): + """Parses a parenthesised subpattern or a flag. Returns FLAGS if it's an + inline flag. + """ + saved_pos = source.pos + ch = source.get(True) + if ch == "?": + # (?... + saved_pos_2 = source.pos + ch = source.get(True) + if ch == "<": + # (?<... + saved_pos_3 = source.pos + ch = source.get() + if ch in ("=", "!"): + # (?<=... or (?") + saved_flags = info.flags + try: + subpattern = _parse_pattern(source, info) + source.expect(")") + finally: + info.flags = saved_flags + source.ignore_space = bool(info.flags & VERBOSE) + + info.close_group() + return Group(info, group, subpattern) + if ch in ("=", "!"): + # (?=... or (?!...: lookahead. + return parse_lookaround(source, info, False, ch == "=") + if ch == "P": + # (?P...: a Python extension. + return parse_extension(source, info) + if ch == "#": + # (?#...: a comment. + return parse_comment(source) + if ch == "(": + # (?(...: a conditional subpattern. + return parse_conditional(source, info) + if ch == ">": + # (?>...: an atomic subpattern. + return parse_atomic(source, info) + if ch == "|": + # (?|...: a common/reset groups branch. + return parse_common(source, info) + if ch == "R" or "0" <= ch <= "9": + # (?R...: probably a call to a group. + return parse_call_group(source, info, ch, saved_pos_2) + if ch == "&": + # (?&...: a call to a named group. + return parse_call_named_group(source, info, saved_pos_2) + if (ch == "+" or ch == "-") and source.peek() in DIGITS: + return parse_rel_call_group(source, info, ch, saved_pos_2) + + # (?...: probably a flags subpattern. + source.pos = saved_pos_2 + return parse_flags_subpattern(source, info) + + if ch == "*": + # (*... + saved_pos_2 = source.pos + word = source.get_while(set(")>"), include=False) + if word[ : 1].isalpha(): + verb = VERBS.get(word) + if not verb: + raise error("unknown verb", source.string, saved_pos_2) + + source.expect(")") + + return verb + + # (...: an unnamed capture group. + source.pos = saved_pos + group = info.open_group() + saved_flags = info.flags + try: + subpattern = _parse_pattern(source, info) + source.expect(")") + finally: + info.flags = saved_flags + source.ignore_space = bool(info.flags & VERBOSE) + + info.close_group() + + return Group(info, group, subpattern) + +def parse_extension(source, info): + "Parses a Python extension." + saved_pos = source.pos + ch = source.get() + if ch == "<": + # (?P<...: a named capture group. + name = parse_name(source) + group = info.open_group(name) + source.expect(">") + saved_flags = info.flags + try: + subpattern = _parse_pattern(source, info) + source.expect(")") + finally: + info.flags = saved_flags + source.ignore_space = bool(info.flags & VERBOSE) + + info.close_group() + + return Group(info, group, subpattern) + if ch == "=": + # (?P=...: a named group reference. + name = parse_name(source, allow_numeric=True) + source.expect(")") + if info.is_open_group(name): + raise error("cannot refer to an open group", source.string, + saved_pos) + + return make_ref_group(info, name, saved_pos) + if ch == ">" or ch == "&": + # (?P>...: a call to a group. + return parse_call_named_group(source, info, saved_pos) + + source.pos = saved_pos + raise error("unknown extension", source.string, saved_pos) + +def parse_comment(source): + "Parses a comment." + while True: + saved_pos = source.pos + c = source.get(True) + + if not c or c == ")": + break + + if c == "\\": + c = source.get(True) + + source.pos = saved_pos + source.expect(")") + + return None + +def parse_lookaround(source, info, behind, positive): + "Parses a lookaround." + saved_flags = info.flags + try: + subpattern = _parse_pattern(source, info) + source.expect(")") + finally: + info.flags = saved_flags + source.ignore_space = bool(info.flags & VERBOSE) + + return LookAround(behind, positive, subpattern) + +def parse_conditional(source, info): + "Parses a conditional subpattern." + saved_flags = info.flags + saved_pos = source.pos + ch = source.get() + if ch == "?": + # (?(?... + ch = source.get() + if ch in ("=", "!"): + # (?(?=... or (?(?!...: lookahead conditional. + return parse_lookaround_conditional(source, info, False, ch == "=") + if ch == "<": + # (?(?<... + ch = source.get() + if ch in ("=", "!"): + # (?(?<=... or (?(?"), include=False) + + if not name: + raise error("missing group name", source.string, source.pos) + + if name.isdigit(): + min_group = 0 if allow_group_0 else 1 + if not allow_numeric or int(name) < min_group: + raise error("bad character in group name", source.string, + source.pos) + else: + if not name.isidentifier(): + raise error("bad character in group name", source.string, + source.pos) + + return name + +def is_octal(string): + "Checks whether a string is octal." + return all(ch in OCT_DIGITS for ch in string) + +def is_decimal(string): + "Checks whether a string is decimal." + return all(ch in DIGITS for ch in string) + +def is_hexadecimal(string): + "Checks whether a string is hexadecimal." + return all(ch in HEX_DIGITS for ch in string) + +def parse_escape(source, info, in_set): + "Parses an escape sequence." + saved_ignore = source.ignore_space + source.ignore_space = False + ch = source.get() + source.ignore_space = saved_ignore + if not ch: + # A backslash at the end of the pattern. + raise error("bad escape (end of pattern)", source.string, source.pos) + if ch in HEX_ESCAPES: + # A hexadecimal escape sequence. + return parse_hex_escape(source, info, ch, HEX_ESCAPES[ch], in_set, ch) + elif ch == "g" and not in_set: + # A group reference. + saved_pos = source.pos + try: + return parse_group_ref(source, info) + except error: + # Invalid as a group reference, so assume it's a literal. + source.pos = saved_pos + + return make_character(info, ord(ch), in_set) + elif ch == "G" and not in_set: + # A search anchor. + return SearchAnchor() + elif ch == "L" and not in_set: + # A string set. + return parse_string_set(source, info) + elif ch == "N": + # A named codepoint. + return parse_named_char(source, info, in_set) + elif ch in "pP": + # A Unicode property, positive or negative. + return parse_property(source, info, ch == "p", in_set) + elif ch == "R" and not in_set: + # A line ending. + charset = [0x0A, 0x0B, 0x0C, 0x0D] + if info.guess_encoding == UNICODE: + charset.extend([0x85, 0x2028, 0x2029]) + + return Atomic(Branch([String([0x0D, 0x0A]), SetUnion(info, [Character(c) + for c in charset])])) + elif ch == "X" and not in_set: + # A grapheme cluster. + return Grapheme() + elif ch in ALPHA: + # An alphabetic escape sequence. + # Positional escapes aren't allowed inside a character set. + if not in_set: + if info.flags & WORD: + value = WORD_POSITION_ESCAPES.get(ch) + elif info.flags & ASCII: + value = ASCII_POSITION_ESCAPES.get(ch) + elif info.flags & UNICODE: + value = UNICODE_POSITION_ESCAPES.get(ch) + else: + value = POSITION_ESCAPES.get(ch) + + if value: + return value + + if info.flags & ASCII: + value = ASCII_CHARSET_ESCAPES.get(ch) + elif info.flags & UNICODE: + value = UNICODE_CHARSET_ESCAPES.get(ch) + else: + value = CHARSET_ESCAPES.get(ch) + + if value: + return value + + value = CHARACTER_ESCAPES.get(ch) + if value: + return Character(ord(value)) + + raise error("bad escape \\%s" % ch, source.string, source.pos) + elif ch in DIGITS: + # A numeric escape sequence. + return parse_numeric_escape(source, info, ch, in_set) + else: + # A literal. + return make_character(info, ord(ch), in_set) + +def parse_numeric_escape(source, info, ch, in_set): + "Parses a numeric escape sequence." + if in_set or ch == "0": + # Octal escape sequence, max 3 digits. + return parse_octal_escape(source, info, [ch], in_set) + + # At least 1 digit, so either octal escape or group. + digits = ch + saved_pos = source.pos + ch = source.get() + if ch in DIGITS: + # At least 2 digits, so either octal escape or group. + digits += ch + saved_pos = source.pos + ch = source.get() + if is_octal(digits) and ch in OCT_DIGITS: + # 3 octal digits, so octal escape sequence. + encoding = info.flags & _ALL_ENCODINGS + if encoding == ASCII or encoding == LOCALE: + octal_mask = 0xFF + else: + octal_mask = 0x1FF + + value = int(digits + ch, 8) & octal_mask + return make_character(info, value) + + # Group reference. + source.pos = saved_pos + if info.is_open_group(digits): + raise error("cannot refer to an open group", source.string, source.pos) + + return make_ref_group(info, digits, source.pos) + +def parse_octal_escape(source, info, digits, in_set): + "Parses an octal escape sequence." + saved_pos = source.pos + ch = source.get() + while len(digits) < 3 and ch in OCT_DIGITS: + digits.append(ch) + saved_pos = source.pos + ch = source.get() + + source.pos = saved_pos + try: + value = int("".join(digits), 8) + return make_character(info, value, in_set) + except ValueError: + if digits[0] in OCT_DIGITS: + raise error("incomplete escape \\%s" % ''.join(digits), + source.string, source.pos) + else: + raise error("bad escape \\%s" % digits[0], source.string, + source.pos) + +def parse_hex_escape(source, info, esc, expected_len, in_set, type): + "Parses a hex escape sequence." + saved_pos = source.pos + digits = [] + for i in range(expected_len): + ch = source.get() + if ch not in HEX_DIGITS: + raise error("incomplete escape \\%s%s" % (type, ''.join(digits)), + source.string, saved_pos) + digits.append(ch) + + try: + value = int("".join(digits), 16) + except ValueError: + pass + else: + if value < 0x110000: + return make_character(info, value, in_set) + + # Bad hex escape. + raise error("bad hex escape \\%s%s" % (esc, ''.join(digits)), + source.string, saved_pos) + +def parse_group_ref(source, info): + "Parses a group reference." + source.expect("<") + saved_pos = source.pos + name = parse_name(source, True) + source.expect(">") + if info.is_open_group(name): + raise error("cannot refer to an open group", source.string, source.pos) + + return make_ref_group(info, name, saved_pos) + +def parse_string_set(source, info): + "Parses a string set reference." + source.expect("<") + name = parse_name(source, True) + source.expect(">") + if name is None or name not in info.kwargs: + raise error("undefined named list", source.string, source.pos) + + return make_string_set(info, name) + +def parse_named_char(source, info, in_set): + "Parses a named character." + saved_pos = source.pos + if source.match("{"): + name = source.get_while(NAMED_CHAR_PART, keep_spaces=True) + if source.match("}"): + try: + value = unicodedata.lookup(name) + return make_character(info, ord(value), in_set) + except KeyError: + raise error("undefined character name", source.string, + source.pos) + + source.pos = saved_pos + return make_character(info, ord("N"), in_set) + +def parse_property(source, info, positive, in_set): + "Parses a Unicode property." + saved_pos = source.pos + ch = source.get() + if ch == "{": + negate = source.match("^") + prop_name, name = parse_property_name(source) + if source.match("}"): + # It's correctly delimited. + if info.flags & ASCII: + encoding = ASCII_ENCODING + elif info.flags & UNICODE: + encoding = UNICODE_ENCODING + else: + encoding = 0 + + prop = lookup_property(prop_name, name, positive != negate, source, + encoding=encoding) + return make_property(info, prop, in_set) + elif ch and ch in "CLMNPSZ": + # An abbreviated property, eg \pL. + if info.flags & ASCII: + encoding = ASCII_ENCODING + elif info.flags & UNICODE: + encoding = UNICODE_ENCODING + else: + encoding = 0 + + prop = lookup_property(None, ch, positive, source, encoding=encoding) + return make_property(info, prop, in_set) + + # Not a property, so treat as a literal "p" or "P". + source.pos = saved_pos + ch = "p" if positive else "P" + return make_character(info, ord(ch), in_set) + +def parse_property_name(source): + "Parses a property name, which may be qualified." + name = source.get_while(PROPERTY_NAME_PART) + saved_pos = source.pos + + ch = source.get() + if ch and ch in ":=": + prop_name = name + name = source.get_while(ALNUM | set(" &_-./")).strip() + + if name: + # Name after the ":" or "=", so it's a qualified name. + saved_pos = source.pos + else: + # No name after the ":" or "=", so assume it's an unqualified name. + prop_name, name = None, prop_name + else: + prop_name = None + + source.pos = saved_pos + return prop_name, name + +def parse_set(source, info): + "Parses a character set." + version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION + + saved_ignore = source.ignore_space + source.ignore_space = False + # Negative set? + negate = source.match("^") + try: + if version == VERSION0: + item = parse_set_imp_union(source, info) + else: + item = parse_set_union(source, info) + + if not source.match("]"): + raise error("missing ]", source.string, source.pos) + finally: + source.ignore_space = saved_ignore + + if negate: + item = item.with_flags(positive=not item.positive) + + item = item.with_flags(case_flags=make_case_flags(info)) + + return item + +def parse_set_union(source, info): + "Parses a set union ([x||y])." + items = [parse_set_symm_diff(source, info)] + while source.match("||"): + items.append(parse_set_symm_diff(source, info)) + + if len(items) == 1: + return items[0] + return SetUnion(info, items) + +def parse_set_symm_diff(source, info): + "Parses a set symmetric difference ([x~~y])." + items = [parse_set_inter(source, info)] + while source.match("~~"): + items.append(parse_set_inter(source, info)) + + if len(items) == 1: + return items[0] + return SetSymDiff(info, items) + +def parse_set_inter(source, info): + "Parses a set intersection ([x&&y])." + items = [parse_set_diff(source, info)] + while source.match("&&"): + items.append(parse_set_diff(source, info)) + + if len(items) == 1: + return items[0] + return SetInter(info, items) + +def parse_set_diff(source, info): + "Parses a set difference ([x--y])." + items = [parse_set_imp_union(source, info)] + while source.match("--"): + items.append(parse_set_imp_union(source, info)) + + if len(items) == 1: + return items[0] + return SetDiff(info, items) + +def parse_set_imp_union(source, info): + "Parses a set implicit union ([xy])." + version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION + + items = [parse_set_member(source, info)] + while True: + saved_pos = source.pos + if source.match("]"): + # End of the set. + source.pos = saved_pos + break + + if version == VERSION1 and any(source.match(op) for op in SET_OPS): + # The new behaviour has set operators. + source.pos = saved_pos + break + + items.append(parse_set_member(source, info)) + + if len(items) == 1: + return items[0] + return SetUnion(info, items) + +def parse_set_member(source, info): + "Parses a member in a character set." + # Parse a set item. + start = parse_set_item(source, info) + saved_pos1 = source.pos + if (not isinstance(start, Character) or not start.positive or not + source.match("-")): + # It's not the start of a range. + return start + + version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION + + # It looks like the start of a range of characters. + saved_pos2 = source.pos + if version == VERSION1 and source.match("-"): + # It's actually the set difference operator '--', so return the + # character. + source.pos = saved_pos1 + return start + + if source.match("]"): + # We've reached the end of the set, so return both the character and + # hyphen. + source.pos = saved_pos2 + return SetUnion(info, [start, Character(ord("-"))]) + + # Parse a set item. + end = parse_set_item(source, info) + if not isinstance(end, Character) or not end.positive: + # It's not a range, so return the character, hyphen and property. + return SetUnion(info, [start, Character(ord("-")), end]) + + # It _is_ a range. + if start.value > end.value: + raise error("bad character range", source.string, source.pos) + + if start.value == end.value: + return start + + return Range(start.value, end.value) + +def parse_set_item(source, info): + "Parses an item in a character set." + version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION + + if source.match("\\"): + # An escape sequence in a set. + return parse_escape(source, info, True) + + saved_pos = source.pos + if source.match("[:"): + # Looks like a POSIX character class. + try: + return parse_posix_class(source, info) + except ParseError: + # Not a POSIX character class. + source.pos = saved_pos + + if version == VERSION1 and source.match("["): + # It's the start of a nested set. + + # Negative set? + negate = source.match("^") + item = parse_set_union(source, info) + + if not source.match("]"): + raise error("missing ]", source.string, source.pos) + + if negate: + item = item.with_flags(positive=not item.positive) + + return item + + ch = source.get() + if not ch: + raise error("unterminated character set", source.string, source.pos) + + return Character(ord(ch)) + +def parse_posix_class(source, info): + "Parses a POSIX character class." + negate = source.match("^") + prop_name, name = parse_property_name(source) + if not source.match(":]"): + raise ParseError() + + return lookup_property(prop_name, name, not negate, source, posix=True) + +def float_to_rational(flt): + "Converts a float to a rational pair." + int_part = int(flt) + error = flt - int_part + if abs(error) < 0.0001: + return int_part, 1 + + den, num = float_to_rational(1.0 / error) + + return int_part * den + num, den + +def numeric_to_rational(numeric): + "Converts a numeric string to a rational string, if possible." + if numeric[ : 1] == "-": + sign, numeric = numeric[0], numeric[1 : ] + else: + sign = "" + + parts = numeric.split("/") + if len(parts) == 2: + num, den = float_to_rational(float(parts[0]) / float(parts[1])) + elif len(parts) == 1: + num, den = float_to_rational(float(parts[0])) + else: + raise ValueError() + + result = "{}{}/{}".format(sign, num, den) + if result.endswith("/1"): + return result[ : -2] + + return result + +def standardise_name(name): + "Standardises a property or value name." + try: + return numeric_to_rational("".join(name)) + except (ValueError, ZeroDivisionError): + return "".join(ch for ch in name if ch not in "_- ").upper() + +_POSIX_CLASSES = set('ALNUM DIGIT PUNCT XDIGIT'.split()) + +_BINARY_VALUES = set('YES Y NO N TRUE T FALSE F'.split()) + +def lookup_property(property, value, positive, source=None, posix=False, encoding=0): + "Looks up a property." + # Normalise the names (which may still be lists). + property = standardise_name(property) if property else None + value = standardise_name(value) + + if (property, value) == ("GENERALCATEGORY", "ASSIGNED"): + property, value, positive = "GENERALCATEGORY", "UNASSIGNED", not positive + + if posix and not property and value.upper() in _POSIX_CLASSES: + value = 'POSIX' + value + + if property: + # Both the property and the value are provided. + prop = PROPERTIES.get(property) + if not prop: + if not source: + raise error("unknown property") + + raise error("unknown property", source.string, source.pos) + + prop_id, value_dict = prop + val_id = value_dict.get(value) + if val_id is None: + if not source: + raise error("unknown property value") + + raise error("unknown property value", source.string, source.pos) + + return Property((prop_id << 16) | val_id, positive, encoding=encoding) + + # Only the value is provided. + # It might be the name of a GC, script or block value. + for property in ("GC", "SCRIPT", "BLOCK"): + prop_id, value_dict = PROPERTIES.get(property) + val_id = value_dict.get(value) + if val_id is not None: + return Property((prop_id << 16) | val_id, positive, encoding=encoding) + + # It might be the name of a binary property. + prop = PROPERTIES.get(value) + if prop: + prop_id, value_dict = prop + if set(value_dict) == _BINARY_VALUES: + return Property((prop_id << 16) | 1, positive, encoding=encoding) + + return Property(prop_id << 16, not positive, encoding=encoding) + + # It might be the name of a binary property starting with a prefix. + if value.startswith("IS"): + prop = PROPERTIES.get(value[2 : ]) + if prop: + prop_id, value_dict = prop + if "YES" in value_dict: + return Property((prop_id << 16) | 1, positive, encoding=encoding) + + # It might be the name of a script or block starting with a prefix. + for prefix, property in (("IS", "SCRIPT"), ("IN", "BLOCK")): + if value.startswith(prefix): + prop_id, value_dict = PROPERTIES.get(property) + val_id = value_dict.get(value[2 : ]) + if val_id is not None: + return Property((prop_id << 16) | val_id, positive, encoding=encoding) + + # Unknown property. + if not source: + raise error("unknown property") + + raise error("unknown property", source.string, source.pos) + +def _compile_replacement(source, pattern, is_unicode): + "Compiles a replacement template escape sequence." + ch = source.get() + if ch in ALPHA: + # An alphabetic escape sequence. + value = CHARACTER_ESCAPES.get(ch) + if value: + return False, [ord(value)] + + if ch in HEX_ESCAPES and (ch == "x" or is_unicode): + # A hexadecimal escape sequence. + return False, [parse_repl_hex_escape(source, HEX_ESCAPES[ch], ch)] + + if ch == "g": + # A group preference. + return True, [compile_repl_group(source, pattern)] + + if ch == "N" and is_unicode: + # A named character. + value = parse_repl_named_char(source) + if value is not None: + return False, [value] + + raise error("bad escape \\%s" % ch, source.string, source.pos) + + if isinstance(source.sep, bytes): + octal_mask = 0xFF + else: + octal_mask = 0x1FF + + if ch == "0": + # An octal escape sequence. + digits = ch + while len(digits) < 3: + saved_pos = source.pos + ch = source.get() + if ch not in OCT_DIGITS: + source.pos = saved_pos + break + digits += ch + + return False, [int(digits, 8) & octal_mask] + + if ch in DIGITS: + # Either an octal escape sequence (3 digits) or a group reference (max + # 2 digits). + digits = ch + saved_pos = source.pos + ch = source.get() + if ch in DIGITS: + digits += ch + saved_pos = source.pos + ch = source.get() + if ch and is_octal(digits + ch): + # An octal escape sequence. + return False, [int(digits + ch, 8) & octal_mask] + + # A group reference. + source.pos = saved_pos + return True, [int(digits)] + + if ch == "\\": + # An escaped backslash is a backslash. + return False, [ord("\\")] + + if not ch: + # A trailing backslash. + raise error("bad escape (end of pattern)", source.string, source.pos) + + # An escaped non-backslash is a backslash followed by the literal. + return False, [ord("\\"), ord(ch)] + +def parse_repl_hex_escape(source, expected_len, type): + "Parses a hex escape sequence in a replacement string." + digits = [] + for i in range(expected_len): + ch = source.get() + if ch not in HEX_DIGITS: + raise error("incomplete escape \\%s%s" % (type, ''.join(digits)), + source.string, source.pos) + digits.append(ch) + + return int("".join(digits), 16) + +def parse_repl_named_char(source): + "Parses a named character in a replacement string." + saved_pos = source.pos + if source.match("{"): + name = source.get_while(ALPHA | set(" ")) + + if source.match("}"): + try: + value = unicodedata.lookup(name) + return ord(value) + except KeyError: + raise error("undefined character name", source.string, + source.pos) + + source.pos = saved_pos + return None + +def compile_repl_group(source, pattern): + "Compiles a replacement template group reference." + source.expect("<") + name = parse_name(source, True, True) + + source.expect(">") + if name.isdigit(): + index = int(name) + if not 0 <= index <= pattern.groups: + raise error("invalid group reference", source.string, source.pos) + + return index + + try: + return pattern.groupindex[name] + except KeyError: + raise IndexError("unknown group") + +# The regular expression is parsed into a syntax tree. The different types of +# node are defined below. + +INDENT = " " +POSITIVE_OP = 0x1 +ZEROWIDTH_OP = 0x2 +FUZZY_OP = 0x4 +REVERSE_OP = 0x8 +REQUIRED_OP = 0x10 +ENCODING_OP_SHIFT = 5 + +POS_TEXT = {False: "NON-MATCH", True: "MATCH"} +CASE_TEXT = {NOCASE: "", IGNORECASE: " SIMPLE_IGNORE_CASE", FULLCASE: "", + FULLIGNORECASE: " FULL_IGNORE_CASE"} + +def make_sequence(items): + if len(items) == 1: + return items[0] + return Sequence(items) + +# Common base class for all nodes. +class RegexBase: + def __init__(self): + self._key = self.__class__ + + def with_flags(self, positive=None, case_flags=None, zerowidth=None): + if positive is None: + positive = self.positive + else: + positive = bool(positive) + if case_flags is None: + case_flags = self.case_flags + else: + case_flags = CASE_FLAGS_COMBINATIONS[case_flags & CASE_FLAGS] + if zerowidth is None: + zerowidth = self.zerowidth + else: + zerowidth = bool(zerowidth) + + if (positive == self.positive and case_flags == self.case_flags and + zerowidth == self.zerowidth): + return self + + return self.rebuild(positive, case_flags, zerowidth) + + def fix_groups(self, pattern, reverse, fuzzy): + pass + + def optimise(self, info, reverse): + return self + + def pack_characters(self, info): + return self + + def remove_captures(self): + return self + + def is_atomic(self): + return True + + def can_be_affix(self): + return True + + def contains_group(self): + return False + + def get_firstset(self, reverse): + raise _FirstSetError() + + def has_simple_start(self): + return False + + def compile(self, reverse=False, fuzzy=False): + return self._compile(reverse, fuzzy) + + def is_empty(self): + return False + + def __hash__(self): + return hash(self._key) + + def __eq__(self, other): + return type(self) is type(other) and self._key == other._key + + def __ne__(self, other): + return not self.__eq__(other) + + def get_required_string(self, reverse): + return self.max_width(), None + +# Base class for zero-width nodes. +class ZeroWidthBase(RegexBase): + def __init__(self, positive=True, encoding=0): + RegexBase.__init__(self) + self.positive = bool(positive) + self.encoding = encoding + + self._key = self.__class__, self.positive + + def get_firstset(self, reverse): + return set([None]) + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if fuzzy: + flags |= FUZZY_OP + if reverse: + flags |= REVERSE_OP + flags |= self.encoding << ENCODING_OP_SHIFT + return [(self._opcode, flags)] + + def dump(self, indent, reverse): + print("{}{} {}{}".format(INDENT * indent, self._op_name, + POS_TEXT[self.positive], ["", " ASCII"][self.encoding])) + + def max_width(self): + return 0 + +class Any(RegexBase): + _opcode = {False: OP.ANY, True: OP.ANY_REV} + _op_name = "ANY" + + def has_simple_start(self): + return True + + def _compile(self, reverse, fuzzy): + flags = 0 + if fuzzy: + flags |= FUZZY_OP + return [(self._opcode[reverse], flags)] + + def dump(self, indent, reverse): + print("{}{}".format(INDENT * indent, self._op_name)) + + def max_width(self): + return 1 + +class AnyAll(Any): + _opcode = {False: OP.ANY_ALL, True: OP.ANY_ALL_REV} + _op_name = "ANY_ALL" + + def __init__(self): + self.positive = True + self.zerowidth = False + self.case_flags = 0 + + self._key = self.__class__, self.positive + +class AnyU(Any): + _opcode = {False: OP.ANY_U, True: OP.ANY_U_REV} + _op_name = "ANY_U" + +class Atomic(RegexBase): + def __init__(self, subpattern): + RegexBase.__init__(self) + self.subpattern = subpattern + + def fix_groups(self, pattern, reverse, fuzzy): + self.subpattern.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + self.subpattern = self.subpattern.optimise(info, reverse) + + if self.subpattern.is_empty(): + return self.subpattern + return self + + def pack_characters(self, info): + self.subpattern = self.subpattern.pack_characters(info) + return self + + def remove_captures(self): + self.subpattern = self.subpattern.remove_captures() + return self + + def can_be_affix(self): + return self.subpattern.can_be_affix() + + def contains_group(self): + return self.subpattern.contains_group() + + def get_firstset(self, reverse): + return self.subpattern.get_firstset(reverse) + + def has_simple_start(self): + return self.subpattern.has_simple_start() + + def _compile(self, reverse, fuzzy): + return ([(OP.ATOMIC, )] + self.subpattern.compile(reverse, fuzzy) + + [(OP.END, )]) + + def dump(self, indent, reverse): + print("{}ATOMIC".format(INDENT * indent)) + self.subpattern.dump(indent + 1, reverse) + + def is_empty(self): + return self.subpattern.is_empty() + + def __eq__(self, other): + return (type(self) is type(other) and self.subpattern == + other.subpattern) + + def max_width(self): + return self.subpattern.max_width() + + def get_required_string(self, reverse): + return self.subpattern.get_required_string(reverse) + +class Boundary(ZeroWidthBase): + _opcode = OP.BOUNDARY + _op_name = "BOUNDARY" + +class Branch(RegexBase): + def __init__(self, branches): + RegexBase.__init__(self) + self.branches = branches + + def fix_groups(self, pattern, reverse, fuzzy): + for b in self.branches: + b.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + if not self.branches: + return Sequence([]) + + # Flatten branches within branches. + branches = Branch._flatten_branches(info, reverse, self.branches) + + # Move any common prefix or suffix out of the branches. + if reverse: + suffix, branches = Branch._split_common_suffix(info, branches) + prefix = [] + else: + prefix, branches = Branch._split_common_prefix(info, branches) + suffix = [] + + # Try to reduce adjacent single-character branches to sets. + branches = Branch._reduce_to_set(info, reverse, branches) + + if len(branches) > 1: + sequence = [Branch(branches)] + + if not prefix or not suffix: + # We might be able to add a quick precheck before the branches. + firstset = self._add_precheck(info, reverse, branches) + + if firstset: + if reverse: + sequence.append(firstset) + else: + sequence.insert(0, firstset) + else: + sequence = branches + + return make_sequence(prefix + sequence + suffix) + + def _add_precheck(self, info, reverse, branches): + charset = set() + pos = -1 if reverse else 0 + + for branch in branches: + if type(branch) is Literal and branch.case_flags == NOCASE: + charset.add(branch.characters[pos]) + else: + return + + if not charset: + return None + + return _check_firstset(info, reverse, [Character(c) for c in charset]) + + def pack_characters(self, info): + self.branches = [b.pack_characters(info) for b in self.branches] + return self + + def remove_captures(self): + self.branches = [b.remove_captures() for b in self.branches] + return self + + def is_atomic(self): + return all(b.is_atomic() for b in self.branches) + + def can_be_affix(self): + return all(b.can_be_affix() for b in self.branches) + + def contains_group(self): + return any(b.contains_group() for b in self.branches) + + def get_firstset(self, reverse): + fs = set() + for b in self.branches: + fs |= b.get_firstset(reverse) + + return fs or set([None]) + + def _compile(self, reverse, fuzzy): + if not self.branches: + return [] + + code = [(OP.BRANCH, )] + for b in self.branches: + code.extend(b.compile(reverse, fuzzy)) + code.append((OP.NEXT, )) + + code[-1] = (OP.END, ) + + return code + + def dump(self, indent, reverse): + print("{}BRANCH".format(INDENT * indent)) + self.branches[0].dump(indent + 1, reverse) + for b in self.branches[1 : ]: + print("{}OR".format(INDENT * indent)) + b.dump(indent + 1, reverse) + + @staticmethod + def _flatten_branches(info, reverse, branches): + # Flatten the branches so that there aren't branches of branches. + new_branches = [] + for b in branches: + b = b.optimise(info, reverse) + if isinstance(b, Branch): + new_branches.extend(b.branches) + else: + new_branches.append(b) + + return new_branches + + @staticmethod + def _split_common_prefix(info, branches): + # Common leading items can be moved out of the branches. + # Get the items in the branches. + alternatives = [] + for b in branches: + if isinstance(b, Sequence): + alternatives.append(b.items) + else: + alternatives.append([b]) + + # What is the maximum possible length of the prefix? + max_count = min(len(a) for a in alternatives) + + # What is the longest common prefix? + prefix = alternatives[0] + pos = 0 + end_pos = max_count + while pos < end_pos and prefix[pos].can_be_affix() and all(a[pos] == + prefix[pos] for a in alternatives): + pos += 1 + count = pos + + if info.flags & UNICODE: + # We need to check that we're not splitting a sequence of + # characters which could form part of full case-folding. + count = pos + while count > 0 and not all(Branch._can_split(a, count) for a in + alternatives): + count -= 1 + + # No common prefix is possible. + if count == 0: + return [], branches + + # Rebuild the branches. + new_branches = [] + for a in alternatives: + new_branches.append(make_sequence(a[count : ])) + + return prefix[ : count], new_branches + + @staticmethod + def _split_common_suffix(info, branches): + # Common trailing items can be moved out of the branches. + # Get the items in the branches. + alternatives = [] + for b in branches: + if isinstance(b, Sequence): + alternatives.append(b.items) + else: + alternatives.append([b]) + + # What is the maximum possible length of the suffix? + max_count = min(len(a) for a in alternatives) + + # What is the longest common suffix? + suffix = alternatives[0] + pos = -1 + end_pos = -1 - max_count + while pos > end_pos and suffix[pos].can_be_affix() and all(a[pos] == + suffix[pos] for a in alternatives): + pos -= 1 + count = -1 - pos + + if info.flags & UNICODE: + # We need to check that we're not splitting a sequence of + # characters which could form part of full case-folding. + while count > 0 and not all(Branch._can_split_rev(a, count) for a + in alternatives): + count -= 1 + + # No common suffix is possible. + if count == 0: + return [], branches + + # Rebuild the branches. + new_branches = [] + for a in alternatives: + new_branches.append(make_sequence(a[ : -count])) + + return suffix[-count : ], new_branches + + @staticmethod + def _can_split(items, count): + # Check the characters either side of the proposed split. + if not Branch._is_full_case(items, count - 1): + return True + + if not Branch._is_full_case(items, count): + return True + + # Check whether a 1-1 split would be OK. + if Branch._is_folded(items[count - 1 : count + 1]): + return False + + # Check whether a 1-2 split would be OK. + if (Branch._is_full_case(items, count + 2) and + Branch._is_folded(items[count - 1 : count + 2])): + return False + + # Check whether a 2-1 split would be OK. + if (Branch._is_full_case(items, count - 2) and + Branch._is_folded(items[count - 2 : count + 1])): + return False + + return True + + @staticmethod + def _can_split_rev(items, count): + end = len(items) + + # Check the characters either side of the proposed split. + if not Branch._is_full_case(items, end - count): + return True + + if not Branch._is_full_case(items, end - count - 1): + return True + + # Check whether a 1-1 split would be OK. + if Branch._is_folded(items[end - count - 1 : end - count + 1]): + return False + + # Check whether a 1-2 split would be OK. + if (Branch._is_full_case(items, end - count + 2) and + Branch._is_folded(items[end - count - 1 : end - count + 2])): + return False + + # Check whether a 2-1 split would be OK. + if (Branch._is_full_case(items, end - count - 2) and + Branch._is_folded(items[end - count - 2 : end - count + 1])): + return False + + return True + + @staticmethod + def _merge_common_prefixes(info, reverse, branches): + # Branches with the same case-sensitive character prefix can be grouped + # together if they are separated only by other branches with a + # character prefix. + prefixed = defaultdict(list) + order = {} + new_branches = [] + for b in branches: + if Branch._is_simple_character(b): + # Branch starts with a simple character. + prefixed[b.value].append([b]) + order.setdefault(b.value, len(order)) + elif (isinstance(b, Sequence) and b.items and + Branch._is_simple_character(b.items[0])): + # Branch starts with a simple character. + prefixed[b.items[0].value].append(b.items) + order.setdefault(b.items[0].value, len(order)) + else: + Branch._flush_char_prefix(info, reverse, prefixed, order, + new_branches) + + new_branches.append(b) + + Branch._flush_char_prefix(info, prefixed, order, new_branches) + + return new_branches + + @staticmethod + def _is_simple_character(c): + return isinstance(c, Character) and c.positive and not c.case_flags + + @staticmethod + def _reduce_to_set(info, reverse, branches): + # Can the branches be reduced to a set? + new_branches = [] + items = set() + case_flags = NOCASE + for b in branches: + if isinstance(b, (Character, Property, SetBase)): + # Branch starts with a single character. + if b.case_flags != case_flags: + # Different case sensitivity, so flush. + Branch._flush_set_members(info, reverse, items, case_flags, + new_branches) + + case_flags = b.case_flags + + items.add(b.with_flags(case_flags=NOCASE)) + else: + Branch._flush_set_members(info, reverse, items, case_flags, + new_branches) + + new_branches.append(b) + + Branch._flush_set_members(info, reverse, items, case_flags, + new_branches) + + return new_branches + + @staticmethod + def _flush_char_prefix(info, reverse, prefixed, order, new_branches): + # Flush the prefixed branches. + if not prefixed: + return + + for value, branches in sorted(prefixed.items(), key=lambda pair: + order[pair[0]]): + if len(branches) == 1: + new_branches.append(make_sequence(branches[0])) + else: + subbranches = [] + optional = False + for b in branches: + if len(b) > 1: + subbranches.append(make_sequence(b[1 : ])) + elif not optional: + subbranches.append(Sequence()) + optional = True + + sequence = Sequence([Character(value), Branch(subbranches)]) + new_branches.append(sequence.optimise(info, reverse)) + + prefixed.clear() + order.clear() + + @staticmethod + def _flush_set_members(info, reverse, items, case_flags, new_branches): + # Flush the set members. + if not items: + return + + if len(items) == 1: + item = list(items)[0] + else: + item = SetUnion(info, list(items)).optimise(info, reverse) + + new_branches.append(item.with_flags(case_flags=case_flags)) + + items.clear() + + @staticmethod + def _is_full_case(items, i): + if not 0 <= i < len(items): + return False + + item = items[i] + return (isinstance(item, Character) and item.positive and + (item.case_flags & FULLIGNORECASE) == FULLIGNORECASE) + + @staticmethod + def _is_folded(items): + if len(items) < 2: + return False + + for i in items: + if (not isinstance(i, Character) or not i.positive or not + i.case_flags): + return False + + folded = "".join(chr(i.value) for i in items) + folded = _regex.fold_case(FULL_CASE_FOLDING, folded) + + # Get the characters which expand to multiple codepoints on folding. + expanding_chars = _regex.get_expand_on_folding() + + for c in expanding_chars: + if folded == _regex.fold_case(FULL_CASE_FOLDING, c): + return True + + return False + + def is_empty(self): + return all(b.is_empty() for b in self.branches) + + def __eq__(self, other): + return type(self) is type(other) and self.branches == other.branches + + def max_width(self): + return max(b.max_width() for b in self.branches) + +class CallGroup(RegexBase): + def __init__(self, info, group, position): + RegexBase.__init__(self) + self.info = info + self.group = group + self.position = position + + self._key = self.__class__, self.group + + def fix_groups(self, pattern, reverse, fuzzy): + try: + self.group = int(self.group) + except ValueError: + try: + self.group = self.info.group_index[self.group] + except KeyError: + raise error("invalid group reference", pattern, self.position) + + if not 0 <= self.group <= self.info.group_count: + raise error("unknown group", pattern, self.position) + + if self.group > 0 and self.info.open_group_count[self.group] > 1: + raise error("ambiguous group reference", pattern, self.position) + + self.info.group_calls.append((self, reverse, fuzzy)) + + self._key = self.__class__, self.group + + def remove_captures(self): + raise error("group reference not allowed", self.pattern, self.position) + + def _compile(self, reverse, fuzzy): + return [(OP.GROUP_CALL, self.call_ref)] + + def dump(self, indent, reverse): + print("{}GROUP_CALL {}".format(INDENT * indent, self.group)) + + def __eq__(self, other): + return type(self) is type(other) and self.group == other.group + + def max_width(self): + return UNLIMITED + + def __del__(self): + self.info = None + +class CallRef(RegexBase): + def __init__(self, ref, parsed): + self.ref = ref + self.parsed = parsed + + def _compile(self, reverse, fuzzy): + return ([(OP.CALL_REF, self.ref)] + self.parsed._compile(reverse, + fuzzy) + [(OP.END, )]) + +class Character(RegexBase): + _opcode = {(NOCASE, False): OP.CHARACTER, (IGNORECASE, False): + OP.CHARACTER_IGN, (FULLCASE, False): OP.CHARACTER, (FULLIGNORECASE, + False): OP.CHARACTER_IGN, (NOCASE, True): OP.CHARACTER_REV, (IGNORECASE, + True): OP.CHARACTER_IGN_REV, (FULLCASE, True): OP.CHARACTER_REV, + (FULLIGNORECASE, True): OP.CHARACTER_IGN_REV} + + def __init__(self, value, positive=True, case_flags=NOCASE, + zerowidth=False): + RegexBase.__init__(self) + self.value = value + self.positive = bool(positive) + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + self.zerowidth = bool(zerowidth) + + if (self.positive and (self.case_flags & FULLIGNORECASE) == + FULLIGNORECASE): + self.folded = _regex.fold_case(FULL_CASE_FOLDING, chr(self.value)) + else: + self.folded = chr(self.value) + + self._key = (self.__class__, self.value, self.positive, + self.case_flags, self.zerowidth) + + def rebuild(self, positive, case_flags, zerowidth): + return Character(self.value, positive, case_flags, zerowidth) + + def optimise(self, info, reverse, in_set=False): + return self + + def get_firstset(self, reverse): + return set([self]) + + def has_simple_start(self): + return True + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if self.zerowidth: + flags |= ZEROWIDTH_OP + if fuzzy: + flags |= FUZZY_OP + + code = PrecompiledCode([self._opcode[self.case_flags, reverse], flags, + self.value]) + + if len(self.folded) > 1: + # The character expands on full case-folding. + code = Branch([code, String([ord(c) for c in self.folded], + case_flags=self.case_flags)]) + + return code.compile(reverse, fuzzy) + + def dump(self, indent, reverse): + display = ascii(chr(self.value)).lstrip("bu") + print("{}CHARACTER {} {}{}".format(INDENT * indent, + POS_TEXT[self.positive], display, CASE_TEXT[self.case_flags])) + + def matches(self, ch): + return (ch == self.value) == self.positive + + def max_width(self): + return len(self.folded) + + def get_required_string(self, reverse): + if not self.positive: + return 1, None + + self.folded_characters = tuple(ord(c) for c in self.folded) + + return 0, self + +class Conditional(RegexBase): + def __init__(self, info, group, yes_item, no_item, position): + RegexBase.__init__(self) + self.info = info + self.group = group + self.yes_item = yes_item + self.no_item = no_item + self.position = position + + def fix_groups(self, pattern, reverse, fuzzy): + try: + self.group = int(self.group) + except ValueError: + try: + self.group = self.info.group_index[self.group] + except KeyError: + if self.group == 'DEFINE': + # 'DEFINE' is a special name unless there's a group with + # that name. + self.group = 0 + else: + raise error("unknown group", pattern, self.position) + + if not 0 <= self.group <= self.info.group_count: + raise error("invalid group reference", pattern, self.position) + + self.yes_item.fix_groups(pattern, reverse, fuzzy) + self.no_item.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + yes_item = self.yes_item.optimise(info, reverse) + no_item = self.no_item.optimise(info, reverse) + + return Conditional(info, self.group, yes_item, no_item, self.position) + + def pack_characters(self, info): + self.yes_item = self.yes_item.pack_characters(info) + self.no_item = self.no_item.pack_characters(info) + return self + + def remove_captures(self): + self.yes_item = self.yes_item.remove_captures() + self.no_item = self.no_item.remove_captures() + + def is_atomic(self): + return self.yes_item.is_atomic() and self.no_item.is_atomic() + + def can_be_affix(self): + return self.yes_item.can_be_affix() and self.no_item.can_be_affix() + + def contains_group(self): + return self.yes_item.contains_group() or self.no_item.contains_group() + + def get_firstset(self, reverse): + return (self.yes_item.get_firstset(reverse) | + self.no_item.get_firstset(reverse)) + + def _compile(self, reverse, fuzzy): + code = [(OP.GROUP_EXISTS, self.group)] + code.extend(self.yes_item.compile(reverse, fuzzy)) + add_code = self.no_item.compile(reverse, fuzzy) + if add_code: + code.append((OP.NEXT, )) + code.extend(add_code) + + code.append((OP.END, )) + + return code + + def dump(self, indent, reverse): + print("{}GROUP_EXISTS {}".format(INDENT * indent, self.group)) + self.yes_item.dump(indent + 1, reverse) + if not self.no_item.is_empty(): + print("{}OR".format(INDENT * indent)) + self.no_item.dump(indent + 1, reverse) + + def is_empty(self): + return self.yes_item.is_empty() and self.no_item.is_empty() + + def __eq__(self, other): + return type(self) is type(other) and (self.group, self.yes_item, + self.no_item) == (other.group, other.yes_item, other.no_item) + + def max_width(self): + return max(self.yes_item.max_width(), self.no_item.max_width()) + + def __del__(self): + self.info = None + +class DefaultBoundary(ZeroWidthBase): + _opcode = OP.DEFAULT_BOUNDARY + _op_name = "DEFAULT_BOUNDARY" + +class DefaultEndOfWord(ZeroWidthBase): + _opcode = OP.DEFAULT_END_OF_WORD + _op_name = "DEFAULT_END_OF_WORD" + +class DefaultStartOfWord(ZeroWidthBase): + _opcode = OP.DEFAULT_START_OF_WORD + _op_name = "DEFAULT_START_OF_WORD" + +class EndOfLine(ZeroWidthBase): + _opcode = OP.END_OF_LINE + _op_name = "END_OF_LINE" + +class EndOfLineU(EndOfLine): + _opcode = OP.END_OF_LINE_U + _op_name = "END_OF_LINE_U" + +class EndOfString(ZeroWidthBase): + _opcode = OP.END_OF_STRING + _op_name = "END_OF_STRING" + +class EndOfStringLine(ZeroWidthBase): + _opcode = OP.END_OF_STRING_LINE + _op_name = "END_OF_STRING_LINE" + +class EndOfStringLineU(EndOfStringLine): + _opcode = OP.END_OF_STRING_LINE_U + _op_name = "END_OF_STRING_LINE_U" + +class EndOfWord(ZeroWidthBase): + _opcode = OP.END_OF_WORD + _op_name = "END_OF_WORD" + +class Failure(ZeroWidthBase): + _op_name = "FAILURE" + + def _compile(self, reverse, fuzzy): + return [(OP.FAILURE, )] + +class Fuzzy(RegexBase): + def __init__(self, subpattern, constraints=None): + RegexBase.__init__(self) + if constraints is None: + constraints = {} + self.subpattern = subpattern + self.constraints = constraints + + # If an error type is mentioned in the cost equation, then its maximum + # defaults to unlimited. + if "cost" in constraints: + for e in "dis": + if e in constraints["cost"]: + constraints.setdefault(e, (0, None)) + + # If any error type is mentioned, then all the error maxima default to + # 0, otherwise they default to unlimited. + if set(constraints) & set("dis"): + for e in "dis": + constraints.setdefault(e, (0, 0)) + else: + for e in "dis": + constraints.setdefault(e, (0, None)) + + # The maximum of the generic error type defaults to unlimited. + constraints.setdefault("e", (0, None)) + + # The cost equation defaults to equal costs. Also, the cost of any + # error type not mentioned in the cost equation defaults to 0. + if "cost" in constraints: + for e in "dis": + constraints["cost"].setdefault(e, 0) + else: + constraints["cost"] = {"d": 1, "i": 1, "s": 1, "max": + constraints["e"][1]} + + def fix_groups(self, pattern, reverse, fuzzy): + self.subpattern.fix_groups(pattern, reverse, True) + + def pack_characters(self, info): + self.subpattern = self.subpattern.pack_characters(info) + return self + + def remove_captures(self): + self.subpattern = self.subpattern.remove_captures() + return self + + def is_atomic(self): + return self.subpattern.is_atomic() + + def contains_group(self): + return self.subpattern.contains_group() + + def _compile(self, reverse, fuzzy): + # The individual limits. + arguments = [] + for e in "dise": + v = self.constraints[e] + arguments.append(v[0]) + arguments.append(UNLIMITED if v[1] is None else v[1]) + + # The coeffs of the cost equation. + for e in "dis": + arguments.append(self.constraints["cost"][e]) + + # The maximum of the cost equation. + v = self.constraints["cost"]["max"] + arguments.append(UNLIMITED if v is None else v) + + flags = 0 + if reverse: + flags |= REVERSE_OP + + test = self.constraints.get("test") + + if test: + return ([(OP.FUZZY_EXT, flags) + tuple(arguments)] + + test.compile(reverse, True) + [(OP.NEXT,)] + + self.subpattern.compile(reverse, True) + [(OP.END,)]) + + return ([(OP.FUZZY, flags) + tuple(arguments)] + + self.subpattern.compile(reverse, True) + [(OP.END,)]) + + def dump(self, indent, reverse): + constraints = self._constraints_to_string() + if constraints: + constraints = " " + constraints + print("{}FUZZY{}".format(INDENT * indent, constraints)) + self.subpattern.dump(indent + 1, reverse) + + def is_empty(self): + return self.subpattern.is_empty() + + def __eq__(self, other): + return (type(self) is type(other) and self.subpattern == + other.subpattern and self.constraints == other.constraints) + + def max_width(self): + return UNLIMITED + + def _constraints_to_string(self): + constraints = [] + + for name in "ids": + min, max = self.constraints[name] + if max == 0: + continue + + con = "" + + if min > 0: + con = "{}<=".format(min) + + con += name + + if max is not None: + con += "<={}".format(max) + + constraints.append(con) + + cost = [] + for name in "ids": + coeff = self.constraints["cost"][name] + if coeff > 0: + cost.append("{}{}".format(coeff, name)) + + limit = self.constraints["cost"]["max"] + if limit is not None and limit > 0: + cost = "{}<={}".format("+".join(cost), limit) + constraints.append(cost) + + return ",".join(constraints) + +class Grapheme(RegexBase): + def _compile(self, reverse, fuzzy): + # Match at least 1 character until a grapheme boundary is reached. Note + # that this is the same whether matching forwards or backwards. + grapheme_matcher = Atomic(Sequence([LazyRepeat(AnyAll(), 1, None), + GraphemeBoundary()])) + + return grapheme_matcher.compile(reverse, fuzzy) + + def dump(self, indent, reverse): + print("{}GRAPHEME".format(INDENT * indent)) + + def max_width(self): + return UNLIMITED + +class GraphemeBoundary: + def compile(self, reverse, fuzzy): + return [(OP.GRAPHEME_BOUNDARY, 1)] + +class GreedyRepeat(RegexBase): + _opcode = OP.GREEDY_REPEAT + _op_name = "GREEDY_REPEAT" + + def __init__(self, subpattern, min_count, max_count): + RegexBase.__init__(self) + self.subpattern = subpattern + self.min_count = min_count + self.max_count = max_count + + def fix_groups(self, pattern, reverse, fuzzy): + self.subpattern.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + subpattern = self.subpattern.optimise(info, reverse) + + return type(self)(subpattern, self.min_count, self.max_count) + + def pack_characters(self, info): + self.subpattern = self.subpattern.pack_characters(info) + return self + + def remove_captures(self): + self.subpattern = self.subpattern.remove_captures() + return self + + def is_atomic(self): + return self.min_count == self.max_count and self.subpattern.is_atomic() + + def can_be_affix(self): + return False + + def contains_group(self): + return self.subpattern.contains_group() + + def get_firstset(self, reverse): + fs = self.subpattern.get_firstset(reverse) + if self.min_count == 0: + fs.add(None) + + return fs + + def _compile(self, reverse, fuzzy): + repeat = [self._opcode, self.min_count] + if self.max_count is None: + repeat.append(UNLIMITED) + else: + repeat.append(self.max_count) + + subpattern = self.subpattern.compile(reverse, fuzzy) + if not subpattern: + return [] + + return ([tuple(repeat)] + subpattern + [(OP.END, )]) + + def dump(self, indent, reverse): + if self.max_count is None: + limit = "INF" + else: + limit = self.max_count + print("{}{} {} {}".format(INDENT * indent, self._op_name, + self.min_count, limit)) + + self.subpattern.dump(indent + 1, reverse) + + def is_empty(self): + return self.subpattern.is_empty() + + def __eq__(self, other): + return type(self) is type(other) and (self.subpattern, self.min_count, + self.max_count) == (other.subpattern, other.min_count, + other.max_count) + + def max_width(self): + if self.max_count is None: + return UNLIMITED + + return self.subpattern.max_width() * self.max_count + + def get_required_string(self, reverse): + max_count = UNLIMITED if self.max_count is None else self.max_count + if self.min_count == 0: + w = self.subpattern.max_width() * max_count + return min(w, UNLIMITED), None + + ofs, req = self.subpattern.get_required_string(reverse) + if req: + return ofs, req + + w = self.subpattern.max_width() * max_count + return min(w, UNLIMITED), None + +class PossessiveRepeat(GreedyRepeat): + def is_atomic(self): + return True + + def _compile(self, reverse, fuzzy): + subpattern = self.subpattern.compile(reverse, fuzzy) + if not subpattern: + return [] + + repeat = [self._opcode, self.min_count] + if self.max_count is None: + repeat.append(UNLIMITED) + else: + repeat.append(self.max_count) + + return ([(OP.ATOMIC, ), tuple(repeat)] + subpattern + [(OP.END, ), + (OP.END, )]) + + def dump(self, indent, reverse): + print("{}ATOMIC".format(INDENT * indent)) + + if self.max_count is None: + limit = "INF" + else: + limit = self.max_count + print("{}{} {} {}".format(INDENT * (indent + 1), self._op_name, + self.min_count, limit)) + + self.subpattern.dump(indent + 2, reverse) + +class Group(RegexBase): + def __init__(self, info, group, subpattern): + RegexBase.__init__(self) + self.info = info + self.group = group + self.subpattern = subpattern + + self.call_ref = None + + def fix_groups(self, pattern, reverse, fuzzy): + self.info.defined_groups[self.group] = (self, reverse, fuzzy) + self.subpattern.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + subpattern = self.subpattern.optimise(info, reverse) + + return Group(self.info, self.group, subpattern) + + def pack_characters(self, info): + self.subpattern = self.subpattern.pack_characters(info) + return self + + def remove_captures(self): + return self.subpattern.remove_captures() + + def is_atomic(self): + return self.subpattern.is_atomic() + + def can_be_affix(self): + return False + + def contains_group(self): + return True + + def get_firstset(self, reverse): + return self.subpattern.get_firstset(reverse) + + def has_simple_start(self): + return self.subpattern.has_simple_start() + + def _compile(self, reverse, fuzzy): + code = [] + + public_group = private_group = self.group + if private_group < 0: + public_group = self.info.private_groups[private_group] + private_group = self.info.group_count - private_group + + key = self.group, reverse, fuzzy + ref = self.info.call_refs.get(key) + if ref is not None: + code += [(OP.CALL_REF, ref)] + + code += [(OP.GROUP, int(not reverse), private_group, public_group)] + code += self.subpattern.compile(reverse, fuzzy) + code += [(OP.END, )] + + if ref is not None: + code += [(OP.END, )] + + return code + + def dump(self, indent, reverse): + group = self.group + if group < 0: + group = self.info.private_groups[group] + print("{}GROUP {}".format(INDENT * indent, group)) + self.subpattern.dump(indent + 1, reverse) + + def __eq__(self, other): + return (type(self) is type(other) and (self.group, self.subpattern) == + (other.group, other.subpattern)) + + def max_width(self): + return self.subpattern.max_width() + + def get_required_string(self, reverse): + return self.subpattern.get_required_string(reverse) + + def __del__(self): + self.info = None + +class Keep(ZeroWidthBase): + _opcode = OP.KEEP + _op_name = "KEEP" + +class LazyRepeat(GreedyRepeat): + _opcode = OP.LAZY_REPEAT + _op_name = "LAZY_REPEAT" + +class LookAround(RegexBase): + _dir_text = {False: "AHEAD", True: "BEHIND"} + + def __init__(self, behind, positive, subpattern): + RegexBase.__init__(self) + self.behind = bool(behind) + self.positive = bool(positive) + self.subpattern = subpattern + + def fix_groups(self, pattern, reverse, fuzzy): + self.subpattern.fix_groups(pattern, self.behind, fuzzy) + + def optimise(self, info, reverse): + subpattern = self.subpattern.optimise(info, self.behind) + if self.positive and subpattern.is_empty(): + return subpattern + + return LookAround(self.behind, self.positive, subpattern) + + def pack_characters(self, info): + self.subpattern = self.subpattern.pack_characters(info) + return self + + def remove_captures(self): + return self.subpattern.remove_captures() + + def is_atomic(self): + return self.subpattern.is_atomic() + + def can_be_affix(self): + return self.subpattern.can_be_affix() + + def contains_group(self): + return self.subpattern.contains_group() + + def get_firstset(self, reverse): + if self.positive and self.behind == reverse: + return self.subpattern.get_firstset(reverse) + + return set([None]) + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if fuzzy: + flags |= FUZZY_OP + if reverse: + flags |= REVERSE_OP + + return ([(OP.LOOKAROUND, flags, int(not self.behind))] + + self.subpattern.compile(self.behind) + [(OP.END, )]) + + def dump(self, indent, reverse): + print("{}LOOK{} {}".format(INDENT * indent, + self._dir_text[self.behind], POS_TEXT[self.positive])) + self.subpattern.dump(indent + 1, self.behind) + + def is_empty(self): + return self.positive and self.subpattern.is_empty() + + def __eq__(self, other): + return type(self) is type(other) and (self.behind, self.positive, + self.subpattern) == (other.behind, other.positive, other.subpattern) + + def max_width(self): + return 0 + +class LookAroundConditional(RegexBase): + _dir_text = {False: "AHEAD", True: "BEHIND"} + + def __init__(self, behind, positive, subpattern, yes_item, no_item): + RegexBase.__init__(self) + self.behind = bool(behind) + self.positive = bool(positive) + self.subpattern = subpattern + self.yes_item = yes_item + self.no_item = no_item + + def fix_groups(self, pattern, reverse, fuzzy): + self.subpattern.fix_groups(pattern, reverse, fuzzy) + self.yes_item.fix_groups(pattern, reverse, fuzzy) + self.no_item.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + subpattern = self.subpattern.optimise(info, self.behind) + yes_item = self.yes_item.optimise(info, self.behind) + no_item = self.no_item.optimise(info, self.behind) + + return LookAroundConditional(self.behind, self.positive, subpattern, + yes_item, no_item) + + def pack_characters(self, info): + self.subpattern = self.subpattern.pack_characters(info) + self.yes_item = self.yes_item.pack_characters(info) + self.no_item = self.no_item.pack_characters(info) + return self + + def remove_captures(self): + self.subpattern = self.subpattern.remove_captures() + self.yes_item = self.yes_item.remove_captures() + self.no_item = self.no_item.remove_captures() + + def is_atomic(self): + return (self.subpattern.is_atomic() and self.yes_item.is_atomic() and + self.no_item.is_atomic()) + + def can_be_affix(self): + return (self.subpattern.can_be_affix() and self.yes_item.can_be_affix() + and self.no_item.can_be_affix()) + + def contains_group(self): + return (self.subpattern.contains_group() or + self.yes_item.contains_group() or self.no_item.contains_group()) + + def _compile(self, reverse, fuzzy): + code = [(OP.CONDITIONAL, int(self.positive), int(not self.behind))] + code.extend(self.subpattern.compile(self.behind, fuzzy)) + code.append((OP.NEXT, )) + code.extend(self.yes_item.compile(reverse, fuzzy)) + add_code = self.no_item.compile(reverse, fuzzy) + if add_code: + code.append((OP.NEXT, )) + code.extend(add_code) + + code.append((OP.END, )) + + return code + + def dump(self, indent, reverse): + print("{}CONDITIONAL {} {}".format(INDENT * indent, + self._dir_text[self.behind], POS_TEXT[self.positive])) + self.subpattern.dump(indent + 1, self.behind) + print("{}EITHER".format(INDENT * indent)) + self.yes_item.dump(indent + 1, reverse) + if not self.no_item.is_empty(): + print("{}OR".format(INDENT * indent)) + self.no_item.dump(indent + 1, reverse) + + def is_empty(self): + return (self.subpattern.is_empty() and self.yes_item.is_empty() or + self.no_item.is_empty()) + + def __eq__(self, other): + return type(self) is type(other) and (self.subpattern, self.yes_item, + self.no_item) == (other.subpattern, other.yes_item, other.no_item) + + def max_width(self): + return max(self.yes_item.max_width(), self.no_item.max_width()) + + def get_required_string(self, reverse): + return self.max_width(), None + +class PrecompiledCode(RegexBase): + def __init__(self, code): + self.code = code + + def _compile(self, reverse, fuzzy): + return [tuple(self.code)] + +class Property(RegexBase): + _opcode = {(NOCASE, False): OP.PROPERTY, (IGNORECASE, False): + OP.PROPERTY_IGN, (FULLCASE, False): OP.PROPERTY, (FULLIGNORECASE, False): + OP.PROPERTY_IGN, (NOCASE, True): OP.PROPERTY_REV, (IGNORECASE, True): + OP.PROPERTY_IGN_REV, (FULLCASE, True): OP.PROPERTY_REV, (FULLIGNORECASE, + True): OP.PROPERTY_IGN_REV} + + def __init__(self, value, positive=True, case_flags=NOCASE, + zerowidth=False, encoding=0): + RegexBase.__init__(self) + self.value = value + self.positive = bool(positive) + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + self.zerowidth = bool(zerowidth) + self.encoding = encoding + + self._key = (self.__class__, self.value, self.positive, + self.case_flags, self.zerowidth) + + def rebuild(self, positive, case_flags, zerowidth): + return Property(self.value, positive, case_flags, zerowidth, + self.encoding) + + def optimise(self, info, reverse, in_set=False): + return self + + def get_firstset(self, reverse): + return set([self]) + + def has_simple_start(self): + return True + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if self.zerowidth: + flags |= ZEROWIDTH_OP + if fuzzy: + flags |= FUZZY_OP + flags |= self.encoding << ENCODING_OP_SHIFT + return [(self._opcode[self.case_flags, reverse], flags, self.value)] + + def dump(self, indent, reverse): + prop = PROPERTY_NAMES[self.value >> 16] + name, value = prop[0], prop[1][self.value & 0xFFFF] + print("{}PROPERTY {} {}:{}{}{}".format(INDENT * indent, + POS_TEXT[self.positive], name, value, CASE_TEXT[self.case_flags], + ["", " ASCII"][self.encoding])) + + def matches(self, ch): + return _regex.has_property_value(self.value, ch) == self.positive + + def max_width(self): + return 1 + +class Prune(ZeroWidthBase): + _op_name = "PRUNE" + + def _compile(self, reverse, fuzzy): + return [(OP.PRUNE, )] + +class Range(RegexBase): + _opcode = {(NOCASE, False): OP.RANGE, (IGNORECASE, False): OP.RANGE_IGN, + (FULLCASE, False): OP.RANGE, (FULLIGNORECASE, False): OP.RANGE_IGN, + (NOCASE, True): OP.RANGE_REV, (IGNORECASE, True): OP.RANGE_IGN_REV, + (FULLCASE, True): OP.RANGE_REV, (FULLIGNORECASE, True): OP.RANGE_IGN_REV} + _op_name = "RANGE" + + def __init__(self, lower, upper, positive=True, case_flags=NOCASE, + zerowidth=False): + RegexBase.__init__(self) + self.lower = lower + self.upper = upper + self.positive = bool(positive) + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + self.zerowidth = bool(zerowidth) + + self._key = (self.__class__, self.lower, self.upper, self.positive, + self.case_flags, self.zerowidth) + + def rebuild(self, positive, case_flags, zerowidth): + return Range(self.lower, self.upper, positive, case_flags, zerowidth) + + def optimise(self, info, reverse, in_set=False): + # Is the range case-sensitive? + if not self.positive or not (self.case_flags & IGNORECASE) or in_set: + return self + + # Is full case-folding possible? + if (not (info.flags & UNICODE) or (self.case_flags & FULLIGNORECASE) != + FULLIGNORECASE): + return self + + # Get the characters which expand to multiple codepoints on folding. + expanding_chars = _regex.get_expand_on_folding() + + # Get the folded characters in the range. + items = [] + for ch in expanding_chars: + if self.lower <= ord(ch) <= self.upper: + folded = _regex.fold_case(FULL_CASE_FOLDING, ch) + items.append(String([ord(c) for c in folded], + case_flags=self.case_flags)) + + if not items: + # We can fall back to simple case-folding. + return self + + if len(items) < self.upper - self.lower + 1: + # Not all the characters are covered by the full case-folding. + items.insert(0, self) + + return Branch(items) + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if self.zerowidth: + flags |= ZEROWIDTH_OP + if fuzzy: + flags |= FUZZY_OP + return [(self._opcode[self.case_flags, reverse], flags, self.lower, + self.upper)] + + def dump(self, indent, reverse): + display_lower = ascii(chr(self.lower)).lstrip("bu") + display_upper = ascii(chr(self.upper)).lstrip("bu") + print("{}RANGE {} {} {}{}".format(INDENT * indent, + POS_TEXT[self.positive], display_lower, display_upper, + CASE_TEXT[self.case_flags])) + + def matches(self, ch): + return (self.lower <= ch <= self.upper) == self.positive + + def max_width(self): + return 1 + +class RefGroup(RegexBase): + _opcode = {(NOCASE, False): OP.REF_GROUP, (IGNORECASE, False): + OP.REF_GROUP_IGN, (FULLCASE, False): OP.REF_GROUP, (FULLIGNORECASE, + False): OP.REF_GROUP_FLD, (NOCASE, True): OP.REF_GROUP_REV, (IGNORECASE, + True): OP.REF_GROUP_IGN_REV, (FULLCASE, True): OP.REF_GROUP_REV, + (FULLIGNORECASE, True): OP.REF_GROUP_FLD_REV} + + def __init__(self, info, group, position, case_flags=NOCASE): + RegexBase.__init__(self) + self.info = info + self.group = group + self.position = position + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + + self._key = self.__class__, self.group, self.case_flags + + def fix_groups(self, pattern, reverse, fuzzy): + try: + self.group = int(self.group) + except ValueError: + try: + self.group = self.info.group_index[self.group] + except KeyError: + raise error("unknown group", pattern, self.position) + + if not 1 <= self.group <= self.info.group_count: + raise error("invalid group reference", pattern, self.position) + + self._key = self.__class__, self.group, self.case_flags + + def remove_captures(self): + raise error("group reference not allowed", self.pattern, self.position) + + def _compile(self, reverse, fuzzy): + flags = 0 + if fuzzy: + flags |= FUZZY_OP + return [(self._opcode[self.case_flags, reverse], flags, self.group)] + + def dump(self, indent, reverse): + print("{}REF_GROUP {}{}".format(INDENT * indent, self.group, + CASE_TEXT[self.case_flags])) + + def max_width(self): + return UNLIMITED + + def __del__(self): + self.info = None + +class SearchAnchor(ZeroWidthBase): + _opcode = OP.SEARCH_ANCHOR + _op_name = "SEARCH_ANCHOR" + +class Sequence(RegexBase): + def __init__(self, items=None): + RegexBase.__init__(self) + if items is None: + items = [] + + self.items = items + + def fix_groups(self, pattern, reverse, fuzzy): + for s in self.items: + s.fix_groups(pattern, reverse, fuzzy) + + def optimise(self, info, reverse): + # Flatten the sequences. + items = [] + for s in self.items: + s = s.optimise(info, reverse) + if isinstance(s, Sequence): + items.extend(s.items) + else: + items.append(s) + + return make_sequence(items) + + def pack_characters(self, info): + "Packs sequences of characters into strings." + items = [] + characters = [] + case_flags = NOCASE + for s in self.items: + if type(s) is Character and s.positive and not s.zerowidth: + if s.case_flags != case_flags: + # Different case sensitivity, so flush, unless neither the + # previous nor the new character are cased. + if s.case_flags or is_cased_i(info, s.value): + Sequence._flush_characters(info, characters, + case_flags, items) + + case_flags = s.case_flags + + characters.append(s.value) + elif type(s) is String or type(s) is Literal: + if s.case_flags != case_flags: + # Different case sensitivity, so flush, unless the neither + # the previous nor the new string are cased. + if s.case_flags or any(is_cased_i(info, c) for c in + characters): + Sequence._flush_characters(info, characters, + case_flags, items) + + case_flags = s.case_flags + + characters.extend(s.characters) + else: + Sequence._flush_characters(info, characters, case_flags, items) + + items.append(s.pack_characters(info)) + + Sequence._flush_characters(info, characters, case_flags, items) + + return make_sequence(items) + + def remove_captures(self): + self.items = [s.remove_captures() for s in self.items] + return self + + def is_atomic(self): + return all(s.is_atomic() for s in self.items) + + def can_be_affix(self): + return False + + def contains_group(self): + return any(s.contains_group() for s in self.items) + + def get_firstset(self, reverse): + fs = set() + items = self.items + if reverse: + items.reverse() + for s in items: + fs |= s.get_firstset(reverse) + if None not in fs: + return fs + fs.discard(None) + + return fs | set([None]) + + def has_simple_start(self): + return bool(self.items) and self.items[0].has_simple_start() + + def _compile(self, reverse, fuzzy): + seq = self.items + if reverse: + seq = seq[::-1] + + code = [] + for s in seq: + code.extend(s.compile(reverse, fuzzy)) + + return code + + def dump(self, indent, reverse): + for s in self.items: + s.dump(indent, reverse) + + @staticmethod + def _flush_characters(info, characters, case_flags, items): + if not characters: + return + + # Disregard case_flags if all of the characters are case-less. + if case_flags & IGNORECASE: + if not any(is_cased_i(info, c) for c in characters): + case_flags = NOCASE + + if (case_flags & FULLIGNORECASE) == FULLIGNORECASE: + literals = Sequence._fix_full_casefold(characters) + + for item in literals: + chars = item.characters + + if len(chars) == 1: + items.append(Character(chars[0], case_flags=item.case_flags)) + else: + items.append(String(chars, case_flags=item.case_flags)) + else: + if len(characters) == 1: + items.append(Character(characters[0], case_flags=case_flags)) + else: + items.append(String(characters, case_flags=case_flags)) + + characters[:] = [] + + @staticmethod + def _fix_full_casefold(characters): + # Split a literal needing full case-folding into chunks that need it + # and chunks that can use simple case-folding, which is faster. + expanded = [_regex.fold_case(FULL_CASE_FOLDING, c) for c in + _regex.get_expand_on_folding()] + string = _regex.fold_case(FULL_CASE_FOLDING, ''.join(chr(c) + for c in characters)).lower() + chunks = [] + + for e in expanded: + found = string.find(e) + + while found >= 0: + chunks.append((found, found + len(e))) + found = string.find(e, found + 1) + + pos = 0 + literals = [] + + for start, end in Sequence._merge_chunks(chunks): + if pos < start: + literals.append(Literal(characters[pos : start], + case_flags=IGNORECASE)) + + literals.append(Literal(characters[start : end], + case_flags=FULLIGNORECASE)) + pos = end + + if pos < len(characters): + literals.append(Literal(characters[pos : ], case_flags=IGNORECASE)) + + return literals + + @staticmethod + def _merge_chunks(chunks): + if len(chunks) < 2: + return chunks + + chunks.sort() + + start, end = chunks[0] + new_chunks = [] + + for s, e in chunks[1 : ]: + if s <= end: + end = max(end, e) + else: + new_chunks.append((start, end)) + start, end = s, e + + new_chunks.append((start, end)) + + return new_chunks + + def is_empty(self): + return all(i.is_empty() for i in self.items) + + def __eq__(self, other): + return type(self) is type(other) and self.items == other.items + + def max_width(self): + return sum(s.max_width() for s in self.items) + + def get_required_string(self, reverse): + seq = self.items + if reverse: + seq = seq[::-1] + + offset = 0 + + for s in seq: + ofs, req = s.get_required_string(reverse) + offset += ofs + if req: + return offset, req + + return offset, None + +class SetBase(RegexBase): + def __init__(self, info, items, positive=True, case_flags=NOCASE, + zerowidth=False): + RegexBase.__init__(self) + self.info = info + self.items = tuple(items) + self.positive = bool(positive) + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + self.zerowidth = bool(zerowidth) + + self.char_width = 1 + + self._key = (self.__class__, self.items, self.positive, + self.case_flags, self.zerowidth) + + def rebuild(self, positive, case_flags, zerowidth): + return type(self)(self.info, self.items, positive, case_flags, + zerowidth).optimise(self.info, False) + + def get_firstset(self, reverse): + return set([self]) + + def has_simple_start(self): + return True + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if self.zerowidth: + flags |= ZEROWIDTH_OP + if fuzzy: + flags |= FUZZY_OP + code = [(self._opcode[self.case_flags, reverse], flags)] + for m in self.items: + code.extend(m.compile()) + + code.append((OP.END, )) + + return code + + def dump(self, indent, reverse): + print("{}{} {}{}".format(INDENT * indent, self._op_name, + POS_TEXT[self.positive], CASE_TEXT[self.case_flags])) + for i in self.items: + i.dump(indent + 1, reverse) + + def _handle_case_folding(self, info, in_set): + # Is the set case-sensitive? + if not self.positive or not (self.case_flags & IGNORECASE) or in_set: + return self + + # Is full case-folding possible? + if (not (self.info.flags & UNICODE) or (self.case_flags & + FULLIGNORECASE) != FULLIGNORECASE): + return self + + # Get the characters which expand to multiple codepoints on folding. + expanding_chars = _regex.get_expand_on_folding() + + # Get the folded characters in the set. + items = [] + seen = set() + for ch in expanding_chars: + if self.matches(ord(ch)): + folded = _regex.fold_case(FULL_CASE_FOLDING, ch) + if folded not in seen: + items.append(String([ord(c) for c in folded], + case_flags=self.case_flags)) + seen.add(folded) + + if not items: + # We can fall back to simple case-folding. + return self + + return Branch([self] + items) + + def max_width(self): + # Is the set case-sensitive? + if not self.positive or not (self.case_flags & IGNORECASE): + return 1 + + # Is full case-folding possible? + if (not (self.info.flags & UNICODE) or (self.case_flags & + FULLIGNORECASE) != FULLIGNORECASE): + return 1 + + # Get the characters which expand to multiple codepoints on folding. + expanding_chars = _regex.get_expand_on_folding() + + # Get the folded characters in the set. + seen = set() + for ch in expanding_chars: + if self.matches(ord(ch)): + folded = _regex.fold_case(FULL_CASE_FOLDING, ch) + seen.add(folded) + + if not seen: + return 1 + + return max(len(folded) for folded in seen) + + def __del__(self): + self.info = None + +class SetDiff(SetBase): + _opcode = {(NOCASE, False): OP.SET_DIFF, (IGNORECASE, False): + OP.SET_DIFF_IGN, (FULLCASE, False): OP.SET_DIFF, (FULLIGNORECASE, False): + OP.SET_DIFF_IGN, (NOCASE, True): OP.SET_DIFF_REV, (IGNORECASE, True): + OP.SET_DIFF_IGN_REV, (FULLCASE, True): OP.SET_DIFF_REV, (FULLIGNORECASE, + True): OP.SET_DIFF_IGN_REV} + _op_name = "SET_DIFF" + + def optimise(self, info, reverse, in_set=False): + items = self.items + if len(items) > 2: + items = [items[0], SetUnion(info, items[1 : ])] + + if len(items) == 1: + return items[0].with_flags(case_flags=self.case_flags, + zerowidth=self.zerowidth).optimise(info, reverse, in_set) + + self.items = tuple(m.optimise(info, reverse, in_set=True) for m in + items) + + return self._handle_case_folding(info, in_set) + + def matches(self, ch): + m = self.items[0].matches(ch) and not self.items[1].matches(ch) + return m == self.positive + +class SetInter(SetBase): + _opcode = {(NOCASE, False): OP.SET_INTER, (IGNORECASE, False): + OP.SET_INTER_IGN, (FULLCASE, False): OP.SET_INTER, (FULLIGNORECASE, + False): OP.SET_INTER_IGN, (NOCASE, True): OP.SET_INTER_REV, (IGNORECASE, + True): OP.SET_INTER_IGN_REV, (FULLCASE, True): OP.SET_INTER_REV, + (FULLIGNORECASE, True): OP.SET_INTER_IGN_REV} + _op_name = "SET_INTER" + + def optimise(self, info, reverse, in_set=False): + items = [] + for m in self.items: + m = m.optimise(info, reverse, in_set=True) + if isinstance(m, SetInter) and m.positive: + # Intersection in intersection. + items.extend(m.items) + else: + items.append(m) + + if len(items) == 1: + return items[0].with_flags(case_flags=self.case_flags, + zerowidth=self.zerowidth).optimise(info, reverse, in_set) + + self.items = tuple(items) + + return self._handle_case_folding(info, in_set) + + def matches(self, ch): + m = all(i.matches(ch) for i in self.items) + return m == self.positive + +class SetSymDiff(SetBase): + _opcode = {(NOCASE, False): OP.SET_SYM_DIFF, (IGNORECASE, False): + OP.SET_SYM_DIFF_IGN, (FULLCASE, False): OP.SET_SYM_DIFF, (FULLIGNORECASE, + False): OP.SET_SYM_DIFF_IGN, (NOCASE, True): OP.SET_SYM_DIFF_REV, + (IGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV, (FULLCASE, True): + OP.SET_SYM_DIFF_REV, (FULLIGNORECASE, True): OP.SET_SYM_DIFF_IGN_REV} + _op_name = "SET_SYM_DIFF" + + def optimise(self, info, reverse, in_set=False): + items = [] + for m in self.items: + m = m.optimise(info, reverse, in_set=True) + if isinstance(m, SetSymDiff) and m.positive: + # Symmetric difference in symmetric difference. + items.extend(m.items) + else: + items.append(m) + + if len(items) == 1: + return items[0].with_flags(case_flags=self.case_flags, + zerowidth=self.zerowidth).optimise(info, reverse, in_set) + + self.items = tuple(items) + + return self._handle_case_folding(info, in_set) + + def matches(self, ch): + m = False + for i in self.items: + m = m != i.matches(ch) + + return m == self.positive + +class SetUnion(SetBase): + _opcode = {(NOCASE, False): OP.SET_UNION, (IGNORECASE, False): + OP.SET_UNION_IGN, (FULLCASE, False): OP.SET_UNION, (FULLIGNORECASE, + False): OP.SET_UNION_IGN, (NOCASE, True): OP.SET_UNION_REV, (IGNORECASE, + True): OP.SET_UNION_IGN_REV, (FULLCASE, True): OP.SET_UNION_REV, + (FULLIGNORECASE, True): OP.SET_UNION_IGN_REV} + _op_name = "SET_UNION" + + def optimise(self, info, reverse, in_set=False): + items = [] + for m in self.items: + m = m.optimise(info, reverse, in_set=True) + if isinstance(m, SetUnion) and m.positive: + # Union in union. + items.extend(m.items) + elif isinstance(m, AnyAll): + return AnyAll() + else: + items.append(m) + + # Are there complementary properties? + properties = (set(), set()) + + for m in items: + if isinstance(m, Property): + properties[m.positive].add((m.value, m.case_flags, m.zerowidth)) + + if properties[0] & properties[1]: + return AnyAll() + + if len(items) == 1: + i = items[0] + return i.with_flags(positive=i.positive == self.positive, + case_flags=self.case_flags, + zerowidth=self.zerowidth).optimise(info, reverse, in_set) + + self.items = tuple(items) + + return self._handle_case_folding(info, in_set) + + def _compile(self, reverse, fuzzy): + flags = 0 + if self.positive: + flags |= POSITIVE_OP + if self.zerowidth: + flags |= ZEROWIDTH_OP + if fuzzy: + flags |= FUZZY_OP + + characters, others = defaultdict(list), [] + for m in self.items: + if isinstance(m, Character): + characters[m.positive].append(m.value) + else: + others.append(m) + + code = [(self._opcode[self.case_flags, reverse], flags)] + + for positive, values in characters.items(): + flags = 0 + if positive: + flags |= POSITIVE_OP + if len(values) == 1: + code.append((OP.CHARACTER, flags, values[0])) + else: + code.append((OP.STRING, flags, len(values)) + tuple(values)) + + for m in others: + code.extend(m.compile()) + + code.append((OP.END, )) + + return code + + def matches(self, ch): + m = any(i.matches(ch) for i in self.items) + return m == self.positive + +class Skip(ZeroWidthBase): + _op_name = "SKIP" + _opcode = OP.SKIP + +class StartOfLine(ZeroWidthBase): + _opcode = OP.START_OF_LINE + _op_name = "START_OF_LINE" + +class StartOfLineU(StartOfLine): + _opcode = OP.START_OF_LINE_U + _op_name = "START_OF_LINE_U" + +class StartOfString(ZeroWidthBase): + _opcode = OP.START_OF_STRING + _op_name = "START_OF_STRING" + +class StartOfWord(ZeroWidthBase): + _opcode = OP.START_OF_WORD + _op_name = "START_OF_WORD" + +class String(RegexBase): + _opcode = {(NOCASE, False): OP.STRING, (IGNORECASE, False): OP.STRING_IGN, + (FULLCASE, False): OP.STRING, (FULLIGNORECASE, False): OP.STRING_FLD, + (NOCASE, True): OP.STRING_REV, (IGNORECASE, True): OP.STRING_IGN_REV, + (FULLCASE, True): OP.STRING_REV, (FULLIGNORECASE, True): + OP.STRING_FLD_REV} + + def __init__(self, characters, case_flags=NOCASE): + self.characters = tuple(characters) + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + + if (self.case_flags & FULLIGNORECASE) == FULLIGNORECASE: + folded_characters = [] + for char in self.characters: + folded = _regex.fold_case(FULL_CASE_FOLDING, chr(char)) + folded_characters.extend(ord(c) for c in folded) + else: + folded_characters = self.characters + + self.folded_characters = tuple(folded_characters) + self.required = False + + self._key = self.__class__, self.characters, self.case_flags + + def get_firstset(self, reverse): + if reverse: + pos = -1 + else: + pos = 0 + return set([Character(self.characters[pos], + case_flags=self.case_flags)]) + + def has_simple_start(self): + return True + + def _compile(self, reverse, fuzzy): + flags = 0 + if fuzzy: + flags |= FUZZY_OP + if self.required: + flags |= REQUIRED_OP + return [(self._opcode[self.case_flags, reverse], flags, + len(self.folded_characters)) + self.folded_characters] + + def dump(self, indent, reverse): + display = ascii("".join(chr(c) for c in self.characters)).lstrip("bu") + print("{}STRING {}{}".format(INDENT * indent, display, + CASE_TEXT[self.case_flags])) + + def max_width(self): + return len(self.folded_characters) + + def get_required_string(self, reverse): + return 0, self + +class Literal(String): + def dump(self, indent, reverse): + literal = ''.join(chr(c) for c in self.characters) + display = ascii(literal).lstrip("bu") + print("{}LITERAL MATCH {}{}".format(INDENT * indent, display, + CASE_TEXT[self.case_flags])) + +class StringSet(Branch): + def __init__(self, info, name, case_flags=NOCASE): + self.info = info + self.name = name + self.case_flags = CASE_FLAGS_COMBINATIONS[case_flags] + + self._key = self.__class__, self.name, self.case_flags + + self.set_key = (name, self.case_flags) + if self.set_key not in info.named_lists_used: + info.named_lists_used[self.set_key] = len(info.named_lists_used) + + index = self.info.named_lists_used[self.set_key] + items = self.info.kwargs[self.name] + + case_flags = self.case_flags + + encoding = self.info.flags & _ALL_ENCODINGS + fold_flags = encoding | case_flags + + choices = [] + + for string in items: + if isinstance(string, str): + string = [ord(c) for c in string] + + choices.append([Character(c, case_flags=case_flags) for c in + string]) + + # Sort from longest to shortest. + choices.sort(key=len, reverse=True) + + self.branches = [Sequence(choice) for choice in choices] + + def dump(self, indent, reverse): + print("{}STRING_SET {}{}".format(INDENT * indent, self.name, + CASE_TEXT[self.case_flags])) + + def __del__(self): + self.info = None + +class Source: + "Scanner for the regular expression source string." + def __init__(self, string): + if isinstance(string, str): + self.string = string + self.char_type = chr + else: + self.string = string.decode("latin-1") + self.char_type = lambda c: bytes([c]) + + self.pos = 0 + self.ignore_space = False + self.sep = string[ : 0] + + def peek(self, override_ignore=False): + string = self.string + pos = self.pos + + try: + if self.ignore_space and not override_ignore: + while True: + if string[pos].isspace(): + # Skip over the whitespace. + pos += 1 + elif string[pos] == "#": + # Skip over the comment to the end of the line. + pos = string.index("\n", pos) + else: + break + + return string[pos] + except IndexError: + # We've reached the end of the string. + return string[ : 0] + except ValueError: + # The comment extended to the end of the string. + return string[ : 0] + + def get(self, override_ignore=False): + string = self.string + pos = self.pos + + try: + if self.ignore_space and not override_ignore: + while True: + if string[pos].isspace(): + # Skip over the whitespace. + pos += 1 + elif string[pos] == "#": + # Skip over the comment to the end of the line. + pos = string.index("\n", pos) + else: + break + + ch = string[pos] + self.pos = pos + 1 + return ch + except IndexError: + # We've reached the end of the string. + self.pos = pos + return string[ : 0] + except ValueError: + # The comment extended to the end of the string. + self.pos = len(string) + return string[ : 0] + + def get_many(self, count=1): + string = self.string + pos = self.pos + + try: + if self.ignore_space: + substring = [] + + while len(substring) < count: + while True: + if string[pos].isspace(): + # Skip over the whitespace. + pos += 1 + elif string[pos] == "#": + # Skip over the comment to the end of the line. + pos = string.index("\n", pos) + else: + break + + substring.append(string[pos]) + pos += 1 + + substring = "".join(substring) + else: + substring = string[pos : pos + count] + pos += len(substring) + + self.pos = pos + return substring + except IndexError: + # We've reached the end of the string. + self.pos = len(string) + return "".join(substring) + except ValueError: + # The comment extended to the end of the string. + self.pos = len(string) + return "".join(substring) + + def get_while(self, test_set, include=True, keep_spaces=False): + string = self.string + pos = self.pos + + if self.ignore_space and not keep_spaces: + try: + substring = [] + + while True: + if string[pos].isspace(): + # Skip over the whitespace. + pos += 1 + elif string[pos] == "#": + # Skip over the comment to the end of the line. + pos = string.index("\n", pos) + elif (string[pos] in test_set) == include: + substring.append(string[pos]) + pos += 1 + else: + break + + self.pos = pos + except IndexError: + # We've reached the end of the string. + self.pos = len(string) + except ValueError: + # The comment extended to the end of the string. + self.pos = len(string) + + return "".join(substring) + else: + try: + while (string[pos] in test_set) == include: + pos += 1 + + substring = string[self.pos : pos] + + self.pos = pos + + return substring + except IndexError: + # We've reached the end of the string. + substring = string[self.pos : pos] + + self.pos = pos + + return substring + + def skip_while(self, test_set, include=True): + string = self.string + pos = self.pos + + try: + if self.ignore_space: + while True: + if string[pos].isspace(): + # Skip over the whitespace. + pos += 1 + elif string[pos] == "#": + # Skip over the comment to the end of the line. + pos = string.index("\n", pos) + elif (string[pos] in test_set) == include: + pos += 1 + else: + break + else: + while (string[pos] in test_set) == include: + pos += 1 + + self.pos = pos + except IndexError: + # We've reached the end of the string. + self.pos = len(string) + except ValueError: + # The comment extended to the end of the string. + self.pos = len(string) + + def match(self, substring): + string = self.string + pos = self.pos + + if self.ignore_space: + try: + for c in substring: + while True: + if string[pos].isspace(): + # Skip over the whitespace. + pos += 1 + elif string[pos] == "#": + # Skip over the comment to the end of the line. + pos = string.index("\n", pos) + else: + break + + if string[pos] != c: + return False + + pos += 1 + + self.pos = pos + + return True + except IndexError: + # We've reached the end of the string. + return False + except ValueError: + # The comment extended to the end of the string. + return False + else: + if not string.startswith(substring, pos): + return False + + self.pos = pos + len(substring) + + return True + + def expect(self, substring): + if not self.match(substring): + raise error("missing {}".format(substring), self.string, self.pos) + + def at_end(self): + string = self.string + pos = self.pos + + try: + if self.ignore_space: + while True: + if string[pos].isspace(): + pos += 1 + elif string[pos] == "#": + pos = string.index("\n", pos) + else: + break + + return pos >= len(string) + except IndexError: + # We've reached the end of the string. + return True + except ValueError: + # The comment extended to the end of the string. + return True + +class Info: + "Info about the regular expression." + + def __init__(self, flags=0, char_type=None, kwargs={}): + flags |= DEFAULT_FLAGS[(flags & _ALL_VERSIONS) or DEFAULT_VERSION] + self.flags = flags + self.global_flags = flags + self.inline_locale = False + + self.kwargs = kwargs + + self.group_count = 0 + self.group_index = {} + self.group_name = {} + self.char_type = char_type + self.named_lists_used = {} + self.open_groups = [] + self.open_group_count = {} + self.defined_groups = {} + self.group_calls = [] + self.private_groups = {} + + def open_group(self, name=None): + group = self.group_index.get(name) + if group is None: + while True: + self.group_count += 1 + if name is None or self.group_count not in self.group_name: + break + + group = self.group_count + if name: + self.group_index[name] = group + self.group_name[group] = name + + if group in self.open_groups: + # We have a nested named group. We'll assign it a private group + # number, initially negative until we can assign a proper + # (positive) number. + group_alias = -(len(self.private_groups) + 1) + self.private_groups[group_alias] = group + group = group_alias + + self.open_groups.append(group) + self.open_group_count[group] = self.open_group_count.get(group, 0) + 1 + + return group + + def close_group(self): + self.open_groups.pop() + + def is_open_group(self, name): + # In version 1, a group reference can refer to an open group. We'll + # just pretend the group isn't open. + version = (self.flags & _ALL_VERSIONS) or DEFAULT_VERSION + if version == VERSION1: + return False + + if name.isdigit(): + group = int(name) + else: + group = self.group_index.get(name) + + return group in self.open_groups + +def _check_group_features(info, parsed): + """Checks whether the reverse and fuzzy features of the group calls match + the groups which they call. + """ + call_refs = {} + additional_groups = [] + for call, reverse, fuzzy in info.group_calls: + # Look up the reference of this group call. + key = (call.group, reverse, fuzzy) + ref = call_refs.get(key) + if ref is None: + # This group doesn't have a reference yet, so look up its features. + if call.group == 0: + # Calling the pattern as a whole. + rev = bool(info.flags & REVERSE) + fuz = isinstance(parsed, Fuzzy) + if (rev, fuz) != (reverse, fuzzy): + # The pattern as a whole doesn't have the features we want, + # so we'll need to make a copy of it with the desired + # features. + additional_groups.append((CallRef(len(call_refs), parsed), + reverse, fuzzy)) + else: + # Calling a capture group. + def_info = info.defined_groups[call.group] + group = def_info[0] + if def_info[1 : ] != (reverse, fuzzy): + # The group doesn't have the features we want, so we'll + # need to make a copy of it with the desired features. + additional_groups.append((group, reverse, fuzzy)) + + ref = len(call_refs) + call_refs[key] = ref + + call.call_ref = ref + + info.call_refs = call_refs + info.additional_groups = additional_groups + +def _get_required_string(parsed, flags): + "Gets the required string and related info of a parsed pattern." + + req_offset, required = parsed.get_required_string(bool(flags & REVERSE)) + if required: + required.required = True + if req_offset >= UNLIMITED: + req_offset = -1 + + req_flags = required.case_flags + if not (flags & UNICODE): + req_flags &= ~UNICODE + + req_chars = required.folded_characters + else: + req_offset = 0 + req_chars = () + req_flags = 0 + + return req_offset, req_chars, req_flags + +class Scanner: + def __init__(self, lexicon, flags=0): + self.lexicon = lexicon + + # Combine phrases into a compound pattern. + patterns = [] + for phrase, action in lexicon: + # Parse the regular expression. + source = Source(phrase) + info = Info(flags, source.char_type) + source.ignore_space = bool(info.flags & VERBOSE) + parsed = _parse_pattern(source, info) + if not source.at_end(): + raise error("unbalanced parenthesis", source.string, + source.pos) + + # We want to forbid capture groups within each phrase. + patterns.append(parsed.remove_captures()) + + # Combine all the subpatterns into one pattern. + info = Info(flags) + patterns = [Group(info, g + 1, p) for g, p in enumerate(patterns)] + parsed = Branch(patterns) + + # Optimise the compound pattern. + reverse = bool(info.flags & REVERSE) + parsed = parsed.optimise(info, reverse) + parsed = parsed.pack_characters(info) + + # Get the required string. + req_offset, req_chars, req_flags = _get_required_string(parsed, + info.flags) + + # Check the features of the groups. + _check_group_features(info, parsed) + + # Complain if there are any group calls. They are not supported by the + # Scanner class. + if info.call_refs: + raise error("recursive regex not supported by Scanner", + source.string, source.pos) + + reverse = bool(info.flags & REVERSE) + + # Compile the compound pattern. The result is a list of tuples. + code = parsed.compile(reverse) + [(OP.SUCCESS, )] + + # Flatten the code into a list of ints. + code = _flatten_code(code) + + if not parsed.has_simple_start(): + # Get the first set, if possible. + try: + fs_code = _compile_firstset(info, parsed.get_firstset(reverse)) + fs_code = _flatten_code(fs_code) + code = fs_code + code + except _FirstSetError: + pass + + # Check the global flags for conflicts. + version = (info.flags & _ALL_VERSIONS) or DEFAULT_VERSION + if version not in (0, VERSION0, VERSION1): + raise ValueError("VERSION0 and VERSION1 flags are mutually incompatible") + + # Create the PatternObject. + # + # Local flags like IGNORECASE affect the code generation, but aren't + # needed by the PatternObject itself. Conversely, global flags like + # LOCALE _don't_ affect the code generation but _are_ needed by the + # PatternObject. + self.scanner = _regex.compile(None, (flags & GLOBAL_FLAGS) | version, + code, {}, {}, {}, [], req_offset, req_chars, req_flags, + len(patterns)) + + def scan(self, string): + result = [] + append = result.append + match = self.scanner.scanner(string).match + i = 0 + while True: + m = match() + if not m: + break + j = m.end() + if i == j: + break + action = self.lexicon[m.lastindex - 1][1] + if hasattr(action, '__call__'): + self.match = m + action = action(self, m.group()) + if action is not None: + append(action) + i = j + + return result, string[i : ] + +# Get the known properties dict. +PROPERTIES = _regex.get_properties() + +# Build the inverse of the properties dict. +PROPERTY_NAMES = {} +for prop_name, (prop_id, values) in PROPERTIES.items(): + name, prop_values = PROPERTY_NAMES.get(prop_id, ("", {})) + name = max(name, prop_name, key=len) + PROPERTY_NAMES[prop_id] = name, prop_values + + for val_name, val_id in values.items(): + prop_values[val_id] = max(prop_values.get(val_id, ""), val_name, + key=len) + +# Character escape sequences. +CHARACTER_ESCAPES = { + "a": "\a", + "b": "\b", + "f": "\f", + "n": "\n", + "r": "\r", + "t": "\t", + "v": "\v", +} + +ASCII_ENCODING = 1 +UNICODE_ENCODING = 2 + +# Predefined character set escape sequences. +CHARSET_ESCAPES = { + "d": lookup_property(None, "Digit", True), + "D": lookup_property(None, "Digit", False), + "h": lookup_property(None, "Blank", True), + "s": lookup_property(None, "Space", True), + "S": lookup_property(None, "Space", False), + "w": lookup_property(None, "Word", True), + "W": lookup_property(None, "Word", False), +} + +ASCII_CHARSET_ESCAPES = dict(CHARSET_ESCAPES) +ASCII_CHARSET_ESCAPES.update({ + "d": lookup_property(None, "Digit", True, encoding=ASCII_ENCODING), + "D": lookup_property(None, "Digit", False, encoding=ASCII_ENCODING), + "s": lookup_property(None, "Space", True, encoding=ASCII_ENCODING), + "S": lookup_property(None, "Space", False, encoding=ASCII_ENCODING), + "w": lookup_property(None, "Word", True, encoding=ASCII_ENCODING), + "W": lookup_property(None, "Word", False, encoding=ASCII_ENCODING), +}) +UNICODE_CHARSET_ESCAPES = dict(CHARSET_ESCAPES) +UNICODE_CHARSET_ESCAPES.update({ + "d": lookup_property(None, "Digit", True, encoding=UNICODE_ENCODING), + "D": lookup_property(None, "Digit", False, encoding=UNICODE_ENCODING), + "s": lookup_property(None, "Space", True, encoding=UNICODE_ENCODING), + "S": lookup_property(None, "Space", False, encoding=UNICODE_ENCODING), + "w": lookup_property(None, "Word", True, encoding=UNICODE_ENCODING), + "W": lookup_property(None, "Word", False, encoding=UNICODE_ENCODING), +}) + +# Positional escape sequences. +POSITION_ESCAPES = { + "A": StartOfString(), + "b": Boundary(), + "B": Boundary(False), + "K": Keep(), + "m": StartOfWord(), + "M": EndOfWord(), + "Z": EndOfString(), + "z": EndOfString(), +} +ASCII_POSITION_ESCAPES = dict(POSITION_ESCAPES) +ASCII_POSITION_ESCAPES.update({ + "b": Boundary(encoding=ASCII_ENCODING), + "B": Boundary(False, encoding=ASCII_ENCODING), + "m": StartOfWord(encoding=ASCII_ENCODING), + "M": EndOfWord(encoding=ASCII_ENCODING), +}) +UNICODE_POSITION_ESCAPES = dict(POSITION_ESCAPES) +UNICODE_POSITION_ESCAPES.update({ + "b": Boundary(encoding=UNICODE_ENCODING), + "B": Boundary(False, encoding=UNICODE_ENCODING), + "m": StartOfWord(encoding=UNICODE_ENCODING), + "M": EndOfWord(encoding=UNICODE_ENCODING), +}) + +# Positional escape sequences when WORD flag set. +WORD_POSITION_ESCAPES = dict(POSITION_ESCAPES) +WORD_POSITION_ESCAPES.update({ + "b": DefaultBoundary(), + "B": DefaultBoundary(False), + "m": DefaultStartOfWord(), + "M": DefaultEndOfWord(), +}) + +# Regex control verbs. +VERBS = { + "FAIL": Failure(), + "F": Failure(), + "PRUNE": Prune(), + "SKIP": Skip(), +} diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/tests/test_regex.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/tests/test_regex.py new file mode 100644 index 0000000000000000000000000000000000000000..b94ac8babd0615f524960d1aa2d85f724d4bd73d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/regex/tests/test_regex.py @@ -0,0 +1,4540 @@ +from weakref import proxy +import copy +import pickle +import regex +import string +import sys +import unittest + +# String subclasses for issue 18468. +class StrSubclass(str): + def __getitem__(self, index): + return StrSubclass(super().__getitem__(index)) + +class BytesSubclass(bytes): + def __getitem__(self, index): + return BytesSubclass(super().__getitem__(index)) + +class RegexTests(unittest.TestCase): + PATTERN_CLASS = "" + FLAGS_WITH_COMPILED_PAT = "cannot process flags argument with a compiled pattern" + INVALID_GROUP_REF = "invalid group reference" + MISSING_GT = "missing >" + BAD_GROUP_NAME = "bad character in group name" + MISSING_GROUP_NAME = "missing group name" + MISSING_LT = "missing <" + UNKNOWN_GROUP_I = "unknown group" + UNKNOWN_GROUP = "unknown group" + BAD_ESCAPE = r"bad escape \(end of pattern\)" + BAD_OCTAL_ESCAPE = r"bad escape \\" + BAD_SET = "unterminated character set" + STR_PAT_ON_BYTES = "cannot use a string pattern on a bytes-like object" + BYTES_PAT_ON_STR = "cannot use a bytes pattern on a string-like object" + STR_PAT_BYTES_TEMPL = "expected str instance, bytes found" + BYTES_PAT_STR_TEMPL = "expected a bytes-like object, str found" + BYTES_PAT_UNI_FLAG = "cannot use UNICODE flag with a bytes pattern" + MIXED_FLAGS = "ASCII, LOCALE and UNICODE flags are mutually incompatible" + MISSING_RPAREN = "missing \\)" + TRAILING_CHARS = "unbalanced parenthesis" + BAD_CHAR_RANGE = "bad character range" + NOTHING_TO_REPEAT = "nothing to repeat" + MULTIPLE_REPEAT = "multiple repeat" + OPEN_GROUP = "cannot refer to an open group" + DUPLICATE_GROUP = "duplicate group" + CANT_TURN_OFF = "bad inline flags: cannot turn flags off" + UNDEF_CHAR_NAME = "undefined character name" + + def assertTypedEqual(self, actual, expect, msg=None): + self.assertEqual(actual, expect, msg) + + def recurse(actual, expect): + if isinstance(expect, (tuple, list)): + for x, y in zip(actual, expect): + recurse(x, y) + else: + self.assertIs(type(actual), type(expect), msg) + + recurse(actual, expect) + + def test_weakref(self): + s = 'QabbbcR' + x = regex.compile('ab+c') + y = proxy(x) + if x.findall('QabbbcR') != y.findall('QabbbcR'): + self.fail() + + def test_search_star_plus(self): + self.assertEqual(regex.search('a*', 'xxx').span(0), (0, 0)) + self.assertEqual(regex.search('x*', 'axx').span(), (0, 0)) + self.assertEqual(regex.search('x+', 'axx').span(0), (1, 3)) + self.assertEqual(regex.search('x+', 'axx').span(), (1, 3)) + self.assertEqual(regex.search('x', 'aaa'), None) + self.assertEqual(regex.match('a*', 'xxx').span(0), (0, 0)) + self.assertEqual(regex.match('a*', 'xxx').span(), (0, 0)) + self.assertEqual(regex.match('x*', 'xxxa').span(0), (0, 3)) + self.assertEqual(regex.match('x*', 'xxxa').span(), (0, 3)) + self.assertEqual(regex.match('a+', 'xxx'), None) + + def bump_num(self, matchobj): + int_value = int(matchobj[0]) + return str(int_value + 1) + + def test_basic_regex_sub(self): + self.assertEqual(regex.sub("(?i)b+", "x", "bbbb BBBB"), 'x x') + self.assertEqual(regex.sub(r'\d+', self.bump_num, '08.2 -2 23x99y'), + '9.3 -3 24x100y') + self.assertEqual(regex.sub(r'\d+', self.bump_num, '08.2 -2 23x99y', 3), + '9.3 -3 23x99y') + + self.assertEqual(regex.sub('.', lambda m: r"\n", 'x'), "\\n") + self.assertEqual(regex.sub('.', r"\n", 'x'), "\n") + + self.assertEqual(regex.sub('(?Px)', r'\g\g', 'xx'), 'xxxx') + self.assertEqual(regex.sub('(?Px)', r'\g\g<1>', 'xx'), 'xxxx') + self.assertEqual(regex.sub('(?Px)', r'\g\g', 'xx'), + 'xxxx') + self.assertEqual(regex.sub('(?Px)', r'\g<1>\g<1>', 'xx'), 'xxxx') + + self.assertEqual(regex.sub('a', r'\t\n\v\r\f\a\b', 'a'), "\t\n\v\r\f\a\b") + self.assertEqual(regex.sub('a', '\t\n\v\r\f\a', 'a'), "\t\n\v\r\f\a") + self.assertEqual(regex.sub('a', '\t\n\v\r\f\a', 'a'), chr(9) + chr(10) + + chr(11) + chr(13) + chr(12) + chr(7)) + + self.assertEqual(regex.sub(r'^\s*', 'X', 'test'), 'Xtest') + + self.assertEqual(regex.sub(r"x", r"\x0A", "x"), "\n") + self.assertEqual(regex.sub(r"x", r"\u000A", "x"), "\n") + self.assertEqual(regex.sub(r"x", r"\U0000000A", "x"), "\n") + self.assertEqual(regex.sub(r"x", r"\N{LATIN CAPITAL LETTER A}", + "x"), "A") + + self.assertEqual(regex.sub(br"x", br"\x0A", b"x"), b"\n") + + def test_bug_449964(self): + # Fails for group followed by other escape. + self.assertEqual(regex.sub(r'(?Px)', r'\g<1>\g<1>\b', 'xx'), + "xx\bxx\b") + + def test_bug_449000(self): + # Test for sub() on escaped characters. + self.assertEqual(regex.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + self.assertEqual(regex.sub('\r\n', r'\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + self.assertEqual(regex.sub(r'\r\n', '\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + self.assertEqual(regex.sub('\r\n', '\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + + def test_bug_1661(self): + # Verify that flags do not get silently ignored with compiled patterns + pattern = regex.compile('.') + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.match(pattern, 'A', regex.I)) + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.search(pattern, 'A', regex.I)) + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.findall(pattern, 'A', regex.I)) + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.compile(pattern, regex.I)) + + def test_bug_3629(self): + # A regex that triggered a bug in the sre-code validator + self.assertEqual(repr(type(regex.compile("(?P)(?(quote))"))), + self.PATTERN_CLASS) + + def test_sub_template_numeric_escape(self): + # Bug 776311 and friends. + self.assertEqual(regex.sub('x', r'\0', 'x'), "\0") + self.assertEqual(regex.sub('x', r'\000', 'x'), "\000") + self.assertEqual(regex.sub('x', r'\001', 'x'), "\001") + self.assertEqual(regex.sub('x', r'\008', 'x'), "\0" + "8") + self.assertEqual(regex.sub('x', r'\009', 'x'), "\0" + "9") + self.assertEqual(regex.sub('x', r'\111', 'x'), "\111") + self.assertEqual(regex.sub('x', r'\117', 'x'), "\117") + + self.assertEqual(regex.sub('x', r'\1111', 'x'), "\1111") + self.assertEqual(regex.sub('x', r'\1111', 'x'), "\111" + "1") + + self.assertEqual(regex.sub('x', r'\00', 'x'), '\x00') + self.assertEqual(regex.sub('x', r'\07', 'x'), '\x07') + self.assertEqual(regex.sub('x', r'\08', 'x'), "\0" + "8") + self.assertEqual(regex.sub('x', r'\09', 'x'), "\0" + "9") + self.assertEqual(regex.sub('x', r'\0a', 'x'), "\0" + "a") + + self.assertEqual(regex.sub('x', r'\400', 'x'), "\u0100") + self.assertEqual(regex.sub('x', r'\777', 'x'), "\u01FF") + self.assertEqual(regex.sub(b'x', br'\400', b'x'), b"\x00") + self.assertEqual(regex.sub(b'x', br'\777', b'x'), b"\xFF") + + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\1', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\8', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\9', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\11', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\18', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\1a', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\90', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\99', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\118', 'x')) # r'\11' + '8' + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\11a', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\181', 'x')) # r'\18' + '1' + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\800', 'x')) # r'\80' + '0' + + # In Python 2.3 (etc), these loop endlessly in sre_parser.py. + self.assertEqual(regex.sub('(((((((((((x)))))))))))', r'\11', 'x'), + 'x') + self.assertEqual(regex.sub('((((((((((y))))))))))(.)', r'\118', 'xyz'), + 'xz8') + self.assertEqual(regex.sub('((((((((((y))))))))))(.)', r'\11a', 'xyz'), + 'xza') + + def test_qualified_re_sub(self): + self.assertEqual(regex.sub('a', 'b', 'aaaaa'), 'bbbbb') + self.assertEqual(regex.sub('a', 'b', 'aaaaa', 1), 'baaaa') + + def test_bug_114660(self): + self.assertEqual(regex.sub(r'(\S)\s+(\S)', r'\1 \2', 'hello there'), + 'hello there') + + def test_bug_462270(self): + # Test for empty sub() behaviour, see SF bug #462270 + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub('(?V0)x*', '-', 'abxd'), '-a-b--d-') + else: + self.assertEqual(regex.sub('(?V0)x*', '-', 'abxd'), '-a-b-d-') + self.assertEqual(regex.sub('(?V1)x*', '-', 'abxd'), '-a-b--d-') + self.assertEqual(regex.sub('x+', '-', 'abxd'), 'ab-d') + + def test_bug_14462(self): + # chr(255) is a valid identifier in Python 3. + group_name = '\xFF' + self.assertEqual(regex.search(r'(?P<' + group_name + '>a)', + 'abc').group(group_name), 'a') + + def test_symbolic_refs(self): + self.assertRaisesRegex(regex.error, self.MISSING_GT, lambda: + regex.sub('(?Px)', r'\gx)', r'\g<', 'xx')) + self.assertRaisesRegex(regex.error, self.MISSING_LT, lambda: + regex.sub('(?Px)', r'\g', 'xx')) + self.assertRaisesRegex(regex.error, self.BAD_GROUP_NAME, lambda: + regex.sub('(?Px)', r'\g', 'xx')) + self.assertRaisesRegex(regex.error, self.BAD_GROUP_NAME, lambda: + regex.sub('(?Px)', r'\g<1a1>', 'xx')) + self.assertRaisesRegex(IndexError, self.UNKNOWN_GROUP_I, lambda: + regex.sub('(?Px)', r'\g', 'xx')) + + # The new behaviour of unmatched but valid groups is to treat them like + # empty matches in the replacement template, like in Perl. + self.assertEqual(regex.sub('(?Px)|(?Py)', r'\g', 'xx'), '') + self.assertEqual(regex.sub('(?Px)|(?Py)', r'\2', 'xx'), '') + + # The old behaviour was to raise it as an IndexError. + self.assertRaisesRegex(regex.error, self.BAD_GROUP_NAME, lambda: + regex.sub('(?Px)', r'\g<-1>', 'xx')) + + def test_re_subn(self): + self.assertEqual(regex.subn("(?i)b+", "x", "bbbb BBBB"), ('x x', 2)) + self.assertEqual(regex.subn("b+", "x", "bbbb BBBB"), ('x BBBB', 1)) + self.assertEqual(regex.subn("b+", "x", "xyz"), ('xyz', 0)) + self.assertEqual(regex.subn("b*", "x", "xyz"), ('xxxyxzx', 4)) + self.assertEqual(regex.subn("b*", "x", "xyz", 2), ('xxxyz', 2)) + + def test_re_split(self): + self.assertEqual(regex.split(":", ":a:b::c"), ['', 'a', 'b', '', 'c']) + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split(":*", ":a:b::c"), ['', '', 'a', '', + 'b', '', 'c', '']) + self.assertEqual(regex.split("(:*)", ":a:b::c"), ['', ':', '', '', + 'a', ':', '', '', 'b', '::', '', '', 'c', '', '']) + self.assertEqual(regex.split("(?::*)", ":a:b::c"), ['', '', 'a', + '', 'b', '', 'c', '']) + self.assertEqual(regex.split("(:)*", ":a:b::c"), ['', ':', '', + None, 'a', ':', '', None, 'b', ':', '', None, 'c', None, '']) + else: + self.assertEqual(regex.split(":*", ":a:b::c"), ['', 'a', 'b', 'c']) + self.assertEqual(regex.split("(:*)", ":a:b::c"), ['', ':', 'a', + ':', 'b', '::', 'c']) + self.assertEqual(regex.split("(?::*)", ":a:b::c"), ['', 'a', 'b', + 'c']) + self.assertEqual(regex.split("(:)*", ":a:b::c"), ['', ':', 'a', + ':', 'b', ':', 'c']) + self.assertEqual(regex.split("([b:]+)", ":a:b::c"), ['', ':', 'a', + ':b::', 'c']) + self.assertEqual(regex.split("(b)|(:+)", ":a:b::c"), ['', None, ':', + 'a', None, ':', '', 'b', None, '', None, '::', 'c']) + self.assertEqual(regex.split("(?:b)|(?::+)", ":a:b::c"), ['', 'a', '', + '', 'c']) + + self.assertEqual(regex.split("x", "xaxbxc"), ['', 'a', 'b', 'c']) + self.assertEqual([m for m in regex.splititer("x", "xaxbxc")], ['', 'a', + 'b', 'c']) + + self.assertEqual(regex.split("(?r)x", "xaxbxc"), ['c', 'b', 'a', '']) + self.assertEqual([m for m in regex.splititer("(?r)x", "xaxbxc")], ['c', + 'b', 'a', '']) + + self.assertEqual(regex.split("(x)|(y)", "xaxbxc"), ['', 'x', None, 'a', + 'x', None, 'b', 'x', None, 'c']) + self.assertEqual([m for m in regex.splititer("(x)|(y)", "xaxbxc")], + ['', 'x', None, 'a', 'x', None, 'b', 'x', None, 'c']) + + self.assertEqual(regex.split("(?r)(x)|(y)", "xaxbxc"), ['c', 'x', None, + 'b', 'x', None, 'a', 'x', None, '']) + self.assertEqual([m for m in regex.splititer("(?r)(x)|(y)", "xaxbxc")], + ['c', 'x', None, 'b', 'x', None, 'a', 'x', None, '']) + + self.assertEqual(regex.split(r"(?V1)\b", "a b c"), ['', 'a', ' ', 'b', + ' ', 'c', '']) + self.assertEqual(regex.split(r"(?V1)\m", "a b c"), ['', 'a ', 'b ', + 'c']) + self.assertEqual(regex.split(r"(?V1)\M", "a b c"), ['a', ' b', ' c', + '']) + + def test_qualified_re_split(self): + self.assertEqual(regex.split(":", ":a:b::c", 2), ['', 'a', 'b::c']) + self.assertEqual(regex.split(':', 'a:b:c:d', 2), ['a', 'b', 'c:d']) + self.assertEqual(regex.split("(:)", ":a:b::c", 2), ['', ':', 'a', ':', + 'b::c']) + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split("(:*)", ":a:b::c", 2), ['', ':', '', + '', 'a:b::c']) + else: + self.assertEqual(regex.split("(:*)", ":a:b::c", 2), ['', ':', 'a', + ':', 'b::c']) + + def test_re_findall(self): + self.assertEqual(regex.findall(":+", "abc"), []) + self.assertEqual(regex.findall(":+", "a:b::c:::d"), [':', '::', ':::']) + self.assertEqual(regex.findall("(:+)", "a:b::c:::d"), [':', '::', + ':::']) + self.assertEqual(regex.findall("(:)(:*)", "a:b::c:::d"), [(':', ''), + (':', ':'), (':', '::')]) + + self.assertEqual(regex.findall(r"\((?P.{0,5}?TEST)\)", + "(MY TEST)"), ["MY TEST"]) + self.assertEqual(regex.findall(r"\((?P.{0,3}?TEST)\)", + "(MY TEST)"), ["MY TEST"]) + self.assertEqual(regex.findall(r"\((?P.{0,3}?T)\)", "(MY T)"), + ["MY T"]) + + self.assertEqual(regex.findall(r"[^a]{2}[A-Z]", "\n S"), [' S']) + self.assertEqual(regex.findall(r"[^a]{2,3}[A-Z]", "\n S"), ['\n S']) + self.assertEqual(regex.findall(r"[^a]{2,3}[A-Z]", "\n S"), [' S']) + + self.assertEqual(regex.findall(r"X(Y[^Y]+?){1,2}( |Q)+DEF", + "XYABCYPPQ\nQ DEF"), [('YPPQ\n', ' ')]) + + self.assertEqual(regex.findall(r"(\nTest(\n+.+?){0,2}?)?\n+End", + "\nTest\nxyz\nxyz\nEnd"), [('\nTest\nxyz\nxyz', '\nxyz')]) + + def test_bug_117612(self): + self.assertEqual(regex.findall(r"(a|(b))", "aba"), [('a', ''), ('b', + 'b'), ('a', '')]) + + def test_re_match(self): + self.assertEqual(regex.match('a', 'a')[:], ('a',)) + self.assertEqual(regex.match('(a)', 'a')[:], ('a', 'a')) + self.assertEqual(regex.match(r'(a)', 'a')[0], 'a') + self.assertEqual(regex.match(r'(a)', 'a')[1], 'a') + self.assertEqual(regex.match(r'(a)', 'a').group(1, 1), ('a', 'a')) + + pat = regex.compile('((a)|(b))(c)?') + self.assertEqual(pat.match('a')[:], ('a', 'a', 'a', None, None)) + self.assertEqual(pat.match('b')[:], ('b', 'b', None, 'b', None)) + self.assertEqual(pat.match('ac')[:], ('ac', 'a', 'a', None, 'c')) + self.assertEqual(pat.match('bc')[:], ('bc', 'b', None, 'b', 'c')) + self.assertEqual(pat.match('bc')[:], ('bc', 'b', None, 'b', 'c')) + + # A single group. + m = regex.match('(a)', 'a') + self.assertEqual(m.group(), 'a') + self.assertEqual(m.group(0), 'a') + self.assertEqual(m.group(1), 'a') + self.assertEqual(m.group(1, 1), ('a', 'a')) + + pat = regex.compile('(?:(?Pa)|(?Pb))(?Pc)?') + self.assertEqual(pat.match('a').group(1, 2, 3), ('a', None, None)) + self.assertEqual(pat.match('b').group('a1', 'b2', 'c3'), (None, 'b', + None)) + self.assertEqual(pat.match('ac').group(1, 'b2', 3), ('a', None, 'c')) + + def test_re_groupref_exists(self): + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', '(a)')[:], + ('(a)', '(', 'a')) + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', 'a')[:], ('a', + None, 'a')) + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', 'a)'), None) + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', '(a'), None) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)b|d))$', 'ab')[:], ('ab', + 'a', 'b')) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)b|d))$', 'cd')[:], ('cd', + None, 'd')) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)|d))$', 'cd')[:], ('cd', + None, 'd')) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)|d))$', 'a')[:], ('a', + 'a', '')) + + # Tests for bug #1177831: exercise groups other than the first group. + p = regex.compile('(?Pa)(?Pb)?((?(g2)c|d))') + self.assertEqual(p.match('abc')[:], ('abc', 'a', 'b', 'c')) + self.assertEqual(p.match('ad')[:], ('ad', 'a', None, 'd')) + self.assertEqual(p.match('abd'), None) + self.assertEqual(p.match('ac'), None) + + def test_re_groupref(self): + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1$', '|a|')[:], ('|a|', + '|', 'a')) + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1?$', 'a')[:], ('a', + None, 'a')) + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1$', 'a|'), None) + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1$', '|a'), None) + self.assertEqual(regex.match(r'^(?:(a)|c)(\1)$', 'aa')[:], ('aa', 'a', + 'a')) + self.assertEqual(regex.match(r'^(?:(a)|c)(\1)?$', 'c')[:], ('c', None, + None)) + + self.assertEqual(regex.findall(r"(?i)(.{1,40}?),(.{1,40}?)(?:;)+(.{1,80}).{1,40}?\3(\ |;)+(.{1,80}?)\1", + "TEST, BEST; LEST ; Lest 123 Test, Best"), [('TEST', ' BEST', + ' LEST', ' ', '123 ')]) + + def test_groupdict(self): + self.assertEqual(regex.match('(?Pfirst) (?Psecond)', + 'first second').groupdict(), {'first': 'first', 'second': 'second'}) + + def test_expand(self): + self.assertEqual(regex.match("(?Pfirst) (?Psecond)", + "first second").expand(r"\2 \1 \g \g"), + 'second first second first') + + def test_repeat_minmax(self): + self.assertEqual(regex.match(r"^(\w){1}$", "abc"), None) + self.assertEqual(regex.match(r"^(\w){1}?$", "abc"), None) + self.assertEqual(regex.match(r"^(\w){1,2}$", "abc"), None) + self.assertEqual(regex.match(r"^(\w){1,2}?$", "abc"), None) + + self.assertEqual(regex.match(r"^(\w){3}$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,3}$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,4}$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){3,4}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){3}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,3}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,4}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){3,4}?$", "abc")[1], 'c') + + self.assertEqual(regex.match("^x{1}$", "xxx"), None) + self.assertEqual(regex.match("^x{1}?$", "xxx"), None) + self.assertEqual(regex.match("^x{1,2}$", "xxx"), None) + self.assertEqual(regex.match("^x{1,2}?$", "xxx"), None) + + self.assertEqual(regex.match("^x{1}", "xxx")[0], 'x') + self.assertEqual(regex.match("^x{1}?", "xxx")[0], 'x') + self.assertEqual(regex.match("^x{0,1}", "xxx")[0], 'x') + self.assertEqual(regex.match("^x{0,1}?", "xxx")[0], '') + + self.assertEqual(bool(regex.match("^x{3}$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,3}$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,4}$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{3,4}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{3}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,3}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,4}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{3,4}?$", "xxx")), True) + + self.assertEqual(regex.match("^x{}$", "xxx"), None) + self.assertEqual(bool(regex.match("^x{}$", "x{}")), True) + + def test_getattr(self): + self.assertEqual(regex.compile("(?i)(a)(b)").pattern, '(?i)(a)(b)') + self.assertEqual(regex.compile("(?i)(a)(b)").flags, regex.I | regex.U | + regex.DEFAULT_VERSION) + self.assertEqual(regex.compile(b"(?i)(a)(b)").flags, regex.A | regex.I + | regex.DEFAULT_VERSION) + self.assertEqual(regex.compile("(?i)(a)(b)").groups, 2) + self.assertEqual(regex.compile("(?i)(a)(b)").groupindex, {}) + + self.assertEqual(regex.compile("(?i)(?Pa)(?Pb)").groupindex, + {'first': 1, 'other': 2}) + + self.assertEqual(regex.match("(a)", "a").pos, 0) + self.assertEqual(regex.match("(a)", "a").endpos, 1) + + self.assertEqual(regex.search("b(c)", "abcdef").pos, 0) + self.assertEqual(regex.search("b(c)", "abcdef").endpos, 6) + self.assertEqual(regex.search("b(c)", "abcdef").span(), (1, 3)) + self.assertEqual(regex.search("b(c)", "abcdef").span(1), (2, 3)) + + self.assertEqual(regex.match("(a)", "a").string, 'a') + self.assertEqual(regex.match("(a)", "a").regs, ((0, 1), (0, 1))) + self.assertEqual(repr(type(regex.match("(a)", "a").re)), + self.PATTERN_CLASS) + + # Issue 14260. + p = regex.compile(r'abc(?Pdef)') + p.groupindex["n"] = 0 + self.assertEqual(p.groupindex["n"], 1) + + def test_special_escapes(self): + self.assertEqual(regex.search(r"\b(b.)\b", "abcd abc bcd bx")[1], 'bx') + self.assertEqual(regex.search(r"\B(b.)\B", "abc bcd bc abxd")[1], 'bx') + self.assertEqual(regex.search(br"\b(b.)\b", b"abcd abc bcd bx", + regex.LOCALE)[1], b'bx') + self.assertEqual(regex.search(br"\B(b.)\B", b"abc bcd bc abxd", + regex.LOCALE)[1], b'bx') + self.assertEqual(regex.search(r"\b(b.)\b", "abcd abc bcd bx", + regex.UNICODE)[1], 'bx') + self.assertEqual(regex.search(r"\B(b.)\B", "abc bcd bc abxd", + regex.UNICODE)[1], 'bx') + + self.assertEqual(regex.search(r"^abc$", "\nabc\n", regex.M)[0], 'abc') + self.assertEqual(regex.search(r"^\Aabc\Z$", "abc", regex.M)[0], 'abc') + self.assertEqual(regex.search(r"^\Aabc\Z$", "\nabc\n", regex.M), None) + + self.assertEqual(regex.search(br"\b(b.)\b", b"abcd abc bcd bx")[1], + b'bx') + self.assertEqual(regex.search(br"\B(b.)\B", b"abc bcd bc abxd")[1], + b'bx') + self.assertEqual(regex.search(br"^abc$", b"\nabc\n", regex.M)[0], + b'abc') + self.assertEqual(regex.search(br"^\Aabc\Z$", b"abc", regex.M)[0], + b'abc') + self.assertEqual(regex.search(br"^\Aabc\Z$", b"\nabc\n", regex.M), + None) + + self.assertEqual(regex.search(r"\d\D\w\W\s\S", "1aa! a")[0], '1aa! a') + self.assertEqual(regex.search(br"\d\D\w\W\s\S", b"1aa! a", + regex.LOCALE)[0], b'1aa! a') + self.assertEqual(regex.search(r"\d\D\w\W\s\S", "1aa! a", + regex.UNICODE)[0], '1aa! a') + + def test_bigcharset(self): + self.assertEqual(regex.match(r"([\u2222\u2223])", "\u2222")[1], + '\u2222') + self.assertEqual(regex.match(r"([\u2222\u2223])", "\u2222", + regex.UNICODE)[1], '\u2222') + self.assertEqual("".join(regex.findall(".", + "e\xe8\xe9\xea\xeb\u0113\u011b\u0117", flags=regex.UNICODE)), + 'e\xe8\xe9\xea\xeb\u0113\u011b\u0117') + self.assertEqual("".join(regex.findall(r"[e\xe8\xe9\xea\xeb\u0113\u011b\u0117]", + "e\xe8\xe9\xea\xeb\u0113\u011b\u0117", flags=regex.UNICODE)), + 'e\xe8\xe9\xea\xeb\u0113\u011b\u0117') + self.assertEqual("".join(regex.findall(r"e|\xe8|\xe9|\xea|\xeb|\u0113|\u011b|\u0117", + "e\xe8\xe9\xea\xeb\u0113\u011b\u0117", flags=regex.UNICODE)), + 'e\xe8\xe9\xea\xeb\u0113\u011b\u0117') + + def test_anyall(self): + self.assertEqual(regex.match("a.b", "a\nb", regex.DOTALL)[0], "a\nb") + self.assertEqual(regex.match("a.*b", "a\n\nb", regex.DOTALL)[0], + "a\n\nb") + + def test_non_consuming(self): + self.assertEqual(regex.match(r"(a(?=\s[^a]))", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a(?=\s[^a]*))", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a(?=\s[abc]))", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a(?=\s[abc]*))", "a bc")[1], 'a') + self.assertEqual(regex.match(r"(a)(?=\s\1)", "a a")[1], 'a') + self.assertEqual(regex.match(r"(a)(?=\s\1*)", "a aa")[1], 'a') + self.assertEqual(regex.match(r"(a)(?=\s(abc|a))", "a a")[1], 'a') + + self.assertEqual(regex.match(r"(a(?!\s[^a]))", "a a")[1], 'a') + self.assertEqual(regex.match(r"(a(?!\s[abc]))", "a d")[1], 'a') + self.assertEqual(regex.match(r"(a)(?!\s\1)", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a)(?!\s(abc|a))", "a b")[1], 'a') + + def test_ignore_case(self): + self.assertEqual(regex.match("abc", "ABC", regex.I)[0], 'ABC') + self.assertEqual(regex.match(b"abc", b"ABC", regex.I)[0], b'ABC') + + self.assertEqual(regex.match(r"(a\s[^a]*)", "a bb", regex.I)[1], + 'a bb') + self.assertEqual(regex.match(r"(a\s[abc])", "a b", regex.I)[1], 'a b') + self.assertEqual(regex.match(r"(a\s[abc]*)", "a bb", regex.I)[1], + 'a bb') + self.assertEqual(regex.match(r"((a)\s\2)", "a a", regex.I)[1], 'a a') + self.assertEqual(regex.match(r"((a)\s\2*)", "a aa", regex.I)[1], + 'a aa') + self.assertEqual(regex.match(r"((a)\s(abc|a))", "a a", regex.I)[1], + 'a a') + self.assertEqual(regex.match(r"((a)\s(abc|a)*)", "a aa", regex.I)[1], + 'a aa') + + # Issue 3511. + self.assertEqual(regex.match(r"[Z-a]", "_").span(), (0, 1)) + self.assertEqual(regex.match(r"(?i)[Z-a]", "_").span(), (0, 1)) + + self.assertEqual(bool(regex.match(r"(?i)nao", "nAo")), True) + self.assertEqual(bool(regex.match(r"(?i)n\xE3o", "n\xC3o")), True) + self.assertEqual(bool(regex.match(r"(?i)n\xE3o", "N\xC3O")), True) + self.assertEqual(bool(regex.match(r"(?i)s", "\u017F")), True) + + def test_case_folding(self): + self.assertEqual(regex.search(r"(?fi)ss", "SS").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SS", "ss").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SS", + "\N{LATIN SMALL LETTER SHARP S}").span(), (0, 1)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LETTER SHARP S}", + "SS").span(), (0, 2)) + + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE ST}", + "ST").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)ST", + "\N{LATIN SMALL LIGATURE ST}").span(), (0, 1)) + self.assertEqual(regex.search(r"(?fi)ST", + "\N{LATIN SMALL LIGATURE LONG S T}").span(), (0, 1)) + + self.assertEqual(regex.search(r"(?fi)SST", + "\N{LATIN SMALL LETTER SHARP S}t").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SST", + "s\N{LATIN SMALL LIGATURE LONG S T}").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SST", + "s\N{LATIN SMALL LIGATURE ST}").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE ST}", + "SST").span(), (1, 3)) + self.assertEqual(regex.search(r"(?fi)SST", + "s\N{LATIN SMALL LIGATURE ST}").span(), (0, 2)) + + self.assertEqual(regex.search(r"(?fi)FFI", + "\N{LATIN SMALL LIGATURE FFI}").span(), (0, 1)) + self.assertEqual(regex.search(r"(?fi)FFI", + "\N{LATIN SMALL LIGATURE FF}i").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)FFI", + "f\N{LATIN SMALL LIGATURE FI}").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE FFI}", + "FFI").span(), (0, 3)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE FF}i", + "FFI").span(), (0, 3)) + self.assertEqual(regex.search(r"(?fi)f\N{LATIN SMALL LIGATURE FI}", + "FFI").span(), (0, 3)) + + sigma = "\u03A3\u03C3\u03C2" + for ch1 in sigma: + for ch2 in sigma: + if not regex.match(r"(?fi)" + ch1, ch2): + self.fail() + + self.assertEqual(bool(regex.search(r"(?iV1)ff", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)ff", "\uFB01\uFB00")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fi", "\uFB01\uFB00")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fffi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB03", + "\uFB00\uFB01")), True) + self.assertEqual(bool(regex.search(r"(?iV1)ff", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fffi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB03", + "\uFB00\uFB01")), True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB01", "\uFB00i")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB01", "\uFB00i")), + True) + + self.assertEqual(regex.findall(r"(?iV0)\m(?:word){e<=3}\M(?ne", "affine", + options=["\N{LATIN SMALL LIGATURE FFI}"]).span(), (0, 6)) + self.assertEqual(regex.search(r"(?fi)a\Lne", + "a\N{LATIN SMALL LIGATURE FFI}ne", options=["ffi"]).span(), (0, 4)) + + def test_category(self): + self.assertEqual(regex.match(r"(\s)", " ")[1], ' ') + + def test_not_literal(self): + self.assertEqual(regex.search(r"\s([^a])", " b")[1], 'b') + self.assertEqual(regex.search(r"\s([^a]*)", " bb")[1], 'bb') + + def test_search_coverage(self): + self.assertEqual(regex.search(r"\s(b)", " b")[1], 'b') + self.assertEqual(regex.search(r"a\s", "a ")[0], 'a ') + + def test_re_escape(self): + p = "" + self.assertEqual(regex.escape(p), p) + for i in range(0, 256): + p += chr(i) + self.assertEqual(bool(regex.match(regex.escape(chr(i)), chr(i))), + True) + self.assertEqual(regex.match(regex.escape(chr(i)), chr(i)).span(), + (0, 1)) + + pat = regex.compile(regex.escape(p)) + self.assertEqual(pat.match(p).span(), (0, 256)) + + def test_re_escape_byte(self): + p = b"" + self.assertEqual(regex.escape(p), p) + for i in range(0, 256): + b = bytes([i]) + p += b + self.assertEqual(bool(regex.match(regex.escape(b), b)), True) + self.assertEqual(regex.match(regex.escape(b), b).span(), (0, 1)) + + pat = regex.compile(regex.escape(p)) + self.assertEqual(pat.match(p).span(), (0, 256)) + + def test_constants(self): + if regex.I != regex.IGNORECASE: + self.fail() + if regex.L != regex.LOCALE: + self.fail() + if regex.M != regex.MULTILINE: + self.fail() + if regex.S != regex.DOTALL: + self.fail() + if regex.X != regex.VERBOSE: + self.fail() + + def test_flags(self): + for flag in [regex.I, regex.M, regex.X, regex.S, regex.L]: + self.assertEqual(repr(type(regex.compile('^pattern$', flag))), + self.PATTERN_CLASS) + + def test_sre_character_literals(self): + for i in [0, 8, 16, 32, 64, 127, 128, 255]: + self.assertEqual(bool(regex.match(r"\%03o" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"\%03o0" % i, chr(i) + "0")), + True) + self.assertEqual(bool(regex.match(r"\%03o8" % i, chr(i) + "8")), + True) + self.assertEqual(bool(regex.match(r"\x%02x" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"\x%02x0" % i, chr(i) + "0")), + True) + self.assertEqual(bool(regex.match(r"\x%02xz" % i, chr(i) + "z")), + True) + + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.match(r"\911", "")) + + def test_sre_character_class_literals(self): + for i in [0, 8, 16, 32, 64, 127, 128, 255]: + self.assertEqual(bool(regex.match(r"[\%03o]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\%03o0]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\%03o8]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\x%02x]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\x%02x0]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\x%02xz]" % i, chr(i))), True) + + self.assertRaisesRegex(regex.error, self.BAD_OCTAL_ESCAPE, lambda: + regex.match(r"[\911]", "")) + + def test_bug_113254(self): + self.assertEqual(regex.match(r'(a)|(b)', 'b').start(1), -1) + self.assertEqual(regex.match(r'(a)|(b)', 'b').end(1), -1) + self.assertEqual(regex.match(r'(a)|(b)', 'b').span(1), (-1, -1)) + + def test_bug_527371(self): + # Bug described in patches 527371/672491. + self.assertEqual(regex.match(r'(a)?a','a').lastindex, None) + self.assertEqual(regex.match(r'(a)(b)?b','ab').lastindex, 1) + self.assertEqual(regex.match(r'(?Pa)(?Pb)?b','ab').lastgroup, + 'a') + self.assertEqual(regex.match("(?Pa(b))", "ab").lastgroup, 'a') + self.assertEqual(regex.match("((a))", "a").lastindex, 1) + + def test_bug_545855(self): + # Bug 545855 -- This pattern failed to cause a compile error as it + # should, instead provoking a TypeError. + self.assertRaisesRegex(regex.error, self.BAD_SET, lambda: + regex.compile('foo[a-')) + + def test_bug_418626(self): + # Bugs 418626 at al. -- Testing Greg Chapman's addition of op code + # SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of + # pattern '*?' on a long string. + self.assertEqual(regex.match('.*?c', 10000 * 'ab' + 'cd').end(0), + 20001) + self.assertEqual(regex.match('.*?cd', 5000 * 'ab' + 'c' + 5000 * 'ab' + + 'cde').end(0), 20003) + self.assertEqual(regex.match('.*?cd', 20000 * 'abc' + 'de').end(0), + 60001) + # Non-simple '*?' still used to hit the recursion limit, before the + # non-recursive scheme was implemented. + self.assertEqual(regex.search('(a|b)*?c', 10000 * 'ab' + 'cd').end(0), + 20001) + + def test_bug_612074(self): + pat = "[" + regex.escape("\u2039") + "]" + self.assertEqual(regex.compile(pat) and 1, 1) + + def test_stack_overflow(self): + # Nasty cases that used to overflow the straightforward recursive + # implementation of repeated groups. + self.assertEqual(regex.match('(x)*', 50000 * 'x')[1], 'x') + self.assertEqual(regex.match('(x)*y', 50000 * 'x' + 'y')[1], 'x') + self.assertEqual(regex.match('(x)*?y', 50000 * 'x' + 'y')[1], 'x') + + def test_scanner(self): + def s_ident(scanner, token): return token + def s_operator(scanner, token): return "op%s" % token + def s_float(scanner, token): return float(token) + def s_int(scanner, token): return int(token) + + scanner = regex.Scanner([(r"[a-zA-Z_]\w*", s_ident), (r"\d+\.\d*", + s_float), (r"\d+", s_int), (r"=|\+|-|\*|/", s_operator), (r"\s+", + None), ]) + + self.assertEqual(repr(type(scanner.scanner.scanner("").pattern)), + self.PATTERN_CLASS) + + self.assertEqual(scanner.scan("sum = 3*foo + 312.50 + bar"), (['sum', + 'op=', 3, 'op*', 'foo', 'op+', 312.5, 'op+', 'bar'], '')) + + def test_bug_448951(self): + # Bug 448951 (similar to 429357, but with single char match). + # (Also test greedy matches.) + for op in '', '?', '*': + self.assertEqual(regex.match(r'((.%s):)?z' % op, 'z')[:], ('z', + None, None)) + self.assertEqual(regex.match(r'((.%s):)?z' % op, 'a:z')[:], ('a:z', + 'a:', 'a')) + + def test_bug_725106(self): + # Capturing groups in alternatives in repeats. + self.assertEqual(regex.match('^((a)|b)*', 'abc')[:], ('ab', 'b', 'a')) + self.assertEqual(regex.match('^(([ab])|c)*', 'abc')[:], ('abc', 'c', + 'b')) + self.assertEqual(regex.match('^((d)|[ab])*', 'abc')[:], ('ab', 'b', + None)) + self.assertEqual(regex.match('^((a)c|[ab])*', 'abc')[:], ('ab', 'b', + None)) + self.assertEqual(regex.match('^((a)|b)*?c', 'abc')[:], ('abc', 'b', + 'a')) + self.assertEqual(regex.match('^(([ab])|c)*?d', 'abcd')[:], ('abcd', + 'c', 'b')) + self.assertEqual(regex.match('^((d)|[ab])*?c', 'abc')[:], ('abc', 'b', + None)) + self.assertEqual(regex.match('^((a)c|[ab])*?c', 'abc')[:], ('abc', 'b', + None)) + + def test_bug_725149(self): + # Mark_stack_base restoring before restoring marks. + self.assertEqual(regex.match('(a)(?:(?=(b)*)c)*', 'abb')[:], ('a', 'a', + None)) + self.assertEqual(regex.match('(a)((?!(b)*))*', 'abb')[:], ('a', 'a', + None, None)) + + def test_bug_764548(self): + # Bug 764548, regex.compile() barfs on str/unicode subclasses. + class my_unicode(str): pass + pat = regex.compile(my_unicode("abc")) + self.assertEqual(pat.match("xyz"), None) + + def test_finditer(self): + it = regex.finditer(r":+", "a:b::c:::d") + self.assertEqual([item[0] for item in it], [':', '::', ':::']) + + def test_bug_926075(self): + if regex.compile('bug_926075') is regex.compile(b'bug_926075'): + self.fail() + + def test_bug_931848(self): + pattern = "[\u002E\u3002\uFF0E\uFF61]" + self.assertEqual(regex.compile(pattern).split("a.b.c"), ['a', 'b', + 'c']) + + def test_bug_581080(self): + it = regex.finditer(r"\s", "a b") + self.assertEqual(next(it).span(), (1, 2)) + self.assertRaises(StopIteration, lambda: next(it)) + + scanner = regex.compile(r"\s").scanner("a b") + self.assertEqual(scanner.search().span(), (1, 2)) + self.assertEqual(scanner.search(), None) + + def test_bug_817234(self): + it = regex.finditer(r".*", "asdf") + self.assertEqual(next(it).span(), (0, 4)) + self.assertEqual(next(it).span(), (4, 4)) + self.assertRaises(StopIteration, lambda: next(it)) + + def test_empty_array(self): + # SF buf 1647541. + import array + for typecode in 'bBhHiIlLfd': + a = array.array(typecode) + self.assertEqual(regex.compile(b"bla").match(a), None) + self.assertEqual(regex.compile(b"").match(a)[1 : ], ()) + + def test_inline_flags(self): + # Bug #1700. + upper_char = chr(0x1ea0) # Latin Capital Letter A with Dot Below + lower_char = chr(0x1ea1) # Latin Small Letter A with Dot Below + + p = regex.compile(upper_char, regex.I | regex.U) + self.assertEqual(bool(p.match(lower_char)), True) + + p = regex.compile(lower_char, regex.I | regex.U) + self.assertEqual(bool(p.match(upper_char)), True) + + p = regex.compile('(?i)' + upper_char, regex.U) + self.assertEqual(bool(p.match(lower_char)), True) + + p = regex.compile('(?i)' + lower_char, regex.U) + self.assertEqual(bool(p.match(upper_char)), True) + + p = regex.compile('(?iu)' + upper_char) + self.assertEqual(bool(p.match(lower_char)), True) + + p = regex.compile('(?iu)' + lower_char) + self.assertEqual(bool(p.match(upper_char)), True) + + # Changed to positional flags in regex 2023.12.23. + self.assertEqual(bool(regex.match(r"(?i)a", "A")), True) + self.assertEqual(regex.match(r"a(?i)", "A"), None) + + def test_dollar_matches_twice(self): + # $ matches the end of string, and just before the terminating \n. + pattern = regex.compile('$') + self.assertEqual(pattern.sub('#', 'a\nb\n'), 'a\nb#\n#') + self.assertEqual(pattern.sub('#', 'a\nb\nc'), 'a\nb\nc#') + self.assertEqual(pattern.sub('#', '\n'), '#\n#') + + pattern = regex.compile('$', regex.MULTILINE) + self.assertEqual(pattern.sub('#', 'a\nb\n' ), 'a#\nb#\n#') + self.assertEqual(pattern.sub('#', 'a\nb\nc'), 'a#\nb#\nc#') + self.assertEqual(pattern.sub('#', '\n'), '#\n#') + + def test_bytes_str_mixing(self): + # Mixing str and bytes is disallowed. + pat = regex.compile('.') + bpat = regex.compile(b'.') + self.assertRaisesRegex(TypeError, self.STR_PAT_ON_BYTES, lambda: + pat.match(b'b')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_ON_STR, lambda: + bpat.match('b')) + self.assertRaisesRegex(TypeError, self.STR_PAT_BYTES_TEMPL, lambda: + pat.sub(b'b', 'c')) + self.assertRaisesRegex(TypeError, self.STR_PAT_ON_BYTES, lambda: + pat.sub('b', b'c')) + self.assertRaisesRegex(TypeError, self.STR_PAT_ON_BYTES, lambda: + pat.sub(b'b', b'c')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_ON_STR, lambda: + bpat.sub(b'b', 'c')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_STR_TEMPL, lambda: + bpat.sub('b', b'c')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_ON_STR, lambda: + bpat.sub('b', 'c')) + + self.assertRaisesRegex(ValueError, self.BYTES_PAT_UNI_FLAG, lambda: + regex.compile(br'\w', regex.UNICODE)) + self.assertRaisesRegex(ValueError, self.BYTES_PAT_UNI_FLAG, lambda: + regex.compile(br'(?u)\w')) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'\w', regex.UNICODE | regex.ASCII)) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?u)\w', regex.ASCII)) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?a)\w', regex.UNICODE)) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?au)\w')) + + def test_ascii_and_unicode_flag(self): + # String patterns. + for flags in (0, regex.UNICODE): + pat = regex.compile('\xc0', flags | regex.IGNORECASE) + self.assertEqual(bool(pat.match('\xe0')), True) + pat = regex.compile(r'\w', flags) + self.assertEqual(bool(pat.match('\xe0')), True) + + pat = regex.compile('\xc0', regex.ASCII | regex.IGNORECASE) + self.assertEqual(pat.match('\xe0'), None) + pat = regex.compile('(?a)\xc0', regex.IGNORECASE) + self.assertEqual(pat.match('\xe0'), None) + pat = regex.compile(r'\w', regex.ASCII) + self.assertEqual(pat.match('\xe0'), None) + pat = regex.compile(r'(?a)\w') + self.assertEqual(pat.match('\xe0'), None) + + # Bytes patterns. + for flags in (0, regex.ASCII): + pat = regex.compile(b'\xc0', flags | regex.IGNORECASE) + self.assertEqual(pat.match(b'\xe0'), None) + pat = regex.compile(br'\w') + self.assertEqual(pat.match(b'\xe0'), None) + + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?au)\w')) + + def test_subscripting_match(self): + m = regex.match(r'(?\w)', 'xy') + if not m: + self.fail("Failed: expected match but returned None") + elif not m or m[0] != m.group(0) or m[1] != m.group(1): + self.fail("Failed") + if not m: + self.fail("Failed: expected match but returned None") + elif m[:] != ('x', 'x'): + self.fail("Failed: expected \"('x', 'x')\" but got {} instead".format(ascii(m[:]))) + + def test_new_named_groups(self): + m0 = regex.match(r'(?P\w)', 'x') + m1 = regex.match(r'(?\w)', 'x') + if not (m0 and m1 and m0[:] == m1[:]): + self.fail("Failed") + + def test_properties(self): + self.assertEqual(regex.match(b'(?ai)\xC0', b'\xE0'), None) + self.assertEqual(regex.match(br'(?ai)\xC0', b'\xE0'), None) + self.assertEqual(regex.match(br'(?a)\w', b'\xE0'), None) + self.assertEqual(bool(regex.match(r'\w', '\xE0')), True) + + # Dropped the following test. It's not possible to determine what the + # correct result should be in the general case. +# self.assertEqual(bool(regex.match(br'(?L)\w', b'\xE0')), +# b'\xE0'.isalnum()) + + self.assertEqual(bool(regex.match(br'(?L)\d', b'0')), True) + self.assertEqual(bool(regex.match(br'(?L)\s', b' ')), True) + self.assertEqual(bool(regex.match(br'(?L)\w', b'a')), True) + self.assertEqual(regex.match(br'(?L)\d', b'?'), None) + self.assertEqual(regex.match(br'(?L)\s', b'?'), None) + self.assertEqual(regex.match(br'(?L)\w', b'?'), None) + + self.assertEqual(regex.match(br'(?L)\D', b'0'), None) + self.assertEqual(regex.match(br'(?L)\S', b' '), None) + self.assertEqual(regex.match(br'(?L)\W', b'a'), None) + self.assertEqual(bool(regex.match(br'(?L)\D', b'?')), True) + self.assertEqual(bool(regex.match(br'(?L)\S', b'?')), True) + self.assertEqual(bool(regex.match(br'(?L)\W', b'?')), True) + + self.assertEqual(bool(regex.match(r'\p{Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'(?i)\p{Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{IsCyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{Script=Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{InCyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{Block=Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:Cyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:IsCyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:Script=Cyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:InCyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:Block=Cyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + + self.assertEqual(bool(regex.match(r'\P{Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{IsCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{Script=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{InCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{Block=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^IsCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^Script=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^InCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^Block=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^Cyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^IsCyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^Script=Cyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^InCyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^Block=Cyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + + self.assertEqual(bool(regex.match(r'\d', '0')), True) + self.assertEqual(bool(regex.match(r'\s', ' ')), True) + self.assertEqual(bool(regex.match(r'\w', 'A')), True) + self.assertEqual(regex.match(r"\d", "?"), None) + self.assertEqual(regex.match(r"\s", "?"), None) + self.assertEqual(regex.match(r"\w", "?"), None) + self.assertEqual(regex.match(r"\D", "0"), None) + self.assertEqual(regex.match(r"\S", " "), None) + self.assertEqual(regex.match(r"\W", "A"), None) + self.assertEqual(bool(regex.match(r'\D', '?')), True) + self.assertEqual(bool(regex.match(r'\S', '?')), True) + self.assertEqual(bool(regex.match(r'\W', '?')), True) + + self.assertEqual(bool(regex.match(r'\p{L}', 'A')), True) + self.assertEqual(bool(regex.match(r'\p{L}', 'a')), True) + self.assertEqual(bool(regex.match(r'\p{Lu}', 'A')), True) + self.assertEqual(bool(regex.match(r'\p{Ll}', 'a')), True) + + self.assertEqual(bool(regex.match(r'(?i)a', 'a')), True) + self.assertEqual(bool(regex.match(r'(?i)a', 'A')), True) + + self.assertEqual(bool(regex.match(r'\w', '0')), True) + self.assertEqual(bool(regex.match(r'\w', 'a')), True) + self.assertEqual(bool(regex.match(r'\w', '_')), True) + + self.assertEqual(regex.match(r"\X", "\xE0").span(), (0, 1)) + self.assertEqual(regex.match(r"\X", "a\u0300").span(), (0, 2)) + self.assertEqual(regex.findall(r"\X", + "a\xE0a\u0300e\xE9e\u0301"), ['a', '\xe0', 'a\u0300', 'e', + '\xe9', 'e\u0301']) + self.assertEqual(regex.findall(r"\X{3}", + "a\xE0a\u0300e\xE9e\u0301"), ['a\xe0a\u0300', 'e\xe9e\u0301']) + self.assertEqual(regex.findall(r"\X", "\r\r\n\u0301A\u0301"), + ['\r', '\r\n', '\u0301', 'A\u0301']) + + self.assertEqual(bool(regex.match(r'\p{Ll}', 'a')), True) + + chars_u = "-09AZaz_\u0393\u03b3" + chars_b = b"-09AZaz_" + word_set = set("Ll Lm Lo Lt Lu Mc Me Mn Nd Nl No Pc".split()) + + tests = [ + (r"\w", chars_u, "09AZaz_\u0393\u03b3"), + (r"[[:word:]]", chars_u, "09AZaz_\u0393\u03b3"), + (r"\W", chars_u, "-"), + (r"[[:^word:]]", chars_u, "-"), + (r"\d", chars_u, "09"), + (r"[[:digit:]]", chars_u, "09"), + (r"\D", chars_u, "-AZaz_\u0393\u03b3"), + (r"[[:^digit:]]", chars_u, "-AZaz_\u0393\u03b3"), + (r"[[:alpha:]]", chars_u, "AZaz\u0393\u03b3"), + (r"[[:^alpha:]]", chars_u, "-09_"), + (r"[[:alnum:]]", chars_u, "09AZaz\u0393\u03b3"), + (r"[[:^alnum:]]", chars_u, "-_"), + (r"[[:xdigit:]]", chars_u, "09Aa"), + (r"[[:^xdigit:]]", chars_u, "-Zz_\u0393\u03b3"), + (r"\p{InBasicLatin}", "a\xE1", "a"), + (r"\P{InBasicLatin}", "a\xE1", "\xE1"), + (r"(?i)\p{InBasicLatin}", "a\xE1", "a"), + (r"(?i)\P{InBasicLatin}", "a\xE1", "\xE1"), + + (br"(?L)\w", chars_b, b"09AZaz_"), + (br"(?L)[[:word:]]", chars_b, b"09AZaz_"), + (br"(?L)\W", chars_b, b"-"), + (br"(?L)[[:^word:]]", chars_b, b"-"), + (br"(?L)\d", chars_b, b"09"), + (br"(?L)[[:digit:]]", chars_b, b"09"), + (br"(?L)\D", chars_b, b"-AZaz_"), + (br"(?L)[[:^digit:]]", chars_b, b"-AZaz_"), + (br"(?L)[[:alpha:]]", chars_b, b"AZaz"), + (br"(?L)[[:^alpha:]]", chars_b, b"-09_"), + (br"(?L)[[:alnum:]]", chars_b, b"09AZaz"), + (br"(?L)[[:^alnum:]]", chars_b, b"-_"), + (br"(?L)[[:xdigit:]]", chars_b, b"09Aa"), + (br"(?L)[[:^xdigit:]]", chars_b, b"-Zz_"), + + (br"(?a)\w", chars_b, b"09AZaz_"), + (br"(?a)[[:word:]]", chars_b, b"09AZaz_"), + (br"(?a)\W", chars_b, b"-"), + (br"(?a)[[:^word:]]", chars_b, b"-"), + (br"(?a)\d", chars_b, b"09"), + (br"(?a)[[:digit:]]", chars_b, b"09"), + (br"(?a)\D", chars_b, b"-AZaz_"), + (br"(?a)[[:^digit:]]", chars_b, b"-AZaz_"), + (br"(?a)[[:alpha:]]", chars_b, b"AZaz"), + (br"(?a)[[:^alpha:]]", chars_b, b"-09_"), + (br"(?a)[[:alnum:]]", chars_b, b"09AZaz"), + (br"(?a)[[:^alnum:]]", chars_b, b"-_"), + (br"(?a)[[:xdigit:]]", chars_b, b"09Aa"), + (br"(?a)[[:^xdigit:]]", chars_b, b"-Zz_"), + ] + for pattern, chars, expected in tests: + try: + if chars[ : 0].join(regex.findall(pattern, chars)) != expected: + self.fail("Failed: {}".format(pattern)) + except Exception as e: + self.fail("Failed: {} raised {}".format(pattern, ascii(e))) + + self.assertEqual(bool(regex.match(r"\p{NumericValue=0}", "0")), + True) + self.assertEqual(bool(regex.match(r"\p{NumericValue=1/2}", + "\N{VULGAR FRACTION ONE HALF}")), True) + self.assertEqual(bool(regex.match(r"\p{NumericValue=0.5}", + "\N{VULGAR FRACTION ONE HALF}")), True) + + def test_word_class(self): + self.assertEqual(regex.findall(r"\w+", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), + ['\u0939\u093f\u0928\u094d\u0926\u0940']) + self.assertEqual(regex.findall(r"\W+", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), [' ', ',']) + self.assertEqual(regex.split(r"(?V1)\b", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), [' ', + '\u0939\u093f\u0928\u094d\u0926\u0940', ',']) + self.assertEqual(regex.split(r"(?V1)\B", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), ['', ' \u0939', + '\u093f', '\u0928', '\u094d', '\u0926', '\u0940,', '']) + + def test_search_anchor(self): + self.assertEqual(regex.findall(r"\G\w{2}", "abcd ef"), ['ab', 'cd']) + + def test_search_reverse(self): + self.assertEqual(regex.findall(r"(?r).", "abc"), ['c', 'b', 'a']) + self.assertEqual(regex.findall(r"(?r).", "abc", overlapped=True), ['c', + 'b', 'a']) + self.assertEqual(regex.findall(r"(?r)..", "abcde"), ['de', 'bc']) + self.assertEqual(regex.findall(r"(?r)..", "abcde", overlapped=True), + ['de', 'cd', 'bc', 'ab']) + self.assertEqual(regex.findall(r"(?r)(.)(-)(.)", "a-b-c", + overlapped=True), [("b", "-", "c"), ("a", "-", "b")]) + + self.assertEqual([m[0] for m in regex.finditer(r"(?r).", "abc")], ['c', + 'b', 'a']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde", + overlapped=True)], ['de', 'cd', 'bc', 'ab']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r).", "abc")], ['c', + 'b', 'a']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde", + overlapped=True)], ['de', 'cd', 'bc', 'ab']) + + self.assertEqual(regex.findall(r"^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual(regex.findall(r"(?V1)^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual(regex.findall(r"(?r)^|\w+", "foo bar"), ['bar', 'foo', + '']) + self.assertEqual(regex.findall(r"(?rV1)^|\w+", "foo bar"), ['bar', + 'foo', '']) + + self.assertEqual([m[0] for m in regex.finditer(r"^|\w+", "foo bar")], + ['', 'foo', 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"(?V1)^|\w+", + "foo bar")], ['', 'foo', 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)^|\w+", + "foo bar")], ['bar', 'foo', '']) + self.assertEqual([m[0] for m in regex.finditer(r"(?rV1)^|\w+", + "foo bar")], ['bar', 'foo', '']) + + self.assertEqual(regex.findall(r"\G\w{2}", "abcd ef"), ['ab', 'cd']) + self.assertEqual(regex.findall(r".{2}(?<=\G.*)", "abcd"), ['ab', 'cd']) + self.assertEqual(regex.findall(r"(?r)\G\w{2}", "abcd ef"), []) + self.assertEqual(regex.findall(r"(?r)\w{2}\G", "abcd ef"), ['ef']) + + self.assertEqual(regex.findall(r"q*", "qqwe"), ['qq', '', '', '']) + self.assertEqual(regex.findall(r"(?V1)q*", "qqwe"), ['qq', '', '', '']) + self.assertEqual(regex.findall(r"(?r)q*", "qqwe"), ['', '', 'qq', '']) + self.assertEqual(regex.findall(r"(?rV1)q*", "qqwe"), ['', '', 'qq', + '']) + + self.assertEqual(regex.findall(".", "abcd", pos=1, endpos=3), ['b', + 'c']) + self.assertEqual(regex.findall(".", "abcd", pos=1, endpos=-1), ['b', + 'c']) + self.assertEqual([m[0] for m in regex.finditer(".", "abcd", pos=1, + endpos=3)], ['b', 'c']) + self.assertEqual([m[0] for m in regex.finditer(".", "abcd", pos=1, + endpos=-1)], ['b', 'c']) + + self.assertEqual([m[0] for m in regex.finditer("(?r).", "abcd", pos=1, + endpos=3)], ['c', 'b']) + self.assertEqual([m[0] for m in regex.finditer("(?r).", "abcd", pos=1, + endpos=-1)], ['c', 'b']) + self.assertEqual(regex.findall("(?r).", "abcd", pos=1, endpos=3), ['c', + 'b']) + self.assertEqual(regex.findall("(?r).", "abcd", pos=1, endpos=-1), + ['c', 'b']) + + self.assertEqual(regex.findall(r"[ab]", "aB", regex.I), ['a', 'B']) + self.assertEqual(regex.findall(r"(?r)[ab]", "aB", regex.I), ['B', 'a']) + + self.assertEqual(regex.findall(r"(?r).{2}", "abc"), ['bc']) + self.assertEqual(regex.findall(r"(?r).{2}", "abc", overlapped=True), + ['bc', 'ab']) + self.assertEqual(regex.findall(r"(\w+) (\w+)", + "first second third fourth fifth"), [('first', 'second'), ('third', + 'fourth')]) + self.assertEqual(regex.findall(r"(?r)(\w+) (\w+)", + "first second third fourth fifth"), [('fourth', 'fifth'), ('second', + 'third')]) + + self.assertEqual([m[0] for m in regex.finditer(r"(?r).{2}", "abc")], + ['bc']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r).{2}", "abc", + overlapped=True)], ['bc', 'ab']) + self.assertEqual([m[0] for m in regex.finditer(r"(\w+) (\w+)", + "first second third fourth fifth")], ['first second', + 'third fourth']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)(\w+) (\w+)", + "first second third fourth fifth")], ['fourth fifth', + 'second third']) + + self.assertEqual(regex.search("abcdef", "abcdef").span(), (0, 6)) + self.assertEqual(regex.search("(?r)abcdef", "abcdef").span(), (0, 6)) + self.assertEqual(regex.search("(?i)abcdef", "ABCDEF").span(), (0, 6)) + self.assertEqual(regex.search("(?ir)abcdef", "ABCDEF").span(), (0, 6)) + + self.assertEqual(regex.sub(r"(.)", r"\1", "abc"), 'abc') + self.assertEqual(regex.sub(r"(?r)(.)", r"\1", "abc"), 'abc') + + def test_atomic(self): + # Issue 433030. + self.assertEqual(regex.search(r"(?>a*)a", "aa"), None) + + def test_possessive(self): + # Single-character non-possessive. + self.assertEqual(regex.search(r"a?a", "a").span(), (0, 1)) + self.assertEqual(regex.search(r"a*a", "aaa").span(), (0, 3)) + self.assertEqual(regex.search(r"a+a", "aaa").span(), (0, 3)) + self.assertEqual(regex.search(r"a{1,3}a", "aaa").span(), (0, 3)) + + # Multiple-character non-possessive. + self.assertEqual(regex.search(r"(?:ab)?ab", "ab").span(), (0, 2)) + self.assertEqual(regex.search(r"(?:ab)*ab", "ababab").span(), (0, 6)) + self.assertEqual(regex.search(r"(?:ab)+ab", "ababab").span(), (0, 6)) + self.assertEqual(regex.search(r"(?:ab){1,3}ab", "ababab").span(), (0, + 6)) + + # Single-character possessive. + self.assertEqual(regex.search(r"a?+a", "a"), None) + self.assertEqual(regex.search(r"a*+a", "aaa"), None) + self.assertEqual(regex.search(r"a++a", "aaa"), None) + self.assertEqual(regex.search(r"a{1,3}+a", "aaa"), None) + + # Multiple-character possessive. + self.assertEqual(regex.search(r"(?:ab)?+ab", "ab"), None) + self.assertEqual(regex.search(r"(?:ab)*+ab", "ababab"), None) + self.assertEqual(regex.search(r"(?:ab)++ab", "ababab"), None) + self.assertEqual(regex.search(r"(?:ab){1,3}+ab", "ababab"), None) + + def test_zerowidth(self): + # Issue 3262. + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split(r"\b", "a b"), ['', 'a', ' ', 'b', + '']) + else: + self.assertEqual(regex.split(r"\b", "a b"), ['a b']) + self.assertEqual(regex.split(r"(?V1)\b", "a b"), ['', 'a', ' ', 'b', + '']) + + # Issue 1647489. + self.assertEqual(regex.findall(r"^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"^|\w+", "foo bar")], + ['', 'foo', 'bar']) + self.assertEqual(regex.findall(r"(?r)^|\w+", "foo bar"), ['bar', + 'foo', '']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)^|\w+", + "foo bar")], ['bar', 'foo', '']) + self.assertEqual(regex.findall(r"(?V1)^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"(?V1)^|\w+", + "foo bar")], ['', 'foo', 'bar']) + self.assertEqual(regex.findall(r"(?rV1)^|\w+", "foo bar"), ['bar', + 'foo', '']) + self.assertEqual([m[0] for m in regex.finditer(r"(?rV1)^|\w+", + "foo bar")], ['bar', 'foo', '']) + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split("", "xaxbxc"), ['', 'x', 'a', 'x', + 'b', 'x', 'c', '']) + self.assertEqual([m for m in regex.splititer("", "xaxbxc")], ['', + 'x', 'a', 'x', 'b', 'x', 'c', '']) + else: + self.assertEqual(regex.split("", "xaxbxc"), ['xaxbxc']) + self.assertEqual([m for m in regex.splititer("", "xaxbxc")], + ['xaxbxc']) + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split("(?r)", "xaxbxc"), ['', 'c', 'x', 'b', + 'x', 'a', 'x', '']) + self.assertEqual([m for m in regex.splititer("(?r)", "xaxbxc")], + ['', 'c', 'x', 'b', 'x', 'a', 'x', '']) + else: + self.assertEqual(regex.split("(?r)", "xaxbxc"), ['xaxbxc']) + self.assertEqual([m for m in regex.splititer("(?r)", "xaxbxc")], + ['xaxbxc']) + + self.assertEqual(regex.split("(?V1)", "xaxbxc"), ['', 'x', 'a', 'x', + 'b', 'x', 'c', '']) + self.assertEqual([m for m in regex.splititer("(?V1)", "xaxbxc")], ['', + 'x', 'a', 'x', 'b', 'x', 'c', '']) + + self.assertEqual(regex.split("(?rV1)", "xaxbxc"), ['', 'c', 'x', 'b', + 'x', 'a', 'x', '']) + self.assertEqual([m for m in regex.splititer("(?rV1)", "xaxbxc")], ['', + 'c', 'x', 'b', 'x', 'a', 'x', '']) + + def test_scoped_and_inline_flags(self): + # Issues 433028, 433024, 433027. + self.assertEqual(regex.search(r"(?i)Ab", "ab").span(), (0, 2)) + self.assertEqual(regex.search(r"(?i:A)b", "ab").span(), (0, 2)) + # Changed to positional flags in regex 2023.12.23. + self.assertEqual(regex.search(r"A(?i)b", "ab"), None) + + self.assertEqual(regex.search(r"(?V0)Ab", "ab"), None) + self.assertEqual(regex.search(r"(?V1)Ab", "ab"), None) + self.assertEqual(regex.search(r"(?-i)Ab", "ab", flags=regex.I), None) + self.assertEqual(regex.search(r"(?-i:A)b", "ab", flags=regex.I), None) + self.assertEqual(regex.search(r"A(?-i)b", "ab", flags=regex.I).span(), + (0, 2)) + + def test_repeated_repeats(self): + # Issue 2537. + self.assertEqual(regex.search(r"(?:a+)+", "aaa").span(), (0, 3)) + self.assertEqual(regex.search(r"(?:(?:ab)+c)+", "abcabc").span(), (0, + 6)) + + # Hg issue 286. + self.assertEqual(regex.search(r"(?:a+){2,}", "aaa").span(), (0, 3)) + + def test_lookbehind(self): + self.assertEqual(regex.search(r"123(?<=a\d+)", "a123").span(), (1, 4)) + self.assertEqual(regex.search(r"123(?<=a\d+)", "b123"), None) + self.assertEqual(regex.search(r"123(?= (3, 7, 0): + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "xy"), + 'y-x-') + else: + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "xy"), + 'y-x') + self.assertEqual(regex.sub(r"(?V1)(x)?(y)?", r"\2-\1", "xy"), 'y-x-') + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "x"), '-x-') + else: + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "x"), '-x') + self.assertEqual(regex.sub(r"(?V1)(x)?(y)?", r"\2-\1", "x"), '-x-') + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "y"), 'y--') + else: + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "y"), 'y-') + self.assertEqual(regex.sub(r"(?V1)(x)?(y)?", r"\2-\1", "y"), 'y--') + + def test_bug_10328 (self): + # Issue 10328. + pat = regex.compile(r'(?mV0)(?P[ \t]+\r*$)|(?P(?<=[^\n])\Z)') + if sys.version_info >= (3, 7, 0): + self.assertEqual(pat.subn(lambda m: '<' + m.lastgroup + '>', + 'foobar '), ('foobar', 2)) + else: + self.assertEqual(pat.subn(lambda m: '<' + m.lastgroup + '>', + 'foobar '), ('foobar', 1)) + self.assertEqual([m.group() for m in pat.finditer('foobar ')], [' ', + '']) + pat = regex.compile(r'(?mV1)(?P[ \t]+\r*$)|(?P(?<=[^\n])\Z)') + self.assertEqual(pat.subn(lambda m: '<' + m.lastgroup + '>', + 'foobar '), ('foobar', 2)) + self.assertEqual([m.group() for m in pat.finditer('foobar ')], [' ', + '']) + + def test_overlapped(self): + self.assertEqual(regex.findall(r"..", "abcde"), ['ab', 'cd']) + self.assertEqual(regex.findall(r"..", "abcde", overlapped=True), ['ab', + 'bc', 'cd', 'de']) + self.assertEqual(regex.findall(r"(?r)..", "abcde"), ['de', 'bc']) + self.assertEqual(regex.findall(r"(?r)..", "abcde", overlapped=True), + ['de', 'cd', 'bc', 'ab']) + self.assertEqual(regex.findall(r"(.)(-)(.)", "a-b-c", overlapped=True), + [("a", "-", "b"), ("b", "-", "c")]) + + self.assertEqual([m[0] for m in regex.finditer(r"..", "abcde")], ['ab', + 'cd']) + self.assertEqual([m[0] for m in regex.finditer(r"..", "abcde", + overlapped=True)], ['ab', 'bc', 'cd', 'de']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde")], + ['de', 'bc']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde", + overlapped=True)], ['de', 'cd', 'bc', 'ab']) + + self.assertEqual([m.groups() for m in regex.finditer(r"(.)(-)(.)", + "a-b-c", overlapped=True)], [("a", "-", "b"), ("b", "-", "c")]) + self.assertEqual([m.groups() for m in regex.finditer(r"(?r)(.)(-)(.)", + "a-b-c", overlapped=True)], [("b", "-", "c"), ("a", "-", "b")]) + + def test_splititer(self): + self.assertEqual(regex.split(r",", "a,b,,c,"), ['a', 'b', '', 'c', '']) + self.assertEqual([m for m in regex.splititer(r",", "a,b,,c,")], ['a', + 'b', '', 'c', '']) + + def test_grapheme(self): + self.assertEqual(regex.match(r"\X", "\xE0").span(), (0, 1)) + self.assertEqual(regex.match(r"\X", "a\u0300").span(), (0, 2)) + + self.assertEqual(regex.findall(r"\X", + "a\xE0a\u0300e\xE9e\u0301"), ['a', '\xe0', 'a\u0300', 'e', + '\xe9', 'e\u0301']) + self.assertEqual(regex.findall(r"\X{3}", + "a\xE0a\u0300e\xE9e\u0301"), ['a\xe0a\u0300', 'e\xe9e\u0301']) + self.assertEqual(regex.findall(r"\X", "\r\r\n\u0301A\u0301"), + ['\r', '\r\n', '\u0301', 'A\u0301']) + + def test_word_boundary(self): + text = 'The quick ("brown") fox can\'t jump 32.3 feet, right?' + self.assertEqual(regex.split(r'(?V1)\b', text), ['', 'The', ' ', + 'quick', ' ("', 'brown', '") ', 'fox', ' ', 'can', "'", 't', + ' ', 'jump', ' ', '32', '.', '3', ' ', 'feet', ', ', + 'right', '?']) + self.assertEqual(regex.split(r'(?V1w)\b', text), ['', 'The', ' ', + 'quick', ' ', '(', '"', 'brown', '"', ')', ' ', 'fox', ' ', + "can't", ' ', 'jump', ' ', '32.3', ' ', 'feet', ',', ' ', + 'right', '?', '']) + + text = "The fox" + self.assertEqual(regex.split(r'(?V1)\b', text), ['', 'The', ' ', + 'fox', '']) + self.assertEqual(regex.split(r'(?V1w)\b', text), ['', 'The', ' ', + 'fox', '']) + + text = "can't aujourd'hui l'objectif" + self.assertEqual(regex.split(r'(?V1)\b', text), ['', 'can', "'", + 't', ' ', 'aujourd', "'", 'hui', ' ', 'l', "'", 'objectif', + '']) + self.assertEqual(regex.split(r'(?V1w)\b', text), ['', "can't", ' ', + "aujourd'hui", ' ', "l'objectif", '']) + + def test_line_boundary(self): + self.assertEqual(regex.findall(r".+", "Line 1\nLine 2\n"), ["Line 1", + "Line 2"]) + self.assertEqual(regex.findall(r".+", "Line 1\rLine 2\r"), + ["Line 1\rLine 2\r"]) + self.assertEqual(regex.findall(r".+", "Line 1\r\nLine 2\r\n"), + ["Line 1\r", "Line 2\r"]) + self.assertEqual(regex.findall(r"(?w).+", "Line 1\nLine 2\n"), + ["Line 1", "Line 2"]) + self.assertEqual(regex.findall(r"(?w).+", "Line 1\rLine 2\r"), + ["Line 1", "Line 2"]) + self.assertEqual(regex.findall(r"(?w).+", "Line 1\r\nLine 2\r\n"), + ["Line 1", "Line 2"]) + + self.assertEqual(regex.search(r"^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"^abc", "\nabc"), None) + self.assertEqual(regex.search(r"^abc", "\rabc"), None) + self.assertEqual(regex.search(r"(?w)^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"(?w)^abc", "\nabc"), None) + self.assertEqual(regex.search(r"(?w)^abc", "\rabc"), None) + + self.assertEqual(regex.search(r"abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"abc$", "abc\r"), None) + self.assertEqual(regex.search(r"(?w)abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"(?w)abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"(?w)abc$", "abc\r").start(), 0) + + self.assertEqual(regex.search(r"(?m)^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"(?m)^abc", "\nabc").start(), 1) + self.assertEqual(regex.search(r"(?m)^abc", "\rabc"), None) + self.assertEqual(regex.search(r"(?mw)^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"(?mw)^abc", "\nabc").start(), 1) + self.assertEqual(regex.search(r"(?mw)^abc", "\rabc").start(), 1) + + self.assertEqual(regex.search(r"(?m)abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"(?m)abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"(?m)abc$", "abc\r"), None) + self.assertEqual(regex.search(r"(?mw)abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"(?mw)abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"(?mw)abc$", "abc\r").start(), 0) + + def test_branch_reset(self): + self.assertEqual(regex.match(r"(?:(a)|(b))(c)", "ac").groups(), ('a', + None, 'c')) + self.assertEqual(regex.match(r"(?:(a)|(b))(c)", "bc").groups(), (None, + 'b', 'c')) + self.assertEqual(regex.match(r"(?:(?a)|(?b))(?c)", + "ac").groups(), ('a', None, 'c')) + self.assertEqual(regex.match(r"(?:(?a)|(?b))(?c)", + "bc").groups(), (None, 'b', 'c')) + + self.assertEqual(regex.match(r"(?a)(?:(?b)|(?c))(?d)", + "abd").groups(), ('a', 'b', None, 'd')) + self.assertEqual(regex.match(r"(?a)(?:(?b)|(?c))(?d)", + "acd").groups(), ('a', None, 'c', 'd')) + self.assertEqual(regex.match(r"(a)(?:(b)|(c))(d)", "abd").groups(), + ('a', 'b', None, 'd')) + + self.assertEqual(regex.match(r"(a)(?:(b)|(c))(d)", "acd").groups(), + ('a', None, 'c', 'd')) + self.assertEqual(regex.match(r"(a)(?|(b)|(b))(d)", "abd").groups(), + ('a', 'b', 'd')) + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "ac").groups(), + ('a', None, 'c')) + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "bc").groups(), + (None, 'b', 'c')) + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "ac").groups(), + ('a', 'c')) + + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "bc").groups(), + ('b', 'c')) + + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(?d))(e)", + "abe").groups(), ('a', 'b', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(?d))(e)", + "cde").groups(), ('d', 'c', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(d))(e)", + "abe").groups(), ('a', 'b', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(d))(e)", + "cde").groups(), ('d', 'c', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(d))(e)", + "abe").groups(), ('a', 'b', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(d))(e)", + "cde").groups(), ('c', 'd', 'e')) + + # Hg issue 87: Allow duplicate names of groups + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "abe").groups(), ("a", "b", "e")) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "abe").capturesdict(), {"a": ["a"], "b": ["b"]}) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "cde").groups(), ("d", None, "e")) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "cde").capturesdict(), {"a": ["c", "d"], "b": []}) + + def test_set(self): + self.assertEqual(regex.match(r"[a]", "a").span(), (0, 1)) + self.assertEqual(regex.match(r"(?i)[a]", "A").span(), (0, 1)) + self.assertEqual(regex.match(r"[a-b]", r"a").span(), (0, 1)) + self.assertEqual(regex.match(r"(?i)[a-b]", r"A").span(), (0, 1)) + + self.assertEqual(regex.sub(r"(?V0)([][])", r"-", "a[b]c"), "a-b-c") + + self.assertEqual(regex.findall(r"[\p{Alpha}]", "a0"), ["a"]) + self.assertEqual(regex.findall(r"(?i)[\p{Alpha}]", "A0"), ["A"]) + + self.assertEqual(regex.findall(r"[a\p{Alpha}]", "ab0"), ["a", "b"]) + self.assertEqual(regex.findall(r"[a\P{Alpha}]", "ab0"), ["a", "0"]) + self.assertEqual(regex.findall(r"(?i)[a\p{Alpha}]", "ab0"), ["a", + "b"]) + self.assertEqual(regex.findall(r"(?i)[a\P{Alpha}]", "ab0"), ["a", + "0"]) + + self.assertEqual(regex.findall(r"[a-b\p{Alpha}]", "abC0"), ["a", + "b", "C"]) + self.assertEqual(regex.findall(r"(?i)[a-b\p{Alpha}]", "AbC0"), ["A", + "b", "C"]) + + self.assertEqual(regex.findall(r"[\p{Alpha}]", "a0"), ["a"]) + self.assertEqual(regex.findall(r"[\P{Alpha}]", "a0"), ["0"]) + self.assertEqual(regex.findall(r"[^\p{Alpha}]", "a0"), ["0"]) + self.assertEqual(regex.findall(r"[^\P{Alpha}]", "a0"), ["a"]) + + self.assertEqual("".join(regex.findall(r"[^\d-h]", "a^b12c-h")), + 'a^bc') + self.assertEqual("".join(regex.findall(r"[^\dh]", "a^b12c-h")), + 'a^bc-') + self.assertEqual("".join(regex.findall(r"[^h\s\db]", "a^b 12c-h")), + 'a^c-') + self.assertEqual("".join(regex.findall(r"[^b\w]", "a b")), ' ') + self.assertEqual("".join(regex.findall(r"[^b\S]", "a b")), ' ') + self.assertEqual("".join(regex.findall(r"[^8\d]", "a 1b2")), 'a b') + + all_chars = "".join(chr(c) for c in range(0x100)) + self.assertEqual(len(regex.findall(r"\p{ASCII}", all_chars)), 128) + self.assertEqual(len(regex.findall(r"\p{Letter}", all_chars)), + 117) + self.assertEqual(len(regex.findall(r"\p{Digit}", all_chars)), 10) + + # Set operators + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Letter}]", + all_chars)), 52) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Alnum}&&\p{Letter}]", + all_chars)), 52) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Alnum}&&\p{Digit}]", + all_chars)), 10) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Cc}]", + all_chars)), 33) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Graph}]", + all_chars)), 94) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}--\p{Cc}]", + all_chars)), 95) + self.assertEqual(len(regex.findall(r"[\p{Letter}\p{Digit}]", + all_chars)), 127) + self.assertEqual(len(regex.findall(r"(?V1)[\p{Letter}||\p{Digit}]", + all_chars)), 127) + self.assertEqual(len(regex.findall(r"\p{HexDigit}", all_chars)), + 22) + self.assertEqual(len(regex.findall(r"(?V1)[\p{HexDigit}~~\p{Digit}]", + all_chars)), 12) + self.assertEqual(len(regex.findall(r"(?V1)[\p{Digit}~~\p{HexDigit}]", + all_chars)), 12) + + self.assertEqual(repr(type(regex.compile(r"(?V0)([][-])"))), + self.PATTERN_CLASS) + self.assertEqual(regex.findall(r"(?V1)[[a-z]--[aei]]", "abc"), ["b", + "c"]) + self.assertEqual(regex.findall(r"(?iV1)[[a-z]--[aei]]", "abc"), ["b", + "c"]) + self.assertEqual(regex.findall(r"(?V1)[\w--a]","abc"), ["b", "c"]) + self.assertEqual(regex.findall(r"(?iV1)[\w--a]","abc"), ["b", "c"]) + + def test_various(self): + tests = [ + # Test ?P< and ?P= extensions. + ('(?Pa)', '', '', regex.error, self.BAD_GROUP_NAME), # Begins with a digit. + ('(?Pa)', '', '', regex.error, self.BAD_GROUP_NAME), # Begins with an illegal char. + ('(?Pa)', '', '', regex.error, self.BAD_GROUP_NAME), # Begins with an illegal char. + + # Same tests, for the ?P= form. + ('(?Pa)(?P=foo_123', 'aa', '', regex.error, + self.MISSING_RPAREN), + ('(?Pa)(?P=1)', 'aa', '1', ascii('a')), + ('(?Pa)(?P=0)', 'aa', '', regex.error, + self.BAD_GROUP_NAME), + ('(?Pa)(?P=-1)', 'aa', '', regex.error, + self.BAD_GROUP_NAME), + ('(?Pa)(?P=!)', 'aa', '', regex.error, + self.BAD_GROUP_NAME), + ('(?Pa)(?P=foo_124)', 'aa', '', regex.error, + self.UNKNOWN_GROUP), # Backref to undefined group. + + ('(?Pa)', 'a', '1', ascii('a')), + ('(?Pa)(?P=foo_123)', 'aa', '1', ascii('a')), + + # Mal-formed \g in pattern treated as literal for compatibility. + (r'(?a)\ga)\g<1>', 'aa', '1', ascii('a')), + (r'(?a)\g', 'aa', '', ascii(None)), + (r'(?a)\g', 'aa', '', regex.error, + self.UNKNOWN_GROUP), # Backref to undefined group. + + ('(?a)', 'a', '1', ascii('a')), + (r'(?a)\g', 'aa', '1', ascii('a')), + + # Test octal escapes. + ('\\1', 'a', '', regex.error, self.INVALID_GROUP_REF), # Backreference. + ('[\\1]', '\1', '0', "'\\x01'"), # Character. + ('\\09', chr(0) + '9', '0', ascii(chr(0) + '9')), + ('\\141', 'a', '0', ascii('a')), + ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', + '0,11', ascii(('abcdefghijklk9', 'k'))), + + # Test \0 is handled everywhere. + (r'\0', '\0', '0', ascii('\0')), + (r'[\0a]', '\0', '0', ascii('\0')), + (r'[a\0]', '\0', '0', ascii('\0')), + (r'[^a\0]', '\0', '', ascii(None)), + + # Test various letter escapes. + (r'\a[\b]\f\n\r\t\v', '\a\b\f\n\r\t\v', '0', + ascii('\a\b\f\n\r\t\v')), + (r'[\a][\b][\f][\n][\r][\t][\v]', '\a\b\f\n\r\t\v', '0', + ascii('\a\b\f\n\r\t\v')), + (r'\xff', '\377', '0', ascii(chr(255))), + + # New \x semantics. + (r'\x00ffffffffffffff', '\377', '', ascii(None)), + (r'\x00f', '\017', '', ascii(None)), + (r'\x00fe', '\376', '', ascii(None)), + + (r'\x00ff', '\377', '', ascii(None)), + (r'\t\n\v\r\f\a\g', '\t\n\v\r\f\ag', '0', ascii('\t\n\v\r\f\ag')), + ('\t\n\v\r\f\a\\g', '\t\n\v\r\f\ag', '0', ascii('\t\n\v\r\f\ag')), + (r'\t\n\v\r\f\a', '\t\n\v\r\f\a', '0', ascii(chr(9) + chr(10) + + chr(11) + chr(13) + chr(12) + chr(7))), + (r'[\t][\n][\v][\r][\f][\b]', '\t\n\v\r\f\b', '0', + ascii('\t\n\v\r\f\b')), + + (r"^\w+=(\\[\000-\277]|[^\n\\])*", + "SRC=eval.c g.c blah blah blah \\\\\n\tapes.c", '0', + ascii("SRC=eval.c g.c blah blah blah \\\\")), + + # Test that . only matches \n in DOTALL mode. + ('a.b', 'acb', '0', ascii('acb')), + ('a.b', 'a\nb', '', ascii(None)), + ('a.*b', 'acc\nccb', '', ascii(None)), + ('a.{4,5}b', 'acc\nccb', '', ascii(None)), + ('a.b', 'a\rb', '0', ascii('a\rb')), + # Changed to positional flags in regex 2023.12.23. + ('a.b(?s)', 'a\nb', '', ascii(None)), + ('(?s)a.b', 'a\nb', '0', ascii('a\nb')), + ('a.*(?s)b', 'acc\nccb', '', ascii(None)), + ('(?s)a.*b', 'acc\nccb', '0', ascii('acc\nccb')), + ('(?s)a.{4,5}b', 'acc\nccb', '0', ascii('acc\nccb')), + + (')', '', '', regex.error, self.TRAILING_CHARS), # Unmatched right bracket. + ('', '', '0', "''"), # Empty pattern. + ('abc', 'abc', '0', ascii('abc')), + ('abc', 'xbc', '', ascii(None)), + ('abc', 'axc', '', ascii(None)), + ('abc', 'abx', '', ascii(None)), + ('abc', 'xabcy', '0', ascii('abc')), + ('abc', 'ababc', '0', ascii('abc')), + ('ab*c', 'abc', '0', ascii('abc')), + ('ab*bc', 'abc', '0', ascii('abc')), + + ('ab*bc', 'abbc', '0', ascii('abbc')), + ('ab*bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab+bc', 'abbc', '0', ascii('abbc')), + ('ab+bc', 'abc', '', ascii(None)), + ('ab+bc', 'abq', '', ascii(None)), + ('ab+bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab?bc', 'abbc', '0', ascii('abbc')), + ('ab?bc', 'abc', '0', ascii('abc')), + ('ab?bc', 'abbbbc', '', ascii(None)), + ('ab?c', 'abc', '0', ascii('abc')), + + ('^abc$', 'abc', '0', ascii('abc')), + ('^abc$', 'abcc', '', ascii(None)), + ('^abc', 'abcc', '0', ascii('abc')), + ('^abc$', 'aabc', '', ascii(None)), + ('abc$', 'aabc', '0', ascii('abc')), + ('^', 'abc', '0', ascii('')), + ('$', 'abc', '0', ascii('')), + ('a.c', 'abc', '0', ascii('abc')), + ('a.c', 'axc', '0', ascii('axc')), + ('a.*c', 'axyzc', '0', ascii('axyzc')), + + ('a.*c', 'axyzd', '', ascii(None)), + ('a[bc]d', 'abc', '', ascii(None)), + ('a[bc]d', 'abd', '0', ascii('abd')), + ('a[b-d]e', 'abd', '', ascii(None)), + ('a[b-d]e', 'ace', '0', ascii('ace')), + ('a[b-d]', 'aac', '0', ascii('ac')), + ('a[-b]', 'a-', '0', ascii('a-')), + ('a[\\-b]', 'a-', '0', ascii('a-')), + ('a[b-]', 'a-', '0', ascii('a-')), + ('a[]b', '-', '', regex.error, self.BAD_SET), + + ('a[', '-', '', regex.error, self.BAD_SET), + ('a\\', '-', '', regex.error, self.BAD_ESCAPE), + ('abc)', '-', '', regex.error, self.TRAILING_CHARS), + ('(abc', '-', '', regex.error, self.MISSING_RPAREN), + ('a]', 'a]', '0', ascii('a]')), + ('a[]]b', 'a]b', '0', ascii('a]b')), + ('a[]]b', 'a]b', '0', ascii('a]b')), + ('a[^bc]d', 'aed', '0', ascii('aed')), + ('a[^bc]d', 'abd', '', ascii(None)), + ('a[^-b]c', 'adc', '0', ascii('adc')), + + ('a[^-b]c', 'a-c', '', ascii(None)), + ('a[^]b]c', 'a]c', '', ascii(None)), + ('a[^]b]c', 'adc', '0', ascii('adc')), + ('\\ba\\b', 'a-', '0', ascii('a')), + ('\\ba\\b', '-a', '0', ascii('a')), + ('\\ba\\b', '-a-', '0', ascii('a')), + ('\\by\\b', 'xy', '', ascii(None)), + ('\\by\\b', 'yz', '', ascii(None)), + ('\\by\\b', 'xyz', '', ascii(None)), + ('x\\b', 'xyz', '', ascii(None)), + + ('x\\B', 'xyz', '0', ascii('x')), + ('\\Bz', 'xyz', '0', ascii('z')), + ('z\\B', 'xyz', '', ascii(None)), + ('\\Bx', 'xyz', '', ascii(None)), + ('\\Ba\\B', 'a-', '', ascii(None)), + ('\\Ba\\B', '-a', '', ascii(None)), + ('\\Ba\\B', '-a-', '', ascii(None)), + ('\\By\\B', 'xy', '', ascii(None)), + ('\\By\\B', 'yz', '', ascii(None)), + ('\\By\\b', 'xy', '0', ascii('y')), + + ('\\by\\B', 'yz', '0', ascii('y')), + ('\\By\\B', 'xyz', '0', ascii('y')), + ('ab|cd', 'abc', '0', ascii('ab')), + ('ab|cd', 'abcd', '0', ascii('ab')), + ('()ef', 'def', '0,1', ascii(('ef', ''))), + ('$b', 'b', '', ascii(None)), + ('a\\(b', 'a(b', '', ascii(('a(b',))), + ('a\\(*b', 'ab', '0', ascii('ab')), + ('a\\(*b', 'a((b', '0', ascii('a((b')), + ('a\\\\b', 'a\\b', '0', ascii('a\\b')), + + ('((a))', 'abc', '0,1,2', ascii(('a', 'a', 'a'))), + ('(a)b(c)', 'abc', '0,1,2', ascii(('abc', 'a', 'c'))), + ('a+b+c', 'aabbabc', '0', ascii('abc')), + ('(a+|b)*', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b)+', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b)?', 'ab', '0,1', ascii(('a', 'a'))), + (')(', '-', '', regex.error, self.TRAILING_CHARS), + ('[^ab]*', 'cde', '0', ascii('cde')), + ('abc', '', '', ascii(None)), + ('a*', '', '0', ascii('')), + + ('a|b|c|d|e', 'e', '0', ascii('e')), + ('(a|b|c|d|e)f', 'ef', '0,1', ascii(('ef', 'e'))), + ('abcd*efg', 'abcdefg', '0', ascii('abcdefg')), + ('ab*', 'xabyabbbz', '0', ascii('ab')), + ('ab*', 'xayabbbz', '0', ascii('a')), + ('(ab|cd)e', 'abcde', '0,1', ascii(('cde', 'cd'))), + ('[abhgefdc]ij', 'hij', '0', ascii('hij')), + ('^(ab|cd)e', 'abcde', '', ascii(None)), + ('(abc|)ef', 'abcdef', '0,1', ascii(('ef', ''))), + ('(a|b)c*d', 'abcd', '0,1', ascii(('bcd', 'b'))), + + ('(ab|ab*)bc', 'abc', '0,1', ascii(('abc', 'a'))), + ('a([bc]*)c*', 'abc', '0,1', ascii(('abc', 'bc'))), + ('a([bc]*)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]+)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]*)(c+d)', 'abcd', '0,1,2', ascii(('abcd', 'b', 'cd'))), + ('a[bcd]*dcdcde', 'adcdcde', '0', ascii('adcdcde')), + ('a[bcd]+dcdcde', 'adcdcde', '', ascii(None)), + ('(ab|a)b*c', 'abc', '0,1', ascii(('abc', 'ab'))), + ('((a)(b)c)(d)', 'abcd', '1,2,3,4', ascii(('abc', 'a', 'b', 'd'))), + ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', '0', ascii('alpha')), + + ('^a(bc+|b[eh])g|.h$', 'abh', '0,1', ascii(('bh', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'ij', '0,1,2', ascii(('ij', 'ij', + 'j'))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effg', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('(((((((((a)))))))))', 'a', '0', ascii('a')), + ('multiple words of text', 'uh-uh', '', ascii(None)), + ('multiple words', 'multiple words, yeah', '0', + ascii('multiple words')), + ('(.*)c(.*)', 'abcde', '0,1,2', ascii(('abcde', 'ab', 'de'))), + + ('\\((.*), (.*)\\)', '(a, b)', '2,1', ascii(('b', 'a'))), + ('[k]', 'ab', '', ascii(None)), + ('a[-]?c', 'ac', '0', ascii('ac')), + ('(abc)\\1', 'abcabc', '1', ascii('abc')), + ('([a-c]*)\\1', 'abcabc', '1', ascii('abc')), + ('^(.+)?B', 'AB', '1', ascii('A')), + ('(a+).\\1$', 'aaaaa', '0,1', ascii(('aaaaa', 'aa'))), + ('^(a+).\\1$', 'aaaa', '', ascii(None)), + ('(abc)\\1', 'abcabc', '0,1', ascii(('abcabc', 'abc'))), + ('([a-c]+)\\1', 'abcabc', '0,1', ascii(('abcabc', 'abc'))), + + ('(a)\\1', 'aa', '0,1', ascii(('aa', 'a'))), + ('(a+)\\1', 'aa', '0,1', ascii(('aa', 'a'))), + ('(a+)+\\1', 'aa', '0,1', ascii(('aa', 'a'))), + ('(a).+\\1', 'aba', '0,1', ascii(('aba', 'a'))), + ('(a)ba*\\1', 'aba', '0,1', ascii(('aba', 'a'))), + ('(aa|a)a\\1$', 'aaa', '0,1', ascii(('aaa', 'a'))), + ('(a|aa)a\\1$', 'aaa', '0,1', ascii(('aaa', 'a'))), + ('(a+)a\\1$', 'aaa', '0,1', ascii(('aaa', 'a'))), + ('([abc]*)\\1', 'abcabc', '0,1', ascii(('abcabc', 'abc'))), + ('(a)(b)c|ab', 'ab', '0,1,2', ascii(('ab', None, None))), + + ('(a)+x', 'aaax', '0,1', ascii(('aaax', 'a'))), + ('([ac])+x', 'aacx', '0,1', ascii(('aacx', 'c'))), + ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', '0,1', + ascii(('d:msgs/tdir/sub1/', 'tdir/'))), + ('([^.]*)\\.([^:]*):[T ]+(.*)', 'track1.title:TBlah blah blah', + '0,1,2,3', ascii(('track1.title:TBlah blah blah', 'track1', + 'title', 'Blah blah blah'))), + ('([^N]*N)+', 'abNNxyzN', '0,1', ascii(('abNNxyzN', 'xyzN'))), + ('([^N]*N)+', 'abNNxyz', '0,1', ascii(('abNN', 'N'))), + ('([abc]*)x', 'abcx', '0,1', ascii(('abcx', 'abc'))), + ('([abc]*)x', 'abc', '', ascii(None)), + ('([xyz]*)x', 'abcx', '0,1', ascii(('x', ''))), + ('(a)+b|aac', 'aac', '0,1', ascii(('aac', None))), + + # Test symbolic groups. + ('(?Paaa)a', 'aaaa', '', regex.error, self.BAD_GROUP_NAME), + ('(?Paaa)a', 'aaaa', '0,id', ascii(('aaaa', 'aaa'))), + ('(?Paa)(?P=id)', 'aaaa', '0,id', ascii(('aaaa', 'aa'))), + ('(?Paa)(?P=xd)', 'aaaa', '', regex.error, self.UNKNOWN_GROUP), + + # Character properties. + (r"\g", "g", '0', ascii('g')), + (r"\g<1>", "g", '', regex.error, self.INVALID_GROUP_REF), + (r"(.)\g<1>", "gg", '0', ascii('gg')), + (r"(.)\g<1>", "gg", '', ascii(('gg', 'g'))), + (r"\N", "N", '0', ascii('N')), + (r"\N{LATIN SMALL LETTER A}", "a", '0', ascii('a')), + (r"\p", "p", '0', ascii('p')), + (r"\p{Ll}", "a", '0', ascii('a')), + (r"\P", "P", '0', ascii('P')), + (r"\P{Lu}", "p", '0', ascii('p')), + + # All tests from Perl. + ('abc', 'abc', '0', ascii('abc')), + ('abc', 'xbc', '', ascii(None)), + ('abc', 'axc', '', ascii(None)), + ('abc', 'abx', '', ascii(None)), + ('abc', 'xabcy', '0', ascii('abc')), + ('abc', 'ababc', '0', ascii('abc')), + + ('ab*c', 'abc', '0', ascii('abc')), + ('ab*bc', 'abc', '0', ascii('abc')), + ('ab*bc', 'abbc', '0', ascii('abbc')), + ('ab*bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{0,}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab+bc', 'abbc', '0', ascii('abbc')), + ('ab+bc', 'abc', '', ascii(None)), + ('ab+bc', 'abq', '', ascii(None)), + ('ab{1,}bc', 'abq', '', ascii(None)), + ('ab+bc', 'abbbbc', '0', ascii('abbbbc')), + + ('ab{1,}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{1,3}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{3,4}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{4,5}bc', 'abbbbc', '', ascii(None)), + ('ab?bc', 'abbc', '0', ascii('abbc')), + ('ab?bc', 'abc', '0', ascii('abc')), + ('ab{0,1}bc', 'abc', '0', ascii('abc')), + ('ab?bc', 'abbbbc', '', ascii(None)), + ('ab?c', 'abc', '0', ascii('abc')), + ('ab{0,1}c', 'abc', '0', ascii('abc')), + + ('^abc$', 'abc', '0', ascii('abc')), + ('^abc$', 'abcc', '', ascii(None)), + ('^abc', 'abcc', '0', ascii('abc')), + ('^abc$', 'aabc', '', ascii(None)), + ('abc$', 'aabc', '0', ascii('abc')), + ('^', 'abc', '0', ascii('')), + ('$', 'abc', '0', ascii('')), + ('a.c', 'abc', '0', ascii('abc')), + ('a.c', 'axc', '0', ascii('axc')), + ('a.*c', 'axyzc', '0', ascii('axyzc')), + + ('a.*c', 'axyzd', '', ascii(None)), + ('a[bc]d', 'abc', '', ascii(None)), + ('a[bc]d', 'abd', '0', ascii('abd')), + ('a[b-d]e', 'abd', '', ascii(None)), + ('a[b-d]e', 'ace', '0', ascii('ace')), + ('a[b-d]', 'aac', '0', ascii('ac')), + ('a[-b]', 'a-', '0', ascii('a-')), + ('a[b-]', 'a-', '0', ascii('a-')), + ('a[b-a]', '-', '', regex.error, self.BAD_CHAR_RANGE), + ('a[]b', '-', '', regex.error, self.BAD_SET), + + ('a[', '-', '', regex.error, self.BAD_SET), + ('a]', 'a]', '0', ascii('a]')), + ('a[]]b', 'a]b', '0', ascii('a]b')), + ('a[^bc]d', 'aed', '0', ascii('aed')), + ('a[^bc]d', 'abd', '', ascii(None)), + ('a[^-b]c', 'adc', '0', ascii('adc')), + ('a[^-b]c', 'a-c', '', ascii(None)), + ('a[^]b]c', 'a]c', '', ascii(None)), + ('a[^]b]c', 'adc', '0', ascii('adc')), + ('ab|cd', 'abc', '0', ascii('ab')), + + ('ab|cd', 'abcd', '0', ascii('ab')), + ('()ef', 'def', '0,1', ascii(('ef', ''))), + ('*a', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('(*)b', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('$b', 'b', '', ascii(None)), + ('a\\', '-', '', regex.error, self.BAD_ESCAPE), + ('a\\(b', 'a(b', '', ascii(('a(b',))), + ('a\\(*b', 'ab', '0', ascii('ab')), + ('a\\(*b', 'a((b', '0', ascii('a((b')), + ('a\\\\b', 'a\\b', '0', ascii('a\\b')), + + ('abc)', '-', '', regex.error, self.TRAILING_CHARS), + ('(abc', '-', '', regex.error, self.MISSING_RPAREN), + ('((a))', 'abc', '0,1,2', ascii(('a', 'a', 'a'))), + ('(a)b(c)', 'abc', '0,1,2', ascii(('abc', 'a', 'c'))), + ('a+b+c', 'aabbabc', '0', ascii('abc')), + ('a{1,}b{1,}c', 'aabbabc', '0', ascii('abc')), + ('a**', '-', '', regex.error, self.MULTIPLE_REPEAT), + ('a.+?c', 'abcabc', '0', ascii('abc')), + ('(a+|b)*', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b){0,}', 'ab', '0,1', ascii(('ab', 'b'))), + + ('(a+|b)+', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b){1,}', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b)?', 'ab', '0,1', ascii(('a', 'a'))), + ('(a+|b){0,1}', 'ab', '0,1', ascii(('a', 'a'))), + (')(', '-', '', regex.error, self.TRAILING_CHARS), + ('[^ab]*', 'cde', '0', ascii('cde')), + ('abc', '', '', ascii(None)), + ('a*', '', '0', ascii('')), + ('([abc])*d', 'abbbcd', '0,1', ascii(('abbbcd', 'c'))), + ('([abc])*bcd', 'abcd', '0,1', ascii(('abcd', 'a'))), + + ('a|b|c|d|e', 'e', '0', ascii('e')), + ('(a|b|c|d|e)f', 'ef', '0,1', ascii(('ef', 'e'))), + ('abcd*efg', 'abcdefg', '0', ascii('abcdefg')), + ('ab*', 'xabyabbbz', '0', ascii('ab')), + ('ab*', 'xayabbbz', '0', ascii('a')), + ('(ab|cd)e', 'abcde', '0,1', ascii(('cde', 'cd'))), + ('[abhgefdc]ij', 'hij', '0', ascii('hij')), + ('^(ab|cd)e', 'abcde', '', ascii(None)), + ('(abc|)ef', 'abcdef', '0,1', ascii(('ef', ''))), + ('(a|b)c*d', 'abcd', '0,1', ascii(('bcd', 'b'))), + + ('(ab|ab*)bc', 'abc', '0,1', ascii(('abc', 'a'))), + ('a([bc]*)c*', 'abc', '0,1', ascii(('abc', 'bc'))), + ('a([bc]*)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]+)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]*)(c+d)', 'abcd', '0,1,2', ascii(('abcd', 'b', 'cd'))), + ('a[bcd]*dcdcde', 'adcdcde', '0', ascii('adcdcde')), + ('a[bcd]+dcdcde', 'adcdcde', '', ascii(None)), + ('(ab|a)b*c', 'abc', '0,1', ascii(('abc', 'ab'))), + ('((a)(b)c)(d)', 'abcd', '1,2,3,4', ascii(('abc', 'a', 'b', 'd'))), + ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', '0', ascii('alpha')), + + ('^a(bc+|b[eh])g|.h$', 'abh', '0,1', ascii(('bh', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'ij', '0,1,2', ascii(('ij', 'ij', + 'j'))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effg', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('((((((((((a))))))))))', 'a', '10', ascii('a')), + ('((((((((((a))))))))))\\10', 'aa', '0', ascii('aa')), + + # Python does not have the same rules for \\41 so this is a syntax error + # ('((((((((((a))))))))))\\41', 'aa', '', ascii(None)), + # ('((((((((((a))))))))))\\41', 'a!', '0', ascii('a!')), + ('((((((((((a))))))))))\\41', '', '', regex.error, + self.INVALID_GROUP_REF), + ('(?i)((((((((((a))))))))))\\41', '', '', regex.error, + self.INVALID_GROUP_REF), + + ('(((((((((a)))))))))', 'a', '0', ascii('a')), + ('multiple words of text', 'uh-uh', '', ascii(None)), + ('multiple words', 'multiple words, yeah', '0', + ascii('multiple words')), + ('(.*)c(.*)', 'abcde', '0,1,2', ascii(('abcde', 'ab', 'de'))), + ('\\((.*), (.*)\\)', '(a, b)', '2,1', ascii(('b', 'a'))), + ('[k]', 'ab', '', ascii(None)), + ('a[-]?c', 'ac', '0', ascii('ac')), + ('(abc)\\1', 'abcabc', '1', ascii('abc')), + ('([a-c]*)\\1', 'abcabc', '1', ascii('abc')), + ('(?i)abc', 'ABC', '0', ascii('ABC')), + + ('(?i)abc', 'XBC', '', ascii(None)), + ('(?i)abc', 'AXC', '', ascii(None)), + ('(?i)abc', 'ABX', '', ascii(None)), + ('(?i)abc', 'XABCY', '0', ascii('ABC')), + ('(?i)abc', 'ABABC', '0', ascii('ABC')), + ('(?i)ab*c', 'ABC', '0', ascii('ABC')), + ('(?i)ab*bc', 'ABC', '0', ascii('ABC')), + ('(?i)ab*bc', 'ABBC', '0', ascii('ABBC')), + ('(?i)ab*?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{0,}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + + ('(?i)ab+?bc', 'ABBC', '0', ascii('ABBC')), + ('(?i)ab+bc', 'ABC', '', ascii(None)), + ('(?i)ab+bc', 'ABQ', '', ascii(None)), + ('(?i)ab{1,}bc', 'ABQ', '', ascii(None)), + ('(?i)ab+bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{1,}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{1,3}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{3,4}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{4,5}?bc', 'ABBBBC', '', ascii(None)), + ('(?i)ab??bc', 'ABBC', '0', ascii('ABBC')), + + ('(?i)ab??bc', 'ABC', '0', ascii('ABC')), + ('(?i)ab{0,1}?bc', 'ABC', '0', ascii('ABC')), + ('(?i)ab??bc', 'ABBBBC', '', ascii(None)), + ('(?i)ab??c', 'ABC', '0', ascii('ABC')), + ('(?i)ab{0,1}?c', 'ABC', '0', ascii('ABC')), + ('(?i)^abc$', 'ABC', '0', ascii('ABC')), + ('(?i)^abc$', 'ABCC', '', ascii(None)), + ('(?i)^abc', 'ABCC', '0', ascii('ABC')), + ('(?i)^abc$', 'AABC', '', ascii(None)), + ('(?i)abc$', 'AABC', '0', ascii('ABC')), + + ('(?i)^', 'ABC', '0', ascii('')), + ('(?i)$', 'ABC', '0', ascii('')), + ('(?i)a.c', 'ABC', '0', ascii('ABC')), + ('(?i)a.c', 'AXC', '0', ascii('AXC')), + ('(?i)a.*?c', 'AXYZC', '0', ascii('AXYZC')), + ('(?i)a.*c', 'AXYZD', '', ascii(None)), + ('(?i)a[bc]d', 'ABC', '', ascii(None)), + ('(?i)a[bc]d', 'ABD', '0', ascii('ABD')), + ('(?i)a[b-d]e', 'ABD', '', ascii(None)), + ('(?i)a[b-d]e', 'ACE', '0', ascii('ACE')), + + ('(?i)a[b-d]', 'AAC', '0', ascii('AC')), + ('(?i)a[-b]', 'A-', '0', ascii('A-')), + ('(?i)a[b-]', 'A-', '0', ascii('A-')), + ('(?i)a[b-a]', '-', '', regex.error, self.BAD_CHAR_RANGE), + ('(?i)a[]b', '-', '', regex.error, self.BAD_SET), + ('(?i)a[', '-', '', regex.error, self.BAD_SET), + ('(?i)a]', 'A]', '0', ascii('A]')), + ('(?i)a[]]b', 'A]B', '0', ascii('A]B')), + ('(?i)a[^bc]d', 'AED', '0', ascii('AED')), + ('(?i)a[^bc]d', 'ABD', '', ascii(None)), + + ('(?i)a[^-b]c', 'ADC', '0', ascii('ADC')), + ('(?i)a[^-b]c', 'A-C', '', ascii(None)), + ('(?i)a[^]b]c', 'A]C', '', ascii(None)), + ('(?i)a[^]b]c', 'ADC', '0', ascii('ADC')), + ('(?i)ab|cd', 'ABC', '0', ascii('AB')), + ('(?i)ab|cd', 'ABCD', '0', ascii('AB')), + ('(?i)()ef', 'DEF', '0,1', ascii(('EF', ''))), + ('(?i)*a', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('(?i)(*)b', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('(?i)$b', 'B', '', ascii(None)), + + ('(?i)a\\', '-', '', regex.error, self.BAD_ESCAPE), + ('(?i)a\\(b', 'A(B', '', ascii(('A(B',))), + ('(?i)a\\(*b', 'AB', '0', ascii('AB')), + ('(?i)a\\(*b', 'A((B', '0', ascii('A((B')), + ('(?i)a\\\\b', 'A\\B', '0', ascii('A\\B')), + ('(?i)abc)', '-', '', regex.error, self.TRAILING_CHARS), + ('(?i)(abc', '-', '', regex.error, self.MISSING_RPAREN), + ('(?i)((a))', 'ABC', '0,1,2', ascii(('A', 'A', 'A'))), + ('(?i)(a)b(c)', 'ABC', '0,1,2', ascii(('ABC', 'A', 'C'))), + ('(?i)a+b+c', 'AABBABC', '0', ascii('ABC')), + + ('(?i)a{1,}b{1,}c', 'AABBABC', '0', ascii('ABC')), + ('(?i)a**', '-', '', regex.error, self.MULTIPLE_REPEAT), + ('(?i)a.+?c', 'ABCABC', '0', ascii('ABC')), + ('(?i)a.*?c', 'ABCABC', '0', ascii('ABC')), + ('(?i)a.{0,5}?c', 'ABCABC', '0', ascii('ABC')), + ('(?i)(a+|b)*', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b){0,}', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b)+', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b){1,}', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b)?', 'AB', '0,1', ascii(('A', 'A'))), + + ('(?i)(a+|b){0,1}', 'AB', '0,1', ascii(('A', 'A'))), + ('(?i)(a+|b){0,1}?', 'AB', '0,1', ascii(('', None))), + ('(?i))(', '-', '', regex.error, self.TRAILING_CHARS), + ('(?i)[^ab]*', 'CDE', '0', ascii('CDE')), + ('(?i)abc', '', '', ascii(None)), + ('(?i)a*', '', '0', ascii('')), + ('(?i)([abc])*d', 'ABBBCD', '0,1', ascii(('ABBBCD', 'C'))), + ('(?i)([abc])*bcd', 'ABCD', '0,1', ascii(('ABCD', 'A'))), + ('(?i)a|b|c|d|e', 'E', '0', ascii('E')), + ('(?i)(a|b|c|d|e)f', 'EF', '0,1', ascii(('EF', 'E'))), + + ('(?i)abcd*efg', 'ABCDEFG', '0', ascii('ABCDEFG')), + ('(?i)ab*', 'XABYABBBZ', '0', ascii('AB')), + ('(?i)ab*', 'XAYABBBZ', '0', ascii('A')), + ('(?i)(ab|cd)e', 'ABCDE', '0,1', ascii(('CDE', 'CD'))), + ('(?i)[abhgefdc]ij', 'HIJ', '0', ascii('HIJ')), + ('(?i)^(ab|cd)e', 'ABCDE', '', ascii(None)), + ('(?i)(abc|)ef', 'ABCDEF', '0,1', ascii(('EF', ''))), + ('(?i)(a|b)c*d', 'ABCD', '0,1', ascii(('BCD', 'B'))), + ('(?i)(ab|ab*)bc', 'ABC', '0,1', ascii(('ABC', 'A'))), + ('(?i)a([bc]*)c*', 'ABC', '0,1', ascii(('ABC', 'BC'))), + + ('(?i)a([bc]*)(c*d)', 'ABCD', '0,1,2', ascii(('ABCD', 'BC', 'D'))), + ('(?i)a([bc]+)(c*d)', 'ABCD', '0,1,2', ascii(('ABCD', 'BC', 'D'))), + ('(?i)a([bc]*)(c+d)', 'ABCD', '0,1,2', ascii(('ABCD', 'B', 'CD'))), + ('(?i)a[bcd]*dcdcde', 'ADCDCDE', '0', ascii('ADCDCDE')), + ('(?i)a[bcd]+dcdcde', 'ADCDCDE', '', ascii(None)), + ('(?i)(ab|a)b*c', 'ABC', '0,1', ascii(('ABC', 'AB'))), + ('(?i)((a)(b)c)(d)', 'ABCD', '1,2,3,4', ascii(('ABC', 'A', 'B', + 'D'))), + ('(?i)[a-zA-Z_][a-zA-Z0-9_]*', 'ALPHA', '0', ascii('ALPHA')), + ('(?i)^a(bc+|b[eh])g|.h$', 'ABH', '0,1', ascii(('BH', None))), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFGZ', '0,1,2', ascii(('EFFGZ', + 'EFFGZ', None))), + + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'IJ', '0,1,2', ascii(('IJ', 'IJ', + 'J'))), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFG', '', ascii(None)), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'BCDD', '', ascii(None)), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'REFFGZ', '0,1,2', ascii(('EFFGZ', + 'EFFGZ', None))), + ('(?i)((((((((((a))))))))))', 'A', '10', ascii('A')), + ('(?i)((((((((((a))))))))))\\10', 'AA', '0', ascii('AA')), + #('(?i)((((((((((a))))))))))\\41', 'AA', '', ascii(None)), + #('(?i)((((((((((a))))))))))\\41', 'A!', '0', ascii('A!')), + ('(?i)(((((((((a)))))))))', 'A', '0', ascii('A')), + ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))', 'A', '1', + ascii('A')), + ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))', 'C', '1', + ascii('C')), + ('(?i)multiple words of text', 'UH-UH', '', ascii(None)), + + ('(?i)multiple words', 'MULTIPLE WORDS, YEAH', '0', + ascii('MULTIPLE WORDS')), + ('(?i)(.*)c(.*)', 'ABCDE', '0,1,2', ascii(('ABCDE', 'AB', 'DE'))), + ('(?i)\\((.*), (.*)\\)', '(A, B)', '2,1', ascii(('B', 'A'))), + ('(?i)[k]', 'AB', '', ascii(None)), + # ('(?i)abcd', 'ABCD', SUCCEED, 'found+"-"+\\found+"-"+\\\\found', ascii(ABCD-$&-\\ABCD)), + # ('(?i)a(bc)d', 'ABCD', SUCCEED, 'g1+"-"+\\g1+"-"+\\\\g1', ascii(BC-$1-\\BC)), + ('(?i)a[-]?c', 'AC', '0', ascii('AC')), + ('(?i)(abc)\\1', 'ABCABC', '1', ascii('ABC')), + ('(?i)([a-c]*)\\1', 'ABCABC', '1', ascii('ABC')), + ('a(?!b).', 'abad', '0', ascii('ad')), + ('a(?=d).', 'abad', '0', ascii('ad')), + ('a(?=c|d).', 'abad', '0', ascii('ad')), + + ('a(?:b|c|d)(.)', 'ace', '1', ascii('e')), + ('a(?:b|c|d)*(.)', 'ace', '1', ascii('e')), + ('a(?:b|c|d)+?(.)', 'ace', '1', ascii('e')), + ('a(?:b|(c|e){1,2}?|d)+?(.)', 'ace', '1,2', ascii(('c', 'e'))), + + # Lookbehind: split by : but not if it is escaped by -. + ('(?]*?b', 'a>b', '', ascii(None)), + # Bug 490573: minimizing repeat problem. + (r'^a*?$', 'foo', '', ascii(None)), + # Bug 470582: nested groups problem. + (r'^((a)c)?(ab)$', 'ab', '1,2,3', ascii((None, None, 'ab'))), + # Another minimizing repeat problem (capturing groups in assertions). + ('^([ab]*?)(?=(b)?)c', 'abc', '1,2', ascii(('ab', None))), + ('^([ab]*?)(?!(b))c', 'abc', '1,2', ascii(('ab', None))), + ('^([ab]*?)(?(.){0,2})d", "abcd").captures(1), + ['b', 'c']) + self.assertEqual(regex.search(r"(.)+", "a").captures(1), ['a']) + + def test_guards(self): + m = regex.search(r"(X.*?Y\s*){3}(X\s*)+AB:", + "XY\nX Y\nX Y\nXY\nXX AB:") + self.assertEqual(m.span(0, 1, 2), ((3, 21), (12, 15), (16, 18))) + + m = regex.search(r"(X.*?Y\s*){3,}(X\s*)+AB:", + "XY\nX Y\nX Y\nXY\nXX AB:") + self.assertEqual(m.span(0, 1, 2), ((0, 21), (12, 15), (16, 18))) + + m = regex.search(r'\d{4}(\s*\w)?\W*((?!\d)\w){2}', "9999XX") + self.assertEqual(m.span(0, 1, 2), ((0, 6), (-1, -1), (5, 6))) + + m = regex.search(r'A\s*?.*?(\n+.*?\s*?){0,2}\(X', 'A\n1\nS\n1 (X') + self.assertEqual(m.span(0, 1), ((0, 10), (5, 8))) + + m = regex.search(r'Derde\s*:', 'aaaaaa:\nDerde:') + self.assertEqual(m.span(), (8, 14)) + m = regex.search(r'Derde\s*:', 'aaaaa:\nDerde:') + self.assertEqual(m.span(), (7, 13)) + + def test_turkic(self): + # Turkish has dotted and dotless I/i. + pairs = "I=i;I=\u0131;i=\u0130" + + all_chars = set() + matching = set() + for pair in pairs.split(";"): + ch1, ch2 = pair.split("=") + all_chars.update((ch1, ch2)) + matching.add((ch1, ch1)) + matching.add((ch1, ch2)) + matching.add((ch2, ch1)) + matching.add((ch2, ch2)) + + for ch1 in all_chars: + for ch2 in all_chars: + m = regex.match(r"(?i)\A" + ch1 + r"\Z", ch2) + if m: + if (ch1, ch2) not in matching: + self.fail("{} matching {}".format(ascii(ch1), + ascii(ch2))) + else: + if (ch1, ch2) in matching: + self.fail("{} not matching {}".format(ascii(ch1), + ascii(ch2))) + + def test_named_lists(self): + options = ["one", "two", "three"] + self.assertEqual(regex.match(r"333\L444", "333one444", + bar=options).group(), "333one444") + self.assertEqual(regex.match(r"(?i)333\L444", "333TWO444", + bar=options).group(), "333TWO444") + self.assertEqual(regex.match(r"333\L444", "333four444", + bar=options), None) + + options = [b"one", b"two", b"three"] + self.assertEqual(regex.match(br"333\L444", b"333one444", + bar=options).group(), b"333one444") + self.assertEqual(regex.match(br"(?i)333\L444", b"333TWO444", + bar=options).group(), b"333TWO444") + self.assertEqual(regex.match(br"333\L444", b"333four444", + bar=options), None) + + self.assertEqual(repr(type(regex.compile(r"3\L4\L+5", + bar=["one", "two", "three"]))), self.PATTERN_CLASS) + + self.assertEqual(regex.findall(r"^\L", "solid QWERT", + options=set(['good', 'brilliant', '+s\\ol[i}d'])), []) + self.assertEqual(regex.findall(r"^\L", "+solid QWERT", + options=set(['good', 'brilliant', '+solid'])), ['+solid']) + + options = ["STRASSE"] + self.assertEqual(regex.match(r"(?fi)\L", + "stra\N{LATIN SMALL LETTER SHARP S}e", words=options).span(), (0, + 6)) + + options = ["STRASSE", "stress"] + self.assertEqual(regex.match(r"(?fi)\L", + "stra\N{LATIN SMALL LETTER SHARP S}e", words=options).span(), (0, + 6)) + + options = ["stra\N{LATIN SMALL LETTER SHARP S}e"] + self.assertEqual(regex.match(r"(?fi)\L", "STRASSE", + words=options).span(), (0, 7)) + + options = ["kit"] + self.assertEqual(regex.search(r"(?i)\L", "SKITS", + words=options).span(), (1, 4)) + self.assertEqual(regex.search(r"(?i)\L", + "SK\N{LATIN CAPITAL LETTER I WITH DOT ABOVE}TS", + words=options).span(), (1, 4)) + + self.assertEqual(regex.search(r"(?fi)\b(\w+) +\1\b", + " stra\N{LATIN SMALL LETTER SHARP S}e STRASSE ").span(), (1, 15)) + self.assertEqual(regex.search(r"(?fi)\b(\w+) +\1\b", + " STRASSE stra\N{LATIN SMALL LETTER SHARP S}e ").span(), (1, 15)) + + self.assertEqual(regex.search(r"^\L$", "", options=[]).span(), + (0, 0)) + + def test_fuzzy(self): + # Some tests borrowed from TRE library tests. + self.assertEqual(repr(type(regex.compile('(fou){s,e<=1}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(fuu){s}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(fuu){s,e}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(anaconda){1i+1d<1,s<=1}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(anaconda){1i+1d<1,s<=1,e<=10}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(anaconda){s<=1,e<=1,1i+1d<1}'))), + self.PATTERN_CLASS) + + text = 'molasses anaconda foo bar baz smith anderson ' + self.assertEqual(regex.search('(znacnda){s<=1,e<=3,1i+1d<1}', text), + None) + self.assertEqual(regex.search('(znacnda){s<=1,e<=3,1i+1d<2}', + text).span(0, 1), ((9, 17), (9, 17))) + self.assertEqual(regex.search('(ananda){1i+1d<2}', text), None) + self.assertEqual(regex.search(r"(?:\bznacnda){e<=2}", text)[0], + "anaconda") + self.assertEqual(regex.search(r"(?:\bnacnda){e<=2}", text)[0], + "anaconda") + + text = 'anaconda foo bar baz smith anderson' + self.assertEqual(regex.search('(fuu){i<=3,d<=3,e<=5}', text).span(0, + 1), ((0, 0), (0, 0))) + self.assertEqual(regex.search('(?b)(fuu){i<=3,d<=3,e<=5}', + text).span(0, 1), ((9, 10), (9, 10))) + self.assertEqual(regex.search('(fuu){i<=2,d<=2,e<=5}', text).span(0, + 1), ((7, 10), (7, 10))) + self.assertEqual(regex.search('(?e)(fuu){i<=2,d<=2,e<=5}', + text).span(0, 1), ((9, 10), (9, 10))) + self.assertEqual(regex.search('(fuu){i<=3,d<=3,e}', text).span(0, 1), + ((0, 0), (0, 0))) + self.assertEqual(regex.search('(?b)(fuu){i<=3,d<=3,e}', text).span(0, + 1), ((9, 10), (9, 10))) + + self.assertEqual(repr(type(regex.compile('(approximate){s<=3,1i+1d<3}'))), + self.PATTERN_CLASS) + + # No cost limit. + self.assertEqual(regex.search('(foobar){e}', + 'xirefoabralfobarxie').span(0, 1), ((0, 6), (0, 6))) + self.assertEqual(regex.search('(?e)(foobar){e}', + 'xirefoabralfobarxie').span(0, 1), ((0, 3), (0, 3))) + self.assertEqual(regex.search('(?b)(foobar){e}', + 'xirefoabralfobarxie').span(0, 1), ((11, 16), (11, 16))) + + # At most two errors. + self.assertEqual(regex.search('(foobar){e<=2}', + 'xirefoabrzlfd').span(0, 1), ((4, 9), (4, 9))) + self.assertEqual(regex.search('(foobar){e<=2}', 'xirefoabzlfd'), None) + + # At most two inserts or substitutions and max two errors total. + self.assertEqual(regex.search('(foobar){i<=2,s<=2,e<=2}', + 'oobargoobaploowap').span(0, 1), ((5, 11), (5, 11))) + + # Find best whole word match for "foobar". + self.assertEqual(regex.search('\\b(foobar){e}\\b', 'zfoobarz').span(0, + 1), ((0, 8), (0, 8))) + self.assertEqual(regex.search('\\b(foobar){e}\\b', + 'boing zfoobarz goobar woop').span(0, 1), ((0, 6), (0, 6))) + self.assertEqual(regex.search('(?b)\\b(foobar){e}\\b', + 'boing zfoobarz goobar woop').span(0, 1), ((15, 21), (15, 21))) + + # Match whole string, allow only 1 error. + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobar').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xfoobar').span(0, + 1), ((0, 7), (0, 7))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobarx').span(0, + 1), ((0, 7), (0, 7))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'fooxbar').span(0, + 1), ((0, 7), (0, 7))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foxbar').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xoobar').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobax').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'oobar').span(0, 1), + ((0, 5), (0, 5))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'fobar').span(0, 1), + ((0, 5), (0, 5))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'fooba').span(0, 1), + ((0, 5), (0, 5))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xfoobarx'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobarxx'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xxfoobar'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xfoxbar'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foxbarx'), None) + + # At most one insert, two deletes, and three substitutions. + # Additionally, deletes cost two and substitutes one, and total + # cost must be less than 4. + self.assertEqual(regex.search('(foobar){i<=1,d<=2,s<=3,2d+1s<4}', + '3oifaowefbaoraofuiebofasebfaobfaorfeoaro').span(0, 1), ((6, 13), (6, + 13))) + self.assertEqual(regex.search('(?b)(foobar){i<=1,d<=2,s<=3,2d+1s<4}', + '3oifaowefbaoraofuiebofasebfaobfaorfeoaro').span(0, 1), ((34, 39), + (34, 39))) + + # Partially fuzzy matches. + self.assertEqual(regex.search('foo(bar){e<=1}zap', 'foobarzap').span(0, + 1), ((0, 9), (3, 6))) + self.assertEqual(regex.search('foo(bar){e<=1}zap', 'fobarzap'), None) + self.assertEqual(regex.search('foo(bar){e<=1}zap', 'foobrzap').span(0, + 1), ((0, 8), (3, 5))) + + text = ('www.cnn.com 64.236.16.20\nwww.slashdot.org 66.35.250.150\n' + 'For useful information, use www.slashdot.org\nthis is demo data!\n') + self.assertEqual(regex.search(r'(?s)^.*(dot.org){e}.*$', text).span(0, + 1), ((0, 120), (120, 120))) + self.assertEqual(regex.search(r'(?es)^.*(dot.org){e}.*$', text).span(0, + 1), ((0, 120), (93, 100))) + self.assertEqual(regex.search(r'^.*(dot.org){e}.*$', text).span(0, 1), + ((0, 119), (24, 101))) + + # Behaviour is unexpected, but arguably not wrong. It first finds the + # best match, then the best in what follows, etc. + self.assertEqual(regex.findall(r"\b\L{e<=1}\b", + " book cot dog desk ", words="cat dog".split()), ["cot", "dog"]) + self.assertEqual(regex.findall(r"\b\L{e<=1}\b", + " book dog cot desk ", words="cat dog".split()), [" dog", "cot"]) + self.assertEqual(regex.findall(r"(?e)\b\L{e<=1}\b", + " book dog cot desk ", words="cat dog".split()), ["dog", "cot"]) + self.assertEqual(regex.findall(r"(?r)\b\L{e<=1}\b", + " book cot dog desk ", words="cat dog".split()), ["dog ", "cot"]) + self.assertEqual(regex.findall(r"(?er)\b\L{e<=1}\b", + " book cot dog desk ", words="cat dog".split()), ["dog", "cot"]) + self.assertEqual(regex.findall(r"(?r)\b\L{e<=1}\b", + " book dog cot desk ", words="cat dog".split()), ["cot", "dog"]) + self.assertEqual(regex.findall(br"\b\L{e<=1}\b", + b" book cot dog desk ", words=b"cat dog".split()), [b"cot", b"dog"]) + self.assertEqual(regex.findall(br"\b\L{e<=1}\b", + b" book dog cot desk ", words=b"cat dog".split()), [b" dog", b"cot"]) + self.assertEqual(regex.findall(br"(?e)\b\L{e<=1}\b", + b" book dog cot desk ", words=b"cat dog".split()), [b"dog", b"cot"]) + self.assertEqual(regex.findall(br"(?r)\b\L{e<=1}\b", + b" book cot dog desk ", words=b"cat dog".split()), [b"dog ", b"cot"]) + self.assertEqual(regex.findall(br"(?er)\b\L{e<=1}\b", + b" book cot dog desk ", words=b"cat dog".split()), [b"dog", b"cot"]) + self.assertEqual(regex.findall(br"(?r)\b\L{e<=1}\b", + b" book dog cot desk ", words=b"cat dog".split()), [b"cot", b"dog"]) + + self.assertEqual(regex.search(r"(\w+) (\1{e<=1})", "foo fou").groups(), + ("foo", "fou")) + self.assertEqual(regex.search(r"(?r)(\2{e<=1}) (\w+)", + "foo fou").groups(), ("foo", "fou")) + self.assertEqual(regex.search(br"(\w+) (\1{e<=1})", + b"foo fou").groups(), (b"foo", b"fou")) + + self.assertEqual(regex.findall(r"(?:(?:QR)+){e}", "abcde"), ["abcde", + ""]) + self.assertEqual(regex.findall(r"(?:Q+){e}", "abc"), ["abc", ""]) + + # Hg issue 41: = for fuzzy matches + self.assertEqual(regex.match(r"(?:service detection){0[^()]+)|(?R))*\)", "(ab(cd)ef)")[ + : ], ("(ab(cd)ef)", "ef")) + self.assertEqual(regex.search(r"\(((?>[^()]+)|(?R))*\)", + "(ab(cd)ef)").captures(1), ["ab", "cd", "(cd)", "ef"]) + + self.assertEqual(regex.search(r"(?r)\(((?R)|(?>[^()]+))*\)", + "(ab(cd)ef)")[ : ], ("(ab(cd)ef)", "ab")) + self.assertEqual(regex.search(r"(?r)\(((?R)|(?>[^()]+))*\)", + "(ab(cd)ef)").captures(1), ["ef", "cd", "(cd)", "ab"]) + + self.assertEqual(regex.search(r"\(([^()]+|(?R))*\)", + "some text (a(b(c)d)e) more text")[ : ], ("(a(b(c)d)e)", "e")) + + self.assertEqual(regex.search(r"(?r)\(((?R)|[^()]+)*\)", + "some text (a(b(c)d)e) more text")[ : ], ("(a(b(c)d)e)", "a")) + + self.assertEqual(regex.search(r"(foo(\(((?:(?>[^()]+)|(?2))*)\)))", + "foo(bar(baz)+baz(bop))")[ : ], ("foo(bar(baz)+baz(bop))", + "foo(bar(baz)+baz(bop))", "(bar(baz)+baz(bop))", + "bar(baz)+baz(bop)")) + + self.assertEqual(regex.search(r"(?r)(foo(\(((?:(?2)|(?>[^()]+))*)\)))", + "foo(bar(baz)+baz(bop))")[ : ], ("foo(bar(baz)+baz(bop))", + "foo(bar(baz)+baz(bop))", "(bar(baz)+baz(bop))", + "bar(baz)+baz(bop)")) + + rgx = regex.compile(r"""^\s*(<\s*([a-zA-Z:]+)(?:\s*[a-zA-Z:]*\s*=\s*(?:'[^']*'|"[^"]*"))*\s*(/\s*)?>(?:[^<>]*|(?1))*(?(3)|<\s*/\s*\2\s*>))\s*$""") + self.assertEqual(bool(rgx.search('')), True) + self.assertEqual(bool(rgx.search('')), False) + self.assertEqual(bool(rgx.search('')), True) + self.assertEqual(bool(rgx.search('')), False) + self.assertEqual(bool(rgx.search('')), False) + + self.assertEqual(bool(rgx.search('')), False) + self.assertEqual(bool(rgx.search('')), True) + self.assertEqual(bool(rgx.search('< fooo / >')), True) + # The next regex should and does match. Perl 5.14 agrees. + #self.assertEqual(bool(rgx.search('foo')), False) + self.assertEqual(bool(rgx.search('foo')), False) + + self.assertEqual(bool(rgx.search('foo')), True) + self.assertEqual(bool(rgx.search('foo')), True) + self.assertEqual(bool(rgx.search('')), True) + + def test_copy(self): + # PatternObjects are immutable, therefore there's no need to clone them. + r = regex.compile("a") + self.assertTrue(copy.copy(r) is r) + self.assertTrue(copy.deepcopy(r) is r) + + # MatchObjects are normally mutable because the target string can be + # detached. However, after the target string has been detached, a + # MatchObject becomes immutable, so there's no need to clone it. + m = r.match("a") + self.assertTrue(copy.copy(m) is not m) + self.assertTrue(copy.deepcopy(m) is not m) + + self.assertTrue(m.string is not None) + m2 = copy.copy(m) + m2.detach_string() + self.assertTrue(m.string is not None) + self.assertTrue(m2.string is None) + + # The following behaviour matches that of the re module. + it = regex.finditer(".", "ab") + it2 = copy.copy(it) + self.assertEqual(next(it).group(), "a") + self.assertEqual(next(it2).group(), "b") + + # The following behaviour matches that of the re module. + it = regex.finditer(".", "ab") + it2 = copy.deepcopy(it) + self.assertEqual(next(it).group(), "a") + self.assertEqual(next(it2).group(), "b") + + # The following behaviour is designed to match that of copying 'finditer'. + it = regex.splititer(" ", "a b") + it2 = copy.copy(it) + self.assertEqual(next(it), "a") + self.assertEqual(next(it2), "b") + + # The following behaviour is designed to match that of copying 'finditer'. + it = regex.splititer(" ", "a b") + it2 = copy.deepcopy(it) + self.assertEqual(next(it), "a") + self.assertEqual(next(it2), "b") + + def test_format(self): + self.assertEqual(regex.subf(r"(\w+) (\w+)", "{0} => {2} {1}", + "foo bar"), "foo bar => bar foo") + self.assertEqual(regex.subf(r"(?\w+) (?\w+)", + "{word2} {word1}", "foo bar"), "bar foo") + + self.assertEqual(regex.subfn(r"(\w+) (\w+)", "{0} => {2} {1}", + "foo bar"), ("foo bar => bar foo", 1)) + self.assertEqual(regex.subfn(r"(?\w+) (?\w+)", + "{word2} {word1}", "foo bar"), ("bar foo", 1)) + + self.assertEqual(regex.match(r"(\w+) (\w+)", + "foo bar").expandf("{0} => {2} {1}"), "foo bar => bar foo") + + def test_fullmatch(self): + self.assertEqual(bool(regex.fullmatch(r"abc", "abc")), True) + self.assertEqual(bool(regex.fullmatch(r"abc", "abcx")), False) + self.assertEqual(bool(regex.fullmatch(r"abc", "abcx", endpos=3)), True) + + self.assertEqual(bool(regex.fullmatch(r"abc", "xabc", pos=1)), True) + self.assertEqual(bool(regex.fullmatch(r"abc", "xabcy", pos=1)), False) + self.assertEqual(bool(regex.fullmatch(r"abc", "xabcy", pos=1, + endpos=4)), True) + + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "abc")), True) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "abcx")), False) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "abcx", endpos=3)), + True) + + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabc", pos=1)), + True) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabcy", pos=1)), + False) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabcy", pos=1, + endpos=4)), True) + + def test_issue_18468(self): + self.assertTypedEqual(regex.sub('y', 'a', 'xyz'), 'xaz') + self.assertTypedEqual(regex.sub('y', StrSubclass('a'), + StrSubclass('xyz')), 'xaz') + self.assertTypedEqual(regex.sub(b'y', b'a', b'xyz'), b'xaz') + self.assertTypedEqual(regex.sub(b'y', BytesSubclass(b'a'), + BytesSubclass(b'xyz')), b'xaz') + self.assertTypedEqual(regex.sub(b'y', bytearray(b'a'), + bytearray(b'xyz')), b'xaz') + self.assertTypedEqual(regex.sub(b'y', memoryview(b'a'), + memoryview(b'xyz')), b'xaz') + + for string in ":a:b::c", StrSubclass(":a:b::c"): + self.assertTypedEqual(regex.split(":", string), ['', 'a', 'b', '', + 'c']) + if sys.version_info >= (3, 7, 0): + self.assertTypedEqual(regex.split(":*", string), ['', '', 'a', + '', 'b', '', 'c', '']) + self.assertTypedEqual(regex.split("(:*)", string), ['', ':', + '', '', 'a', ':', '', '', 'b', '::', '', '', 'c', '', '']) + else: + self.assertTypedEqual(regex.split(":*", string), ['', 'a', 'b', + 'c']) + self.assertTypedEqual(regex.split("(:*)", string), ['', ':', + 'a', ':', 'b', '::', 'c']) + + for string in (b":a:b::c", BytesSubclass(b":a:b::c"), + bytearray(b":a:b::c"), memoryview(b":a:b::c")): + self.assertTypedEqual(regex.split(b":", string), [b'', b'a', b'b', + b'', b'c']) + if sys.version_info >= (3, 7, 0): + self.assertTypedEqual(regex.split(b":*", string), [b'', b'', + b'a', b'', b'b', b'', b'c', b'']) + self.assertTypedEqual(regex.split(b"(:*)", string), [b'', b':', + b'', b'', b'a', b':', b'', b'', b'b', b'::', b'', b'', b'c', + b'', b'']) + else: + self.assertTypedEqual(regex.split(b":*", string), [b'', b'a', + b'b', b'c']) + self.assertTypedEqual(regex.split(b"(:*)", string), [b'', b':', + b'a', b':', b'b', b'::', b'c']) + + for string in "a:b::c:::d", StrSubclass("a:b::c:::d"): + self.assertTypedEqual(regex.findall(":+", string), [":", "::", + ":::"]) + self.assertTypedEqual(regex.findall("(:+)", string), [":", "::", + ":::"]) + self.assertTypedEqual(regex.findall("(:)(:*)", string), [(":", ""), + (":", ":"), (":", "::")]) + + for string in (b"a:b::c:::d", BytesSubclass(b"a:b::c:::d"), + bytearray(b"a:b::c:::d"), memoryview(b"a:b::c:::d")): + self.assertTypedEqual(regex.findall(b":+", string), [b":", b"::", + b":::"]) + self.assertTypedEqual(regex.findall(b"(:+)", string), [b":", b"::", + b":::"]) + self.assertTypedEqual(regex.findall(b"(:)(:*)", string), [(b":", + b""), (b":", b":"), (b":", b"::")]) + + for string in 'a', StrSubclass('a'): + self.assertEqual(regex.match('a', string).groups(), ()) + self.assertEqual(regex.match('(a)', string).groups(), ('a',)) + self.assertEqual(regex.match('(a)', string).group(0), 'a') + self.assertEqual(regex.match('(a)', string).group(1), 'a') + self.assertEqual(regex.match('(a)', string).group(1, 1), ('a', + 'a')) + + for string in (b'a', BytesSubclass(b'a'), bytearray(b'a'), + memoryview(b'a')): + self.assertEqual(regex.match(b'a', string).groups(), ()) + self.assertEqual(regex.match(b'(a)', string).groups(), (b'a',)) + self.assertEqual(regex.match(b'(a)', string).group(0), b'a') + self.assertEqual(regex.match(b'(a)', string).group(1), b'a') + self.assertEqual(regex.match(b'(a)', string).group(1, 1), (b'a', + b'a')) + + def test_partial(self): + self.assertEqual(regex.match('ab', 'a', partial=True).partial, True) + self.assertEqual(regex.match('ab', 'a', partial=True).span(), (0, 1)) + self.assertEqual(regex.match(r'cats', 'cat', partial=True).partial, + True) + self.assertEqual(regex.match(r'cats', 'cat', partial=True).span(), (0, + 3)) + self.assertEqual(regex.match(r'cats', 'catch', partial=True), None) + self.assertEqual(regex.match(r'abc\w{3}', 'abcdef', + partial=True).partial, False) + self.assertEqual(regex.match(r'abc\w{3}', 'abcdef', + partial=True).span(), (0, 6)) + self.assertEqual(regex.match(r'abc\w{3}', 'abcde', + partial=True).partial, True) + self.assertEqual(regex.match(r'abc\w{3}', 'abcde', + partial=True).span(), (0, 5)) + + self.assertEqual(regex.match(r'\d{4}$', '1234', partial=True).partial, + False) + + self.assertEqual(regex.match(r'\L', 'post', partial=True, + words=['post']).partial, False) + self.assertEqual(regex.match(r'\L', 'post', partial=True, + words=['post']).span(), (0, 4)) + self.assertEqual(regex.match(r'\L', 'pos', partial=True, + words=['post']).partial, True) + self.assertEqual(regex.match(r'\L', 'pos', partial=True, + words=['post']).span(), (0, 3)) + + self.assertEqual(regex.match(r'(?fi)\L', 'POST', partial=True, + words=['po\uFB06']).partial, False) + self.assertEqual(regex.match(r'(?fi)\L', 'POST', partial=True, + words=['po\uFB06']).span(), (0, 4)) + self.assertEqual(regex.match(r'(?fi)\L', 'POS', partial=True, + words=['po\uFB06']).partial, True) + self.assertEqual(regex.match(r'(?fi)\L', 'POS', partial=True, + words=['po\uFB06']).span(), (0, 3)) + self.assertEqual(regex.match(r'(?fi)\L', 'po\uFB06', + partial=True, words=['POS']), None) + + self.assertEqual(regex.match(r'[a-z]*4R$', 'a', partial=True).span(), + (0, 1)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'ab', partial=True).span(), + (0, 2)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'ab4', partial=True).span(), + (0, 3)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'a4', partial=True).span(), + (0, 2)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'a4R', partial=True).span(), + (0, 3)) + self.assertEqual(regex.match(r'[a-z]*4R$', '4a', partial=True), None) + self.assertEqual(regex.match(r'[a-z]*4R$', 'a44', partial=True), None) + + def test_hg_bugs(self): + # Hg issue 28: regex.compile("(?>b)") causes "TypeError: 'Character' + # object is not subscriptable" + self.assertEqual(bool(regex.compile("(?>b)", flags=regex.V1)), True) + + # Hg issue 29: regex.compile("^((?>\w+)|(?>\s+))*$") causes + # "TypeError: 'GreedyRepeat' object is not iterable" + self.assertEqual(bool(regex.compile(r"^((?>\w+)|(?>\s+))*$", + flags=regex.V1)), True) + + # Hg issue 31: atomic and normal groups in recursive patterns + self.assertEqual(regex.findall(r"\((?:(?>[^()]+)|(?R))*\)", + "a(bcd(e)f)g(h)"), ['(bcd(e)f)', '(h)']) + self.assertEqual(regex.findall(r"\((?:(?:[^()]+)|(?R))*\)", + "a(bcd(e)f)g(h)"), ['(bcd(e)f)', '(h)']) + self.assertEqual(regex.findall(r"\((?:(?>[^()]+)|(?R))*\)", + "a(b(cd)e)f)g)h"), ['(b(cd)e)']) + self.assertEqual(regex.findall(r"\((?:(?>[^()]+)|(?R))*\)", + "a(bc(d(e)f)gh"), ['(d(e)f)']) + self.assertEqual(regex.findall(r"(?r)\((?:(?>[^()]+)|(?R))*\)", + "a(bc(d(e)f)gh"), ['(d(e)f)']) + self.assertEqual([m.group() for m in + regex.finditer(r"\((?:[^()]*+|(?0))*\)", "a(b(c(de)fg)h")], + ['(c(de)fg)']) + + # Hg issue 32: regex.search("a(bc)d", "abcd", regex.I|regex.V1) returns + # None + self.assertEqual(regex.search("a(bc)d", "abcd", regex.I | + regex.V1).group(0), "abcd") + + # Hg issue 33: regex.search("([\da-f:]+)$", "E", regex.I|regex.V1) + # returns None + self.assertEqual(regex.search(r"([\da-f:]+)$", "E", regex.I | + regex.V1).group(0), "E") + self.assertEqual(regex.search(r"([\da-f:]+)$", "e", regex.I | + regex.V1).group(0), "e") + + # Hg issue 34: regex.search("^(?=ab(de))(abd)(e)", "abde").groups() + # returns (None, 'abd', 'e') instead of ('de', 'abd', 'e') + self.assertEqual(regex.search("^(?=ab(de))(abd)(e)", "abde").groups(), + ('de', 'abd', 'e')) + + # Hg issue 35: regex.compile("\ ", regex.X) causes "_regex_core.error: + # bad escape" + self.assertEqual(bool(regex.match(r"\ ", " ", flags=regex.X)), True) + + # Hg issue 36: regex.search("^(a|)\1{2}b", "b") returns None + self.assertEqual(regex.search(r"^(a|)\1{2}b", "b").group(0, 1), ('b', + '')) + + # Hg issue 37: regex.search("^(a){0,0}", "abc").group(0,1) returns + # ('a', 'a') instead of ('', None) + self.assertEqual(regex.search("^(a){0,0}", "abc").group(0, 1), ('', + None)) + + # Hg issue 38: regex.search("(?>.*/)b", "a/b") returns None + self.assertEqual(regex.search("(?>.*/)b", "a/b").group(0), "a/b") + + # Hg issue 39: regex.search("((?i)blah)\\s+\\1", "blah BLAH") doesn't + # return None + # Changed to positional flags in regex 2023.12.23. + self.assertEqual(regex.search(r"((?i)blah)\s+\1", "blah BLAH"), None) + + # Hg issue 40: regex.search("(\()?[^()]+(?(1)\)|)", "(abcd").group(0) + # returns "bcd" instead of "abcd" + self.assertEqual(regex.search(r"(\()?[^()]+(?(1)\)|)", + "(abcd").group(0), "abcd") + + # Hg issue 42: regex.search("(a*)*", "a", flags=regex.V1).span(1) + # returns (0, 1) instead of (1, 1) + self.assertEqual(regex.search("(a*)*", "a").span(1), (1, 1)) + self.assertEqual(regex.search("(a*)*", "aa").span(1), (2, 2)) + self.assertEqual(regex.search("(a*)*", "aaa").span(1), (3, 3)) + + # Hg issue 43: regex.compile("a(?#xxx)*") causes "_regex_core.error: + # nothing to repeat" + self.assertEqual(regex.search("a(?#xxx)*", "aaa").group(), "aaa") + + # Hg issue 44: regex.compile("(?=abc){3}abc") causes + # "_regex_core.error: nothing to repeat" + self.assertEqual(regex.search("(?=abc){3}abc", "abcabcabc").span(), (0, + 3)) + + # Hg issue 45: regex.compile("^(?:a(?:(?:))+)+") causes + # "_regex_core.error: nothing to repeat" + self.assertEqual(regex.search("^(?:a(?:(?:))+)+", "a").span(), (0, 1)) + self.assertEqual(regex.search("^(?:a(?:(?:))+)+", "aa").span(), (0, 2)) + + # Hg issue 46: regex.compile("a(?x: b c )d") causes + # "_regex_core.error: missing )" + self.assertEqual(regex.search("a(?x: b c )d", "abcd").group(0), "abcd") + + # Hg issue 47: regex.compile("a#comment\n*", flags=regex.X) causes + # "_regex_core.error: nothing to repeat" + self.assertEqual(regex.search("a#comment\n*", "aaa", + flags=regex.X).group(0), "aaa") + + # Hg issue 48: regex.search("(a(?(1)\\1)){4}", "a"*10, + # flags=regex.V1).group(0,1) returns ('aaaaa', 'a') instead of ('aaaaaaaaaa', 'aaaa') + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){1}", + "aaaaaaaaaa").span(0, 1), ((0, 1), (0, 1))) + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){2}", + "aaaaaaaaaa").span(0, 1), ((0, 3), (1, 3))) + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){3}", + "aaaaaaaaaa").span(0, 1), ((0, 6), (3, 6))) + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){4}", + "aaaaaaaaaa").span(0, 1), ((0, 10), (6, 10))) + + # Hg issue 49: regex.search("(a)(?<=b(?1))", "baz", regex.V1) returns + # None incorrectly + self.assertEqual(regex.search("(?V1)(a)(?<=b(?1))", "baz").group(0), + "a") + + # Hg issue 50: not all keywords are found by named list with + # overlapping keywords when full Unicode casefolding is required + self.assertEqual(regex.findall(r'(?fi)\L', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05', + keywords=['post','pos']), ['POST', 'Post', 'post', 'po\u017Ft', + 'po\uFB06', 'po\uFB05']) + self.assertEqual(regex.findall(r'(?fi)pos|post', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05'), ['POS', + 'Pos', 'pos', 'po\u017F', 'po\uFB06', 'po\uFB05']) + self.assertEqual(regex.findall(r'(?fi)post|pos', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05'), ['POST', + 'Post', 'post', 'po\u017Ft', 'po\uFB06', 'po\uFB05']) + self.assertEqual(regex.findall(r'(?fi)post|another', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05'), ['POST', + 'Post', 'post', 'po\u017Ft', 'po\uFB06', 'po\uFB05']) + + # Hg issue 51: regex.search("((a)(?1)|(?2))", "a", flags=regex.V1) + # returns None incorrectly + self.assertEqual(regex.search("(?V1)((a)(?1)|(?2))", "a").group(0, 1, + 2), ('a', 'a', None)) + + # Hg issue 52: regex.search("(\\1xx|){6}", "xx", + # flags=regex.V1).span(0,1) returns incorrect value + self.assertEqual(regex.search(r"(?V1)(\1xx|){6}", "xx").span(0, 1), + ((0, 2), (2, 2))) + + # Hg issue 53: regex.search("(a|)+", "a") causes MemoryError + self.assertEqual(regex.search("(a|)+", "a").group(0, 1), ("a", "")) + + # Hg issue 54: regex.search("(a|)*\\d", "a"*80) causes MemoryError + self.assertEqual(regex.search(r"(a|)*\d", "a" * 80), None) + + # Hg issue 55: regex.search("^(?:a?b?)*$", "ac") take a very long time. + self.assertEqual(regex.search("^(?:a?b?)*$", "ac"), None) + + # Hg issue 58: bad named character escape sequences like "\\N{1}" + # treats as "N" + self.assertRaisesRegex(regex.error, self.UNDEF_CHAR_NAME, lambda: + regex.compile("\\N{1}")) + + # Hg issue 59: regex.search("\\Z", "a\na\n") returns None incorrectly + self.assertEqual(regex.search("\\Z", "a\na\n").span(0), (4, 4)) + + # Hg issue 60: regex.search("(q1|.)*(q2|.)*(x(a|bc)*y){2,}", "xayxay") + # returns None incorrectly + self.assertEqual(regex.search("(q1|.)*(q2|.)*(x(a|bc)*y){2,}", + "xayxay").group(0), "xayxay") + + # Hg issue 61: regex.search("[^a]", "A", regex.I).group(0) returns '' + # incorrectly + self.assertEqual(regex.search("(?i)[^a]", "A"), None) + + # Hg issue 63: regex.search("[[:ascii:]]", "\N{KELVIN SIGN}", + # flags=regex.I|regex.V1) doesn't return None + self.assertEqual(regex.search("(?i)[[:ascii:]]", "\N{KELVIN SIGN}"), + None) + + # Hg issue 66: regex.search("((a|b(?1)c){3,5})", "baaaaca", + # flags=regex.V1).groups() returns ('baaaac', 'baaaac') instead of ('aaaa', 'a') + self.assertEqual(regex.search("((a|b(?1)c){3,5})", "baaaaca").group(0, + 1, 2), ('aaaa', 'aaaa', 'a')) + + # Hg issue 71: non-greedy quantifier in lookbehind + self.assertEqual(regex.findall(r"(?<=:\S+ )\w+", ":9 abc :10 def"), + ['abc', 'def']) + self.assertEqual(regex.findall(r"(?<=:\S* )\w+", ":9 abc :10 def"), + ['abc', 'def']) + self.assertEqual(regex.findall(r"(?<=:\S+? )\w+", ":9 abc :10 def"), + ['abc', 'def']) + self.assertEqual(regex.findall(r"(?<=:\S*? )\w+", ":9 abc :10 def"), + ['abc', 'def']) + + # Hg issue 73: conditional patterns + self.assertEqual(regex.search(r"(?:fe)?male", "female").group(), + "female") + self.assertEqual([m.group() for m in + regex.finditer(r"(fe)?male: h(?(1)(er)|(is)) (\w+)", + "female: her dog; male: his cat. asdsasda")], ['female: her dog', + 'male: his cat']) + + # Hg issue 78: "Captures" doesn't work for recursive calls + self.assertEqual(regex.search(r'(?\((?:[^()]++|(?&rec))*\))', + 'aaa(((1+0)+1)+1)bbb').captures('rec'), ['(1+0)', '((1+0)+1)', + '(((1+0)+1)+1)']) + + # Hg issue 80: Escape characters throws an exception + self.assertRaisesRegex(regex.error, self.BAD_ESCAPE, lambda: + regex.sub('x', '\\', 'x'), ) + + # Hg issue 82: error range does not work + fz = "(CAGCCTCCCATTTCAGAATATACATCC){1a(?b))', "ab").spans("x"), [(1, + 2), (0, 2)]) + + # Hg issue 91: match.expand is extremely slow + # Check that the replacement cache works. + self.assertEqual(regex.sub(r'(-)', lambda m: m.expand(r'x'), 'a-b-c'), + 'axbxc') + + # Hg issue 94: Python crashes when executing regex updates + # pattern.findall + rx = regex.compile(r'\bt(est){i<2}', flags=regex.V1) + self.assertEqual(rx.search("Some text"), None) + self.assertEqual(rx.findall("Some text"), []) + + # Hg issue 95: 'pos' for regex.error + self.assertRaisesRegex(regex.error, self.MULTIPLE_REPEAT, lambda: + regex.compile(r'.???')) + + # Hg issue 97: behaviour of regex.escape's special_only is wrong + # + # Hg issue 244: Make `special_only=True` the default in + # `regex.escape()` + self.assertEqual(regex.escape('foo!?', special_only=False), 'foo\\!\\?') + self.assertEqual(regex.escape('foo!?', special_only=True), 'foo!\\?') + self.assertEqual(regex.escape('foo!?'), 'foo!\\?') + + self.assertEqual(regex.escape(b'foo!?', special_only=False), b'foo\\!\\?') + self.assertEqual(regex.escape(b'foo!?', special_only=True), + b'foo!\\?') + self.assertEqual(regex.escape(b'foo!?'), b'foo!\\?') + + # Hg issue 100: strange results from regex.search + self.assertEqual(regex.search('^([^z]*(?:WWWi|W))?$', + 'WWWi').groups(), ('WWWi', )) + self.assertEqual(regex.search('^([^z]*(?:WWWi|w))?$', + 'WWWi').groups(), ('WWWi', )) + self.assertEqual(regex.search('^([^z]*?(?:WWWi|W))?$', + 'WWWi').groups(), ('WWWi', )) + + # Hg issue 101: findall() broken (seems like memory corruption) + pat = regex.compile(r'xxx', flags=regex.FULLCASE | regex.UNICODE) + self.assertEqual([x.group() for x in pat.finditer('yxxx')], ['xxx']) + self.assertEqual(pat.findall('yxxx'), ['xxx']) + + raw = 'yxxx' + self.assertEqual([x.group() for x in pat.finditer(raw)], ['xxx']) + self.assertEqual(pat.findall(raw), ['xxx']) + + pat = regex.compile(r'xxx', flags=regex.FULLCASE | regex.IGNORECASE | + regex.UNICODE) + self.assertEqual([x.group() for x in pat.finditer('yxxx')], ['xxx']) + self.assertEqual(pat.findall('yxxx'), ['xxx']) + + raw = 'yxxx' + self.assertEqual([x.group() for x in pat.finditer(raw)], ['xxx']) + self.assertEqual(pat.findall(raw), ['xxx']) + + # Hg issue 106: * operator not working correctly with sub() + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub('(?V0).*', 'x', 'test'), 'xx') + else: + self.assertEqual(regex.sub('(?V0).*', 'x', 'test'), 'x') + self.assertEqual(regex.sub('(?V1).*', 'x', 'test'), 'xx') + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub('(?V0).*?', '|', 'test'), '|||||||||') + else: + self.assertEqual(regex.sub('(?V0).*?', '|', 'test'), '|t|e|s|t|') + self.assertEqual(regex.sub('(?V1).*?', '|', 'test'), '|||||||||') + + # Hg issue 112: re: OK, but regex: SystemError + self.assertEqual(regex.sub(r'^(@)\n(?!.*?@)(.*)', + r'\1\n==========\n\2', '@\n', flags=regex.DOTALL), '@\n==========\n') + + # Hg issue 109: Edit distance of fuzzy match + self.assertEqual(regex.match(r'(?:cats|cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats|cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats|cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + + self.assertEqual(regex.match(r'(?:cat){e<=1}', 'caz').fuzzy_counts, + (1, 0, 0)) + self.assertEqual(regex.match(r'(?e)(?:cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match(r'(?b)(?:cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + + self.assertEqual(regex.match(r'(?:cats){e<=2}', 'c ats').fuzzy_counts, + (1, 1, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats){e<=2}', + 'c ats').fuzzy_counts, (0, 1, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats){e<=2}', + 'c ats').fuzzy_counts, (0, 1, 0)) + + self.assertEqual(regex.match(r'(?:cats){e<=2}', + 'c a ts').fuzzy_counts, (0, 2, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats){e<=2}', + 'c a ts').fuzzy_counts, (0, 2, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats){e<=2}', + 'c a ts').fuzzy_counts, (0, 2, 0)) + + self.assertEqual(regex.match(r'(?:cats){e<=1}', 'c ats').fuzzy_counts, + (0, 1, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats){e<=1}', + 'c ats').fuzzy_counts, (0, 1, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats){e<=1}', + 'c ats').fuzzy_counts, (0, 1, 0)) + + # Hg issue 115: Infinite loop when processing backreferences + self.assertEqual(regex.findall(r'\bof ([a-z]+) of \1\b', + 'To make use of one of these modules'), []) + + # Hg issue 125: Reference to entire match (\g<0>) in + # Pattern.sub() doesn't work as of 2014.09.22 release. + self.assertEqual(regex.sub(r'x', r'\g<0>', 'x'), 'x') + + # Unreported issue: no such builtin as 'ascii' in Python 2. + self.assertEqual(bool(regex.match(r'a', 'a', regex.DEBUG)), True) + + # Hg issue 131: nested sets behaviour + self.assertEqual(regex.findall(r'(?V1)[[b-e]--cd]', 'abcdef'), ['b', + 'e']) + self.assertEqual(regex.findall(r'(?V1)[b-e--cd]', 'abcdef'), ['b', + 'e']) + self.assertEqual(regex.findall(r'(?V1)[[bcde]--cd]', 'abcdef'), ['b', + 'e']) + self.assertEqual(regex.findall(r'(?V1)[bcde--cd]', 'abcdef'), ['b', + 'e']) + + # Hg issue 132: index out of range on null property \p{} + self.assertRaisesRegex(regex.error, '^unknown property at position 4$', + lambda: regex.compile(r'\p{}')) + + # Issue 23692. + self.assertEqual(regex.match('(?:()|(?(1)()|z)){2}(?(2)a|z)', + 'a').group(0, 1, 2), ('a', '', '')) + self.assertEqual(regex.match('(?:()|(?(1)()|z)){0,2}(?(2)a|z)', + 'a').group(0, 1, 2), ('a', '', '')) + + # Hg issue 137: Posix character class :punct: does not seem to be + # supported. + + # Posix compatibility as recommended here: + # http://www.unicode.org/reports/tr18/#Compatibility_Properties + + # Posix in Unicode. + chars = ''.join(chr(c) for c in range(0x10000)) + + self.assertEqual(ascii(''.join(regex.findall(r'''[[:alnum:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{Alpha}\p{PosixDigit}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:alpha:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Alpha}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:ascii:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{InBasicLatin}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:blank:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{gc=Space_Separator}\t]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:cntrl:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{gc=Control}+''', chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:digit:]]+''', + chars))), ascii(''.join(regex.findall(r'''[0-9]+''', chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:graph:]]+''', + chars))), ascii(''.join(regex.findall(r'''[^\p{Space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:lower:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Lower}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:print:]]+''', + chars))), ascii(''.join(regex.findall(r'''(?V1)[\p{Graph}\p{Blank}--\p{Cntrl}]+''', chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:punct:]]+''', + chars))), + ascii(''.join(regex.findall(r'''(?V1)[\p{gc=Punctuation}\p{gc=Symbol}--\p{Alpha}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:space:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Whitespace}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:upper:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Upper}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:word:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{Alpha}\p{gc=Mark}\p{Digit}\p{gc=Connector_Punctuation}\p{Join_Control}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:xdigit:]]+''', + chars))), ascii(''.join(regex.findall(r'''[0-9A-Fa-f]+''', + chars)))) + + # Posix in ASCII. + chars = bytes(range(0x100)) + + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:alnum:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\p{Alpha}\p{PosixDigit}]+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:alpha:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Alpha}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:ascii:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\x00-\x7F]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:blank:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\p{gc=Space_Separator}\t]+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:cntrl:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{gc=Control}+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:digit:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[0-9]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:graph:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[^\p{Space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:lower:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Lower}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:print:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?aV1)[\p{Graph}\p{Blank}--\p{Cntrl}]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:punct:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?aV1)[\p{gc=Punctuation}\p{gc=Symbol}--\p{Alpha}]+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:space:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Whitespace}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:upper:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Upper}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:word:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\p{Alpha}\p{gc=Mark}\p{Digit}\p{gc=Connector_Punctuation}\p{Join_Control}]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:xdigit:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[0-9A-Fa-f]+''', chars)))) + + # Hg issue 138: grapheme anchored search not working properly. + self.assertEqual(ascii(regex.search(r'\X$', 'ab\u2103').group()), + ascii('\u2103')) + + # Hg issue 139: Regular expression with multiple wildcards where first + # should match empty string does not always work. + self.assertEqual(regex.search("([^L]*)([^R]*R)", "LtR").groups(), ('', + 'LtR')) + + # Hg issue 140: Replace with REVERSE and groups has unexpected + # behavior. + self.assertEqual(regex.sub(r'(.)', r'x\1y', 'ab'), 'xayxby') + self.assertEqual(regex.sub(r'(?r)(.)', r'x\1y', 'ab'), 'xayxby') + self.assertEqual(regex.subf(r'(.)', 'x{1}y', 'ab'), 'xayxby') + self.assertEqual(regex.subf(r'(?r)(.)', 'x{1}y', 'ab'), 'xayxby') + + # Hg issue 141: Crash on a certain partial match. + self.assertEqual(regex.fullmatch('(a)*abc', 'ab', + partial=True).span(), (0, 2)) + self.assertEqual(regex.fullmatch('(a)*abc', 'ab', + partial=True).partial, True) + + # Hg issue 143: Partial matches have incorrect span if prefix is '.' + # wildcard. + self.assertEqual(regex.search('OXRG', 'OOGOX', partial=True).span(), + (3, 5)) + self.assertEqual(regex.search('.XRG', 'OOGOX', partial=True).span(), + (3, 5)) + self.assertEqual(regex.search('.{1,3}XRG', 'OOGOX', + partial=True).span(), (1, 5)) + + # Hg issue 144: Latest version problem with matching 'R|R'. + self.assertEqual(regex.match('R|R', 'R').span(), (0, 1)) + + # Hg issue 146: Forced-fail (?!) works improperly in conditional. + self.assertEqual(regex.match(r'(.)(?(1)(?!))', 'xy'), None) + + # Groups cleared after failure. + self.assertEqual(regex.findall(r'(y)?(\d)(?(1)\b\B)', 'ax1y2z3b'), + [('', '1'), ('', '2'), ('', '3')]) + self.assertEqual(regex.findall(r'(y)?+(\d)(?(1)\b\B)', 'ax1y2z3b'), + [('', '1'), ('', '2'), ('', '3')]) + + # Hg issue 147: Fuzzy match can return match points beyond buffer end. + self.assertEqual([m.span() for m in regex.finditer(r'(?i)(?:error){e}', + 'regex failure')], [(0, 5), (5, 10), (10, 13), (13, 13)]) + self.assertEqual([m.span() for m in + regex.finditer(r'(?fi)(?:error){e}', 'regex failure')], [(0, 5), (5, + 10), (10, 13), (13, 13)]) + + # Hg issue 150: Have an option for POSIX-compatible longest match of + # alternates. + self.assertEqual(regex.search(r'(?p)\d+(\w(\d*)?|[eE]([+-]\d+))', + '10b12')[0], '10b12') + self.assertEqual(regex.search(r'(?p)\d+(\w(\d*)?|[eE]([+-]\d+))', + '10E+12')[0], '10E+12') + + self.assertEqual(regex.search(r'(?p)(\w|ae|oe|ue|ss)', 'ae')[0], 'ae') + self.assertEqual(regex.search(r'(?p)one(self)?(selfsufficient)?', + 'oneselfsufficient')[0], 'oneselfsufficient') + + # Hg issue 151: Request: \K. + self.assertEqual(regex.search(r'(ab\Kcd)', 'abcd').group(0, 1), ('cd', + 'abcd')) + self.assertEqual(regex.findall(r'\w\w\K\w\w', 'abcdefgh'), ['cd', + 'gh']) + self.assertEqual(regex.findall(r'(\w\w\K\w\w)', 'abcdefgh'), ['abcd', + 'efgh']) + + self.assertEqual(regex.search(r'(?r)(ab\Kcd)', 'abcd').group(0, 1), + ('ab', 'abcd')) + self.assertEqual(regex.findall(r'(?r)\w\w\K\w\w', 'abcdefgh'), ['ef', + 'ab']) + self.assertEqual(regex.findall(r'(?r)(\w\w\K\w\w)', 'abcdefgh'), + ['efgh', 'abcd']) + + # Hg issue 152: Request: Request: (?(DEFINE)...). + self.assertEqual(regex.search(r'(?(DEFINE)(?\d+)(?\w+))(?&quant) (?&item)', + '5 elephants')[0], '5 elephants') + + self.assertEqual(regex.search(r'(?&routine)(?(DEFINE)(?.))', 'a').group('routine'), None) + self.assertEqual(regex.search(r'(?&routine)(?(DEFINE)(?.))', 'a').captures('routine'), ['a']) + + # Hg issue 153: Request: (*SKIP). + self.assertEqual(regex.search(r'12(*FAIL)|3', '123')[0], '3') + self.assertEqual(regex.search(r'(?r)12(*FAIL)|3', '123')[0], '3') + + self.assertEqual(regex.search(r'\d+(*PRUNE)\d', '123'), None) + self.assertEqual(regex.search(r'\d+(?=(*PRUNE))\d', '123')[0], '123') + self.assertEqual(regex.search(r'\d+(*PRUNE)bcd|[3d]', '123bcd')[0], + '123bcd') + self.assertEqual(regex.search(r'\d+(*PRUNE)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d+?(*PRUNE)bcd|[3d]', '123bcd')[0], + '3bcd') + self.assertEqual(regex.search(r'\d+?(*PRUNE)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d++(?<=3(*PRUNE))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'\d++(?<=3(*PRUNE))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=(*PRUNE)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=2(*PRUNE)3)zzd|[3d]$', + '124zzd')[0], 'd') + + self.assertEqual(regex.search(r'(?r)\d(*PRUNE)\d+', '123'), None) + self.assertEqual(regex.search(r'(?r)\d(?<=(*PRUNE))\d+', '123')[0], + '123') + self.assertEqual(regex.search(r'(?r)\d+(*PRUNE)bcd|[3d]', + '123bcd')[0], '123bcd') + self.assertEqual(regex.search(r'(?r)\d+(*PRUNE)bcd|[3d]', + '123zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*PRUNE))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*PRUNE))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=(*PRUNE)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=2(*PRUNE)3)zzd|[3d]$', + '124zzd')[0], 'd') + + self.assertEqual(regex.search(r'\d+(*SKIP)bcd|[3d]', '123bcd')[0], + '123bcd') + self.assertEqual(regex.search(r'\d+(*SKIP)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d+?(*SKIP)bcd|[3d]', '123bcd')[0], + '3bcd') + self.assertEqual(regex.search(r'\d+?(*SKIP)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d++(?<=3(*SKIP))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'\d++(?<=3(*SKIP))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=(*SKIP)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=2(*SKIP)3)zzd|[3d]$', + '124zzd')[0], 'd') + + self.assertEqual(regex.search(r'(?r)\d+(*SKIP)bcd|[3d]', '123bcd')[0], + '123bcd') + self.assertEqual(regex.search(r'(?r)\d+(*SKIP)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*SKIP))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*SKIP))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=(*SKIP)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=2(*SKIP)3)zzd|[3d]$', + '124zzd')[0], 'd') + + # Hg issue 154: Segmentation fault 11 when working with an atomic group + text = """June 30, December 31, 2013 2012 +some words follow: +more words and numbers 1,234,567 9,876,542 +more words and numbers 1,234,567 9,876,542""" + self.assertEqual(len(regex.findall(r'(?2014|2013 ?2012)', text)), 1) + + # Hg issue 156: regression on atomic grouping + self.assertEqual(regex.match('1(?>2)', '12').span(), (0, 2)) + + # Hg issue 157: regression: segfault on complex lookaround + self.assertEqual(regex.match(r'(?V1w)(?=(?=[^A-Z]*+[A-Z])(?=[^a-z]*+[a-z]))(?=\D*+\d)(?=\p{Alphanumeric}*+\P{Alphanumeric})\A(?s:.){8,255}+\Z', + 'AAaa11!!')[0], 'AAaa11!!') + + # Hg issue 158: Group issue with (?(DEFINE)...) + TEST_REGEX = regex.compile(r'''(?smx) +(?(DEFINE) + (? + ^,[^,]+, + ) +) + +# Group 2 is defined on this line +^,([^,]+), + +(?:(?!(?&subcat)[\r\n]+(?&subcat)).)+ +''') + + TEST_DATA = ''' +,Cat 1, +,Brand 1, +some +thing +,Brand 2, +other +things +,Cat 2, +,Brand, +Some +thing +''' + + self.assertEqual([m.span(1, 2) for m in + TEST_REGEX.finditer(TEST_DATA)], [((-1, -1), (2, 7)), ((-1, -1), (54, + 59))]) + + # Hg issue 161: Unexpected fuzzy match results + self.assertEqual(regex.search('(abcdefgh){e}', + '******abcdefghijklmnopqrtuvwxyz', regex.BESTMATCH).span(), (6, 14)) + self.assertEqual(regex.search('(abcdefghi){e}', + '******abcdefghijklmnopqrtuvwxyz', regex.BESTMATCH).span(), (6, 15)) + + # Hg issue 163: allow lookarounds in conditionals. + self.assertEqual(regex.match(r'(?:(?=\d)\d+\b|\w+)', '123abc').span(), + (0, 6)) + self.assertEqual(regex.match(r'(?(?=\d)\d+\b|\w+)', '123abc'), None) + self.assertEqual(regex.search(r'(?(?<=love\s)you|(?<=hate\s)her)', + "I love you").span(), (7, 10)) + self.assertEqual(regex.findall(r'(?(?<=love\s)you|(?<=hate\s)her)', + "I love you but I don't hate her either"), ['you', 'her']) + + # Hg issue 180: bug of POSIX matching. + self.assertEqual(regex.search(r'(?p)a*(.*?)', 'aaabbb').group(0, 1), + ('aaabbb', 'bbb')) + self.assertEqual(regex.search(r'(?p)a*(.*)', 'aaabbb').group(0, 1), + ('aaabbb', 'bbb')) + self.assertEqual(regex.sub(r'(?p)a*(.*?)', r'\1', 'aaabbb'), 'bbb') + self.assertEqual(regex.sub(r'(?p)a*(.*)', r'\1', 'aaabbb'), 'bbb') + + # Hg issue 192: Named lists reverse matching doesn't work with + # IGNORECASE and V1 + self.assertEqual(regex.match(r'(?irV0)\L', '21', kw=['1']).span(), + (1, 2)) + self.assertEqual(regex.match(r'(?irV1)\L', '21', kw=['1']).span(), + (1, 2)) + + # Hg issue 193: Alternation and .REVERSE flag. + self.assertEqual(regex.search('a|b', '111a222').span(), (3, 4)) + self.assertEqual(regex.search('(?r)a|b', '111a222').span(), (3, 4)) + + # Hg issue 194: .FULLCASE and Backreference + self.assertEqual(regex.search(r'(?if)<(CLI)><\1>', + '').span(), (0, 10)) + self.assertEqual(regex.search(r'(?if)<(CLI)><\1>', + '').span(), (0, 10)) + self.assertEqual(regex.search(r'(?ifr)<\1><(CLI)>', + '').span(), (0, 10)) + + # Hg issue 195: Pickle (or otherwise serial) the compiled regex + r = regex.compile(r'\L', options=['foo', 'bar']) + p = pickle.dumps(r) + r = pickle.loads(p) + self.assertEqual(r.match('foo').span(), (0, 3)) + + # Hg issue 196: Fuzzy matching on repeated regex not working as + # expected + self.assertEqual(regex.match('(x{6}){e<=1}', 'xxxxxx', + flags=regex.BESTMATCH).span(), (0, 6)) + self.assertEqual(regex.match('(x{6}){e<=1}', 'xxxxx', + flags=regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.match('(x{6}){e<=1}', 'x', + flags=regex.BESTMATCH), None) + self.assertEqual(regex.match('(?r)(x{6}){e<=1}', 'xxxxxx', + flags=regex.BESTMATCH).span(), (0, 6)) + self.assertEqual(regex.match('(?r)(x{6}){e<=1}', 'xxxxx', + flags=regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.match('(?r)(x{6}){e<=1}', 'x', + flags=regex.BESTMATCH), None) + + # Hg issue 197: ValueError in regex.compile + self.assertRaises(regex.error, lambda: + regex.compile(b'00000\\0\\00\\^\50\\00\\U05000000')) + + # Hg issue 198: ValueError in regex.compile + self.assertRaises(regex.error, lambda: regex.compile(b"{e', '22', aa=['121', + '22'])), True) + self.assertEqual(bool(regex.search(r'(?ri)\L', '22', aa=['121', + '22'])), True) + self.assertEqual(bool(regex.search(r'(?fi)\L', '22', aa=['121', + '22'])), True) + self.assertEqual(bool(regex.search(r'(?fri)\L', '22', aa=['121', + '22'])), True) + + # Hg issue 208: Named list, (?ri) flags, Backreference + self.assertEqual(regex.search(r'(?r)\1dog..(?<=(\L))$', 'ccdogcc', + aa=['bcb', 'cc']). span(), (0, 7)) + self.assertEqual(regex.search(r'(?ir)\1dog..(?<=(\L))$', + 'ccdogcc', aa=['bcb', 'cc']). span(), (0, 7)) + + # Hg issue 210: Fuzzy matching and Backreference + self.assertEqual(regex.search(r'(2)(?:\1{5}){e<=1}', + '3222212').span(), (1, 7)) + self.assertEqual(regex.search(r'(\d)(?:\1{5}){e<=1}', + '3222212').span(), (1, 7)) + + # Hg issue 211: Segmentation fault with recursive matches and atomic + # groups + self.assertEqual(regex.match(r'''\A(?P(?>\((?&whole)\)|[+\-]))\Z''', + '((-))').span(), (0, 5)) + self.assertEqual(regex.match(r'''\A(?P(?>\((?&whole)\)|[+\-]))\Z''', + '((-)+)'), None) + + # Hg issue 212: Unexpected matching difference with .*? between re and + # regex + self.assertEqual(regex.match(r"x.*? (.).*\1(.*)\1", + 'x |y| z|').span(), (0, 9)) + self.assertEqual(regex.match(r"\.sr (.*?) (.)(.*)\2(.*)\2(.*)", + r'.sr h |||').span(), (0, 35)) + + # Hg issue 213: Segmentation Fault + a = '"\\xF9\\x80\\xAEqdz\\x95L\\xA7\\x89[\\xFE \\x91)\\xF9]\\xDB\'\\x99\\x09=\\x00\\xFD\\x98\\x22\\xDD\\xF1\\xB6\\xC3 Z\\xB6gv\\xA5x\\x93P\\xE1r\\x14\\x8Cv\\x0C\\xC0w\\x15r\\xFFc%" ' + py_regex_pattern = r'''(?P((?>(?"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``)))) (?P((?>(?"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``))))''' + self.assertEqual(bool(regex.search(py_regex_pattern, a)), False) + + # Hg Issue 216: Invalid match when using negative lookbehind and pipe + self.assertEqual(bool(regex.match('foo(?<=foo)', 'foo')), True) + self.assertEqual(bool(regex.match('foo(?.*\!\w*\:.*)|(?P.*))', + '!')), False) + + # Hg issue 220: Misbehavior of group capture with OR operand + self.assertEqual(regex.match(r'\w*(ea)\w*|\w*e(?!a)\w*', + 'easier').groups(), ('ea', )) + + # Hg issue 225: BESTMATCH in fuzzy match not working + self.assertEqual(regex.search('(^1234$){i,d}', '12234', + regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.search('(^1234$){i,d}', '12234', + regex.BESTMATCH).fuzzy_counts, (0, 1, 0)) + + self.assertEqual(regex.search('(^1234$){s,i,d}', '12234', + regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.search('(^1234$){s,i,d}', '12234', + regex.BESTMATCH).fuzzy_counts, (0, 1, 0)) + + # Hg issue 226: Error matching at start of string + self.assertEqual(regex.search('(^123$){s,i,d}', 'xxxxxxxx123', + regex.BESTMATCH).span(), (0, 11)) + self.assertEqual(regex.search('(^123$){s,i,d}', 'xxxxxxxx123', + regex.BESTMATCH).fuzzy_counts, (0, 8, 0)) + + # Hg issue 227: Incorrect behavior for ? operator with UNICODE + + # IGNORECASE + self.assertEqual(regex.search(r'a?yz', 'xxxxyz', flags=regex.FULLCASE | + regex.IGNORECASE).span(), (4, 6)) + + # Hg issue 230: Is it a bug of (?(DEFINE)...) + self.assertEqual(regex.findall(r'(?:(?![a-d]).)+', 'abcdefgh'), + ['efgh']) + self.assertEqual(regex.findall(r'''(?(DEFINE)(?P(?:(?![a-d]).)))(?&mydef)+''', + 'abcdefgh'), ['efgh']) + + # Hg issue 238: Not fully re backward compatible + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){1,3}', + '"Erm....yes. T..T...Thank you for that."'), [('Erm....', 'Erm', + '....'), ('T...', 'T', '...')]) + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){3}', + '"Erm....yes. T..T...Thank you for that."'), []) + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){2}', + '"Erm....yes. T..T...Thank you for that."'), [('T...', 'T', '...')]) + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){1}', + '"Erm....yes. T..T...Thank you for that."'), [('Erm....', 'Erm', + '....'), ('T..', 'T', '..'), ('T...', 'T', '...')]) + + # Hg issue 247: Unexpected result with fuzzy matching and lookahead + # expression + self.assertEqual(regex.search(r'(?:ESTONIA(?!\w)){e<=1}', + 'ESTONIAN WORKERS').group(), 'ESTONIAN') + self.assertEqual(regex.search(r'(?:ESTONIA(?=\W)){e<=1}', + 'ESTONIAN WORKERS').group(), 'ESTONIAN') + + self.assertEqual(regex.search(r'(?:(?.))(?&func)', + 'abc').groups(), (None, )) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?&func)', + 'abc').groupdict(), {'func': None}) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?&func)', + 'abc').capturesdict(), {'func': ['a']}) + + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?=(?&func))', + 'abc').groups(), (None, )) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?=(?&func))', + 'abc').groupdict(), {'func': None}) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?=(?&func))', + 'abc').capturesdict(), {'func': ['a']}) + + self.assertEqual(regex.search(r'(?(DEFINE)(?.)).(?<=(?&func))', + 'abc').groups(), (None, )) + self.assertEqual(regex.search(r'(?(DEFINE)(?.)).(?<=(?&func))', + 'abc').groupdict(), {'func': None}) + self.assertEqual(regex.search(r'(?(DEFINE)(?.)).(?<=(?&func))', + 'abc').capturesdict(), {'func': ['a']}) + + # Hg issue 271: Comment logic different between Re and Regex + self.assertEqual(bool(regex.match(r'ab(?#comment\))cd', 'abcd')), True) + + # Hg issue 276: Partial Matches yield incorrect matches and bounds + self.assertEqual(regex.search(r'[a-z]+ [a-z]*?:', 'foo bar', + partial=True).span(), (0, 7)) + self.assertEqual(regex.search(r'(?r):[a-z]*? [a-z]+', 'foo bar', + partial=True).span(), (0, 7)) + + # Hg issue 291: Include Script Extensions as a supported Unicode property + self.assertEqual(bool(regex.match(r'(?u)\p{Script:Beng}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script:Bengali}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Bengali}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Beng}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Cakm}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Sylo}', + '\u09EF')), True) + + # Hg issue #293: scx (Script Extensions) property currently matches + # incorrectly + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Latin}', 'P')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Ahom}', 'P')), False) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Common}', '4')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Caucasian_Albanian}', '4')), + False) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Arabic}', '\u062A')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Balinese}', '\u062A')), + False) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Devanagari}', '\u091C')), + True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Batak}', '\u091C')), False) + + # Hg issue 296: Group references are not taken into account when group is reporting the last match + self.assertEqual(regex.fullmatch('(?P.)*(?&x)', 'abc').captures('x'), + ['a', 'b', 'c']) + self.assertEqual(regex.fullmatch('(?P.)*(?&x)', 'abc').group('x'), + 'b') + + self.assertEqual(regex.fullmatch('(?P.)(?P.)(?P.)', + 'abc').captures('x'), ['a', 'b', 'c']) + self.assertEqual(regex.fullmatch('(?P.)(?P.)(?P.)', + 'abc').group('x'), 'c') + + # Hg issue 299: Partial gives misleading results with "open ended" regexp + self.assertEqual(regex.match('(?:ab)*', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*?', '', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)+?', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)++', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)++', 'abab', partial=True).partial, + False) + + self.assertEqual(regex.match('(?r)(?:ab)*', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*?', '', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)+?', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)++', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)++', 'abab', partial=True).partial, + False) + + self.assertEqual(regex.match('a*', '', partial=True).partial, False) + self.assertEqual(regex.match('a*?', '', partial=True).partial, False) + self.assertEqual(regex.match('a*+', '', partial=True).partial, False) + self.assertEqual(regex.match('a+', '', partial=True).partial, True) + self.assertEqual(regex.match('a+?', '', partial=True).partial, True) + self.assertEqual(regex.match('a++', '', partial=True).partial, True) + self.assertEqual(regex.match('a+', 'a', partial=True).partial, False) + self.assertEqual(regex.match('a+?', 'a', partial=True).partial, False) + self.assertEqual(regex.match('a++', 'a', partial=True).partial, False) + + self.assertEqual(regex.match('(?r)a*', '', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a*?', '', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a*+', '', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a+', '', partial=True).partial, True) + self.assertEqual(regex.match('(?r)a+?', '', partial=True).partial, True) + self.assertEqual(regex.match('(?r)a++', '', partial=True).partial, True) + self.assertEqual(regex.match('(?r)a+', 'a', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a+?', 'a', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a++', 'a', partial=True).partial, False) + + self.assertEqual(regex.match(r"(?:\s*\w+'*)+", 'whatever', partial=True).partial, + False) + + # Hg issue 300: segmentation fault + pattern = ('(?PGGCGTCACACTTTGCTATGCCATAGCAT[AG]TTTATCCATAAGA' + 'TTAGCGGATCCTACCTGACGCTTTTTATCGCAACTCTCTACTGTTTCTCCATAACAGAACATATTGA' + 'CTATCCGGTATTACCCGGCATGACAGGAGTAAAA){e<=1}' + '(?P[ACGT]{1059}){e<=2}' + '(?PTAATCGTCTTGTTTGATACACAAGGGTCGCATCTGCGGCCCTTTTGCTTTTTTAAG' + 'TTGTAAGGATATGCCATTCTAGA){e<=0}' + '(?P[ACGT]{18}){e<=0}' + '(?PAGATCGG[CT]AGAGCGTCGTGTAGGGAAAGAGTGTGG){e<=1}') + + text = ('GCACGGCGTCACACTTTGCTATGCCATAGCATATTTATCCATAAGATTAGCGGATCCTACC' + 'TGACGCTTTTTATCGCAACTCTCTACTGTTTCTCCATAACAGAACATATTGACTATCCGGTATTACC' + 'CGGCATGACAGGAGTAAAAATGGCTATCGACGAAAACAAACAGAAAGCGTTGGCGGCAGCACTGGGC' + 'CAGATTGAGAAACAATTTGGTAAAGGCTCCATCATGCGCCTGGGTGAAGACCGTTCCATGGATGTGG' + 'AAACCATCTCTACCGGTTCGCTTTCACTGGATATCGCGCTTGGGGCAGGTGGTCTGCCGATGGGCCG' + 'TATCGTCGAAATCTACGGACCGGAATCTTCCGGTAAAACCACGCTGACGCTGCAGGTGATCGCCGCA' + 'GCGCAGCGTGAAGGTAAAACCTGTGCGTTTATCGATGCTGAACACGCGCTGGACCCAATCTACGCAC' + 'GTAAACTGGGCGTCGATATCGACAACCTGCTGTGCTCCCAGCCGGACACCGGCGAGCAGGCACTGGA' + 'AATCTGTGACGCCCTGGCGCGTTCTGGCGCAGTAGACGTTATCGTCGTTGACTCCGTGGCGGCACTG' + 'ACGCCGAAAGCGGAAATCGAAGGCGAAATCGGCGACTCTCATATGGGCCTTGCGGCACGTATGATGA' + 'GCCAGGCGATGCGTAAGCTGGCGGGTAACCTGAAGCAGTCCAACACGCTGCTGATCTTCATCAACCC' + 'CATCCGTATGAAAATTGGTGTGATGTTCGGCAACCCGGAAACCACTTACCGGTGGTAACGCGCTGAA' + 'ATTCTACGCCTCTGTTCGTCTCGACATCCGTTAAATCGGCGCGGTGAAAGAGGGCGAAAACGTGGTG' + 'GGTAGCGAAACCCGCGTGAAAGTGGTGAAGAACAAAATCGCTGCGCCGTTTAAACAGGCTGAATTCC' + 'AGATCCTCTACGGCGAAGGTATCAACTTCTACCCCGAACTGGTTGACCTGGGCGTAAAAGAGAAGCT' + 'GATCGAGAAAGCAGGCGCGTGGTACAGCTACAAAGGTGAGAAGATCGGTCAGGGTAAAGCGAATGCG' + 'ACTGCCTGGCTGAAATTTAACCCGGAAACCGCGAAAGAGATCGAGTGAAAAGTACGTGAGTTGCTGC' + 'TGAGCAACCCGAACTCAACGCCGGATTTCTCTGTAGATGATAGCGAAGGCGTAGCAGAAACTAACGA' + 'AGATTTTTAATCGTCTTGTTTGATACACAAGGGTCGCATCTGCGGCCCTTTTGCTTTTTTAAGTTGT' + 'AAGGATATGCCATTCTAGACAGTTAACACACCAACAAAGATCGGTAGAGCGTCGTGTAGGGAAAGAG' + 'TGTGGTACC') + + m = regex.search(pattern, text, flags=regex.BESTMATCH) + self.assertEqual(m.fuzzy_counts, (0, 1, 0)) + self.assertEqual(m.fuzzy_changes, ([], [1206], [])) + + # Hg issue 306: Fuzzy match parameters not respecting quantifier scope + self.assertEqual(regex.search(r'(?e)(dogf(((oo){e<1})|((00){e<1}))d){e<2}', + 'dogfood').fuzzy_counts, (0, 0, 0)) + self.assertEqual(regex.search(r'(?e)(dogf(((oo){e<1})|((00){e<1}))d){e<2}', + 'dogfoot').fuzzy_counts, (1, 0, 0)) + + # Hg issue 312: \X not matching graphemes with zero-width-joins + self.assertEqual(regex.findall(r'\X', + '\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466'), + ['\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466']) + + # Hg issue 320: Abnormal performance + self.assertEqual(bool(regex.search(r'(?=a)a', 'a')), True) + self.assertEqual(bool(regex.search(r'(?!b)a', 'a')), True) + + # Hg issue 327: .fullmatch() causes MemoryError + self.assertEqual(regex.fullmatch(r'((\d)*?)*?', '123').span(), (0, 3)) + + # Hg issue 329: Wrong group matches when question mark quantifier is used within a look behind + self.assertEqual(regex.search(r'''(?(DEFINE)(?(?THIS_SHOULD_NOT_MATCHx?)|(?right))).*(?<=(?&mydef).*)''', + 'x right').capturesdict(), {'mydef': ['right'], 'wrong': [], 'right': + ['right']}) + + # Hg issue 338: specifying allowed characters when fuzzy-matching + self.assertEqual(bool(regex.match(r'(?:cat){e<=1:[u]}', 'cut')), True) + self.assertEqual(bool(regex.match(r'(?:cat){e<=1:u}', 'cut')), True) + + # Hg issue 353: fuzzy changes negative indexes + self.assertEqual(regex.search(r'(?be)(AGTGTTCCCCGCGCCAGCGGGGATAAACCG){s<=5,i<=5,d<=5,s+i+d<=10}', + 'TTCCCCGCGCCAGCGGGGATAAACCG').fuzzy_changes, ([], [], [0, 1, 3, 5])) + + # Git issue 364: Contradictory values in fuzzy_counts and fuzzy_changes + self.assertEqual(regex.match(r'(?:bc){e}', 'c').fuzzy_counts, (1, 0, + 1)) + self.assertEqual(regex.match(r'(?:bc){e}', 'c').fuzzy_changes, ([0], + [], [1])) + self.assertEqual(regex.match(r'(?e)(?:bc){e}', 'c').fuzzy_counts, (0, + 0, 1)) + self.assertEqual(regex.match(r'(?e)(?:bc){e}', 'c').fuzzy_changes, + ([], [], [0])) + self.assertEqual(regex.match(r'(?b)(?:bc){e}', 'c').fuzzy_counts, (0, + 0, 1)) + self.assertEqual(regex.match(r'(?b)(?:bc){e}', 'c').fuzzy_changes, + ([], [], [0])) + + # Git issue 370: Confusions about Fuzzy matching behavior + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){e}', + '$ 10,112.111.12').fuzzy_counts, (6, 0, 5)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=1}', + '$ 10,112.111.12').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=1,i<=1,d<=1}', + '$ 10,112.111.12').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=3}', + '$ 10,1a2.111.12').fuzzy_counts, (2, 0, 0)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=2}', + '$ 10,1a2.111.12').fuzzy_counts, (2, 0, 0)) + + self.assertEqual(regex.fullmatch(r'(?e)(?:0?,0(?:,0)?){s<=1,d<=1}', + ',0;0').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.fullmatch(r'(?e)(?:0??,0(?:,0)?){s<=1,d<=1}', + ',0;0').fuzzy_counts, (1, 0, 0)) + + # Git issue 371: Specifying character set when fuzzy-matching allows characters not in the set + self.assertEqual(regex.search(r"\b(?e)(?:\d{6,20}){i<=5:[\-\\\/]}\b", + "cat dog starting at 00:01132.000. hello world"), None) + + # Git issue 385: Comments in expressions + self.assertEqual(bool(regex.compile('(?#)')), True) + self.assertEqual(bool(regex.compile('(?x)(?#)')), True) + + # Git issue 394: Unexpected behaviour in fuzzy matching with limited character set with IGNORECASE flag + self.assertEqual(regex.findall(r'(\d+){i<=2:[ab]}', '123X4Y5'), + ['123', '4', '5']) + self.assertEqual(regex.findall(r'(?i)(\d+){i<=2:[ab]}', '123X4Y5'), + ['123', '4', '5']) + + # Git issue 403: Fuzzy matching with wrong distance (unnecessary substitutions) + self.assertEqual(regex.match(r'^(test){e<=5}$', 'terstin', + flags=regex.B).fuzzy_counts, (0, 3, 0)) + + # Git issue 408: regex fails with a quantified backreference but succeeds with repeated backref + self.assertEqual(bool(regex.match(r"(?:(x*)\1\1\1)*x$", "x" * 5)), True) + self.assertEqual(bool(regex.match(r"(?:(x*)\1{3})*x$", "x" * 5)), True) + + # Git issue 415: Fuzzy character restrictions don't apply to insertions at "right edge" + self.assertEqual(regex.match(r't(?:es){s<=1:\d}t', 'te5t').group(), + 'te5t') + self.assertEqual(regex.match(r't(?:es){s<=1:\d}t', 'tezt'), None) + self.assertEqual(regex.match(r't(?:es){i<=1:\d}t', 'tes5t').group(), + 'tes5t') + self.assertEqual(regex.match(r't(?:es){i<=1:\d}t', 'teszt'), None) + self.assertEqual(regex.match(r't(?:es){i<=1:\d}t', + 'tes5t').fuzzy_changes, ([], [3], [])) + self.assertEqual(regex.match(r't(es){i<=1,0.*)(?PCTTCC){e<=1}(?P([ACGT]){4,6})(?PCAATACCGACTCCTCACTGTGT){e<=2}(?P([ACGT]){0,6}$)' + + m = regex.match(pattern, sequence, flags=regex.BESTMATCH) + self.assertEqual(m.span(), (0, 50)) + self.assertEqual(m.groupdict(), {'insert': 'TTCAGACGTGTGCT', 'anchor': 'CTTCC', 'umi': 'GATCT', 'sid': 'CAATACCGACTCCTCACTGTGT', 'end': 'GTCT'}) + + m = regex.match(pattern, sequence, flags=regex.ENHANCEMATCH) + self.assertEqual(m.span(), (0, 50)) + self.assertEqual(m.groupdict(), {'insert': 'TTCAGACGTGTGCT', 'anchor': 'CTTCC', 'umi': 'GATCT', 'sid': 'CAATACCGACTCCTCACTGTGT', 'end': 'GTCT'}) + + # Git issue 433: Disagreement between fuzzy_counts and fuzzy_changes + pattern = r'(?P.*)(?PAACACTGG){e<=1}(?P([AT][CG]){5}){e<=2}(?PGTAACCGAAG){e<=2}(?P([ACGT]){0,6}$)' + + sequence = 'GGAAAACACTGGTCTCAGTCTCGTAACCGAAGTGGTCG' + m = regex.match(pattern, sequence, flags=regex.BESTMATCH) + self.assertEqual(m.fuzzy_counts, (0, 0, 0)) + self.assertEqual(m.fuzzy_changes, ([], [], [])) + + sequence = 'GGAAAACACTGGTCTCAGTCTCGTCCCCGAAGTGGTCG' + m = regex.match(pattern, sequence, flags=regex.BESTMATCH) + self.assertEqual(m.fuzzy_counts, (2, 0, 0)) + self.assertEqual(m.fuzzy_changes, ([24, 25], [], [])) + + # Git issue 439: Unmatched groups: sub vs subf + self.assertEqual(regex.sub(r'(test1)|(test2)', r'matched: \1\2', 'test1'), 'matched: test1') + self.assertEqual(regex.subf(r'(test1)|(test2)', r'matched: {1}{2}', 'test1'), 'matched: test1') + self.assertEqual(regex.search(r'(test1)|(test2)', 'matched: test1').expand(r'matched: \1\2'), 'matched: test1'), + self.assertEqual(regex.search(r'(test1)|(test2)', 'matched: test1').expandf(r'matched: {1}{2}'), 'matched: test1') + + # Git issue 442: Fuzzy regex matching doesn't seem to test insertions correctly + self.assertEqual(regex.search(r"(?:\bha\b){i:[ ]}", "having"), None) + self.assertEqual(regex.search(r"(?:\bha\b){i:[ ]}", "having", flags=regex.I), None) + + # Git issue 467: Scoped inline flags 'a', 'u' and 'L' affect global flags + self.assertEqual(regex.match(r'(?a:\w)\w', 'd\N{CYRILLIC SMALL LETTER ZHE}').span(), (0, 2)) + self.assertEqual(regex.match(r'(?a:\w)(?u:\w)', 'd\N{CYRILLIC SMALL LETTER ZHE}').span(), (0, 2)) + + # Git issue 473: Emoji classified as letter + self.assertEqual(regex.match(r'^\p{LC}+$', '\N{SMILING CAT FACE WITH OPEN MOUTH}'), None) + self.assertEqual(regex.match(r'^\p{So}+$', '\N{SMILING CAT FACE WITH OPEN MOUTH}').span(), (0, 1)) + + # Git issue 474: regex has no equivalent to `re.Match.groups()` for captures + self.assertEqual(regex.match(r'(.)+', 'abc').allcaptures(), (['abc'], ['a', 'b', 'c'])) + self.assertEqual(regex.match(r'(.)+', 'abc').allspans(), ([(0, 3)], [(0, 1), (1, 2), (2, 3)])) + + # Git issue 477: \v for vertical spacing + self.assertEqual(bool(regex.fullmatch(r'\p{HorizSpace}+', '\t \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000')), True) + self.assertEqual(bool(regex.fullmatch(r'\p{VertSpace}+', '\n\v\f\r\x85\u2028\u2029')), True) + + # Git issue 479: Segmentation fault when using conditional pattern + self.assertEqual(regex.match(r'(?(?<=A)|(?(?![^B])C|D))', 'A'), None) + self.assertEqual(regex.search(r'(?(?<=A)|(?(?![^B])C|D))', 'A').span(), (1, 1)) + + # Git issue 494: Backtracking failure matching regex ^a?(a?)b?c\1$ against string abca + self.assertEqual(regex.search(r"^a?(a?)b?c\1$", "abca").span(), (0, 4)) + + # Git issue 498: Conditional negative lookahead inside positive lookahead fails to match + self.assertEqual(regex.match(r'(?(?=a).|..)', 'ab').span(), (0, 1)) + self.assertEqual(regex.match(r'(?(?=b).|..)', 'ab').span(), (0, 2)) + self.assertEqual(regex.match(r'(?(?!a).|..)', 'ab').span(), (0, 2)) + self.assertEqual(regex.match(r'(?(?!b).|..)', 'ab').span(), (0, 1)) + + # Git issue 525: segfault when fuzzy matching empty list + self.assertEqual(regex.match(r"(\L){e<=5}", "blah", foo=[]).span(), (0, 0)) + + # Git issue 527: `VERBOSE`/`X` flag breaks `\N` escapes + self.assertEqual(regex.compile(r'\N{LATIN SMALL LETTER A}').match('a').span(), (0, 1)) + self.assertEqual(regex.compile(r'\N{LATIN SMALL LETTER A}', flags=regex.X).match('a').span(), (0, 1)) + + # Git issue 539: Bug: Partial matching fails on a simple example + self.assertEqual(regex.match(r"[^/]*b/ccc", "b/ccc", partial=True).span(), (0, 5)) + self.assertEqual(regex.match(r"[^/]*b/ccc", "b/ccb", partial=True), None) + self.assertEqual(regex.match(r"[^/]*b/ccc", "b/cc", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"[^/]*b/xyz", "b/xy", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"[^/]*b/xyz", "b/yz", partial=True), None) + + self.assertEqual(regex.match(r"(?i)[^/]*b/ccc", "b/ccc", partial=True).span(), (0, 5)) + self.assertEqual(regex.match(r"(?i)[^/]*b/ccc", "b/ccb", partial=True), None) + self.assertEqual(regex.match(r"(?i)[^/]*b/ccc", "b/cc", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/xy", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/yz", partial=True), None) + + # Git issue 546: Partial match not working in some instances with non-greedy capture + self.assertEqual(bool(regex.match(r'.*?', '<', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', '.*?', '', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'x', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo ', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo bar', partial=True)), True) + + # Git issue 551: + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]-a]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]--a]', 'a')), False) + self.assertEqual(bool(regex.match(r'(?V1)[[a-z]--b]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]--b]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[a-[\s\S]]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[a--[\s\S]]', 'a')), False) + + self.assertEqual(regex.search(r'(?ifu)(H\N{LATIN SMALL LETTER O WITH DIAERESIS}gskolan?)[\\s\\S]*p', + 'Yrkesh\N{LATIN SMALL LETTER O WITH DIAERESIS}gskola . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen'), + None) + + # Git issue 572: Inline ASCII modifier doesn't seem to affect anything + self.assertEqual(bool(regex.match(r'\d', '\uFF19')), True) + self.assertEqual(bool(regex.match(r'(?a:\d)', '\uFF19')), False) + + # Git issue 575: Issues with ASCII/Unicode modifiers + self.assertEqual(regex.findall('\\d', '9\uFF19'), ['9', '\uff19']) + self.assertEqual(regex.findall('(?u:\\d)', '9\uFF19'), ['9', '\uff19']) + self.assertEqual(regex.findall('(?a:\\d)', '9\uFF19'), ['9']) + + self.assertEqual(regex.findall('\\d', '9\uFF19', flags=regex.U), ['9', '\uff19']) + self.assertEqual(regex.findall('(?u:\\d)', '9\uFF19', flags=regex.U), ['9', '\uff19']) + self.assertEqual(regex.findall('(?a:\\d)', '9\uFF19', flags=regex.U), ['9']) + + self.assertEqual(regex.findall('\\d', '9\uFF19', flags=regex.A), ['9']) + self.assertEqual(regex.findall('(?u:\\d)', '9\uFF19', flags=regex.A), ['9', '\uff19']) + self.assertEqual(regex.findall('(?a:\\d)', '9\uFF19', flags=regex.A), ['9']) + + self.assertEqual(len(regex.findall(r'\p{L}', ''.join(chr(c) for c in range(0x100)), flags=0)), 117) + self.assertEqual(len(regex.findall(r'\p{L}', ''.join(chr(c) for c in range(0x100)), flags=regex.A)), 52) + self.assertEqual(len(regex.findall(r'\p{L}', ''.join(chr(c) for c in range(0x100)), flags=regex.U)), 117) + + self.assertEqual(len(regex.findall(r'(?a:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=0)), 52) + self.assertEqual(len(regex.findall(r'(?a:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.A)), 52) + self.assertEqual(len(regex.findall(r'(?a:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.U)), 52) + + self.assertEqual(len(regex.findall(r'(?u:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=0)), 117) + self.assertEqual(len(regex.findall(r'(?u:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.A)), 117) + self.assertEqual(len(regex.findall(r'(?u:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.U)), 117) + + # Git issue 580: Regression in v2025.7.31: \P{L} no longer matches in simple patterns + self.assertEqual(bool(regex.match(r"\A\P{L}?\p{L}", "hello,")), True) + self.assertEqual(bool(regex.fullmatch(r"\A\P{L}*(?P\p{L}+)\P{L}*\Z", "hello,")), True) + + # Git issue 584: AttributeError: 'AnyAll' object has no attribute 'positive' + self.assertEqual(bool(regex.compile('(\\s|\\S)')), True) + + # Git PR 585: Fix AttributeError: 'AnyAll' object has no attribute '_key' + self.assertEqual(bool(regex.compile('(?:[\\S\\s]|[A-D][M-Z])')), True) + + def test_fuzzy_ext(self): + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', 'e')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', '-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', '-')), + False) + + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', 'ae')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', + 'ae')), True) + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', 'a-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', + 'a-')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?:ab){e<=1:[a-z]}', 'ae')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:ab){e<=1:[a-z]}', + 'ae')), True) + self.assertEqual(bool(regex.fullmatch(r'(?:ab){e<=1:[a-z]}', 'a-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:ab){e<=1:[a-z]}', + 'a-')), False) + + self.assertEqual(bool(regex.fullmatch(r'(a)\1{e<=1:[a-z]}', 'ae')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?r)\1{e<=1:[a-z]}(a)', + 'ea')), True) + self.assertEqual(bool(regex.fullmatch(r'(a)\1{e<=1:[a-z]}', 'a-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)\1{e<=1:[a-z]}(a)', + '-a')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'ts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'st')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'st')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'ts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + '-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 's-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 's-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + '-s')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'ssst')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'ssts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(\N{LATIN SMALL LETTER SHARP S})', + 'stss')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(\N{LATIN SMALL LETTER SHARP S})', + 'tsss')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'ss-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'sss-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + '-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 's-')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}ts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}st')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(ss)', + 'st\N{LATIN SMALL LETTER SHARP S}')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(ss)', + 'ts\N{LATIN SMALL LETTER SHARP S}')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}s-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(ss)\1{e<=1:[a-z]}', + 's-\N{LATIN SMALL LETTER SHARP S}')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(ss)\1{e<=1:[a-z]}', + '-s\N{LATIN SMALL LETTER SHARP S}')), False) + + def test_subscripted_captures(self): + self.assertEqual(regex.match(r'(?P.)+', + 'abc').expandf('{0} {0[0]} {0[-1]}'), 'abc abc abc') + self.assertEqual(regex.match(r'(?P.)+', + 'abc').expandf('{1} {1[0]} {1[1]} {1[2]} {1[-1]} {1[-2]} {1[-3]}'), + 'c a b c c b a') + self.assertEqual(regex.match(r'(?P.)+', + 'abc').expandf('{x} {x[0]} {x[1]} {x[2]} {x[-1]} {x[-2]} {x[-3]}'), + 'c a b c c b a') + + self.assertEqual(regex.subf(r'(?P.)+', r'{0} {0[0]} {0[-1]}', + 'abc'), 'abc abc abc') + self.assertEqual(regex.subf(r'(?P.)+', + '{1} {1[0]} {1[1]} {1[2]} {1[-1]} {1[-2]} {1[-3]}', 'abc'), + 'c a b c c b a') + self.assertEqual(regex.subf(r'(?P.)+', + '{x} {x[0]} {x[1]} {x[2]} {x[-1]} {x[-2]} {x[-3]}', 'abc'), + 'c a b c c b a') + + def test_more_zerowidth(self): + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split(r'\b|:+', 'a::bc'), ['', 'a', '', '', + 'bc', '']) + self.assertEqual(regex.sub(r'\b|:+', '-', 'a::bc'), '-a---bc-') + self.assertEqual(regex.findall(r'\b|:+', 'a::bc'), ['', '', '::', + '', '']) + self.assertEqual([m.span() for m in regex.finditer(r'\b|:+', + 'a::bc')], [(0, 0), (1, 1), (1, 3), (3, 3), (5, 5)]) + self.assertEqual([m.span() for m in regex.finditer(r'(?m)^\s*?$', + 'foo\n\n\nbar')], [(4, 4), (4, 5), (5, 5)]) + + def test_line_ending(self): + self.assertEqual(regex.findall(r'\R', '\r\n\n\x0B\f\r\x85\u2028\u2029'), + ['\r\n', '\n', '\x0B', '\f', '\r', '\x85', '\u2028', '\u2029']) + self.assertEqual(regex.findall(br'\R', b'\r\n\n\x0B\f\r\x85'), [b'\r\n', + b'\n', b'\x0B', b'\f', b'\r']) + +def test_main(): + unittest.main(verbosity=2) + +if __name__ == "__main__": + test_main() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..42eec28815385631d549cfb3edb71c4e5cbfa725 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/METADATA @@ -0,0 +1,120 @@ +Metadata-Version: 2.4 +Name: requests +Version: 2.34.0 +Summary: Python HTTP for Humans. +Author-email: Kenneth Reitz +Maintainer-email: Ian Stapleton Cordasco , Nate Prewitt +License: Apache-2.0 +Project-URL: Documentation, https://requests.readthedocs.io +Project-URL: Source, https://github.com/psf/requests +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3.15 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=3.10 +Description-Content-Type: text/markdown +License-File: LICENSE +License-File: NOTICE +Requires-Dist: charset_normalizer<4,>=2 +Requires-Dist: idna<4,>=2.5 +Requires-Dist: urllib3<3,>=1.26 +Requires-Dist: certifi>=2023.5.7 +Provides-Extra: security +Provides-Extra: socks +Requires-Dist: PySocks!=1.5.7,>=1.5.6; extra == "socks" +Provides-Extra: use-chardet-on-py3 +Requires-Dist: chardet<8,>=3.0.2; extra == "use-chardet-on-py3" +Dynamic: license-file + +# Requests + +[![Version](https://img.shields.io/pypi/v/requests.svg?maxAge=86400)](https://pypi.org/project/requests/) +[![Supported Versions](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests) +[![Downloads](https://static.pepy.tech/badge/requests/month)](https://pepy.tech/project/requests) +[![Contributors](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors) +[![Documentation](https://readthedocs.org/projects/requests/badge/?version=latest)](https://requests.readthedocs.io) + +**Requests** is a simple, yet elegant, HTTP library. + +```python +>>> import requests +>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass')) +>>> r.status_code +200 +>>> r.headers['content-type'] +'application/json; charset=utf8' +>>> r.encoding +'utf-8' +>>> r.text +'{"authenticated": true, ...' +>>> r.json() +{'authenticated': True, ...} +``` + +Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your `PUT` & `POST` data — but nowadays, just use the `json` method! + +Requests is one of the most downloaded Python packages today, pulling in around `300M downloads / week` — according to GitHub, Requests is currently [depended upon](https://github.com/psf/requests/network/dependents?package_id=UGFja2FnZS01NzA4OTExNg%3D%3D) by `4,000,000+` repositories. + +## Installing Requests and Supported Versions + +Requests is available on PyPI: + +```console +$ python -m pip install requests +``` + +Requests officially supports Python 3.10+. + +## Supported Features & Best–Practices + +Requests is ready for the demands of building robust and reliable HTTP–speaking applications, for the needs of today. + +- Keep-Alive & Connection Pooling +- International Domains and URLs +- Sessions with Cookie Persistence +- Browser-style TLS/SSL Verification +- Basic & Digest Authentication +- Familiar `dict`–like Cookies +- Automatic Content Decompression and Decoding +- Multi-part File Uploads +- SOCKS Proxy Support +- Connection Timeouts +- Streaming Downloads +- Automatic honoring of `.netrc` +- Chunked HTTP Requests + +## Cloning the repository + +When cloning the Requests repository, you may need to add the `-c +fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit timestamp (see +[this issue](https://github.com/psf/requests/issues/2690) for more background): + +```shell +git clone -c fetch.fsck.badTimezone=ignore https://github.com/psf/requests.git +``` + +You can also apply this setting to your global Git config: + +```shell +git config --global fetch.fsck.badTimezone ignore +``` + +--- + +[![Kenneth Reitz](https://raw.githubusercontent.com/psf/requests/main/ext/kr.png)](https://kennethreitz.org) [![Python Software Foundation](https://raw.githubusercontent.com/psf/requests/main/ext/psf.png)](https://www.python.org/psf) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..92d8c550aae9369f86af93ea2466b2b42b7b44f0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/RECORD @@ -0,0 +1,46 @@ +requests-2.34.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +requests-2.34.0.dist-info/METADATA,sha256=64w-xXm2cnAgXrcsEJ6g6498dx3VZgqS8TRITZnoerk,4806 +requests-2.34.0.dist-info/RECORD,, +requests-2.34.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91 +requests-2.34.0.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142 +requests-2.34.0.dist-info/licenses/NOTICE,sha256=9REJct7a0rTp0xRRja87fXLW4C5Jms2AIYHeb3RXHcw,38 +requests-2.34.0.dist-info/top_level.txt,sha256=fMSVmHfb5rbGOo6xv-O_tUX6j-WyixssE-SnwcDRxNQ,9 +requests/__init__.py,sha256=MRFX5_pKqRZsgn1SN-b9aU7rXKVJ7kDi6Q-J8hq81W4,5922 +requests/__pycache__/__init__.cpython-311.pyc,, +requests/__pycache__/__version__.cpython-311.pyc,, +requests/__pycache__/_internal_utils.cpython-311.pyc,, +requests/__pycache__/_types.cpython-311.pyc,, +requests/__pycache__/adapters.cpython-311.pyc,, +requests/__pycache__/api.cpython-311.pyc,, +requests/__pycache__/auth.cpython-311.pyc,, +requests/__pycache__/certs.cpython-311.pyc,, +requests/__pycache__/compat.cpython-311.pyc,, +requests/__pycache__/cookies.cpython-311.pyc,, +requests/__pycache__/exceptions.cpython-311.pyc,, +requests/__pycache__/help.cpython-311.pyc,, +requests/__pycache__/hooks.cpython-311.pyc,, +requests/__pycache__/models.cpython-311.pyc,, +requests/__pycache__/packages.cpython-311.pyc,, +requests/__pycache__/sessions.cpython-311.pyc,, +requests/__pycache__/status_codes.cpython-311.pyc,, +requests/__pycache__/structures.cpython-311.pyc,, +requests/__pycache__/utils.cpython-311.pyc,, +requests/__version__.py,sha256=Uw6k1hzJNkFZyzAXYVHE-Qc_JiJOGDlZM6AsxLpMAyY,435 +requests/_internal_utils.py,sha256=TH2NEyyYmPx9cV5HPzrHR4XdxKuW0skkD4eDXcbZgf8,1542 +requests/_types.py,sha256=Z3uDlyGkslMrN0q5b0WQgqaL9KE-jL-Yi6p5Py926ec,5882 +requests/adapters.py,sha256=ZH6r1EU94jKqQLVf8DPW8Zd4kQt-cGnFH99jB2_HdJM,28064 +requests/api.py,sha256=TRVICsBG8Ikgl5joZQR270oo6-b4G0AHWPjvQuxrVQk,7152 +requests/auth.py,sha256=6TlRpVLUw8X9m4Sl4dSbA8qrpHI8T_ES2mBTYA7IWmU,12233 +requests/certs.py,sha256=_ZxrgzWc75D_bE7uq43MI4jaOC68p9AKSZs8C0NKh-Q,430 +requests/compat.py,sha256=XXm6KJaQtQFQRDQaH3vH0kE0_BOi2z78-FJRW_mqGLQ,2465 +requests/cookies.py,sha256=ChzmFA8rlCBSLFCA41bmifp5bCUi9VyhCCb17Y4Kcjw,21549 +requests/exceptions.py,sha256=xeGPM1JFSWjjN7swVvCGffLzfAoNLBp33AXn4LPAQRs,4564 +requests/help.py,sha256=cjUZuxiE2hjYT2svt49-v3-1f3MgcLYCWuBx2sai0Xk,4210 +requests/hooks.py,sha256=69igJHXTGg5HOo9VPpUB_0NkW5VjiFrVKETnpj8Ndqs,1138 +requests/models.py,sha256=PhqYjte-BQbUY_KJGMH4hYXtZm1Q0lboWEg0kwHL7-w,41698 +requests/packages.py,sha256=_g0gZ681UyAlKHRjH6kanbaoxx2eAb6qzcXiODyTIoc,904 +requests/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +requests/sessions.py,sha256=iuFhQXbkGx-MP7uGiTC1d0YqZmRSp0eelZ424p37Va8,34266 +requests/status_codes.py,sha256=GVD0fInPGAGXh-B9jOSPZtazjmIvfZTXCpAkf-5sBA4,4351 +requests/structures.py,sha256=upRgw5B48l5vHSokrJQaxvjS7pcZf6jI0MJi2KHmegI,4134 +requests/utils.py,sha256=ZX_QI0OyWGu9E4pOwPA87rdhDCcS-WrFTyinCL99B5w,36322 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/licenses/LICENSE b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..67db8588217f266eb561f75fae738656325deac9 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/licenses/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/licenses/NOTICE b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/licenses/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..1ff62db688277b77c83c1766dac7f165364d3528 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests-2.34.0.dist-info/licenses/NOTICE @@ -0,0 +1,2 @@ +Requests +Copyright 2019 Kenneth Reitz diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ad842400b99c65c91988579e76419cf48224a680 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__init__.py @@ -0,0 +1,219 @@ +# __ +# /__) _ _ _ _ _/ _ +# / ( (- (/ (/ (- _) / _) +# / + +""" +Requests HTTP Library +~~~~~~~~~~~~~~~~~~~~~ + +Requests is an HTTP library, written in Python, for human beings. +Basic GET usage: + + >>> import requests + >>> r = requests.get('https://www.python.org') + >>> r.status_code + 200 + >>> b'Python is a programming language' in r.content + True + +... or POST: + + >>> payload = dict(key1='value1', key2='value2') + >>> r = requests.post('https://httpbin.org/post', data=payload) + >>> print(r.text) + { + ... + "form": { + "key1": "value1", + "key2": "value2" + }, + ... + } + +The other HTTP methods are supported - see `requests.api`. Full documentation +is at . + +:copyright: (c) 2017 by Kenneth Reitz. +:license: Apache 2.0, see LICENSE for more details. +""" + +from __future__ import annotations + +import warnings + +import urllib3 + +from .exceptions import RequestsDependencyWarning + +try: + from charset_normalizer import __version__ as charset_normalizer_version +except ImportError: + charset_normalizer_version = None + +try: + from chardet import __version__ as chardet_version # type: ignore[import-not-found] +except ImportError: + chardet_version = None + + +def check_compatibility( + urllib3_version: str, + chardet_version: str | None, + charset_normalizer_version: str | None, +) -> None: + urllib3_version_list = urllib3_version.split(".")[:3] + assert urllib3_version_list != ["dev"] # Verify urllib3 isn't installed from git. + + # Sometimes, urllib3 only reports its version as 16.1. + if len(urllib3_version_list) == 2: + urllib3_version_list.append("0") + + # Check urllib3 for compatibility. + major, minor, patch = urllib3_version_list # noqa: F811 + major, minor, patch = int(major), int(minor), int(patch) + # urllib3 >= 1.21.1 + assert major >= 1 + if major == 1: + assert minor >= 21 + + # Check charset_normalizer for compatibility. + if chardet_version: + major, minor, patch = chardet_version.split(".")[:3] + major, minor, patch = int(major), int(minor), int(patch) + # chardet_version >= 3.0.2, < 8.0.0 + assert (3, 0, 2) <= (major, minor, patch) < (8, 0, 0) + elif charset_normalizer_version: + major, minor, patch = charset_normalizer_version.split(".")[:3] + major, minor, patch = int(major), int(minor), int(patch) + # charset_normalizer >= 2.0.0 < 4.0.0 + assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0) + else: + warnings.warn( + "Unable to find acceptable character detection dependency " + "(chardet or charset_normalizer).", + RequestsDependencyWarning, + ) + + +def _check_cryptography(cryptography_version: str) -> None: + # cryptography < 1.3.4 + try: + cryptography_version_list = list(map(int, cryptography_version.split("."))) + except ValueError: + return + + if cryptography_version_list < [1, 3, 4]: + warning = f"Old version of cryptography ({cryptography_version_list}) may cause slowdown." + warnings.warn(warning, RequestsDependencyWarning) + + +# Check imported dependencies for compatibility. +try: + check_compatibility( + urllib3.__version__, # type: ignore[reportPrivateImportUsage] + chardet_version, # type: ignore[reportUnknownArgumentType] + charset_normalizer_version, + ) +except (AssertionError, ValueError): + warnings.warn( + f"urllib3 ({urllib3.__version__}) or chardet " # type: ignore[reportPrivateImportUsage] + f"({chardet_version})/charset_normalizer ({charset_normalizer_version}) " + "doesn't match a supported version!", + RequestsDependencyWarning, + ) + +# Attempt to enable urllib3's fallback for SNI support +# if the standard library doesn't support SNI or the +# 'ssl' library isn't available. +try: + try: + import ssl + except ImportError: + ssl = None + + if not getattr(ssl, "HAS_SNI", False): + from urllib3.contrib import pyopenssl + + pyopenssl.inject_into_urllib3() + + # Check cryptography version + from cryptography import ( # type: ignore[reportMissingImports] + __version__ as cryptography_version, # type: ignore[reportUnknownVariableType] + ) + + _check_cryptography(cryptography_version) # type: ignore[reportUnknownArgumentType] +except ImportError: + pass + +# urllib3's DependencyWarnings should be silenced. +from urllib3.exceptions import DependencyWarning + +warnings.simplefilter("ignore", DependencyWarning) + +# Set default logging handler to avoid "No handler found" warnings. +import logging +from logging import NullHandler + +from . import packages, utils +from .__version__ import ( + __author__, + __author_email__, + __build__, + __cake__, + __copyright__, + __description__, + __license__, + __title__, + __url__, + __version__, +) +from .api import delete, get, head, options, patch, post, put, request +from .exceptions import ( + ConnectionError, + ConnectTimeout, + FileModeWarning, + HTTPError, + JSONDecodeError, + ReadTimeout, + RequestException, + Timeout, + TooManyRedirects, + URLRequired, +) +from .models import PreparedRequest, Request, Response +from .sessions import Session, session +from .status_codes import codes + +__all__ = ( + "ConnectionError", + "ConnectTimeout", + "HTTPError", + "JSONDecodeError", + "PreparedRequest", + "ReadTimeout", + "Request", + "RequestException", + "Response", + "Session", + "Timeout", + "TooManyRedirects", + "URLRequired", + "codes", + "delete", + "get", + "head", + "options", + "packages", + "patch", + "post", + "put", + "request", + "session", + "utils", +) + +logging.getLogger(__name__).addHandler(NullHandler()) + +# FileModeWarnings go off per the default. +warnings.simplefilter("default", FileModeWarning, append=True) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a2bde680c44797f17a98bdf9bdb00a047ab37a9 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/__version__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/__version__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df8556e2203dc72c6e6c72634dc007f45904837b Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/__version__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/_internal_utils.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/_internal_utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cab1beaf328cdf35b7154e2a595c84536f9b605 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/_internal_utils.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/_types.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/_types.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af94fd254c89759d9cc3a39d62ce7430a06a73d4 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/_types.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/adapters.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/adapters.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee7c68aeee8c53a621f03f66e3da51b0259a5d21 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/adapters.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/api.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..78487f24580eb7e01c4bcb4b43cc645c2d250455 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/api.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/auth.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/auth.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0477f7d9e0492dbf237f655fa81a53c7024fa04 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/auth.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/certs.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/certs.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..969a3b7f7b59598971e7c68fada4eba0f6eb5873 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/certs.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/compat.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/compat.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c490f504330c40d6a258c746afb994c2ca85cdb0 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/compat.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/cookies.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/cookies.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0773014228511aa59ff4bdf40a9ff2f6633f187 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/cookies.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/exceptions.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4727ebad0941382fd0cadc8a82168b2ce2f7a488 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/exceptions.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/help.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/help.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b1c11c7c5f4d3ec6139669e7ea303b6914a980c0 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/help.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/hooks.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/hooks.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3fa0ac021e7fa9104baa603cfbebb26254cbb954 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/hooks.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/models.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8e655bdfff51efd339016f38498bf91d56be071 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/models.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/packages.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/packages.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..074b2d2823e87e4ab61b62e049b51d5e54a079ac Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/packages.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/sessions.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/sessions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d0ec5f6b6070342ac5f7f1036027f17fbc589c0 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/sessions.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/status_codes.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/status_codes.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..362f6b2e513bd2342bf9aec881154c3f011fec40 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/status_codes.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/structures.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/structures.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f898bf73ff2581d40d900bcedf95de9147e9240b Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/structures.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/utils.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0fc65dbb8c55cfec7b00dd23948ff78ceb55c9c6 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__pycache__/utils.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__version__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__version__.py new file mode 100644 index 0000000000000000000000000000000000000000..872a8aaa227c3b6a38008d06c4c433c80e30a3e9 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/__version__.py @@ -0,0 +1,14 @@ +# .-. .-. .-. . . .-. .-. .-. .-. +# |( |- |.| | | |- `-. | `-. +# ' ' `-' `-`.`-' `-' `-' ' `-' + +__title__ = "requests" +__description__ = "Python HTTP for Humans." +__url__ = "https://requests.readthedocs.io" +__version__ = "2.34.0" +__build__ = 0x023400 +__author__ = "Kenneth Reitz" +__author_email__ = "me@kennethreitz.org" +__license__ = "Apache-2.0" +__copyright__ = "Copyright Kenneth Reitz" +__cake__ = "\u2728 \U0001f370 \u2728" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/_internal_utils.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/_internal_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..0466a7d347db4ed34a37db51b75fc8e80bc06055 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/_internal_utils.py @@ -0,0 +1,51 @@ +""" +requests._internal_utils +~~~~~~~~~~~~~~ + +Provides utility functions that are consumed internally by Requests +which depend on extremely few external helpers (such as compat) +""" + +import re + +from .compat import builtin_str + +_VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*\Z") +_VALID_HEADER_NAME_RE_STR = re.compile(r"^[^:\s][^:\r\n]*\Z") +_VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*\Z|^\Z") +_VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*\Z|^\Z") + +_HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) +_HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) +HEADER_VALIDATORS = { + bytes: _HEADER_VALIDATORS_BYTE, + str: _HEADER_VALIDATORS_STR, +} + + +def to_native_string(string: str | bytes, encoding: str = "ascii") -> str: + """Given a string object, regardless of type, returns a representation of + that string in the native string type, encoding and decoding where + necessary. This assumes ASCII unless told otherwise. + """ + if isinstance(string, builtin_str): + out = string + else: + out = string.decode(encoding) + + return out + + +def unicode_is_ascii(u_string: str) -> bool: + """Determine if unicode string only contains ASCII characters. + + :param str u_string: unicode string to check. Must be unicode + and not Python 2 `str`. + :rtype: bool + """ + assert isinstance(u_string, str) + try: + u_string.encode("ascii") + return True + except UnicodeEncodeError: + return False diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/_types.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/_types.py new file mode 100644 index 0000000000000000000000000000000000000000..963867b0126c72d73f9c4edca94f5bd4d78d9515 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/_types.py @@ -0,0 +1,178 @@ +""" +requests._types +~~~~~~~~~~~~~~~ + +This module contains type aliases used internally by the Requests library. +These types are not part of the public API and must not be relied upon +by external code. +""" + +from __future__ import annotations + +from collections.abc import Callable, Iterable, Mapping, MutableMapping +from typing import ( + TYPE_CHECKING, + Any, + Protocol, + TypeAlias, + TypeVar, + runtime_checkable, +) + +_T_co = TypeVar("_T_co", covariant=True) +_KT_co = TypeVar("_KT_co", covariant=True) +_VT_co = TypeVar("_VT_co", covariant=True) + + +@runtime_checkable +class SupportsRead(Protocol[_T_co]): + def read(self, length: int = ..., /) -> _T_co: ... + + +@runtime_checkable +class SupportsItems(Protocol[_KT_co, _VT_co]): + def items(self) -> Iterable[tuple[_KT_co, _VT_co]]: ... + + +# These are needed at runtime for default_hooks() return type +HookType: TypeAlias = Callable[["Response"], Any] +HooksInputType: TypeAlias = Mapping[str, Iterable[HookType] | HookType] + + +def is_prepared(request: PreparedRequest) -> TypeIs[_ValidatedRequest]: + """Verify a PreparedRequest has been fully prepared.""" + if TYPE_CHECKING: + return request.url is not None and request.method is not None + # noop at runtime to avoid AssertionError + return True + + +if TYPE_CHECKING: + from http.cookiejar import CookieJar + from typing import TypeAlias, TypedDict + + from typing_extensions import ( + Buffer, # TODO: move to collections.abc when Python >= 3.12 + TypeIs, # TODO: move to typing when Python >= 3.13 + ) + + from .auth import AuthBase + from .cookies import RequestsCookieJar + from .models import PreparedRequest, Response + from .structures import CaseInsensitiveDict + + class _ValidatedRequest(PreparedRequest): + """Subtype asserting a PreparedRequest has been fully prepared before calling. + + The override suppression is required because mutable attribute types are + invariant (Liskov), but we only narrow after preparation is complete. This + is the explicit contract for Requests but Python's typing doesn't have a + better way to represent the requirement. + """ + + url: str # type: ignore[reportIncompatibleVariableOverride] + method: str # type: ignore[reportIncompatibleVariableOverride] + + # Type aliases for core API concepts (ordered by request() signature) + UriType: TypeAlias = str | bytes + + _ParamsMappingKeyType: TypeAlias = str | bytes | int | float + _ParamsMappingValueType: TypeAlias = ( + str | bytes | int | float | Iterable[str | bytes | int | float] | None + ) + ParamsType: TypeAlias = ( + SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType] + | tuple[tuple[_ParamsMappingKeyType, _ParamsMappingValueType], ...] + | Iterable[tuple[_ParamsMappingKeyType, _ParamsMappingValueType]] + | str + | bytes + | None + ) + + KVDataType: TypeAlias = Iterable[tuple[Any, Any]] | SupportsItems[Any, Any] + + RawDataType: TypeAlias = KVDataType | str | bytes + StreamDataType: TypeAlias = SupportsRead[str | bytes] + EncodableDataType: TypeAlias = RawDataType | StreamDataType + + DataType: TypeAlias = ( + KVDataType + | Iterable[bytes | str] + | str + | bytes + | Buffer + | SupportsRead[str | bytes] + | None + ) + + BodyType: TypeAlias = ( + bytes | str | Iterable[bytes | str] | SupportsRead[bytes | str] | None + ) + + HeadersType: TypeAlias = CaseInsensitiveDict[str] | Mapping[str, str | bytes] + HeadersUpdateType: TypeAlias = Mapping[str, str | bytes | None] + + CookiesType: TypeAlias = RequestsCookieJar | Mapping[str, str] + + # Building blocks for FilesType + _FileName: TypeAlias = str | None + _FileContent: TypeAlias = SupportsRead[str | bytes] | str | bytes + _FileSpecBasic: TypeAlias = tuple[_FileName, _FileContent] + _FileSpecWithContentType: TypeAlias = tuple[_FileName, _FileContent, str] + _FileSpecWithHeaders: TypeAlias = tuple[ + _FileName, _FileContent, str, CaseInsensitiveDict[str] | Mapping[str, str] + ] + _FileSpec: TypeAlias = ( + _FileContent | _FileSpecBasic | _FileSpecWithContentType | _FileSpecWithHeaders + ) + FilesType: TypeAlias = ( + Mapping[str, _FileSpec] | Iterable[tuple[str, _FileSpec]] | None + ) + + AuthType: TypeAlias = ( + tuple[str, str] | AuthBase | Callable[[PreparedRequest], PreparedRequest] | None + ) + + TimeoutType: TypeAlias = float | tuple[float | None, float | None] | None + ProxiesType: TypeAlias = MutableMapping[str, str] + HooksType: TypeAlias = dict[str, list[HookType]] | None + VerifyType: TypeAlias = bool | str + CertType: TypeAlias = str | tuple[str, str] | None + JsonType: TypeAlias = ( + None | bool | int | float | str | list["JsonType"] | dict[str, "JsonType"] + ) + + # TypedDicts for Unpack kwargs (PEP 692) + + class BaseRequestKwargs(TypedDict, total=False): + headers: Mapping[str, str | bytes] | None + cookies: RequestsCookieJar | CookieJar | dict[str, str] | None + files: FilesType + auth: AuthType + timeout: TimeoutType + allow_redirects: bool + proxies: dict[str, str] | None + hooks: HooksInputType | None + stream: bool | None + verify: VerifyType | None + cert: CertType + + class RequestKwargs(BaseRequestKwargs, total=False): + """kwargs for request(), options(), head(), delete().""" + + params: ParamsType + data: DataType + json: JsonType + + class GetKwargs(BaseRequestKwargs, total=False): + data: DataType + json: JsonType + + class PostKwargs(BaseRequestKwargs, total=False): + params: ParamsType + + class DataKwargs(BaseRequestKwargs, total=False): + """kwargs for put(), patch().""" + + params: ParamsType + json: JsonType diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/adapters.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/adapters.py new file mode 100644 index 0000000000000000000000000000000000000000..40fe8a6d5a6168ba7303b91477af925db0aa3914 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/adapters.py @@ -0,0 +1,748 @@ +""" +requests.adapters +~~~~~~~~~~~~~~~~~ + +This module contains the transport adapters that Requests uses to define +and maintain connections. +""" + +from __future__ import annotations + +import os.path +import socket # noqa: F401 # type: ignore[reportUnusedImport] +import typing +import warnings +from typing import Any + +from urllib3.exceptions import ( + ClosedPoolError, + ConnectTimeoutError, + LocationValueError, + MaxRetryError, + NewConnectionError, + ProtocolError, + ReadTimeoutError, + ResponseError, +) +from urllib3.exceptions import HTTPError as _HTTPError +from urllib3.exceptions import InvalidHeader as _InvalidHeader +from urllib3.exceptions import ProxyError as _ProxyError +from urllib3.exceptions import SSLError as _SSLError +from urllib3.poolmanager import PoolManager, proxy_from_url +from urllib3.util import Timeout as TimeoutSauce +from urllib3.util import parse_url +from urllib3.util.retry import Retry + +from .auth import _basic_auth_str # type: ignore[reportPrivateUsage] +from .compat import basestring, urlparse +from .cookies import extract_cookies_to_jar +from .exceptions import ( + ConnectionError, + ConnectTimeout, + InvalidHeader, + InvalidProxyURL, + InvalidSchema, + InvalidURL, + ProxyError, + ReadTimeout, + RetryError, + SSLError, +) +from .models import Response +from .structures import CaseInsensitiveDict +from .utils import ( + DEFAULT_CA_BUNDLE_PATH, + get_auth_from_url, + get_encoding_from_headers, + prepend_scheme_if_needed, + select_proxy, + urldefragauth, +) + +try: + from urllib3.contrib.socks import SOCKSProxyManager # type: ignore[assignment] +except ImportError: + + def SOCKSProxyManager(*args: Any, **kwargs: Any) -> None: + raise InvalidSchema("Missing dependencies for SOCKS support.") + + +if typing.TYPE_CHECKING: + from urllib3.connectionpool import HTTPConnectionPool + from urllib3.poolmanager import PoolManager as _PoolManager + + from . import _types as _t + from .models import PreparedRequest + +from ._types import is_prepared as _is_prepared + +DEFAULT_POOLBLOCK = False +DEFAULT_POOLSIZE = 10 +DEFAULT_RETRIES = 0 +DEFAULT_POOL_TIMEOUT = None + + +def _urllib3_request_context( + request: PreparedRequest, + verify: bool | str | None, + client_cert: tuple[str, str] | str | None, + poolmanager: PoolManager, +) -> tuple[dict[str, Any], dict[str, Any]]: + host_params: dict[str, Any] = {} + pool_kwargs: dict[str, Any] = {} + parsed_request_url = urlparse(request.url) + scheme = parsed_request_url.scheme.lower() + port = parsed_request_url.port + + cert_reqs = "CERT_REQUIRED" + if verify is False: + cert_reqs = "CERT_NONE" + elif isinstance(verify, str): + if not os.path.isdir(verify): + pool_kwargs["ca_certs"] = verify + else: + pool_kwargs["ca_cert_dir"] = verify + pool_kwargs["cert_reqs"] = cert_reqs + if client_cert is not None: + if isinstance(client_cert, tuple) and len(client_cert) == 2: + pool_kwargs["cert_file"] = client_cert[0] + pool_kwargs["key_file"] = client_cert[1] + else: + # According to our docs, we allow users to specify just the client + # cert path + pool_kwargs["cert_file"] = client_cert + host_params = { + "scheme": scheme, + "host": parsed_request_url.hostname, + "port": port, + } + return host_params, pool_kwargs + + +class BaseAdapter: + """The Base Transport Adapter""" + + def __init__(self) -> None: + super().__init__() + + def send( + self, + request: PreparedRequest, + stream: bool = False, + timeout: _t.TimeoutType = None, + verify: _t.VerifyType = True, + cert: _t.CertType = None, + proxies: dict[str, str] | None = None, + ) -> Response: + """Sends PreparedRequest object. Returns Response object. + + :param request: The :class:`PreparedRequest ` being sent. + :param stream: (optional) Whether to stream the request content. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use + :param cert: (optional) Any user-provided SSL certificate to be trusted. + :param proxies: (optional) The proxies dictionary to apply to the request. + """ + raise NotImplementedError + + def close(self) -> None: + """Cleans up adapter specific items.""" + raise NotImplementedError + + +class HTTPAdapter(BaseAdapter): + """The built-in HTTP Adapter for urllib3. + + Provides a general-case interface for Requests sessions to contact HTTP and + HTTPS urls by implementing the Transport Adapter interface. This class will + usually be created by the :class:`Session ` class under the + covers. + + :param pool_connections: The number of urllib3 connection pools to cache. + :param pool_maxsize: The maximum number of connections to save in the pool. + :param max_retries: The maximum number of retries each connection + should attempt. Note, this applies only to failed DNS lookups, socket + connections and connection timeouts, never to requests where data has + made it to the server. By default, Requests does not retry failed + connections. If you need granular control over the conditions under + which we retry a request, import urllib3's ``Retry`` class and pass + that instead. + :param pool_block: Whether the connection pool should block for connections. + + Usage:: + + >>> import requests + >>> s = requests.Session() + >>> a = requests.adapters.HTTPAdapter(max_retries=3) + >>> s.mount('http://', a) + """ + + __attrs__: list[str] = [ + "max_retries", + "config", + "_pool_connections", + "_pool_maxsize", + "_pool_block", + ] + + max_retries: Retry + config: dict[str, Any] + proxy_manager: dict[str, Any] + _pool_connections: int + _pool_maxsize: int + _pool_block: bool + poolmanager: _PoolManager + + def __init__( + self, + pool_connections: int = DEFAULT_POOLSIZE, + pool_maxsize: int = DEFAULT_POOLSIZE, + max_retries: int | Retry = DEFAULT_RETRIES, + pool_block: bool = DEFAULT_POOLBLOCK, + ) -> None: + if max_retries == DEFAULT_RETRIES: + self.max_retries = Retry(0, read=False) + else: + self.max_retries = Retry.from_int(max_retries) + self.config = {} + self.proxy_manager = {} + + super().__init__() + + self._pool_connections = pool_connections + self._pool_maxsize = pool_maxsize + self._pool_block = pool_block + + self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block) + + def __getstate__(self) -> dict[str, Any]: + return {attr: getattr(self, attr, None) for attr in self.__attrs__} + + def __setstate__(self, state: dict[str, Any]) -> None: + # Can't handle by adding 'proxy_manager' to self.__attrs__ because + # self.poolmanager uses a lambda function, which isn't pickleable. + self.proxy_manager = {} + self.config = {} + + for attr, value in state.items(): + setattr(self, attr, value) + + self.init_poolmanager( + self._pool_connections, self._pool_maxsize, block=self._pool_block + ) + + def init_poolmanager( + self, + connections: int, + maxsize: int, + block: bool = DEFAULT_POOLBLOCK, + **pool_kwargs: Any, + ) -> None: + """Initializes a urllib3 PoolManager. + + This method should not be called from user code, and is only + exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param connections: The number of urllib3 connection pools to cache. + :param maxsize: The maximum number of connections to save in the pool. + :param block: Block when no free connections are available. + :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. + """ + # save these values for pickling + self._pool_connections = connections + self._pool_maxsize = maxsize + self._pool_block = block + + self.poolmanager = PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + **pool_kwargs, + ) + + def proxy_manager_for(self, proxy: str, **proxy_kwargs: Any) -> Any: + """Return urllib3 ProxyManager for the given proxy. + + This method should not be called from user code, and is only + exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param proxy: The proxy to return a urllib3 ProxyManager for. + :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. + :returns: ProxyManager + :rtype: urllib3.ProxyManager + """ + if proxy in self.proxy_manager: + manager = self.proxy_manager[proxy] + elif proxy.lower().startswith("socks"): + username, password = get_auth_from_url(proxy) + manager = self.proxy_manager[proxy] = SOCKSProxyManager( + proxy, + username=username, + password=password, + num_pools=self._pool_connections, + maxsize=self._pool_maxsize, + block=self._pool_block, + **proxy_kwargs, + ) + else: + proxy_headers = self.proxy_headers(proxy) + manager = self.proxy_manager[proxy] = proxy_from_url( + proxy, + proxy_headers=proxy_headers, + num_pools=self._pool_connections, + maxsize=self._pool_maxsize, + block=self._pool_block, + **proxy_kwargs, + ) + + return manager + + def cert_verify( + self, conn: Any, url: str, verify: _t.VerifyType, cert: _t.CertType + ) -> None: + """Verify a SSL certificate. This method should not be called from user + code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param conn: The urllib3 connection object associated with the cert. + :param url: The requested URL. + :param verify: Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use + :param cert: The SSL certificate to verify. + """ + if url.lower().startswith("https") and verify: + cert_loc = None + + # Allow self-specified cert location. + if verify is not True: + cert_loc = verify + + if not cert_loc: + cert_loc = DEFAULT_CA_BUNDLE_PATH + + if not cert_loc or not os.path.exists(cert_loc): + raise OSError( + f"Could not find a suitable TLS CA certificate bundle, " + f"invalid path: {cert_loc}" + ) + + conn.cert_reqs = "CERT_REQUIRED" + + if not os.path.isdir(cert_loc): + conn.ca_certs = cert_loc + else: + conn.ca_cert_dir = cert_loc + else: + conn.cert_reqs = "CERT_NONE" + conn.ca_certs = None + conn.ca_cert_dir = None + + if cert: + if not isinstance(cert, basestring): + conn.cert_file = cert[0] + conn.key_file = cert[1] + else: + conn.cert_file = cert + conn.key_file = None + if conn.cert_file and not os.path.exists(conn.cert_file): + raise OSError( + f"Could not find the TLS certificate file, " + f"invalid path: {conn.cert_file}" + ) + if conn.key_file and not os.path.exists(conn.key_file): + raise OSError( + f"Could not find the TLS key file, invalid path: {conn.key_file}" + ) + + def build_response(self, req: PreparedRequest, resp: Any) -> Response: + """Builds a :class:`Response ` object from a urllib3 + response. This should not be called from user code, and is only exposed + for use when subclassing the + :class:`HTTPAdapter ` + + :param req: The :class:`PreparedRequest ` used to generate the response. + :param resp: The urllib3 response object. + :rtype: requests.Response + """ + assert _is_prepared(req) + response = Response() + + # Fallback to None if there's no status_code, for whatever reason. + response.status_code = getattr(resp, "status", None) # type: ignore[assignment] + + # Make headers case-insensitive. + response.headers = CaseInsensitiveDict(getattr(resp, "headers", {})) + + # Set encoding. + response.encoding = get_encoding_from_headers(response.headers) + response.raw = resp + response.reason = response.raw.reason + + if isinstance(req.url, bytes): + response.url = req.url.decode("utf-8") + else: + response.url = req.url + + # Add new cookies from the server. + extract_cookies_to_jar(response.cookies, req, resp) + + # Give the Response some context. + response.request = req + response.connection = self + + return response + + def build_connection_pool_key_attributes( + self, request: PreparedRequest, verify: _t.VerifyType, cert: _t.CertType = None + ) -> tuple[dict[str, Any], dict[str, Any]]: + """Build the PoolKey attributes used by urllib3 to return a connection. + + This looks at the PreparedRequest, the user-specified verify value, + and the value of the cert parameter to determine what PoolKey values + to use to select a connection from a given urllib3 Connection Pool. + + The SSL related pool key arguments are not consistently set. As of + this writing, use the following to determine what keys may be in that + dictionary: + + * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the + default Requests SSL Context + * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but + ``"cert_reqs"`` will be set + * If ``verify`` is a string, (i.e., it is a user-specified trust bundle) + ``"ca_certs"`` will be set if the string is not a directory recognized + by :py:func:`os.path.isdir`, otherwise ``"ca_cert_dir"`` will be + set. + * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If + ``"cert"`` is a tuple with a second item, ``"key_file"`` will also + be present + + To override these settings, one may subclass this class, call this + method and use the above logic to change parameters as desired. For + example, if one wishes to use a custom :py:class:`ssl.SSLContext` one + must both set ``"ssl_context"`` and based on what else they require, + alter the other keys to ensure the desired behaviour. + + :param request: + The PreparedRequest being sent over the connection. + :type request: + :class:`~requests.models.PreparedRequest` + :param verify: + Either a boolean, in which case it controls whether + we verify the server's TLS certificate, or a string, in which case it + must be a path to a CA bundle to use. + :param cert: + (optional) Any user-provided SSL certificate for client + authentication (a.k.a., mTLS). This may be a string (i.e., just + the path to a file which holds both certificate and key) or a + tuple of length 2 with the certificate file path and key file + path. + :returns: + A tuple of two dictionaries. The first is the "host parameters" + portion of the Pool Key including scheme, hostname, and port. The + second is a dictionary of SSLContext related parameters. + """ + return _urllib3_request_context(request, verify, cert, self.poolmanager) + + def get_connection_with_tls_context( + self, + request: PreparedRequest, + verify: _t.VerifyType, + proxies: dict[str, str] | None = None, + cert: _t.CertType = None, + ) -> HTTPConnectionPool: + """Returns a urllib3 connection for the given request and TLS settings. + This should not be called from user code, and is only exposed for use + when subclassing the :class:`HTTPAdapter `. + + :param request: + The :class:`PreparedRequest ` object to be sent + over the connection. + :param verify: + Either a boolean, in which case it controls whether we verify the + server's TLS certificate, or a string, in which case it must be a + path to a CA bundle to use. + :param proxies: + (optional) The proxies dictionary to apply to the request. + :param cert: + (optional) Any user-provided SSL certificate to be used for client + authentication (a.k.a., mTLS). + :rtype: + urllib3.HTTPConnectionPool + """ + assert _is_prepared(request) + + proxy = select_proxy(request.url, proxies) + try: + host_params, pool_kwargs = self.build_connection_pool_key_attributes( + request, + verify, + cert, + ) + except ValueError as e: + raise InvalidURL(e, request=request) + if proxy: + proxy = prepend_scheme_if_needed(proxy, "http") + proxy_url = parse_url(proxy) + if not proxy_url.host: + raise InvalidProxyURL( + "Please check proxy URL. It is malformed " + "and could be missing the host." + ) + proxy_manager = self.proxy_manager_for(proxy) + conn = proxy_manager.connection_from_host( + **host_params, pool_kwargs=pool_kwargs + ) + else: + # Only scheme should be lower case + conn = self.poolmanager.connection_from_host( + **host_params, pool_kwargs=pool_kwargs + ) + + return conn + + def get_connection( + self, url: str, proxies: dict[str, str] | None = None + ) -> HTTPConnectionPool: + """DEPRECATED: Users should move to `get_connection_with_tls_context` + for all subclasses of HTTPAdapter using Requests>=2.32.2. + + Returns a urllib3 connection for the given URL. This should not be + called from user code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param url: The URL to connect to. + :param proxies: (optional) A Requests-style dictionary of proxies used on this request. + :rtype: urllib3.HTTPConnectionPool + """ + warnings.warn( + ( + "`get_connection` has been deprecated in favor of " + "`get_connection_with_tls_context`. Custom HTTPAdapter subclasses " + "will need to migrate for Requests>=2.32.2. Please see " + "https://github.com/psf/requests/pull/6710 for more details." + ), + DeprecationWarning, + ) + proxy = select_proxy(url, proxies) + + if proxy: + proxy = prepend_scheme_if_needed(proxy, "http") + proxy_url = parse_url(proxy) + if not proxy_url.host: + raise InvalidProxyURL( + "Please check proxy URL. It is malformed " + "and could be missing the host." + ) + proxy_manager = self.proxy_manager_for(proxy) + conn = proxy_manager.connection_from_url(url) + else: + # Only scheme should be lower case + parsed = urlparse(url) + url = parsed.geturl() + conn = self.poolmanager.connection_from_url(url) + + return conn + + def close(self) -> None: + """Disposes of any internal state. + + Currently, this closes the PoolManager and any active ProxyManager, + which closes any pooled connections. + """ + self.poolmanager.clear() + for proxy in self.proxy_manager.values(): + proxy.clear() + + def request_url( + self, request: PreparedRequest, proxies: dict[str, str] | None + ) -> str: + """Obtain the url to use when making the final request. + + If the message is being sent through a HTTP proxy, the full URL has to + be used. Otherwise, we should only use the path portion of the URL. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param request: The :class:`PreparedRequest ` being sent. + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. + :rtype: str + """ + assert _is_prepared(request) + + proxy = select_proxy(request.url, proxies) + scheme = urlparse(request.url).scheme + + is_proxied_http_request = proxy and scheme != "https" + using_socks_proxy = False + if proxy: + proxy_scheme = urlparse(proxy).scheme.lower() + using_socks_proxy = proxy_scheme.startswith("socks") + + url = request.path_url + + if is_proxied_http_request and not using_socks_proxy: + url = urldefragauth(request.url) + + return url + + def add_headers(self, request: PreparedRequest, **kwargs: Any) -> None: + """Add any headers needed by the connection. As of v2.0 this does + nothing by default, but is left for overriding by users that subclass + the :class:`HTTPAdapter `. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param request: The :class:`PreparedRequest ` to add headers to. + :param kwargs: The keyword arguments from the call to send(). + """ + pass + + def proxy_headers(self, proxy: str) -> dict[str, str]: + """Returns a dictionary of the headers to add to any request sent + through a proxy. This works with urllib3 magic to ensure that they are + correctly sent to the proxy, rather than in a tunnelled request if + CONNECT is being used. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param proxy: The url of the proxy being used for this request. + :rtype: dict + """ + headers: dict[str, str] = {} + username, password = get_auth_from_url(proxy) + + if username: + headers["Proxy-Authorization"] = _basic_auth_str(username, password) + + return headers + + def send( + self, + request: PreparedRequest, + stream: bool = False, + timeout: _t.TimeoutType = None, + verify: _t.VerifyType = True, + cert: _t.CertType = None, + proxies: dict[str, str] | None = None, + ) -> Response: + """Sends PreparedRequest object. Returns Response object. + + :param request: The :class:`PreparedRequest ` being sent. + :param stream: (optional) Whether to stream the request content. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple or urllib3 Timeout object + :param verify: (optional) Either a boolean, in which case it controls whether + we verify the server's TLS certificate, or a string, in which case it + must be a path to a CA bundle to use + :param cert: (optional) Any user-provided SSL certificate to be trusted. + :param proxies: (optional) The proxies dictionary to apply to the request. + :rtype: requests.Response + """ + + assert _is_prepared(request) + + try: + conn = self.get_connection_with_tls_context( + request, verify, proxies=proxies, cert=cert + ) + except LocationValueError as e: + raise InvalidURL(e, request=request) + + self.cert_verify(conn, request.url, verify, cert) + url = self.request_url(request, proxies) + self.add_headers( + request, + stream=stream, + timeout=timeout, + verify=verify, + cert=cert, + proxies=proxies, + ) + + chunked = not (request.body is None or "Content-Length" in request.headers) + + if isinstance(timeout, tuple): + try: + connect, read = timeout + resolved_timeout = TimeoutSauce(connect=connect, read=read) + except ValueError: + raise ValueError( + f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " + f"or a single float to set both timeouts to the same value." + ) + elif isinstance(timeout, TimeoutSauce): + resolved_timeout = timeout + else: + resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) + + try: + resp = conn.urlopen( + method=request.method, + url=url, + body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] + headers=request.headers, # type: ignore[arg-type] # urllib3#3072 + redirect=False, + assert_same_host=False, + preload_content=False, + decode_content=False, + retries=self.max_retries, + timeout=resolved_timeout, + chunked=chunked, + ) + + except (ProtocolError, OSError) as err: + raise ConnectionError(err, request=request) + + except MaxRetryError as e: + if isinstance(e.reason, ConnectTimeoutError): + # TODO: Remove this in 3.0.0: see #2811 + if not isinstance(e.reason, NewConnectionError): + raise ConnectTimeout(e, request=request) + + if isinstance(e.reason, ResponseError): + raise RetryError(e, request=request) + + if isinstance(e.reason, _ProxyError): + raise ProxyError(e, request=request) + + if isinstance(e.reason, _SSLError): + # This branch is for urllib3 v1.22 and later. + raise SSLError(e, request=request) + + raise ConnectionError(e, request=request) + + except ClosedPoolError as e: + raise ConnectionError(e, request=request) + + except _ProxyError as e: + raise ProxyError(e) + + except (_SSLError, _HTTPError) as e: + if isinstance(e, _SSLError): + # This branch is for urllib3 versions earlier than v1.22 + raise SSLError(e, request=request) + elif isinstance(e, ReadTimeoutError): + raise ReadTimeout(e, request=request) + elif isinstance(e, _InvalidHeader): + raise InvalidHeader(e, request=request) + else: + raise + + return self.build_response(request, resp) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/api.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/api.py new file mode 100644 index 0000000000000000000000000000000000000000..eeb3b54d7f27e2c843080dfe81dfdb0d460c2b31 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/api.py @@ -0,0 +1,180 @@ +""" +requests.api +~~~~~~~~~~~~ + +This module implements the Requests API. + +:copyright: (c) 2012 by Kenneth Reitz. +:license: Apache2, see LICENSE for more details. +""" + +from __future__ import annotations + +from typing import TYPE_CHECKING + +from . import sessions +from .models import Response + +if TYPE_CHECKING: + from typing_extensions import Unpack + + from . import _types as _t + + +def request( + method: str, url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs] +) -> Response: + """Constructs and sends a :class:`Request `. + + :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. + :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. + ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` + or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content_type'`` is a string + defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers + to add for the file. + :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) How many seconds to wait for the server to send data + before giving up, as a float, or a :ref:`(connect timeout, read + timeout) ` tuple. + :type timeout: float or tuple + :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. + :type allow_redirects: bool + :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use. Defaults to ``True``. + :param stream: (optional) if ``False``, the response content will be immediately downloaded. + :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. + :return: :class:`Response ` object + :rtype: requests.Response + + Usage:: + + >>> import requests + >>> req = requests.request('GET', 'https://httpbin.org/get') + >>> req + + """ + + # By using the 'with' statement we are sure the session is closed, thus we + # avoid leaving sockets open which can trigger a ResourceWarning in some + # cases, and look like a memory leak in others. + with sessions.Session() as session: + return session.request(method=method, url=url, **kwargs) + + +def get( + url: _t.UriType, params: _t.ParamsType = None, **kwargs: Unpack[_t.GetKwargs] +) -> Response: + r"""Sends a GET request. + + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("get", url, params=params, **kwargs) + + +def options(url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs]) -> Response: + r"""Sends an OPTIONS request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("options", url, **kwargs) + + +def head(url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs]) -> Response: + r"""Sends a HEAD request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. If + `allow_redirects` is not provided, it will be set to `False` (as + opposed to the default :meth:`request` behavior). + :return: :class:`Response ` object + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", False) + return request("head", url, **kwargs) + + +def post( + url: _t.UriType, + data: _t.DataType = None, + json: _t.JsonType = None, + **kwargs: Unpack[_t.PostKwargs], +) -> Response: + r"""Sends a POST request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("post", url, data=data, json=json, **kwargs) + + +def put( + url: _t.UriType, data: _t.DataType = None, **kwargs: Unpack[_t.DataKwargs] +) -> Response: + r"""Sends a PUT request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("put", url, data=data, **kwargs) + + +def patch( + url: _t.UriType, data: _t.DataType = None, **kwargs: Unpack[_t.DataKwargs] +) -> Response: + r"""Sends a PATCH request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("patch", url, data=data, **kwargs) + + +def delete(url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs]) -> Response: + r"""Sends a DELETE request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("delete", url, **kwargs) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/auth.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/auth.py new file mode 100644 index 0000000000000000000000000000000000000000..2af481dbf59e31965bde74c2e27d73517a39d7ac --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/auth.py @@ -0,0 +1,354 @@ +""" +requests.auth +~~~~~~~~~~~~~ + +This module contains the authentication handlers for Requests. +""" + +from __future__ import annotations + +import hashlib +import os +import re +import threading +import time +import warnings +from base64 import b64encode +from typing import TYPE_CHECKING, Any, Final, cast, overload + +from ._internal_utils import to_native_string +from .compat import basestring, str, urlparse +from .cookies import extract_cookies_to_jar +from .utils import parse_dict_header + +if TYPE_CHECKING: + from http.cookiejar import CookieJar + from typing import Any + + from .models import PreparedRequest, Response + +CONTENT_TYPE_FORM_URLENCODED: Final = "application/x-www-form-urlencoded" +CONTENT_TYPE_MULTI_PART: Final = "multipart/form-data" + + +def _basic_auth_str(username: bytes | str, password: bytes | str) -> str: + """Returns a Basic Auth string.""" + + # "I want us to put a big-ol' comment on top of it that + # says that this behaviour is dumb but we need to preserve + # it because people are relying on it." + # - Lukasa + # + # These are here solely to maintain backwards compatibility + # for things like ints. This will be removed in 3.0.0. + if not isinstance(username, basestring): # type: ignore[reportUnnecessaryIsInstance] # runtime guard for non-str/bytes + warnings.warn( + "Non-string usernames will no longer be supported in Requests " + f"3.0.0. Please convert the object you've passed in ({username!r}) to " + "a string or bytes object in the near future to avoid " + "problems.", + category=DeprecationWarning, + ) + username = str(username) + + if not isinstance(password, basestring): # type: ignore[reportUnnecessaryIsInstance] # runtime guard for non-str/bytes + warnings.warn( + "Non-string passwords will no longer be supported in Requests " + f"3.0.0. Please convert the object you've passed in ({type(password)!r}) to " + "a string or bytes object in the near future to avoid " + "problems.", + category=DeprecationWarning, + ) + password = str(password) + # -- End Removal -- + + if isinstance(username, str): + username = username.encode("latin1") + + if isinstance(password, str): + password = password.encode("latin1") + + authstr = "Basic " + to_native_string( + b64encode(b":".join((username, password))).strip() + ) + + return authstr + + +class AuthBase: + """Base class that all auth implementations derive from""" + + def __call__(self, r: PreparedRequest) -> PreparedRequest: + raise NotImplementedError("Auth hooks must be callable.") + + +class HTTPBasicAuth(AuthBase): + """Attaches HTTP Basic Authentication to the given Request object.""" + + username: bytes | str + password: bytes | str + + @overload + def __init__(self, username: str, password: str) -> None: ... + @overload + def __init__(self, username: bytes, password: bytes) -> None: ... + + def __init__(self, username: bytes | str, password: bytes | str) -> None: + self.username = username + self.password = password + + def __eq__(self, other: object) -> bool: + return all( + [ + self.username == getattr(other, "username", None), + self.password == getattr(other, "password", None), + ] + ) + + def __ne__(self, other: Any) -> bool: + return not self == other + + def __call__(self, r: PreparedRequest) -> PreparedRequest: + r.headers["Authorization"] = _basic_auth_str(self.username, self.password) + return r + + +class HTTPProxyAuth(HTTPBasicAuth): + """Attaches HTTP Proxy Authentication to a given Request object.""" + + def __call__(self, r: PreparedRequest) -> PreparedRequest: + r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) + return r + + +class HTTPDigestAuth(AuthBase): + """Attaches HTTP Digest Authentication to the given Request object.""" + + username: bytes | str + password: bytes | str + _thread_local: threading.local + last_nonce: str + nonce_count: int + chal: dict[str, str] + pos: int | None + num_401_calls: int | None + + @overload + def __init__(self, username: str, password: str) -> None: ... + @overload + def __init__(self, username: bytes, password: bytes) -> None: ... + + def __init__(self, username: bytes | str, password: bytes | str) -> None: + self.username = username + self.password = password + # Keep state in per-thread local storage + self._thread_local = threading.local() + + def init_per_thread_state(self) -> None: + # Ensure state is initialized just once per-thread + if not hasattr(self._thread_local, "init"): + self._thread_local.init = True + self._thread_local.last_nonce = "" + self._thread_local.nonce_count = 0 + self._thread_local.chal = {} + self._thread_local.pos = None + self._thread_local.num_401_calls = None + + def build_digest_header(self, method: str, url: str) -> str | None: + """ + :rtype: str + """ + + realm = self._thread_local.chal["realm"] + nonce = self._thread_local.chal["nonce"] + qop = self._thread_local.chal.get("qop") + algorithm = self._thread_local.chal.get("algorithm") + opaque = self._thread_local.chal.get("opaque") + hash_utf8 = None + + if algorithm is None: + _algorithm = "MD5" + else: + _algorithm = algorithm.upper() + # lambdas assume digest modules are imported at the top level + if _algorithm == "MD5" or _algorithm == "MD5-SESS": + + def md5_utf8(x: str | bytes) -> str: + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.md5(x, usedforsecurity=False).hexdigest() + + hash_utf8 = md5_utf8 + elif _algorithm == "SHA": + + def sha_utf8(x: str | bytes) -> str: + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha1(x, usedforsecurity=False).hexdigest() + + hash_utf8 = sha_utf8 + elif _algorithm == "SHA-256": + + def sha256_utf8(x: str | bytes) -> str: + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha256(x, usedforsecurity=False).hexdigest() + + hash_utf8 = sha256_utf8 + elif _algorithm == "SHA-512": + + def sha512_utf8(x: str | bytes) -> str: + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha512(x, usedforsecurity=False).hexdigest() + + hash_utf8 = sha512_utf8 + + if hash_utf8 is None: + return None + + def KD(s: str, d: str) -> str: + return hash_utf8(f"{s}:{d}") + + # XXX not implemented yet + entdig = None + p_parsed = urlparse(url) + #: path is request-uri defined in RFC 2616 which should not be empty + path = p_parsed.path or "/" + if p_parsed.query: + path += f"?{p_parsed.query}" + + A1 = f"{self.username}:{realm}:{self.password}" + A2 = f"{method}:{path}" + + HA1 = hash_utf8(A1) + HA2 = hash_utf8(A2) + + if nonce == self._thread_local.last_nonce: + self._thread_local.nonce_count += 1 + else: + self._thread_local.nonce_count = 1 + ncvalue = f"{self._thread_local.nonce_count:08x}" + s = str(self._thread_local.nonce_count).encode("utf-8") + s += nonce.encode("utf-8") + s += time.ctime().encode("utf-8") + s += os.urandom(8) + + cnonce = hashlib.sha1(s, usedforsecurity=False).hexdigest()[:16] + if _algorithm == "MD5-SESS": + HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}") # type: ignore[reportConstantRedefinition] # RFC 2617 terminology + + if not qop: + respdig = KD(HA1, f"{nonce}:{HA2}") + elif qop == "auth" or "auth" in qop.split(","): + noncebit = f"{nonce}:{ncvalue}:{cnonce}:auth:{HA2}" + respdig = KD(HA1, noncebit) + else: + # XXX handle auth-int. + return None + + self._thread_local.last_nonce = nonce + + # XXX should the partial digests be encoded too? + base = ( + f'username="{self.username}", realm="{realm}", nonce="{nonce}", ' + f'uri="{path}", response="{respdig}"' + ) + if opaque: + base += f', opaque="{opaque}"' + if algorithm: + base += f', algorithm="{algorithm}"' + if entdig: + base += f', digest="{entdig}"' + if qop: + base += f', qop="auth", nc={ncvalue}, cnonce="{cnonce}"' + + return f"Digest {base}" + + def handle_redirect(self, r: Response, **kwargs: Any) -> None: + """Reset num_401_calls counter on redirects.""" + if r.is_redirect: + self._thread_local.num_401_calls = 1 + + def handle_401(self, r: Response, **kwargs: Any) -> Response: + """ + Takes the given response and tries digest-auth, if needed. + + :rtype: requests.Response + """ + + # If response is not 4xx, do not auth + # See https://github.com/psf/requests/issues/3772 + if not 400 <= r.status_code < 500: + self._thread_local.num_401_calls = 1 + return r + + if self._thread_local.pos is not None: + # Rewind the file position indicator of the body to where + # it was to resend the request. + if (seek := getattr(r.request.body, "seek", None)) is not None: + seek(self._thread_local.pos) + s_auth = r.headers.get("www-authenticate", "") + + if "digest" in s_auth.lower() and self._thread_local.num_401_calls < 2: + self._thread_local.num_401_calls += 1 + pat = re.compile(r"digest ", flags=re.IGNORECASE) + self._thread_local.chal = parse_dict_header(pat.sub("", s_auth, count=1)) + + # Consume content and release the original connection + # to allow our new request to reuse the same one. + r.content + r.close() + prep = r.request.copy() + cookie_jar = cast("CookieJar", prep._cookies) # type: ignore[reportPrivateUsage] + extract_cookies_to_jar(cookie_jar, r.request, r.raw) + prep.prepare_cookies(cookie_jar) + + _digest_auth = self.build_digest_header( + cast(str, prep.method), cast(str, prep.url) + ) + if _digest_auth: + prep.headers["Authorization"] = _digest_auth + _r = r.connection.send(prep, **kwargs) + _r.history.append(r) + _r.request = prep + + return _r + + self._thread_local.num_401_calls = 1 + return r + + def __call__(self, r: PreparedRequest) -> PreparedRequest: + # Initialize per-thread state, if needed + self.init_per_thread_state() + # If we have a saved nonce, skip the 401 + if self._thread_local.last_nonce: + _digest_auth = self.build_digest_header( + cast(str, r.method), cast(str, r.url) + ) + if _digest_auth: + r.headers["Authorization"] = _digest_auth + if (tell := getattr(r.body, "tell", None)) is not None: + self._thread_local.pos = tell() + else: + # In the case of HTTPDigestAuth being reused and the body of + # the previous request was a file-like object, pos has the + # file position of the previous body. Ensure it's set to + # None. + self._thread_local.pos = None + r.register_hook("response", self.handle_401) + r.register_hook("response", self.handle_redirect) + self._thread_local.num_401_calls = 1 + + return r + + def __eq__(self, other: object) -> bool: + return all( + [ + self.username == getattr(other, "username", None), + self.password == getattr(other, "password", None), + ] + ) + + def __ne__(self, other: Any) -> bool: + return not self == other diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/certs.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/certs.py new file mode 100644 index 0000000000000000000000000000000000000000..4f85ac070bc0230af8155bcadfaa96165268cede --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/certs.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +""" +requests.certs +~~~~~~~~~~~~~~ + +This module returns the preferred default CA certificate bundle. There is +only one — the one from the certifi package. + +If you are packaging Requests, e.g., for a Linux distribution or a managed +environment, you can change the definition of where() to return a separately +packaged CA bundle. +""" + +from certifi import where + +if __name__ == "__main__": + print(where()) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/compat.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..deab3c091fed207315c5af60fb415d7407a08b48 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/compat.py @@ -0,0 +1,113 @@ +""" +requests.compat +~~~~~~~~~~~~~~~ + +This module previously handled import compatibility issues +between Python 2 and Python 3. It remains for backwards +compatibility until the next major version. +""" + +# pyright: reportUnusedImport=false + +from __future__ import annotations + +import importlib +import sys +from types import ModuleType + +# ------- +# urllib3 +# ------- +from urllib3 import ( + __version__ as urllib3_version, # type: ignore[reportPrivateImportUsage] +) + +# Detect which major version of urllib3 is being used. +try: + is_urllib3_1 = int(urllib3_version.split(".")[0]) == 1 +except (TypeError, AttributeError): + # If we can't discern a version, prefer old functionality. + is_urllib3_1 = True + +# ------------------- +# Character Detection +# ------------------- + + +def _resolve_char_detection() -> ModuleType | None: + """Find supported character detection libraries.""" + chardet = None + for lib in ("chardet", "charset_normalizer"): + if chardet is None: + try: + chardet = importlib.import_module(lib) + except ImportError: + pass + return chardet + + +chardet = _resolve_char_detection() + +# ------- +# Pythons +# ------- + +# Syntax sugar. +_ver = sys.version_info + +#: Python 2.x? +is_py2 = _ver[0] == 2 + +#: Python 3.x? +is_py3 = _ver[0] == 3 + +# json/simplejson module import resolution +has_simplejson = False +try: + import simplejson as json # type: ignore[import-not-found] + + has_simplejson = True +except ImportError: + import json + +if has_simplejson: + from simplejson import JSONDecodeError # type: ignore[import-not-found] +else: + from json import JSONDecodeError + +# Keep OrderedDict for backwards compatibility. +from collections import OrderedDict +from collections.abc import Callable, Mapping, MutableMapping +from http import cookiejar as cookielib +from http.cookies import Morsel +from io import StringIO + +# -------------- +# Legacy Imports +# -------------- +from urllib.parse import ( + quote, + quote_plus, + unquote, + unquote_plus, + urldefrag, + urlencode, + urljoin, + urlparse, + urlsplit, + urlunparse, +) +from urllib.request import ( + getproxies, + getproxies_environment, + parse_http_list, + proxy_bypass, + proxy_bypass_environment, # type: ignore[attr-defined] # https://github.com/python/cpython/issues/145331 +) + +builtin_str = str +str = str +bytes = bytes +basestring = (str, bytes) +numeric_types = (int, float) +integer_types = (int,) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/cookies.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/cookies.py new file mode 100644 index 0000000000000000000000000000000000000000..2e3fc215095fad13817562bbaee871cba57eec08 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/cookies.py @@ -0,0 +1,625 @@ +""" +requests.cookies +~~~~~~~~~~~~~~~~ + +Compatibility code to be able to use `http.cookiejar.CookieJar` with requests. + +requests.utils imports from here, so be careful with imports. +""" + +from __future__ import annotations + +import calendar +import copy +import time +from collections.abc import Iterator, MutableMapping +from http.cookiejar import Cookie, CookieJar, CookiePolicy +from typing import TYPE_CHECKING, Any, TypeVar, overload + +from ._internal_utils import to_native_string +from ._types import is_prepared as _is_prepared +from .compat import Morsel, cookielib, urlparse, urlunparse + +if TYPE_CHECKING: + from _typeshed import SupportsKeysAndGetItem + + from .models import PreparedRequest + +import threading + + +class MockRequest: + """Wraps a `requests.PreparedRequest` to mimic a `urllib2.Request`. + + The code in `http.cookiejar.CookieJar` expects this interface in order to correctly + manage cookie policies, i.e., determine whether a cookie can be set, given the + domains of the request and the cookie. + + The original request object is read-only. The client is responsible for collecting + the new headers via `get_new_headers()` and interpreting them appropriately. You + probably want `get_cookie_header`, defined below. + """ + + type: str + + def __init__(self, request: PreparedRequest) -> None: + assert _is_prepared(request) + self._r = request + self._new_headers: dict[str, str] = {} + self.type = urlparse(self._r.url).scheme + + def get_type(self) -> str: + return self.type + + def get_host(self) -> str: + return urlparse(self._r.url).netloc + + def get_origin_req_host(self) -> str: + return self.get_host() + + def get_full_url(self) -> str: + # Only return the response's URL if the user hadn't set the Host + # header + if not self._r.headers.get("Host"): + return self._r.url + # If they did set it, retrieve it and reconstruct the expected domain + host = to_native_string(self._r.headers["Host"], encoding="utf-8") + parsed = urlparse(self._r.url) + # Reconstruct the URL as we expect it + return urlunparse( + [ + parsed.scheme, + host, + parsed.path, + parsed.params, + parsed.query, + parsed.fragment, + ] + ) + + def is_unverifiable(self) -> bool: + return True + + def has_header(self, name: str) -> bool: + return name in self._r.headers or name in self._new_headers + + def get_header(self, name: str, default: str | None = None) -> str | None: + return self._r.headers.get(name, self._new_headers.get(name, default)) # type: ignore[return-value] + + def add_header(self, key: str, val: str) -> None: + """cookiejar has no legitimate use for this method; add it back if you find one.""" + raise NotImplementedError( + "Cookie headers should be added with add_unredirected_header()" + ) + + def add_unredirected_header(self, name: str, value: str) -> None: + self._new_headers[name] = value + + def get_new_headers(self) -> dict[str, str]: + return self._new_headers + + @property + def unverifiable(self) -> bool: + return self.is_unverifiable() + + @property + def origin_req_host(self) -> str: + return self.get_origin_req_host() + + @property + def host(self) -> str: + return self.get_host() + + +class MockResponse: + """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. + + ...what? Basically, expose the parsed HTTP headers from the server response + the way `http.cookiejar` expects to see them. + """ + + def __init__(self, headers: Any) -> None: + """Make a MockResponse for `cookiejar` to read. + + :param headers: a httplib.HTTPMessage or analogous carrying the headers + """ + self._headers = headers + + def info(self) -> Any: + return self._headers + + def getheaders(self, name: str) -> Any: + self._headers.getheaders(name) + + +def extract_cookies_to_jar( + jar: CookieJar, request: PreparedRequest, response: Any +) -> None: + """Extract the cookies from the response into a CookieJar. + + :param jar: http.cookiejar.CookieJar (not necessarily a RequestsCookieJar) + :param request: our own requests.Request object + :param response: urllib3.HTTPResponse object + """ + if not (hasattr(response, "_original_response") and response._original_response): + return + # the _original_response field is the wrapped httplib.HTTPResponse object, + req = MockRequest(request) + # pull out the HTTPMessage with the headers and put it in the mock: + res = MockResponse(response._original_response.msg) + jar.extract_cookies(res, req) # type: ignore[arg-type] + + +def get_cookie_header(jar: CookieJar, request: PreparedRequest) -> str | None: + """ + Produce an appropriate Cookie header string to be sent with `request`, or None. + + :rtype: str + """ + r = MockRequest(request) + jar.add_cookie_header(r) # type: ignore[arg-type] + return r.get_new_headers().get("Cookie") + + +def remove_cookie_by_name( + cookiejar: CookieJar, name: str, domain: str | None = None, path: str | None = None +) -> None: + """Unsets a cookie by name, by default over all domains and paths. + + Wraps CookieJar.clear(), is O(n). + """ + clearables: list[tuple[str, str, str]] = [] + for cookie in cookiejar: + if cookie.name != name: + continue + if domain is not None and domain != cookie.domain: + continue + if path is not None and path != cookie.path: + continue + clearables.append((cookie.domain, cookie.path, cookie.name)) + + for domain, path, name in clearables: + cookiejar.clear(domain, path, name) + + +class CookieConflictError(RuntimeError): + """There are two cookies that meet the criteria specified in the cookie jar. + Use .get and .set and include domain and path args in order to be more specific. + """ + + +class RequestsCookieJar(CookieJar, MutableMapping[str, str | None]): # type: ignore[misc] + """Compatibility class; is a http.cookiejar.CookieJar, but exposes a dict + interface. + + This is the CookieJar we create by default for requests and sessions that + don't specify one, since some clients may expect response.cookies and + session.cookies to support dict operations. + + Requests does not use the dict interface internally; it's just for + compatibility with external client code. All requests code should work + out of the box with externally provided instances of ``CookieJar``, e.g. + ``LWPCookieJar`` and ``FileCookieJar``. + + Unlike a regular CookieJar, this class is pickleable. + + .. warning:: dictionary operations that are normally O(1) may be O(n). + """ + + _policy: CookiePolicy + + def get( # type: ignore[override] + self, + name: str, + default: str | None = None, + domain: str | None = None, + path: str | None = None, + ) -> str | None: + """Dict-like get() that also supports optional domain and path args in + order to resolve naming collisions from using one cookie jar over + multiple domains. + + .. warning:: operation is O(n), not O(1). + """ + try: + return self._find_no_duplicates(name, domain, path) + except KeyError: + return default + + def set( + self, name: str, value: str | Morsel[dict[str, str]] | None, **kwargs: Any + ) -> Cookie | None: + """Dict-like set() that also supports optional domain and path args in + order to resolve naming collisions from using one cookie jar over + multiple domains. + """ + # support client code that unsets cookies by assignment of a None value: + if value is None: + remove_cookie_by_name( + self, name, domain=kwargs.get("domain"), path=kwargs.get("path") + ) + return + + if isinstance(value, Morsel): + c = morsel_to_cookie(value) + else: + c = create_cookie(name, value, **kwargs) + self.set_cookie(c) + return c + + def iterkeys(self) -> Iterator[str]: + """Dict-like iterkeys() that returns an iterator of names of cookies + from the jar. + + .. seealso:: itervalues() and iteritems(). + """ + for cookie in iter(self): + yield cookie.name + + def keys(self) -> list[str]: # type: ignore[override] + """Dict-like keys() that returns a list of names of cookies from the + jar. + + .. seealso:: values() and items(). + """ + return list(self.iterkeys()) + + def itervalues(self) -> Iterator[str | None]: + """Dict-like itervalues() that returns an iterator of values of cookies + from the jar. + + .. seealso:: iterkeys() and iteritems(). + """ + for cookie in iter(self): + yield cookie.value + + def values(self) -> list[str | None]: # type: ignore[override] + """Dict-like values() that returns a list of values of cookies from the + jar. + + .. seealso:: keys() and items(). + """ + return list(self.itervalues()) + + def iteritems(self) -> Iterator[tuple[str, str | None]]: + """Dict-like iteritems() that returns an iterator of name-value tuples + from the jar. + + .. seealso:: iterkeys() and itervalues(). + """ + for cookie in iter(self): + yield cookie.name, cookie.value + + def items(self) -> list[tuple[str, str | None]]: # type: ignore[override] + """Dict-like items() that returns a list of name-value tuples from the + jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a + vanilla python dict of key value pairs. + + .. seealso:: keys() and values(). + """ + return list(self.iteritems()) + + def list_domains(self) -> list[str]: + """Utility method to list all the domains in the jar.""" + domains: list[str] = [] + for cookie in iter(self): + if cookie.domain not in domains: + domains.append(cookie.domain) + return domains + + def list_paths(self) -> list[str]: + """Utility method to list all the paths in the jar.""" + paths: list[str] = [] + for cookie in iter(self): + if cookie.path not in paths: + paths.append(cookie.path) + return paths + + def multiple_domains(self) -> bool: + """Returns True if there are multiple domains in the jar. + Returns False otherwise. + + :rtype: bool + """ + domains: list[str] = [] + for cookie in iter(self): + if cookie.domain is not None and cookie.domain in domains: # type: ignore[reportUnnecessaryComparison] # defensive check + return True + domains.append(cookie.domain) + return False # there is only one domain in jar + + def get_dict( + self, domain: str | None = None, path: str | None = None + ) -> dict[str, str | None]: + """Takes as an argument an optional domain and path and returns a plain + old Python dict of name-value pairs of cookies that meet the + requirements. + + :rtype: dict + """ + dictionary: dict[str, str | None] = {} + for cookie in iter(self): + if (domain is None or cookie.domain == domain) and ( + path is None or cookie.path == path + ): + dictionary[cookie.name] = cookie.value + return dictionary + + def __iter__(self) -> Iterator[Cookie]: # type: ignore[override] + """RequestCookieJar's __iter__ comes from CookieJar not MutableMapping.""" + return super().__iter__() + + def __contains__(self, name: object) -> bool: + try: + return super().__contains__(name) + except CookieConflictError: + return True + + def __getitem__(self, name: str) -> str | None: + """Dict-like __getitem__() for compatibility with client code. Throws + exception if there are more than one cookie with name. In that case, + use the more explicit get() method instead. + + .. warning:: operation is O(n), not O(1). + """ + return self._find_no_duplicates(name) + + def __setitem__( + self, name: str, value: str | Morsel[dict[str, str]] | None + ) -> None: + """Dict-like __setitem__ for compatibility with client code. Throws + exception if there is already a cookie of that name in the jar. In that + case, use the more explicit set() method instead. + """ + self.set(name, value) + + def __delitem__(self, name: str) -> None: + """Deletes a cookie given a name. Wraps ``http.cookiejar.CookieJar``'s + ``remove_cookie_by_name()``. + """ + remove_cookie_by_name(self, name) + + def set_cookie(self, cookie: Cookie, *args: Any, **kwargs: Any) -> None: + if ( + (value := cookie.value) is not None + and value.startswith('"') + and value.endswith('"') + ): + cookie.value = value.replace('\\"', "") + return super().set_cookie(cookie, *args, **kwargs) + + def update( # type: ignore[override] + self, other: CookieJar | SupportsKeysAndGetItem[str, str] + ) -> None: + """Updates this jar with cookies from another CookieJar or dict-like""" + if isinstance(other, cookielib.CookieJar): + for cookie in other: + self.set_cookie(copy.copy(cookie)) + else: + super().update(other) + + def _find( + self, name: str, domain: str | None = None, path: str | None = None + ) -> str | None: + """Requests uses this method internally to get cookie values. + + If there are conflicting cookies, _find arbitrarily chooses one. + See _find_no_duplicates if you want an exception thrown if there are + conflicting cookies. + + :param name: a string containing name of cookie + :param domain: (optional) string containing domain of cookie + :param path: (optional) string containing path of cookie + :return: cookie.value + """ + for cookie in iter(self): + if cookie.name == name: + if domain is None or cookie.domain == domain: + if path is None or cookie.path == path: + return cookie.value + + raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") + + def _find_no_duplicates( + self, name: str, domain: str | None = None, path: str | None = None + ) -> str: + """Both ``__get_item__`` and ``get`` call this function: it's never + used elsewhere in Requests. + + :param name: a string containing name of cookie + :param domain: (optional) string containing domain of cookie + :param path: (optional) string containing path of cookie + :raises KeyError: if cookie is not found + :raises CookieConflictError: if there are multiple cookies + that match name and optionally domain and path + :return: cookie.value + """ + toReturn = None + for cookie in iter(self): + if cookie.name == name: + if domain is None or cookie.domain == domain: + if path is None or cookie.path == path: + if toReturn is not None: + # if there are multiple cookies that meet passed in criteria + raise CookieConflictError( + f"There are multiple cookies with name, {name!r}" + ) + # we will eventually return this as long as no cookie conflict + toReturn = cookie.value + + if toReturn is not None: + return toReturn + raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") + + def __getstate__(self) -> dict[str, Any]: + """Unlike a normal CookieJar, this class is pickleable.""" + state = self.__dict__.copy() + # remove the unpickleable RLock object + state.pop("_cookies_lock") + return state + + def __setstate__(self, state: dict[str, Any]) -> None: + """Unlike a normal CookieJar, this class is pickleable.""" + self.__dict__.update(state) + if "_cookies_lock" not in self.__dict__: + self._cookies_lock = threading.RLock() + + def copy(self) -> RequestsCookieJar: + """Return a copy of this RequestsCookieJar.""" + new_cj = RequestsCookieJar() + new_cj.set_policy(self.get_policy()) + new_cj.update(self) + return new_cj + + def get_policy(self) -> CookiePolicy: + """Return the CookiePolicy instance used.""" + return self._policy + + +def _copy_cookie_jar(jar: CookieJar | None) -> CookieJar | None: # type: ignore[reportUnusedFunction] # cross-module usage in models.py + if jar is None: + return None + + if copy_method := getattr(jar, "copy", None): + # We're dealing with an instance of RequestsCookieJar + return copy_method() + # We're dealing with a generic CookieJar instance + new_jar = copy.copy(jar) + new_jar.clear() + for cookie in jar: + new_jar.set_cookie(copy.copy(cookie)) + return new_jar + + +def create_cookie(name: str, value: str, **kwargs: Any) -> Cookie: + """Make a cookie from underspecified parameters. + + By default, the pair of `name` and `value` will be set for the domain '' + and sent on every request (this is sometimes called a "supercookie"). + """ + result: dict[str, Any] = { + "version": 0, + "name": name, + "value": value, + "port": None, + "domain": "", + "path": "/", + "secure": False, + "expires": None, + "discard": True, + "comment": None, + "comment_url": None, + "rest": {"HttpOnly": None}, + "rfc2109": False, + } + + badargs = set(kwargs) - set(result) + if badargs: + raise TypeError( + f"create_cookie() got unexpected keyword arguments: {list(badargs)}" + ) + + result.update(kwargs) + result["port_specified"] = bool(result["port"]) + result["domain_specified"] = bool(result["domain"]) + result["domain_initial_dot"] = result["domain"].startswith(".") + result["path_specified"] = bool(result["path"]) + + return cookielib.Cookie(**result) + + +def morsel_to_cookie(morsel: Morsel[Any]) -> Cookie: + """Convert a Morsel object into a Cookie containing the one k/v pair.""" + + expires: int | None = None + if morsel["max-age"]: + try: + expires = int(time.time() + int(morsel["max-age"])) + except ValueError: + raise TypeError(f"max-age: {morsel['max-age']} must be integer") + elif morsel["expires"]: + time_template = "%a, %d-%b-%Y %H:%M:%S GMT" + expires = calendar.timegm(time.strptime(morsel["expires"], time_template)) + return create_cookie( + comment=morsel["comment"], + comment_url=bool(morsel["comment"]), + discard=False, + domain=morsel["domain"], + expires=expires, + name=morsel.key, + path=morsel["path"], + port=None, + rest={"HttpOnly": morsel["httponly"]}, + rfc2109=False, + secure=bool(morsel["secure"]), + value=morsel.value, + version=morsel["version"] or 0, + ) + + +_CookieJarT = TypeVar("_CookieJarT", bound=CookieJar) + + +@overload +def cookiejar_from_dict( + cookie_dict: dict[str, str] | None, + cookiejar: None = None, + overwrite: bool = True, +) -> RequestsCookieJar: ... + + +@overload +def cookiejar_from_dict( + cookie_dict: dict[str, str] | None, + cookiejar: _CookieJarT, + overwrite: bool = True, +) -> _CookieJarT: ... + + +def cookiejar_from_dict( + cookie_dict: dict[str, str] | None, + cookiejar: CookieJar | None = None, + overwrite: bool = True, +) -> CookieJar: + """Returns a CookieJar from a key/value dictionary. + + :param cookie_dict: Dict of key/values to insert into CookieJar. + :param cookiejar: (optional) A cookiejar to add the cookies to. + :param overwrite: (optional) If False, will not replace cookies + already in the jar with new ones. + :rtype: CookieJar + """ + if cookiejar is None: + cookiejar = RequestsCookieJar() + + if cookie_dict is not None: + names_from_jar = [cookie.name for cookie in cookiejar] + for name in cookie_dict: + if overwrite or (name not in names_from_jar): + cookiejar.set_cookie(create_cookie(name, cookie_dict[name])) + + return cookiejar + + +def merge_cookies( + cookiejar: CookieJar, cookies: dict[str, str] | CookieJar | None +) -> CookieJar: + """Add cookies to cookiejar and returns a merged CookieJar. + + :param cookiejar: CookieJar object to add the cookies to. + :param cookies: Dictionary or CookieJar object to be added. + :rtype: CookieJar + """ + if not isinstance(cookiejar, cookielib.CookieJar): # type: ignore[reportUnnecessaryIsInstance] # runtime guard + raise ValueError("You can only merge into CookieJar") + + if isinstance(cookies, dict): + cookiejar = cookiejar_from_dict(cookies, cookiejar=cookiejar, overwrite=False) + elif isinstance(cookies, cookielib.CookieJar): + if update_method := getattr(cookiejar, "update", None): + update_method(cookies) + else: + for cookie_in_jar in cookies: + cookiejar.set_cookie(cookie_in_jar) + + return cookiejar diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/exceptions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..cb5e9510e3b1cf4804ac6091fd7fdb55e9f2745b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/exceptions.py @@ -0,0 +1,162 @@ +""" +requests.exceptions +~~~~~~~~~~~~~~~~~~~ + +This module contains the set of Requests' exceptions. +""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from urllib3.exceptions import HTTPError as BaseHTTPError + +from .compat import JSONDecodeError as CompatJSONDecodeError + +if TYPE_CHECKING: + from .models import PreparedRequest, Request, Response + + +class RequestException(IOError): + """There was an ambiguous exception that occurred while handling your + request. + """ + + response: Response | None + request: Request | PreparedRequest | None + + def __init__(self, *args: Any, **kwargs: Any) -> None: + """Initialize RequestException with `request` and `response` objects.""" + response: Response | None = kwargs.pop("response", None) + self.response = response + self.request = kwargs.pop("request", None) + if response is not None and not self.request and hasattr(response, "request"): + self.request = response.request + super().__init__(*args, **kwargs) + + +class InvalidJSONError(RequestException): + """A JSON error occurred.""" + + +class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError): + """Couldn't decode the text into json""" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + """ + Construct the JSONDecodeError instance first with all + args. Then use it's args to construct the IOError so that + the json specific args aren't used as IOError specific args + and the error message from JSONDecodeError is preserved. + """ + CompatJSONDecodeError.__init__(self, *args) + InvalidJSONError.__init__(self, *self.args, **kwargs) + + def __reduce__(self) -> tuple[Any, ...] | str: + """ + The __reduce__ method called when pickling the object must + be the one from the JSONDecodeError (be it json/simplejson) + as it expects all the arguments for instantiation, not just + one like the IOError, and the MRO would by default call the + __reduce__ method from the IOError due to the inheritance order. + """ + return CompatJSONDecodeError.__reduce__(self) + + +class HTTPError(RequestException): + """An HTTP error occurred.""" + + +class ConnectionError(RequestException): + """A Connection error occurred.""" + + +class ProxyError(ConnectionError): + """A proxy error occurred.""" + + +class SSLError(ConnectionError): + """An SSL error occurred.""" + + +class Timeout(RequestException): + """The request timed out. + + Catching this error will catch both + :exc:`~requests.exceptions.ConnectTimeout` and + :exc:`~requests.exceptions.ReadTimeout` errors. + """ + + +class ConnectTimeout(ConnectionError, Timeout): + """The request timed out while trying to connect to the remote server. + + Requests that produced this error are safe to retry. + """ + + +class ReadTimeout(Timeout): + """The server did not send any data in the allotted amount of time.""" + + +class URLRequired(RequestException): + """A valid URL is required to make a request.""" + + +class TooManyRedirects(RequestException): + """Too many redirects.""" + + +class MissingSchema(RequestException, ValueError): + """The URL scheme (e.g. http or https) is missing.""" + + +class InvalidSchema(RequestException, ValueError): + """The URL scheme provided is either invalid or unsupported.""" + + +class InvalidURL(RequestException, ValueError): + """The URL provided was somehow invalid.""" + + +class InvalidHeader(RequestException, ValueError): + """The header value provided was somehow invalid.""" + + +class InvalidProxyURL(InvalidURL): + """The proxy URL provided is invalid.""" + + +class ChunkedEncodingError(RequestException): + """The server declared chunked encoding but sent an invalid chunk.""" + + +class ContentDecodingError(RequestException, BaseHTTPError): + """Failed to decode response content.""" + + +class StreamConsumedError(RequestException, TypeError): + """The content for this response was already consumed.""" + + +class RetryError(RequestException): + """Custom retries logic failed""" + + +class UnrewindableBodyError(RequestException): + """Requests encountered an error when trying to rewind a body.""" + + +# Warnings + + +class RequestsWarning(Warning): + """Base warning for Requests.""" + + +class FileModeWarning(RequestsWarning, DeprecationWarning): + """A file was opened in text mode, but Requests determined its binary length.""" + + +class RequestsDependencyWarning(RequestsWarning): + """An imported dependency doesn't match the expected version range.""" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/help.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/help.py new file mode 100644 index 0000000000000000000000000000000000000000..9269cc71263e3f5938a89a9d6c2fed5a4274cc14 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/help.py @@ -0,0 +1,134 @@ +"""Module containing bug report helper(s).""" + +# pyright: reportUnknownMemberType=false + +import json +import platform +import ssl +import sys +from typing import Any + +import idna +import urllib3 + +from . import __version__ as requests_version + +try: + import charset_normalizer +except ImportError: + charset_normalizer = None + +try: + import chardet # type: ignore[import-not-found] +except ImportError: + chardet = None + +try: + from urllib3.contrib import pyopenssl +except ImportError: + pyopenssl = None + OpenSSL = None + cryptography = None +else: + import cryptography # type: ignore[import-not-found] + import OpenSSL # type: ignore[import-not-found] + + +def _implementation(): + """Return a dict with the Python implementation and version. + + Provide both the name and the version of the Python implementation + currently running. For example, on CPython 3.10.3 it will return + {'name': 'CPython', 'version': '3.10.3'}. + + This function works best on CPython and PyPy: in particular, it probably + doesn't work for Jython or IronPython. Future investigation should be done + to work out the correct shape of the code for those platforms. + """ + implementation = platform.python_implementation() + + if implementation == "CPython": + implementation_version = platform.python_version() + elif implementation == "PyPy": + pypy = sys.pypy_version_info # type: ignore[attr-defined] + implementation_version = f"{pypy.major}.{pypy.minor}.{pypy.micro}" + if sys.pypy_version_info.releaselevel != "final": # type: ignore[attr-defined] + implementation_version = "".join( + [implementation_version, sys.pypy_version_info.releaselevel] # type: ignore[attr-defined] + ) + elif implementation == "Jython": + implementation_version = platform.python_version() # Complete Guess + elif implementation == "IronPython": + implementation_version = platform.python_version() # Complete Guess + else: + implementation_version = "Unknown" + + return {"name": implementation, "version": implementation_version} + + +def info() -> dict[str, Any]: + """Generate information for a bug report.""" + try: + platform_info = { + "system": platform.system(), + "release": platform.release(), + } + except OSError: + platform_info = { + "system": "Unknown", + "release": "Unknown", + } + + implementation_info = _implementation() + urllib3_info = {"version": urllib3.__version__} # type: ignore[reportPrivateImportUsage] + charset_normalizer_info = {"version": None} + chardet_info: dict[str, str | None] = {"version": None} + if charset_normalizer: + charset_normalizer_info = {"version": charset_normalizer.__version__} + if chardet: + chardet_info = {"version": chardet.__version__} + + pyopenssl_info: dict[str, str | None] = { + "version": None, + "openssl_version": "", + } + if OpenSSL: + pyopenssl_info = { + "version": OpenSSL.__version__, + "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", + } + cryptography_info = { + "version": getattr(cryptography, "__version__", ""), + } + idna_info = { + "version": getattr(idna, "__version__", ""), + } + + system_ssl = ssl.OPENSSL_VERSION_NUMBER + system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""} # type: ignore[reportUnnecessaryComparison] + + return { + "platform": platform_info, + "implementation": implementation_info, + "system_ssl": system_ssl_info, + "using_pyopenssl": pyopenssl is not None, + "using_charset_normalizer": chardet is None, + "pyOpenSSL": pyopenssl_info, + "urllib3": urllib3_info, + "chardet": chardet_info, + "charset_normalizer": charset_normalizer_info, + "cryptography": cryptography_info, + "idna": idna_info, + "requests": { + "version": requests_version, + }, + } + + +def main(): + """Pretty-print the bug information as JSON.""" + print(json.dumps(info(), sort_keys=True, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/hooks.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/hooks.py new file mode 100644 index 0000000000000000000000000000000000000000..11ff9e9f27e76f5ef6b9b609e88c2f418d655e16 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/hooks.py @@ -0,0 +1,48 @@ +""" +requests.hooks +~~~~~~~~~~~~~~ + +This module provides the capabilities for the Requests hooks system. + +Available hooks: + +``response``: + The response generated from a Request. +""" + +from __future__ import annotations + +from collections.abc import Callable, Iterable +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from . import _types as _t + from .models import Response + +HOOKS: list[str] = ["response"] + + +def default_hooks() -> dict[str, list[_t.HookType]]: + return {event: [] for event in HOOKS} + + +# TODO: response is the only one + + +def dispatch_hook( + key: str, + hooks: _t.HooksInputType | None, + hook_data: Response, + **kwargs: Any, +) -> Response: + """Dispatches a hook dictionary on a given piece of data.""" + hooks_dict = hooks or {} + hook_list: Iterable[_t.HookType] | _t.HookType | None = hooks_dict.get(key) + if hook_list: + if isinstance(hook_list, Callable): + hook_list = [hook_list] + for hook in hook_list: + _hook_data = hook(hook_data, **kwargs) + if _hook_data is not None: + hook_data = _hook_data + return hook_data diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/models.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/models.py new file mode 100644 index 0000000000000000000000000000000000000000..4142f2a4bbf39820b46b414a15af805a34b1a013 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/models.py @@ -0,0 +1,1180 @@ +""" +requests.models +~~~~~~~~~~~~~~~ + +This module contains the primary objects that power Requests. +""" + +from __future__ import annotations + +import datetime + +# Import encoding now, to avoid implicit import later. +# Implicit import within threads may cause LookupError when standard library is in a ZIP, +# such as in Embedded Python. See https://github.com/psf/requests/issues/3578. +import encodings.idna # noqa: F401 # type: ignore[reportUnusedImport] +from collections.abc import Callable, Generator, Iterable, Iterator, Mapping +from io import UnsupportedOperation +from typing import ( + TYPE_CHECKING, + Any, + Final, + Literal, + cast, + overload, +) + +from urllib3.exceptions import ( + DecodeError, + LocationParseError, + ProtocolError, + ReadTimeoutError, + SSLError, +) +from urllib3.fields import RequestField +from urllib3.filepost import encode_multipart_formdata +from urllib3.util import parse_url + +from ._internal_utils import to_native_string, unicode_is_ascii +from ._types import SupportsRead as _SupportsRead +from .auth import HTTPBasicAuth +from .compat import ( + JSONDecodeError, + basestring, + builtin_str, + chardet, + cookielib, + urlencode, + urlsplit, + urlunparse, +) +from .compat import json as complexjson +from .cookies import ( + _copy_cookie_jar, # type: ignore[reportPrivateUsage] + cookiejar_from_dict, + get_cookie_header, +) +from .exceptions import ( + ChunkedEncodingError, + ConnectionError, + ContentDecodingError, + HTTPError, + InvalidJSONError, + InvalidURL, + MissingSchema, + StreamConsumedError, +) +from .exceptions import JSONDecodeError as RequestsJSONDecodeError +from .exceptions import SSLError as RequestsSSLError +from .hooks import default_hooks +from .status_codes import codes +from .structures import CaseInsensitiveDict +from .utils import ( + check_header_validity, + get_auth_from_url, + guess_filename, + guess_json_utf, + iter_slices, + parse_header_links, + requote_uri, + stream_decode_response_unicode, + super_len, + to_key_val_list, +) + +if TYPE_CHECKING: + from http.cookiejar import CookieJar + + from typing_extensions import Self + + from . import _types as _t + from .adapters import HTTPAdapter + from .cookies import RequestsCookieJar + +#: The set of HTTP status codes that indicate an automatically +#: processable redirect. +REDIRECT_STATI: Final[tuple[int, ...]] = ( # type: ignore[assignment] + codes.moved, # 301 + codes.found, # 302 + codes.other, # 303 + codes.temporary_redirect, # 307 + codes.permanent_redirect, # 308 +) + +DEFAULT_REDIRECT_LIMIT: int = 30 +CONTENT_CHUNK_SIZE: int = 10 * 1024 +ITER_CHUNK_SIZE: int = 512 + + +class RequestEncodingMixin: + url: str | None + + @property + def path_url(self) -> str: + """Build the path URL to use.""" + + url: list[str] = [] + + p = urlsplit(cast(str, self.url)) + + path = p.path + if not path: + path = "/" + + url.append(path) + + query = p.query + if query: + url.append("?") + url.append(query) + + return "".join(url) + + @overload + @staticmethod + def _encode_params(data: str) -> str: ... + + @overload + @staticmethod + def _encode_params(data: bytes) -> bytes: ... + + @overload + @staticmethod + def _encode_params( + data: _t.SupportsRead[str | bytes], + ) -> _t.SupportsRead[str | bytes]: ... + + @overload + @staticmethod + def _encode_params(data: _t.KVDataType) -> str: ... + + @staticmethod + def _encode_params( + data: _t.EncodableDataType, + ) -> str | bytes | _t.SupportsRead[str | bytes]: + """Encode parameters in a piece of data. + + Will successfully encode parameters when passed as a dict or a list of + 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary + if parameters are supplied as a dict. + """ + + if isinstance(data, (str, bytes)): + return data + elif isinstance(data, _SupportsRead): + return data + elif hasattr(data, "__iter__"): + result: list[tuple[bytes, bytes]] = [] + for k, vs in to_key_val_list(data): + if isinstance(vs, basestring) or not hasattr(vs, "__iter__"): + vs = [vs] + for v in vs: + if v is not None: + result.append( + ( + k.encode("utf-8") if isinstance(k, str) else k, + v.encode("utf-8") if isinstance(v, str) else v, + ) + ) + return urlencode(result, doseq=True) + else: + return data # type: ignore[return-value] # unreachable for valid _t.DataType + + @staticmethod + def _encode_files( + files: _t.FilesType, data: _t.RawDataType | None + ) -> tuple[bytes, str]: + """Build the body for a multipart/form-data request. + + Will successfully encode files when passed as a dict or a list of + tuples. Order is retained if data is a list of tuples but arbitrary + if parameters are supplied as a dict. + The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) + or 4-tuples (filename, fileobj, contentype, custom_headers). + """ + if not files: + raise ValueError("Files must be provided.") + elif isinstance(data, basestring): + raise ValueError("Data must not be a string.") + + new_fields: list[RequestField | tuple[str, bytes]] = [] + fields = to_key_val_list(data or {}) + files = to_key_val_list(files or {}) + + for field, val in fields: + if isinstance(val, basestring) or not hasattr(val, "__iter__"): + val = [val] + for v in val: + if v is not None: + # Don't call str() on bytestrings: in Py3 it all goes wrong. + if not isinstance(v, bytes): + v = str(v) + + new_fields.append( + ( + field.decode("utf-8") + if isinstance(field, bytes) + else field, + v.encode("utf-8") if isinstance(v, str) else v, + ) + ) + + for k, v in files: + # support for explicit filename + ft = None + fh = None + if isinstance(v, (tuple, list)): + if len(v) == 2: + fn, fp = v + elif len(v) == 3: + fn, fp, ft = v + else: + fn, fp, ft, fh = v + else: + fn = guess_filename(v) or k + fp = v + + if isinstance(fp, (str, bytes, bytearray)): + fdata = fp + elif isinstance(fp, _SupportsRead): # type: ignore[reportUnnecessaryIsInstance] # defensive check for untyped callers + fdata = fp.read() + elif fp is None: # type: ignore[reportUnnecessaryComparison] # defensive check for untyped callers + continue + else: + fdata = fp + + rf = RequestField(name=k, data=fdata, filename=fn, headers=fh) + rf.make_multipart(content_type=ft) + new_fields.append(rf) + + body, content_type = encode_multipart_formdata(new_fields) + + return body, content_type + + +class RequestHooksMixin: + hooks: dict[str, list[_t.HookType]] + + def register_hook( + self, event: str, hook: Iterable[_t.HookType] | _t.HookType + ) -> None: + """Properly register a hook.""" + + if event not in self.hooks: + raise ValueError(f'Unsupported event specified, with event name "{event}"') + + if isinstance(hook, Callable): + self.hooks[event].append(hook) + elif hasattr(hook, "__iter__"): + self.hooks[event].extend(h for h in hook if isinstance(h, Callable)) # type: ignore[reportUnnecessaryIsInstance] # defensive runtime filter + + def deregister_hook(self, event: str, hook: _t.HookType) -> bool: + """Deregister a previously registered hook. + Returns True if the hook existed, False if not. + """ + + try: + self.hooks[event].remove(hook) + return True + except ValueError: + return False + + +class Request(RequestHooksMixin): + """A user-created :class:`Request ` object. + + Used to prepare a :class:`PreparedRequest `, which is sent to the server. + + :param method: HTTP method to use. + :param url: URL to send. + :param headers: dictionary of headers to send. + :param files: dictionary of {filename: fileobject} files to multipart upload. + :param data: the body to attach to the request. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. + :param json: json for the body to attach to the request (if files or data is not specified). + :param params: URL parameters to append to the URL. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. + :param auth: Auth handler or (user, pass) tuple. + :param cookies: dictionary or CookieJar of cookies to attach to this request. + :param hooks: dictionary of callback hooks, for internal usage. + + Usage:: + + >>> import requests + >>> req = requests.Request('GET', 'https://httpbin.org/get') + >>> req.prepare() + + """ + + method: str | None + url: _t.UriType | None + headers: CaseInsensitiveDict[str] | Mapping[str, str | bytes] | None + files: _t.FilesType + data: _t.DataType + json: _t.JsonType + params: _t.ParamsType + auth: _t.AuthType + cookies: RequestsCookieJar | CookieJar | dict[str, str] | None + + def __init__( + self, + method: str | None = None, + url: _t.UriType | None = None, + headers: Mapping[str, str | bytes] | None = None, + files: _t.FilesType = None, + data: _t.DataType = None, + params: _t.ParamsType = None, + auth: _t.AuthType = None, + cookies: RequestsCookieJar | CookieJar | dict[str, str] | None = None, + hooks: _t.HooksInputType | None = None, + json: _t.JsonType = None, + ) -> None: + # Default empty dicts for dict params. + data = [] if data is None else data + files = [] if files is None else files + headers = {} if headers is None else headers + params = {} if params is None else params + hooks = {} if hooks is None else hooks + + self.hooks = default_hooks() + for k, v in list(hooks.items()): + self.register_hook(event=k, hook=v) + + self.method = method + self.url = url + self.headers = headers + self.files = files + self.data = data + self.json = json + self.params = params + self.auth = auth + self.cookies = cookies + + def __repr__(self) -> str: + return f"" + + def prepare(self) -> PreparedRequest: + """Constructs a :class:`PreparedRequest ` for transmission and returns it.""" + p = PreparedRequest() + p.prepare( + method=self.method, + url=self.url, + headers=self.headers, + files=self.files, + data=self.data, + json=self.json, + params=self.params, + auth=self.auth, + cookies=self.cookies, + hooks=self.hooks, + ) + return p + + +class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): + """The fully mutable :class:`PreparedRequest ` object, + containing the exact bytes that will be sent to the server. + + Instances are generated from a :class:`Request ` object, and + should not be instantiated manually; doing so may produce undesirable + effects. + + Usage:: + + >>> import requests + >>> req = requests.Request('GET', 'https://httpbin.org/get') + >>> r = req.prepare() + >>> r + + + >>> s = requests.Session() + >>> s.send(r) + + """ + + method: str | None + url: str | None + headers: CaseInsensitiveDict[str | bytes] + _cookies: RequestsCookieJar | CookieJar | None + body: _t.BodyType + hooks: dict[str, list[_t.HookType]] + _body_position: int | object | None + + def __init__(self) -> None: + #: HTTP verb to send to the server. + self.method = None + #: HTTP URL to send the request to. + self.url = None + #: dictionary of HTTP headers. + self.headers = None # type: ignore[assignment] + # The `CookieJar` used to create the Cookie header will be stored here + # after prepare_cookies is called + self._cookies = None + #: request body to send to the server. + self.body = None + #: dictionary of callback hooks, for internal usage. + self.hooks = default_hooks() + #: integer denoting starting position of a readable file-like body. + self._body_position = None + + def prepare( + self, + method: str | None = None, + url: _t.UriType | None = None, + headers: Mapping[str, str | bytes] | None = None, + files: _t.FilesType = None, + data: _t.DataType = None, + params: _t.ParamsType = None, + auth: _t.AuthType = None, + cookies: RequestsCookieJar | CookieJar | dict[str, str] | None = None, + hooks: _t.HooksInputType | None = None, + json: _t.JsonType = None, + ) -> None: + """Prepares the entire request with the given parameters.""" + + url = cast("_t.UriType", url) + self.prepare_method(method) + self.prepare_url(url, params) + self.prepare_headers(headers) + self.prepare_cookies(cookies) + self.prepare_body(data, files, json) + self.prepare_auth(auth, url) + + # Note that prepare_auth must be last to enable authentication schemes + # such as OAuth to work on a fully prepared request. + + # This MUST go after prepare_auth. Authenticators could add a hook + self.prepare_hooks(hooks) + + def __repr__(self) -> str: + return f"" + + def copy(self) -> PreparedRequest: + p = PreparedRequest() + p.method = self.method + p.url = self.url + p.headers = self.headers.copy() if self.headers is not None else None # type: ignore[assignment] + p._cookies = _copy_cookie_jar(self._cookies) + p.body = self.body + p.hooks = self.hooks + p._body_position = self._body_position + return p + + def prepare_method(self, method: str | None) -> None: + """Prepares the given HTTP method.""" + self.method = method + if self.method is not None: + self.method = to_native_string(self.method.upper()) + + @staticmethod + def _get_idna_encoded_host(host: str) -> str: + import idna + + try: + host = idna.encode(host, uts46=True).decode("utf-8") + except idna.IDNAError: + raise UnicodeError + return host + + def prepare_url( + self, + url: _t.UriType, + params: _t.ParamsType, + ) -> None: + """Prepares the given HTTP URL.""" + #: Accept objects that have string representations. + #: We're unable to blindly call unicode/str functions + #: as this will include the bytestring indicator (b'') + #: on python 3.x. + #: https://github.com/psf/requests/pull/2238 + if isinstance(url, bytes): + url = url.decode("utf8") + else: + url = str(url) + + # Remove leading whitespaces from url + url = url.lstrip() + + # Don't do any URL preparation for non-HTTP schemes like `mailto`, + # `data` etc to work around exceptions from `url_parse`, which + # handles RFC 3986 only. + if ":" in url and not url.lower().startswith("http"): + self.url = url + return + + # Support for unicode domain names and paths. + try: + scheme, auth, host, port, path, query, fragment = parse_url(url) + except LocationParseError as e: + raise InvalidURL(*e.args) + + if not scheme: + raise MissingSchema( + f"Invalid URL {url!r}: No scheme supplied. " + f"Perhaps you meant https://{url}?" + ) + + if not host: + raise InvalidURL(f"Invalid URL {url!r}: No host supplied") + + # In general, we want to try IDNA encoding the hostname if the string contains + # non-ASCII characters. This allows users to automatically get the correct IDNA + # behaviour. For strings containing only ASCII characters, we need to also verify + # it doesn't start with a wildcard (*), before allowing the unencoded hostname. + if not unicode_is_ascii(host): + try: + host = self._get_idna_encoded_host(host) + except UnicodeError: + raise InvalidURL("URL has an invalid label.") + elif host.startswith(("*", ".")): + raise InvalidURL("URL has an invalid label.") + + # Carefully reconstruct the network location + netloc = auth or "" + if netloc: + netloc += "@" + netloc += host + if port: + netloc += f":{port}" + + # Bare domains aren't valid URLs. + if not path: + path = "/" + + if isinstance(params, (str, bytes)): + params = to_native_string(params) + + if params is not None: + enc_params = self._encode_params(params) + else: + enc_params = "" + + if enc_params: + if query: + query = f"{query}&{enc_params}" + else: + query = enc_params + + url = requote_uri(urlunparse((scheme, netloc, path, "", query, fragment))) + self.url = url + + def prepare_headers(self, headers: Mapping[str, str | bytes] | None) -> None: + """Prepares the given HTTP headers.""" + + self.headers = CaseInsensitiveDict() + if headers: + for header in headers.items(): + # Raise exception on invalid header value. + check_header_validity(header) + name, value = header + self.headers[to_native_string(name)] = value + + def prepare_body( + self, data: _t.DataType, files: _t.FilesType, json: _t.JsonType = None + ) -> None: + """Prepares the given HTTP body data.""" + + # Check if file, fo, generator, iterator. + # If not, run through normal process. + + # Nottin' on you. + body = None + content_type = None + + if not data and json is not None: + # urllib3 requires a bytes-like body. Python 2's json.dumps + # provides this natively, but Python 3 gives a Unicode string. + content_type = "application/json" + + try: + body = complexjson.dumps(json, allow_nan=False) + except ValueError as ve: + raise InvalidJSONError(ve, request=self) + + if not isinstance(body, bytes): + body = body.encode("utf-8") + + if isinstance(data, Iterable) and not isinstance( + data, (str, bytes, list, tuple, Mapping) + ): + try: + length = super_len(data) + except (TypeError, AttributeError, UnsupportedOperation): + length = None + + body = data + + if getattr(body, "tell", None) is not None: + # Record the current file position before reading. + # This will allow us to rewind a file in the event + # of a redirect. + try: + self._body_position = body.tell() # type: ignore[union-attr] # guarded by getattr check + except OSError: + # This differentiates from None, allowing us to catch + # a failed `tell()` later when trying to rewind the body + self._body_position = object() + + if files: + raise NotImplementedError( + "Streamed bodies and files are mutually exclusive." + ) + + if length: + self.headers["Content-Length"] = builtin_str(length) + else: + self.headers["Transfer-Encoding"] = "chunked" + else: + # After is_stream filtering, remaining data is raw (not streamed) + raw_data = cast("_t.RawDataType | None", data) + + # Multi-part file uploads. + if files: + (body, content_type) = self._encode_files(files, raw_data) + else: + if raw_data: + body = self._encode_params(raw_data) + if isinstance(data, basestring) or isinstance(data, _SupportsRead): + content_type = None + else: + content_type = "application/x-www-form-urlencoded" + + self.prepare_content_length(body) + + # Add content-type if it wasn't explicitly provided. + if content_type and ("content-type" not in self.headers): + self.headers["Content-Type"] = content_type + + self.body = body # type: ignore[assignment] # body transforms from DataType to BodyType + + def prepare_content_length(self, body: _t.BodyType) -> None: + """Prepare Content-Length header based on request method and body""" + if body is not None: + length = super_len(body) + if length: + # If length exists, set it. Otherwise, we fallback + # to Transfer-Encoding: chunked. + self.headers["Content-Length"] = builtin_str(length) + elif ( + self.method not in ("GET", "HEAD") + and self.headers.get("Content-Length") is None + ): + # Set Content-Length to 0 for methods that can have a body + # but don't provide one. (i.e. not GET or HEAD) + self.headers["Content-Length"] = "0" + + def prepare_auth( + self, + auth: _t.AuthType, + url: _t.UriType = "", + ) -> None: + """Prepares the given HTTP auth data.""" + + # If no Auth is explicitly provided, extract it from the URL first. + if auth is None: + url_auth = get_auth_from_url(cast(str, self.url)) + auth = url_auth if any(url_auth) else None + + if auth: + if isinstance(auth, tuple) and len(auth) == 2: # type: ignore[arg-type] # pyright widens tuple from Callable in AuthType + # special-case basic HTTP auth + auth_handler = HTTPBasicAuth(*auth) # type: ignore[arg-type] # pyright widens tuple from Callable in AuthType + else: + # TODO: can be fixed by flipping the conditionals + auth_handler = cast("Callable[..., PreparedRequest]", auth) + + # Allow auth to make its changes. + r = auth_handler(self) + + # Update self to reflect the auth changes. + self.__dict__.update(r.__dict__) + + # Recompute Content-Length + self.prepare_content_length(self.body) + + def prepare_cookies( + self, cookies: RequestsCookieJar | CookieJar | dict[str, str] | None + ) -> None: + """Prepares the given HTTP cookie data. + + This function eventually generates a ``Cookie`` header from the + given cookies using cookielib. Due to cookielib's design, the header + will not be regenerated if it already exists, meaning this function + can only be called once for the life of the + :class:`PreparedRequest ` object. Any subsequent calls + to ``prepare_cookies`` will have no actual effect, unless the "Cookie" + header is removed beforehand. + """ + if isinstance(cookies, cookielib.CookieJar): + self._cookies = cookies + else: + self._cookies = cookiejar_from_dict(cookies) + + cookies_jar = cast("CookieJar", self._cookies) + cookie_header = get_cookie_header(cookies_jar, self) + if cookie_header is not None: + self.headers["Cookie"] = cookie_header + + def prepare_hooks(self, hooks: _t.HooksInputType | None) -> None: + """Prepares the given hooks.""" + # hooks can be passed as None to the prepare method and to this + # method. To prevent iterating over None, simply use an empty list + # if hooks is False-y + hooks = hooks or {} + for event in hooks: + self.register_hook(event, hooks[event]) + + +class Response: + """The :class:`Response ` object, which contains a + server's response to an HTTP request. + """ + + _content: bytes | Literal[False] | None + _content_consumed: bool + _next: PreparedRequest | None + status_code: int + headers: CaseInsensitiveDict[str] + raw: Any + url: str + encoding: str | None + history: list[Response] + reason: str | None + cookies: RequestsCookieJar + elapsed: datetime.timedelta + request: PreparedRequest + connection: HTTPAdapter + + __attrs__: list[str] = [ + "_content", + "status_code", + "headers", + "url", + "history", + "encoding", + "reason", + "cookies", + "elapsed", + "request", + ] + + def __init__(self) -> None: + self._content = False + self._content_consumed = False + self._next = None + + #: Integer Code of responded HTTP Status, e.g. 404 or 200. + self.status_code = None # type: ignore[assignment] + + #: Case-insensitive Dictionary of Response Headers. + #: For example, ``headers['content-encoding']`` will return the + #: value of a ``'Content-Encoding'`` response header. + self.headers = CaseInsensitiveDict() + + #: File-like object representation of response (for advanced usage). + #: Use of ``raw`` requires that ``stream=True`` be set on the request. + #: This requirement does not apply for use internally to Requests. + self.raw = None + + #: Final URL location of Response. + self.url = None # type: ignore[assignment] + + #: Encoding to decode with when accessing r.text. + self.encoding = None + + #: A list of :class:`Response ` objects from + #: the history of the Request. Any redirect responses will end + #: up here. The list is sorted from the oldest to the most recent request. + self.history = [] + + #: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK". + self.reason = None + + #: A CookieJar of Cookies the server sent back. + self.cookies = cookiejar_from_dict({}) + + #: The amount of time elapsed between sending the request + #: and the arrival of the response (as a timedelta). + #: This property specifically measures the time taken between sending + #: the first byte of the request and finishing parsing the headers. It + #: is therefore unaffected by consuming the response content or the + #: value of the ``stream`` keyword argument. + self.elapsed = datetime.timedelta(0) + + #: The :class:`PreparedRequest ` object to which this + #: is a response. + self.request = None # type: ignore[assignment] + + def __enter__(self) -> Self: + return self + + def __exit__(self, *args: Any) -> None: + self.close() + + def __getstate__(self) -> dict[str, Any]: + # Consume everything; accessing the content attribute makes + # sure the content has been fully read. + if not self._content_consumed: + self.content + + return {attr: getattr(self, attr, None) for attr in self.__attrs__} + + def __setstate__(self, state: dict[str, Any]) -> None: + for name, value in state.items(): + setattr(self, name, value) + + # pickled objects do not have .raw + setattr(self, "_content_consumed", True) + setattr(self, "raw", None) + + def __repr__(self) -> str: + return f"" + + def __bool__(self) -> bool: + """Returns True if :attr:`status_code` is less than 400. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code, is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + return self.ok + + def __nonzero__(self) -> bool: + """Returns True if :attr:`status_code` is less than 400. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code, is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + return self.ok + + def __iter__(self) -> Iterator[bytes]: + """Allows you to use a response as an iterator.""" + return self.iter_content(128) + + @property + def ok(self) -> bool: + """Returns True if :attr:`status_code` is less than 400, False if not. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + try: + self.raise_for_status() + except HTTPError: + return False + return True + + @property + def is_redirect(self) -> bool: + """True if this Response is a well-formed HTTP redirect that could have + been processed automatically (by :meth:`Session.resolve_redirects`). + """ + return "location" in self.headers and self.status_code in REDIRECT_STATI + + @property + def is_permanent_redirect(self) -> bool: + """True if this Response one of the permanent versions of redirect.""" + return "location" in self.headers and self.status_code in ( + codes.moved_permanently, + codes.permanent_redirect, + ) + + @property + def next(self) -> PreparedRequest | None: + """Returns a PreparedRequest for the next request in a redirect chain, if there is one.""" + return self._next + + @property + def apparent_encoding(self) -> str | None: + """The apparent encoding, provided by the charset_normalizer or chardet libraries.""" + if chardet is not None: + return chardet.detect(self.content)["encoding"] + else: + # If no character detection library is available, we'll fall back + # to a standard Python utf-8 str. + return "utf-8" + + @overload + def iter_content( + self, chunk_size: int | None = 1, decode_unicode: Literal[False] = False + ) -> Iterator[bytes]: ... + @overload + def iter_content( + self, chunk_size: int | None = 1, *, decode_unicode: Literal[True] + ) -> Iterator[str | bytes]: ... + def iter_content( + self, chunk_size: int | None = 1, decode_unicode: bool = False + ) -> Iterator[str | bytes]: + """Iterates over the response data. When stream=True is set on the + request, this avoids reading the content at once into memory for + large responses. The chunk size is the number of bytes it should + read into memory. This is not necessarily the length of each item + returned as decoding can take place. + + chunk_size must be of type int or None. A value of None will + function differently depending on the value of `stream`. + stream=True will read data as it arrives in whatever size the + chunks are received. If stream=False, data is returned as + a single chunk. + + If decode_unicode is True, content will be decoded using encoding + information from the response. If no encoding information is available, + bytes will be returned. This can be bypassed by manually setting + `encoding` on the response. + """ + + def generate() -> Generator[bytes, None, None]: + # Special case for urllib3. + if hasattr(self.raw, "stream"): + try: + yield from self.raw.stream(chunk_size, decode_content=True) + except ProtocolError as e: + raise ChunkedEncodingError(e) + except DecodeError as e: + raise ContentDecodingError(e) + except ReadTimeoutError as e: + raise ConnectionError(e) + except SSLError as e: + raise RequestsSSLError(e) + else: + # Standard file-like object. + while True: + chunk = self.raw.read(chunk_size) + if not chunk: + break + yield chunk + + self._content_consumed = True + + if self._content_consumed and isinstance(self._content, bool): + raise StreamConsumedError() + elif chunk_size is not None and not isinstance(chunk_size, int): # type: ignore[reportUnnecessaryIsInstance] # runtime guard for untyped callers + raise TypeError( + f"chunk_size must be an int, it is instead a {type(chunk_size)}." + ) + + if self._content_consumed: + # simulate reading small chunks of the content + content = cast(bytes, self._content) + chunks = iter_slices(content, chunk_size) + else: + chunks = generate() + + if decode_unicode: + chunks = stream_decode_response_unicode(chunks, self) + + return chunks + + @overload + def iter_lines( + self, + chunk_size: int = ITER_CHUNK_SIZE, + decode_unicode: Literal[False] = False, + delimiter: bytes | None = None, + ) -> Iterator[bytes]: ... + @overload + def iter_lines( + self, + chunk_size: int = ITER_CHUNK_SIZE, + *, + decode_unicode: Literal[True], + delimiter: str | bytes | None = None, + ) -> Iterator[str | bytes]: ... + def iter_lines( + self, + chunk_size: int = ITER_CHUNK_SIZE, + decode_unicode: bool = False, + delimiter: str | bytes | None = None, + ) -> Iterator[str | bytes]: + """Iterates over the response data, one line at a time. When + stream=True is set on the request, this avoids reading the + content at once into memory for large responses. + + The decode_unicode param works the same as in `iter_content`, with the + same caveats. + + .. note:: This method is not reentrant safe. + """ + + pending: str | bytes | None = None + + for chunk in self.iter_content( + chunk_size=chunk_size, decode_unicode=decode_unicode + ): + if pending is not None: + # TODO: remove cast after iter_lines rewrite + chunk = cast("str | bytes", pending + chunk) # type: ignore[operator] + + if delimiter: + lines = chunk.split(delimiter) # type: ignore[arg-type] + else: + lines = chunk.splitlines() + + if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: + pending = lines.pop() + else: + pending = None + + yield from lines + + if pending is not None: + yield pending + + @property + def content(self) -> bytes: + """Content of the response, in bytes.""" + + if self._content is False: + # Read the contents. + if self._content_consumed: + raise RuntimeError("The content for this response was already consumed") + + if self.status_code == 0 or self.raw is None: + self._content = None + else: + self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b"" + + self._content_consumed = True + # don't need to release the connection; that's been handled by urllib3 + # since we exhausted the data. + return self._content # type: ignore[return-value] + + @property + def text(self) -> str: + """Content of the response, in unicode. + + If Response.encoding is None, encoding will be guessed using + ``charset_normalizer`` or ``chardet``. + + The encoding of the response content is determined based solely on HTTP + headers, following RFC 2616 to the letter. If you can take advantage of + non-HTTP knowledge to make a better guess at the encoding, you should + set ``r.encoding`` appropriately before accessing this property. + """ + + # Try charset from content-type + content = None + encoding = self.encoding + + if not self.content: + return "" + + # Fallback to auto-detected encoding. + if self.encoding is None: + encoding = self.apparent_encoding + + # Decode unicode from given encoding. + try: + content = str(self.content, encoding or "utf-8", errors="replace") + except (LookupError, TypeError): + # A LookupError is raised if the encoding was not found which could + # indicate a misspelling or similar mistake. + # + # A TypeError can be raised if encoding is None + # + # So we try blindly encoding. + content = str(self.content, errors="replace") + + return content + + def json(self, **kwargs: Any) -> Any: + r"""Decodes the JSON response body (if any) as a Python object. + + This may return a dictionary, list, etc. depending on what is in the response. + + :param \*\*kwargs: Optional arguments that ``json.loads`` takes. + :raises requests.exceptions.JSONDecodeError: If the response body does not + contain valid json. + """ + + if not self.encoding and self.content and len(self.content) > 3: + # No encoding set. JSON RFC 4627 section 3 states we should expect + # UTF-8, -16 or -32. Detect which one to use; If the detection or + # decoding fails, fall back to `self.text` (using charset_normalizer to make + # a best guess). + encoding = guess_json_utf(self.content) + if encoding is not None: + try: + return complexjson.loads(self.content.decode(encoding), **kwargs) + except UnicodeDecodeError: + # Wrong UTF codec detected; usually because it's not UTF-8 + # but some other 8-bit codec. This is an RFC violation, + # and the server didn't bother to tell us what codec *was* + # used. + pass + except JSONDecodeError as e: + raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) + + try: + return complexjson.loads(self.text, **kwargs) + except JSONDecodeError as e: + # Catch JSON-related errors and raise as requests.JSONDecodeError + # This aliases json.JSONDecodeError and simplejson.JSONDecodeError + raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) + + @property + def links(self) -> dict[str, dict[str, str]]: + """Returns the parsed header links of the response, if any.""" + + header = self.headers.get("link") + + resolved_links: dict[str, dict[str, str]] = {} + + if header: + links = parse_header_links(header) + + for link in links: + key = link.get("rel") or link.get("url") + if key is not None: + resolved_links[key] = link + + return resolved_links + + def raise_for_status(self) -> None: + """Raises :class:`HTTPError`, if one occurred.""" + + http_error_msg = "" + if isinstance(self.reason, bytes): + # We attempt to decode utf-8 first because some servers + # choose to localize their reason strings. If the string + # isn't utf-8, we fall back to iso-8859-1 for all other + # encodings. (See PR #3538) + try: + reason = self.reason.decode("utf-8") + except UnicodeDecodeError: + reason = self.reason.decode("iso-8859-1") + else: + reason = self.reason + + if 400 <= self.status_code < 500: + http_error_msg = ( + f"{self.status_code} Client Error: {reason} for url: {self.url}" + ) + + elif 500 <= self.status_code < 600: + http_error_msg = ( + f"{self.status_code} Server Error: {reason} for url: {self.url}" + ) + + if http_error_msg: + raise HTTPError(http_error_msg, response=self) + + def close(self) -> None: + """Releases the connection back to the pool. Once this method has been + called the underlying ``raw`` object must not be accessed again. + + *Note: Should not normally need to be called explicitly.* + """ + if not self._content_consumed: + self.raw.close() + + release_conn = getattr(self.raw, "release_conn", None) + if release_conn is not None: + release_conn() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/packages.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/packages.py new file mode 100644 index 0000000000000000000000000000000000000000..5ab3d8e250de8475cb22553f564e5444e02c7460 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/packages.py @@ -0,0 +1,23 @@ +import sys + +from .compat import chardet + +# This code exists for backwards compatibility reasons. +# I don't like it either. Just look the other way. :) + +for package in ("urllib3", "idna"): + locals()[package] = __import__(package) + # This traversal is apparently necessary such that the identities are + # preserved (requests.packages.urllib3.* is urllib3.*) + for mod in list(sys.modules): + if mod == package or mod.startswith(f"{package}."): + sys.modules[f"requests.packages.{mod}"] = sys.modules[mod] + +if chardet is not None: + target = chardet.__name__ + for mod in list(sys.modules): + if mod == target or mod.startswith(f"{target}."): + imported_mod = sys.modules[mod] + sys.modules[f"requests.packages.{mod}"] = imported_mod + mod = mod.replace(target, "chardet") + sys.modules[f"requests.packages.{mod}"] = imported_mod diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/sessions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/sessions.py new file mode 100644 index 0000000000000000000000000000000000000000..8f13887d187deda256e08f305950a56a9c145ea5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/sessions.py @@ -0,0 +1,920 @@ +""" +requests.sessions +~~~~~~~~~~~~~~~~~ + +This module provides a Session object to manage and persist settings across +requests (cookies, auth, proxies). +""" + +from __future__ import annotations + +import os +import sys +import time +from collections import OrderedDict +from collections.abc import Generator, Mapping, MutableMapping +from datetime import timedelta +from typing import TYPE_CHECKING, Any, cast + +from ._internal_utils import to_native_string +from ._types import is_prepared as _is_prepared +from .adapters import HTTPAdapter +from .auth import _basic_auth_str # type: ignore[reportPrivateUsage] +from .compat import cookielib, urljoin, urlparse +from .cookies import ( + RequestsCookieJar, + cookiejar_from_dict, + extract_cookies_to_jar, + merge_cookies, +) +from .exceptions import ( + ChunkedEncodingError, + ContentDecodingError, + InvalidSchema, + TooManyRedirects, +) +from .hooks import default_hooks, dispatch_hook + +# formerly defined here, reexposed here for backward compatibility +from .models import ( # noqa: F401 + DEFAULT_REDIRECT_LIMIT, + REDIRECT_STATI, # type: ignore[reportUnusedImport] + PreparedRequest, + Request, + Response, +) +from .status_codes import codes +from .structures import CaseInsensitiveDict +from .utils import ( # noqa: F401 + DEFAULT_PORTS, + default_headers, + get_auth_from_url, + get_environ_proxies, + get_netrc_auth, + requote_uri, + resolve_proxies, + rewind_body, + should_bypass_proxies, # type: ignore[reportUnusedImport] # re-export for external consumers + to_key_val_list, +) + +if TYPE_CHECKING: + from http.cookiejar import CookieJar + + from typing_extensions import Self, Unpack + + from . import _types as _t + from .adapters import BaseAdapter + +# Preferred clock, based on which one is more accurate on a given system. +if sys.platform == "win32": + preferred_clock = time.perf_counter +else: + preferred_clock = time.time + + +def merge_setting( + request_setting: Any, session_setting: Any, dict_class: type = OrderedDict +) -> Any: + """Determines appropriate setting for a given request, taking into account + the explicit setting on that request, and the setting in the session. If a + setting is a dictionary, they will be merged together using `dict_class` + """ + + if session_setting is None: + return request_setting + + if request_setting is None: + return session_setting + + # Bypass if not a dictionary (e.g. verify) + if not ( + isinstance(session_setting, Mapping) and isinstance(request_setting, Mapping) + ): + return request_setting + + merged_setting = dict_class(to_key_val_list(session_setting)) # type: ignore[arg-type] # isinstance narrows Any to Mapping[Unknown] + merged_setting.update(to_key_val_list(request_setting)) # type: ignore[arg-type] + + # Remove keys that are set to None. Extract keys first to avoid altering + # the dictionary during iteration. + none_keys = [k for (k, v) in merged_setting.items() if v is None] + for key in none_keys: + del merged_setting[key] + + return merged_setting + + +def merge_hooks( + request_hooks: _t.HooksType, + session_hooks: _t.HooksType, + dict_class: type = OrderedDict, +) -> _t.HooksType: + """Properly merges both requests and session hooks. + + This is necessary because when request_hooks == {'response': []}, the + merge breaks Session hooks entirely. + """ + if session_hooks is None or session_hooks.get("response") == []: + return request_hooks + + if request_hooks is None or request_hooks.get("response") == []: + return session_hooks + + return merge_setting(request_hooks, session_hooks, dict_class) + + +class SessionRedirectMixin: + max_redirects: int + trust_env: bool + cookies: RequestsCookieJar + + def send(self, request: PreparedRequest, **kwargs: Any) -> Response: ... + + def get_redirect_target(self, resp: Response) -> str | None: + """Receives a Response. Returns a redirect URI or ``None``""" + # Due to the nature of how requests processes redirects this method will + # be called at least once upon the original response and at least twice + # on each subsequent redirect response (if any). + # If a custom mixin is used to handle this logic, it may be advantageous + # to cache the redirect location onto the response object as a private + # attribute. + if resp.is_redirect: + location = resp.headers["location"] + # Currently the underlying http module on py3 decode headers + # in latin1, but empirical evidence suggests that latin1 is very + # rarely used with non-ASCII characters in HTTP headers. + # It is more likely to get UTF8 header rather than latin1. + # This causes incorrect handling of UTF8 encoded location headers. + # To solve this, we re-encode the location in latin1. + location = location.encode("latin1") + return to_native_string(location, "utf8") + return None + + def should_strip_auth(self, old_url: str, new_url: str) -> bool: + """Decide whether Authorization header should be removed when redirecting""" + old_parsed = urlparse(old_url) + new_parsed = urlparse(new_url) + if old_parsed.hostname != new_parsed.hostname: + return True + # Special case: allow http -> https redirect when using the standard + # ports. This isn't specified by RFC 7235, but is kept to avoid + # breaking backwards compatibility with older versions of requests + # that allowed any redirects on the same host. + if ( + old_parsed.scheme == "http" + and old_parsed.port in (80, None) + and new_parsed.scheme == "https" + and new_parsed.port in (443, None) + ): + return False + + # Handle default port usage corresponding to scheme. + changed_port = old_parsed.port != new_parsed.port + changed_scheme = old_parsed.scheme != new_parsed.scheme + default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) + if ( + not changed_scheme + and old_parsed.port in default_port + and new_parsed.port in default_port + ): + return False + + # Standard case: root URI must match + return changed_port or changed_scheme + + def resolve_redirects( + self, + resp: Response, + req: PreparedRequest, + stream: bool = False, + timeout: _t.TimeoutType = None, + verify: _t.VerifyType = True, + cert: _t.CertType = None, + proxies: dict[str, str] | None = None, + yield_requests: bool = False, + **adapter_kwargs: Any, + ) -> Generator[Response, None, None]: + """Receives a Response. Returns a generator of Responses or Requests.""" + + hist: list[Response] = [] # keep track of history + + url = self.get_redirect_target(resp) + previous_fragment = urlparse(req.url).fragment + while url: + prepared_request = req.copy() + + # Update history and keep track of redirects. + resp.history = hist[:] + hist.append(resp) + + try: + resp.content # Consume socket so it can be released + except (ChunkedEncodingError, ContentDecodingError, RuntimeError): + resp.raw.read(decode_content=False) + + if len(resp.history) >= self.max_redirects: + raise TooManyRedirects( + f"Exceeded {self.max_redirects} redirects.", response=resp + ) + + # Release the connection back into the pool. + resp.close() + + # Handle redirection without scheme (see: RFC 1808 Section 4) + if url.startswith("//"): + parsed_rurl = urlparse(resp.url) + url = ":".join([to_native_string(parsed_rurl.scheme), url]) + + # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2) + parsed = urlparse(url) + if parsed.fragment == "" and previous_fragment: + parsed = parsed._replace(fragment=previous_fragment) + elif parsed.fragment: + previous_fragment = parsed.fragment + url = parsed.geturl() + + # Facilitate relative 'location' headers, as allowed by RFC 7231. + # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') + # Compliant with RFC3986, we percent encode the url. + if not parsed.netloc: + url = urljoin(resp.url, requote_uri(url)) + else: + url = requote_uri(url) + + prepared_request.url = to_native_string(url) + + self.rebuild_method(prepared_request, resp) + + # https://github.com/psf/requests/issues/1084 + if resp.status_code not in ( + codes.temporary_redirect, + codes.permanent_redirect, + ): + # https://github.com/psf/requests/issues/3490 + purged_headers = ("Content-Length", "Content-Type", "Transfer-Encoding") + for header in purged_headers: + prepared_request.headers.pop(header, None) + prepared_request.body = None + + headers = prepared_request.headers + headers.pop("Cookie", None) + + # Extract any cookies sent on the response to the cookiejar + # in the new request. Because we've mutated our copied prepared + # request, use the old one that we haven't yet touched. + cookie_jar = cast("CookieJar", prepared_request._cookies) # type: ignore[reportPrivateUsage] + extract_cookies_to_jar(cookie_jar, req, resp.raw) + merge_cookies(cookie_jar, self.cookies) + prepared_request.prepare_cookies(cookie_jar) + + # Rebuild auth and proxy information. + proxies = self.rebuild_proxies(prepared_request, proxies) + self.rebuild_auth(prepared_request, resp) + + # A failed tell() sets `_body_position` to `object()`. This non-None + # value ensures `rewindable` will be True, allowing us to raise an + # UnrewindableBodyError, instead of hanging the connection. + rewindable = prepared_request._body_position is not None and ( # type: ignore[reportPrivateUsage] + "Content-Length" in headers or "Transfer-Encoding" in headers + ) + + # Attempt to rewind consumed file-like object. + if rewindable: + rewind_body(prepared_request) + + # Override the original request. + req = prepared_request + + if yield_requests: + yield req # type: ignore[misc] # Internal use only, returns PreparedRequest + else: + resp = self.send( + req, + stream=stream, + timeout=timeout, + verify=verify, + cert=cert, + proxies=proxies, + allow_redirects=False, + **adapter_kwargs, + ) + + extract_cookies_to_jar(self.cookies, prepared_request, resp.raw) + + # extract redirect url, if any, for the next loop + url = self.get_redirect_target(resp) + yield resp + + def rebuild_auth( + self, prepared_request: PreparedRequest, response: Response + ) -> None: + """When being redirected we may want to strip authentication from the + request to avoid leaking credentials. This method intelligently removes + and reapplies authentication where possible to avoid credential loss. + """ + original_request = response.request + assert _is_prepared(original_request) + assert _is_prepared(prepared_request) + + headers = prepared_request.headers + original_url = original_request.url + url = prepared_request.url + + if "Authorization" in headers and self.should_strip_auth(original_url, url): + # If we get redirected to a new host, we should strip out any + # authentication headers. + del headers["Authorization"] + + # .netrc might have more auth for us on our new host. + new_auth = get_netrc_auth(url) if self.trust_env else None + if new_auth is not None: + prepared_request.prepare_auth(new_auth) + + def rebuild_proxies( + self, + prepared_request: PreparedRequest, + proxies: dict[str, str] | None, + ) -> dict[str, str]: + """This method re-evaluates the proxy configuration by considering the + environment variables. If we are redirected to a URL covered by + NO_PROXY, we strip the proxy configuration. Otherwise, we set missing + proxy keys for this URL (in case they were stripped by a previous + redirect). + + This method also replaces the Proxy-Authorization header where + necessary. + + :rtype: dict + """ + assert _is_prepared(prepared_request) + headers = prepared_request.headers + scheme = urlparse(prepared_request.url).scheme + new_proxies = resolve_proxies(prepared_request, proxies, self.trust_env) + + if "Proxy-Authorization" in headers: + del headers["Proxy-Authorization"] + + try: + username, password = get_auth_from_url(new_proxies[scheme]) + except KeyError: + username, password = None, None + + # urllib3 handles proxy authorization for us in the standard adapter. + # Avoid appending this to TLS tunneled requests where it may be leaked. + if not scheme.startswith("https") and username and password: + headers["Proxy-Authorization"] = _basic_auth_str(username, password) + + return new_proxies + + def rebuild_method( + self, prepared_request: PreparedRequest, response: Response + ) -> None: + """When being redirected we may want to change the method of the request + based on certain specs or browser behavior. + """ + method = prepared_request.method + + # https://tools.ietf.org/html/rfc7231#section-6.4.4 + if response.status_code == codes.see_other and method != "HEAD": + method = "GET" + + # Do what the browsers do, despite standards... + # First, turn 302s into GETs. + if response.status_code == codes.found and method != "HEAD": + method = "GET" + + # Second, if a POST is responded to with a 301, turn it into a GET. + # This bizarre behaviour is explained in Issue 1704. + if response.status_code == codes.moved and method == "POST": + method = "GET" + + prepared_request.method = method + + +class Session(SessionRedirectMixin): + """A Requests session. + + Provides cookie persistence, connection-pooling, and configuration. + + Basic Usage:: + + >>> import requests + >>> s = requests.Session() + >>> s.get('https://httpbin.org/get') + + + Or as a context manager:: + + >>> with requests.Session() as s: + ... s.get('https://httpbin.org/get') + + """ + + headers: CaseInsensitiveDict[str] + auth: _t.AuthType + proxies: dict[str, str] + hooks: dict[str, list[_t.HookType]] + params: MutableMapping[str, Any] + stream: bool + verify: _t.VerifyType + cert: _t.CertType + max_redirects: int + trust_env: bool + cookies: RequestsCookieJar + adapters: MutableMapping[str, BaseAdapter] + + __attrs__: list[str] = [ + "headers", + "cookies", + "auth", + "proxies", + "hooks", + "params", + "verify", + "cert", + "adapters", + "stream", + "trust_env", + "max_redirects", + ] + + def __init__(self) -> None: + #: A case-insensitive dictionary of headers to be sent on each + #: :class:`Request ` sent from this + #: :class:`Session `. + self.headers = default_headers() + + #: Default Authentication tuple or object to attach to + #: :class:`Request `. + self.auth = None + + #: Dictionary mapping protocol or protocol and host to the URL of the proxy + #: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to + #: be used on each :class:`Request `. + self.proxies = {} + + #: Event-handling hooks. + self.hooks = default_hooks() + + #: Dictionary of querystring data to attach to each + #: :class:`Request `. The dictionary values may be lists for + #: representing multivalued query parameters. + self.params = {} + + #: Stream response content default. + self.stream = False + + #: SSL Verification default. + #: Defaults to `True`, requiring requests to verify the TLS certificate at the + #: remote end. + #: If verify is set to `False`, requests will accept any TLS certificate + #: presented by the server, and will ignore hostname mismatches and/or + #: expired certificates, which will make your application vulnerable to + #: man-in-the-middle (MitM) attacks. + #: Only set this to `False` for testing. + #: If verify is set to a string, it must be the path to a CA bundle file + #: that will be used to verify the TLS certificate. + self.verify = True + + #: SSL client certificate default, if String, path to ssl client + #: cert file (.pem). If Tuple, ('cert', 'key') pair. + self.cert = None + + #: Maximum number of redirects allowed. If the request exceeds this + #: limit, a :class:`TooManyRedirects` exception is raised. + #: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is + #: 30. + self.max_redirects = DEFAULT_REDIRECT_LIMIT + + #: Trust environment settings for proxy configuration, default + #: authentication and similar. + self.trust_env = True + + #: A CookieJar containing all currently outstanding cookies set on this + #: session. By default it is a + #: :class:`RequestsCookieJar `, but + #: may be any other ``cookielib.CookieJar`` compatible object. + self.cookies = cookiejar_from_dict({}) + + # Default connection adapters. + self.adapters = OrderedDict() + self.mount("https://", HTTPAdapter()) + self.mount("http://", HTTPAdapter()) + + def __enter__(self) -> Self: + return self + + def __exit__(self, *args: Any) -> None: + self.close() + + def prepare_request(self, request: Request) -> PreparedRequest: + """Constructs a :class:`PreparedRequest ` for + transmission and returns it. The :class:`PreparedRequest` has settings + merged from the :class:`Request ` instance and those of the + :class:`Session`. + + :param request: :class:`Request` instance to prepare with this + session's settings. + :rtype: requests.PreparedRequest + """ + url = cast("_t.UriType", request.url) + method = cast(str, request.method) + + cookies = request.cookies or {} + + # Bootstrap CookieJar. + if not isinstance(cookies, cookielib.CookieJar): + cookies = cookiejar_from_dict(cookies) + + # Merge with session cookies + merged_cookies = merge_cookies( + merge_cookies(RequestsCookieJar(), self.cookies), cookies + ) + + # Set environment's basic authentication if not explicitly set. + auth = request.auth + if self.trust_env and not auth and not self.auth: + auth = get_netrc_auth(url) + + p = PreparedRequest() + p.prepare( + method=method.upper(), + url=url, + files=request.files, + data=request.data, + json=request.json, + headers=merge_setting( + request.headers, self.headers, dict_class=CaseInsensitiveDict + ), + params=merge_setting(request.params, self.params), + auth=merge_setting(auth, self.auth), + cookies=merged_cookies, + hooks=merge_hooks(request.hooks, self.hooks), + ) + return p + + def request( + self, + method: str, + url: _t.UriType, + params: _t.ParamsType = None, + data: _t.DataType = None, + headers: Mapping[str, str | bytes] | None = None, + cookies: RequestsCookieJar | CookieJar | dict[str, str] | None = None, + files: _t.FilesType = None, + auth: _t.AuthType = None, + timeout: _t.TimeoutType = None, + allow_redirects: bool = True, + proxies: dict[str, str] | None = None, + hooks: _t.HooksInputType | None = None, + stream: bool | None = None, + verify: _t.VerifyType | None = None, + cert: _t.CertType = None, + json: _t.JsonType = None, + ) -> Response: + """Constructs a :class:`Request `, prepares it and sends it. + Returns :class:`Response ` object. + + :param method: method for the new :class:`Request` object. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary or bytes to be sent in the query + string for the :class:`Request`. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) json to send in the body of the + :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the + :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the + :class:`Request`. + :param files: (optional) Dictionary of ``'filename': file-like-objects`` + for multipart encoding upload. + :param auth: (optional) Auth tuple or callable to enable + Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) How many seconds to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple + :param allow_redirects: (optional) Set to True by default. + :type allow_redirects: bool + :param proxies: (optional) Dictionary mapping protocol or protocol and + hostname to the URL of the proxy. + :param hooks: (optional) Dictionary mapping hook name to one event or + list of events, event must be callable. + :param stream: (optional) whether to immediately download the response + content. Defaults to ``False``. + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use. Defaults to ``True``. When set to + ``False``, requests will accept any TLS certificate presented by + the server, and will ignore hostname mismatches and/or expired + certificates, which will make your application vulnerable to + man-in-the-middle (MitM) attacks. Setting verify to ``False`` + may be useful during local development or testing. + :param cert: (optional) if String, path to ssl client cert file (.pem). + If Tuple, ('cert', 'key') pair. + :rtype: requests.Response + """ + if isinstance(url, bytes): + url = url.decode("utf-8") + + # Create the Request. + req = Request( + method=method.upper(), + url=url, + headers=headers, + files=files, + data=data or {}, + json=json, + params=params or {}, + auth=auth, + cookies=cookies, + hooks=hooks, + ) + prep = self.prepare_request(req) + + assert _is_prepared(prep) + + proxies = proxies or {} + + settings = self.merge_environment_settings( + prep.url, proxies, stream, verify, cert + ) + + # Send the request. + send_kwargs = { + "timeout": timeout, + "allow_redirects": allow_redirects, + } + send_kwargs.update(settings) + resp = self.send(prep, **send_kwargs) + + return resp + + def get( + self, + url: _t.UriType, + params: _t.ParamsType = None, + **kwargs: Unpack[_t.GetKwargs], + ) -> Response: + r"""Sends a GET request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", True) + return self.request("GET", url, params=params, **kwargs) + + def options(self, url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs]) -> Response: + r"""Sends a OPTIONS request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", True) + return self.request("OPTIONS", url, **kwargs) + + def head(self, url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs]) -> Response: + r"""Sends a HEAD request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", False) + return self.request("HEAD", url, **kwargs) + + def post( + self, + url: _t.UriType, + data: _t.DataType = None, + json: _t.JsonType = None, + **kwargs: Unpack[_t.PostKwargs], + ) -> Response: + r"""Sends a POST request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) json to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("POST", url, data=data, json=json, **kwargs) + + def put( + self, url: _t.UriType, data: _t.DataType = None, **kwargs: Unpack[_t.DataKwargs] + ) -> Response: + r"""Sends a PUT request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("PUT", url, data=data, **kwargs) + + def patch( + self, url: _t.UriType, data: _t.DataType = None, **kwargs: Unpack[_t.DataKwargs] + ) -> Response: + r"""Sends a PATCH request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("PATCH", url, data=data, **kwargs) + + def delete(self, url: _t.UriType, **kwargs: Unpack[_t.RequestKwargs]) -> Response: + r"""Sends a DELETE request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("DELETE", url, **kwargs) + + def send(self, request: PreparedRequest, **kwargs: Any) -> Response: + """Send a given PreparedRequest. + + :rtype: requests.Response + """ + # Set defaults that the hooks can utilize to ensure they always have + # the correct parameters to reproduce the previous request. + kwargs.setdefault("stream", self.stream) + kwargs.setdefault("verify", self.verify) + kwargs.setdefault("cert", self.cert) + if "proxies" not in kwargs: + kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env) + + # It's possible that users might accidentally send a Request object. + # Guard against that specific failure case. + if isinstance(request, Request): + raise ValueError("You can only send PreparedRequests.") + + assert _is_prepared(request) + + # Set up variables needed for resolve_redirects and dispatching of hooks + allow_redirects = kwargs.pop("allow_redirects", True) + stream = kwargs.get("stream") + hooks = request.hooks + + # Get the appropriate adapter to use + adapter = self.get_adapter(url=request.url) + + # Start time (approximately) of the request + start = preferred_clock() + + # Send the request + r = adapter.send(request, **kwargs) + + # Total elapsed time of the request (approximately) + elapsed = preferred_clock() - start + r.elapsed = timedelta(seconds=elapsed) + + # Response manipulation hooks + r = dispatch_hook("response", hooks, r, **kwargs) + + # Persist cookies + if r.history: + # If the hooks create history then we want those cookies too + for resp in r.history: + extract_cookies_to_jar(self.cookies, resp.request, resp.raw) + + extract_cookies_to_jar(self.cookies, request, r.raw) + + # Resolve redirects if allowed. + if allow_redirects: + # Redirect resolving generator. + gen = self.resolve_redirects(r, request, **kwargs) + history = [resp for resp in gen] + else: + history = [] + + # Shuffle things around if there's history. + if history: + # Insert the first (original) request at the start + history.insert(0, r) + # Get the last request made + r = history.pop() + r.history = history + + # If redirects aren't being followed, store the response on the Request for Response.next(). + if not allow_redirects: + try: + r._next = next( # type: ignore[assignment] # yield_requests=True returns PreparedRequest + self.resolve_redirects(r, request, yield_requests=True, **kwargs) + ) + except StopIteration: + pass + + if not stream: + r.content + + return r + + def merge_environment_settings( + self, + url: str, + proxies: dict[str, str] | None, + stream: bool | None, + verify: _t.VerifyType | None, + cert: _t.CertType, + ) -> dict[str, Any]: + """ + Check the environment and merge it with some settings. + + :rtype: dict + """ + # Gather clues from the surrounding environment. + if self.trust_env: + # Set environment's proxies. + no_proxy = proxies.get("no_proxy") if proxies is not None else None + env_proxies = get_environ_proxies(url, no_proxy=no_proxy) + if proxies is not None: + for k, v in env_proxies.items(): + proxies.setdefault(k, v) + + # Look for requests environment configuration + # and be compatible with cURL. + if verify is True or verify is None: + verify = ( + os.environ.get("REQUESTS_CA_BUNDLE") + or os.environ.get("CURL_CA_BUNDLE") + or verify + ) + + # Merge all the kwargs. + proxies = merge_setting(proxies, self.proxies) + stream = merge_setting(stream, self.stream) + verify = merge_setting(verify, self.verify) + cert = merge_setting(cert, self.cert) + + return {"proxies": proxies, "stream": stream, "verify": verify, "cert": cert} + + def get_adapter(self, url: str) -> BaseAdapter: + """ + Returns the appropriate connection adapter for the given URL. + + :rtype: requests.adapters.BaseAdapter + """ + for prefix, adapter in self.adapters.items(): + if url.lower().startswith(prefix.lower()): + return adapter + + # Nothing matches :-/ + raise InvalidSchema(f"No connection adapters were found for {url!r}") + + def close(self) -> None: + """Closes all adapters and as such the session""" + for v in self.adapters.values(): + v.close() + + def mount(self, prefix: str, adapter: BaseAdapter) -> None: + """Registers a connection adapter to a prefix. + + Adapters are sorted in descending order by prefix length. + """ + self.adapters[prefix] = adapter + keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] + + for key in keys_to_move: + self.adapters[key] = self.adapters.pop(key) + + def __getstate__(self) -> dict[str, Any]: + state = {attr: getattr(self, attr, None) for attr in self.__attrs__} + return state + + def __setstate__(self, state: dict[str, Any]) -> None: + for attr, value in state.items(): + setattr(self, attr, value) + + +def session() -> Session: + """ + Returns a :class:`Session` for context-management. + + .. deprecated:: 1.0.0 + + This method has been deprecated since version 1.0.0 and is only kept for + backwards compatibility. New code should use :class:`~requests.sessions.Session` + to create a session. This may be removed at a future date. + + :rtype: Session + """ + return Session() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/status_codes.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/status_codes.py new file mode 100644 index 0000000000000000000000000000000000000000..6c59d6baec83bd82055106a5d2cea08fa1195274 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/status_codes.py @@ -0,0 +1,128 @@ +r""" +The ``codes`` object defines a mapping from common names for HTTP statuses +to their numerical codes, accessible either as attributes or as dictionary +items. + +Example:: + + >>> import requests + >>> requests.codes['temporary_redirect'] + 307 + >>> requests.codes.teapot + 418 + >>> requests.codes['\o/'] + 200 + +Some codes have multiple names, and both upper- and lower-case versions of +the names are allowed. For example, ``codes.ok``, ``codes.OK``, and +``codes.okay`` all correspond to the HTTP status code 200. +""" + +from .structures import LookupDict + +_codes = { + # Informational. + 100: ("continue",), + 101: ("switching_protocols",), + 102: ("processing", "early-hints"), + 103: ("checkpoint",), + 122: ("uri_too_long", "request_uri_too_long"), + 200: ("ok", "okay", "all_ok", "all_okay", "all_good", "\\o/", "✓"), + 201: ("created",), + 202: ("accepted",), + 203: ("non_authoritative_info", "non_authoritative_information"), + 204: ("no_content",), + 205: ("reset_content", "reset"), + 206: ("partial_content", "partial"), + 207: ("multi_status", "multiple_status", "multi_stati", "multiple_stati"), + 208: ("already_reported",), + 226: ("im_used",), + # Redirection. + 300: ("multiple_choices",), + 301: ("moved_permanently", "moved", "\\o-"), + 302: ("found",), + 303: ("see_other", "other"), + 304: ("not_modified",), + 305: ("use_proxy",), + 306: ("switch_proxy",), + 307: ("temporary_redirect", "temporary_moved", "temporary"), + 308: ( + "permanent_redirect", + "resume_incomplete", + "resume", + ), # "resume" and "resume_incomplete" to be removed in 3.0 + # Client Error. + 400: ("bad_request", "bad"), + 401: ("unauthorized",), + 402: ("payment_required", "payment"), + 403: ("forbidden",), + 404: ("not_found", "-o-"), + 405: ("method_not_allowed", "not_allowed"), + 406: ("not_acceptable",), + 407: ("proxy_authentication_required", "proxy_auth", "proxy_authentication"), + 408: ("request_timeout", "timeout"), + 409: ("conflict",), + 410: ("gone",), + 411: ("length_required",), + 412: ("precondition_failed", "precondition"), + 413: ("request_entity_too_large", "content_too_large"), + 414: ("request_uri_too_large", "uri_too_long"), + 415: ("unsupported_media_type", "unsupported_media", "media_type"), + 416: ( + "requested_range_not_satisfiable", + "requested_range", + "range_not_satisfiable", + ), + 417: ("expectation_failed",), + 418: ("im_a_teapot", "teapot", "i_am_a_teapot"), + 421: ("misdirected_request",), + 422: ("unprocessable_entity", "unprocessable", "unprocessable_content"), + 423: ("locked",), + 424: ("failed_dependency", "dependency"), + 425: ("unordered_collection", "unordered", "too_early"), + 426: ("upgrade_required", "upgrade"), + 428: ("precondition_required", "precondition"), + 429: ("too_many_requests", "too_many"), + 431: ("header_fields_too_large", "fields_too_large"), + 444: ("no_response", "none"), + 449: ("retry_with", "retry"), + 450: ("blocked_by_windows_parental_controls", "parental_controls"), + 451: ("unavailable_for_legal_reasons", "legal_reasons"), + 499: ("client_closed_request",), + # Server Error. + 500: ("internal_server_error", "server_error", "/o\\", "✗"), + 501: ("not_implemented",), + 502: ("bad_gateway",), + 503: ("service_unavailable", "unavailable"), + 504: ("gateway_timeout",), + 505: ("http_version_not_supported", "http_version"), + 506: ("variant_also_negotiates",), + 507: ("insufficient_storage",), + 509: ("bandwidth_limit_exceeded", "bandwidth"), + 510: ("not_extended",), + 511: ("network_authentication_required", "network_auth", "network_authentication"), +} + +codes: LookupDict[int] = LookupDict(name="status_codes") + + +def _init(): + for code, titles in _codes.items(): + for title in titles: + setattr(codes, title, code) + if not title.startswith(("\\", "/")): + setattr(codes, title.upper(), code) + + def doc(code: int) -> str: + names = ", ".join(f"``{n}``" for n in _codes[code]) + return "* %d: %s" % (code, names) + + global __doc__ + __doc__ = ( + __doc__ + "\n" + "\n".join(doc(code) for code in sorted(_codes)) + if __doc__ is not None + else None + ) + + +_init() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/structures.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/structures.py new file mode 100644 index 0000000000000000000000000000000000000000..7675eaf15a181dada66c02bb0468dc00d6f523b3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/structures.py @@ -0,0 +1,130 @@ +""" +requests.structures +~~~~~~~~~~~~~~~~~~~ + +Data structures that power Requests. +""" + +from __future__ import annotations + +from collections import OrderedDict +from collections.abc import Iterable, Iterator, Mapping +from typing import Any, Generic, TypeVar, overload + +from .compat import MutableMapping + +_VT = TypeVar("_VT") +_D = TypeVar("_D") + + +class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): + """A case-insensitive ``dict``-like object. + + Implements all methods and operations of + ``MutableMapping`` as well as dict's ``copy``. Also + provides ``lower_items``. + + All keys are expected to be strings. The structure remembers the + case of the last key to be set, and ``iter(instance)``, + ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` + will contain case-sensitive keys. However, querying and contains + testing is case insensitive:: + + cid = CaseInsensitiveDict() + cid['Accept'] = 'application/json' + cid['aCCEPT'] == 'application/json' # True + list(cid) == ['Accept'] # True + + For example, ``headers['content-encoding']`` will return the + value of a ``'Content-Encoding'`` response header, regardless + of how the header name was originally stored. + + If the constructor, ``.update``, or equality comparison + operations are given keys that have equal ``.lower()``s, the + behavior is undefined. + """ + + _store: OrderedDict[str, tuple[str, _VT]] + + def __init__( + self, + data: Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None = None, + **kwargs: _VT, + ) -> None: + self._store = OrderedDict() + if data is None: + data = {} + self.update(data, **kwargs) + + def __setitem__(self, key: str, value: _VT) -> None: + # Use the lowercased key for lookups, but store the actual + # key alongside the value. + self._store[key.lower()] = (key, value) + + def __getitem__(self, key: str) -> _VT: + return self._store[key.lower()][1] + + def __delitem__(self, key: str) -> None: + del self._store[key.lower()] + + def __iter__(self) -> Iterator[str]: + return (casedkey for casedkey, _ in self._store.values()) + + def __len__(self) -> int: + return len(self._store) + + def lower_items(self) -> Iterator[tuple[str, _VT]]: + """Like iteritems(), but with all lowercase keys.""" + return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()) + + def __eq__(self, other: object) -> bool: + if isinstance(other, Mapping): + other_dict: CaseInsensitiveDict[Any] = CaseInsensitiveDict(other) # type: ignore[reportUnknownArgumentType] + else: + return NotImplemented + # Compare insensitively + return dict(self.lower_items()) == dict(other_dict.lower_items()) + + # Copy is required + def copy(self) -> CaseInsensitiveDict[_VT]: + return CaseInsensitiveDict(self._store.values()) + + def __repr__(self) -> str: + return str(dict(self.items())) + + +class LookupDict(dict[str, _VT]): + """Dictionary lookup object.""" + + name: Any + + def __init__(self, name: Any = None) -> None: + self.name = name + super().__init__() + + def __repr__(self) -> str: + return f"" + + def __getattr__(self, key: str) -> _VT | None: + # We need this for type checkers to infer typing + # on attribute access with status_codes.py + if key in self.__dict__: + return self.__dict__[key] + else: + raise AttributeError( + f"'{type(self).__name__}' object has no attribute '{key}'" + ) + + def __getitem__(self, key: str) -> _VT | None: # type: ignore[override] + # We allow fall-through here, so values default to None + + return self.__dict__.get(key, None) + + @overload + def get(self, key: str, default: None = None) -> _VT | None: ... + + @overload + def get(self, key: str, default: _D | _VT) -> _D | _VT: ... + + def get(self, key: str, default: _D | None = None) -> _VT | _D | None: + return self.__dict__.get(key, default) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/utils.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..120336ddc6ed5d802735685349c3c3cd42e0c597 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests/utils.py @@ -0,0 +1,1155 @@ +""" +requests.utils +~~~~~~~~~~~~~~ + +This module provides utility functions that are used within Requests +that are also useful for external consumption. +""" + +from __future__ import annotations + +import codecs +import contextlib +import io +import os +import re +import socket +import struct +import sys +import tempfile +import warnings +import zipfile +from collections import OrderedDict +from collections.abc import Generator, Iterable +from typing import ( + TYPE_CHECKING, + Any, + Final, + TypeVar, + cast, + overload, +) + +from urllib3.util import make_headers, parse_url + +from . import certs +from .__version__ import __version__ + +# to_native_string is unused here, but imported here for backwards compatibility +from ._internal_utils import ( # noqa: F401 + _HEADER_VALIDATORS_BYTE, # type: ignore[reportPrivateUsage] + _HEADER_VALIDATORS_STR, # type: ignore[reportPrivateUsage] + HEADER_VALIDATORS, # type: ignore[reportUnusedImport] + to_native_string, # type: ignore[reportUnusedImport] +) +from ._types import SupportsItems as _SupportsItems +from .compat import ( + Mapping, + bytes, + getproxies, + getproxies_environment, + integer_types, + is_urllib3_1, + proxy_bypass, + proxy_bypass_environment, # type: ignore[attr-defined] # https://github.com/python/cpython/issues/145331 + quote, + str, + unquote, + urlparse, + urlunparse, +) +from .compat import parse_http_list as _parse_list_header +from .cookies import cookiejar_from_dict +from .exceptions import ( + FileModeWarning, + InvalidHeader, + InvalidURL, + UnrewindableBodyError, +) +from .structures import CaseInsensitiveDict + +if TYPE_CHECKING: + from http.cookiejar import CookieJar + from io import BufferedWriter + + from . import _types as _t + from .models import PreparedRequest, Request, Response + +NETRC_FILES: Final = (".netrc", "_netrc") + + +# Certificate is extracted by certifi when needed. +DEFAULT_CA_BUNDLE_PATH: str = certs.where() + + +DEFAULT_PORTS: Final = {"http": 80, "https": 443} + +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + +# Ensure that ', ' is used to preserve previous delimiter behavior. +DEFAULT_ACCEPT_ENCODING: Final = ", ".join( + re.split(r",\s*", make_headers(accept_encoding=True)["accept-encoding"]) +) + + +if sys.platform == "win32": + # provide a proxy_bypass version on Windows without DNS lookups + + def proxy_bypass_registry(host: str) -> bool: + try: + import winreg + except ImportError: + return False + + try: + internetSettings = winreg.OpenKey( + winreg.HKEY_CURRENT_USER, + r"Software\Microsoft\Windows\CurrentVersion\Internet Settings", + ) + # ProxyEnable could be REG_SZ or REG_DWORD, normalizing it + proxyEnable = int(winreg.QueryValueEx(internetSettings, "ProxyEnable")[0]) + # ProxyOverride is almost always a string + proxyOverride = winreg.QueryValueEx(internetSettings, "ProxyOverride")[0] + except (OSError, ValueError): + return False + if not proxyEnable or not proxyOverride: + return False + + # make a check value list from the registry entry: replace the + # '' string by the localhost entry and the corresponding + # canonical entry. + proxyOverride = proxyOverride.split(";") + # filter out empty strings to avoid re.match return true in the following code. + proxyOverride = filter(None, proxyOverride) + # now check if we match one of the registry values. + for test in proxyOverride: + if test == "": + if "." not in host: + return True + test = test.replace(".", r"\.") # mask dots + test = test.replace("*", r".*") # change glob sequence + test = test.replace("?", r".") # change glob char + if re.match(test, host, re.I): + return True + return False + + def proxy_bypass(host: str) -> bool: # noqa + """Return True, if the host should be bypassed. + + Checks proxy settings gathered from the environment, if specified, + or the registry. + """ + if getproxies_environment(): + return proxy_bypass_environment(host) + else: + return proxy_bypass_registry(host) + + +def dict_to_sequence( + d: _t.SupportsItems[Any, Any] | Iterable[tuple[Any, Any]], +) -> Iterable[tuple[Any, Any]]: + """Returns an internal sequence dictionary update.""" + + if isinstance(d, _SupportsItems): + return d.items() + + return d + + +def super_len(o: Any) -> int: + total_length = None + current_position = 0 + + if not is_urllib3_1 and isinstance(o, str): + # urllib3 2.x+ treats all strings as utf-8 instead + # of latin-1 (iso-8859-1) like http.client. + o = o.encode("utf-8") + + if hasattr(o, "__len__"): + total_length = len(o) + + elif hasattr(o, "len"): + total_length = o.len + + elif hasattr(o, "fileno"): + try: + fileno = o.fileno() + except (io.UnsupportedOperation, AttributeError): + # AttributeError is a surprising exception, seeing as how we've just checked + # that `hasattr(o, 'fileno')`. It happens for objects obtained via + # `Tarfile.extractfile()`, per issue 5229. + pass + else: + total_length = os.fstat(fileno).st_size + + # Having used fstat to determine the file length, we need to + # confirm that this file was opened up in binary mode. + if "b" not in o.mode: + warnings.warn( + ( + "Requests has determined the content-length for this " + "request using the binary size of the file: however, the " + "file has been opened in text mode (i.e. without the 'b' " + "flag in the mode). This may lead to an incorrect " + "content-length. In Requests 3.0, support will be removed " + "for files in text mode." + ), + FileModeWarning, + ) + + if hasattr(o, "tell"): + try: + current_position = o.tell() + except OSError: + # This can happen in some weird situations, such as when the file + # is actually a special file descriptor like stdin. In this + # instance, we don't know what the length is, so set it to zero and + # let requests chunk it instead. + if total_length is not None: + current_position = total_length + else: + if hasattr(o, "seek") and total_length is None: + # StringIO and BytesIO have seek but no usable fileno + try: + # seek to end of file + o.seek(0, 2) + total_length = o.tell() + + # seek back to current position to support + # partially read file-like objects + o.seek(current_position or 0) + except OSError: + total_length = 0 + + if total_length is None: + total_length = 0 + + return max(0, total_length - current_position) + + +def get_netrc_auth( + url: _t.UriType, raise_errors: bool = False +) -> tuple[str, str] | None: + """Returns the Requests tuple auth for a given url from netrc.""" + + if isinstance(url, bytes): + url = url.decode("utf-8") + + netrc_file = os.environ.get("NETRC") + if netrc_file is not None: + netrc_locations = (netrc_file,) + else: + netrc_locations = (f"~/{f}" for f in NETRC_FILES) + + try: + from netrc import NetrcParseError, netrc + + netrc_path = None + + for f in netrc_locations: + loc = os.path.expanduser(f) + if os.path.exists(loc): + netrc_path = loc + break + + # Abort early if there isn't one. + if netrc_path is None: + return + + ri = urlparse(url) + host = ri.hostname + + if host is None: + return + + try: + _netrc = netrc(netrc_path).authenticators(host) + if _netrc and any(_netrc): + # Return with login / password + login_i = 0 if _netrc[0] else 1 + return (_netrc[login_i] or "", _netrc[2] or "") + except (NetrcParseError, OSError): + # If there was a parsing error or a permissions issue reading the file, + # we'll just skip netrc auth unless explicitly asked to raise errors. + if raise_errors: + raise + + # App Engine hackiness. + except (ImportError, AttributeError): + pass + + +def guess_filename(obj: Any) -> str | None: + """Tries to guess the filename of the given object.""" + name = getattr(obj, "name", None) + if name and isinstance(name, (str, bytes)) and name[0] != "<" and name[-1] != ">": + return os.path.basename(name) # type: ignore[return-value] # urllib3 accepts bytes but types str only + + +def extract_zipped_paths(path: str) -> str: + """Replace nonexistent paths that look like they refer to a member of a zip + archive with the location of an extracted copy of the target, or else + just return the provided path unchanged. + """ + if os.path.exists(path): + # this is already a valid path, no need to do anything further + return path + + # find the first valid part of the provided path and treat that as a zip archive + # assume the rest of the path is the name of a member in the archive + archive, member = os.path.split(path) + while archive and not os.path.exists(archive): + archive, prefix = os.path.split(archive) + if not prefix: + # If we don't check for an empty prefix after the split (in other words, archive remains unchanged after the split), + # we _can_ end up in an infinite loop on a rare corner case affecting a small number of users + break + member = "/".join([prefix, member]) + + if not zipfile.is_zipfile(archive): + return path + + zip_file = zipfile.ZipFile(archive) + if member not in zip_file.namelist(): + return path + + # we have a valid zip archive and a valid member of that archive + suffix = os.path.splitext(member.split("/")[-1])[-1] + fd, extracted_path = tempfile.mkstemp(suffix=suffix) + try: + os.write(fd, zip_file.read(member)) + finally: + os.close(fd) + + return extracted_path + + +@contextlib.contextmanager +def atomic_open(filename: str) -> Generator[BufferedWriter, None, None]: + """Write a file to the disk in an atomic fashion""" + tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename)) + try: + with os.fdopen(tmp_descriptor, "wb") as tmp_handler: + yield tmp_handler + os.replace(tmp_name, filename) + except BaseException: + os.remove(tmp_name) + raise + + +def from_key_val_list( + value: Mapping[Any, Any] | Iterable[tuple[Any, Any]] | None, +) -> dict[Any, Any] | None: + """Take an object and test to see if it can be represented as a + dictionary. Unless it can not be represented as such, return an + OrderedDict, e.g., + + :: + + >>> from_key_val_list([('key', 'val')]) + OrderedDict([('key', 'val')]) + >>> from_key_val_list('string') + Traceback (most recent call last): + ... + ValueError: cannot encode objects that are not 2-tuples + >>> from_key_val_list({'key': 'val'}) + OrderedDict([('key', 'val')]) + + :rtype: OrderedDict + """ + if value is None: + return None + + if isinstance(value, (str, bytes, bool, int)): + raise ValueError("cannot encode objects that are not 2-tuples") + + return OrderedDict(value) + + +@overload +def to_key_val_list(value: None) -> None: ... +@overload +def to_key_val_list( + value: _t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]], +) -> list[tuple[_KT, _VT]]: ... +def to_key_val_list( + value: _t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]] | None, +) -> list[tuple[_KT, _VT]] | None: + """Take an object and test to see if it can be represented as a + dictionary. If it can be, return a list of tuples, e.g., + + :: + + >>> to_key_val_list([('key', 'val')]) + [('key', 'val')] + >>> to_key_val_list({'key': 'val'}) + [('key', 'val')] + >>> to_key_val_list('string') + Traceback (most recent call last): + ... + ValueError: cannot encode objects that are not 2-tuples + + :rtype: list + """ + if value is None: + return None + + if isinstance(value, (str, bytes, bool, int)): + raise ValueError("cannot encode objects that are not 2-tuples") + + if isinstance(value, _SupportsItems): + return list(value.items()) + + return list(value) + + +# From mitsuhiko/werkzeug (used with permission). +def parse_list_header(value: str) -> list[str]: + """Parse lists as described by RFC 2068 Section 2. + + In particular, parse comma-separated lists where the elements of + the list may include quoted-strings. A quoted-string could + contain a comma. A non-quoted string could have quotes in the + middle. Quotes are removed automatically after parsing. + + It basically works like :func:`parse_set_header` just that items + may appear multiple times and case sensitivity is preserved. + + The return value is a standard :class:`list`: + + >>> parse_list_header('token, "quoted value"') + ['token', 'quoted value'] + + To create a header from the :class:`list` again, use the + :func:`dump_header` function. + + :param value: a string with a list header. + :return: :class:`list` + :rtype: list + """ + result: list[str] = [] + for item in _parse_list_header(value): + if item[:1] == item[-1:] == '"': + item = unquote_header_value(item[1:-1]) + result.append(item) + return result + + +# From mitsuhiko/werkzeug (used with permission). +def parse_dict_header(value: str) -> dict[str, str | None]: + """Parse lists of key, value pairs as described by RFC 2068 Section 2 and + convert them into a python dict: + + >>> d = parse_dict_header('foo="is a fish", bar="as well"') + >>> type(d) is dict + True + >>> sorted(d.items()) + [('bar', 'as well'), ('foo', 'is a fish')] + + If there is no value for a key it will be `None`: + + >>> parse_dict_header('key_without_value') + {'key_without_value': None} + + To create a header from the :class:`dict` again, use the + :func:`dump_header` function. + + :param value: a string with a dict header. + :return: :class:`dict` + :rtype: dict + """ + result: dict[str, str | None] = {} + for item in _parse_list_header(value): + if "=" not in item: + result[item] = None + continue + name, value = item.split("=", 1) + if value[:1] == value[-1:] == '"': + value = unquote_header_value(value[1:-1]) + result[name] = value + return result + + +# From mitsuhiko/werkzeug (used with permission). +def unquote_header_value(value: str, is_filename: bool = False) -> str: + r"""Unquotes a header value. (Reversal of :func:`quote_header_value`). + This does not use the real unquoting but what browsers are actually + using for quoting. + + :param value: the header value to unquote. + :rtype: str + """ + if value and value[0] == value[-1] == '"': + # this is not the real unquoting, but fixing this so that the + # RFC is met will result in bugs with internet explorer and + # probably some other browsers as well. IE for example is + # uploading files with "C:\foo\bar.txt" as filename + value = value[1:-1] + + # if this is a filename and the starting characters look like + # a UNC path, then just return the value without quotes. Using the + # replace sequence below on a UNC path has the effect of turning + # the leading double slash into a single slash and then + # _fix_ie_filename() doesn't work correctly. See #458. + if not is_filename or value[:2] != "\\\\": + return value.replace("\\\\", "\\").replace('\\"', '"') + return value + + +def dict_from_cookiejar(cj: CookieJar) -> dict[str, str | None]: + """Returns a key/value dictionary from a CookieJar. + + :param cj: CookieJar object to extract cookies from. + :rtype: dict + """ + + cookie_dict = {cookie.name: cookie.value for cookie in cj} + return cookie_dict + + +def add_dict_to_cookiejar(cj: CookieJar, cookie_dict: dict[str, str]) -> CookieJar: + """Returns a CookieJar from a key/value dictionary. + + :param cj: CookieJar to insert cookies into. + :param cookie_dict: Dict of key/values to insert into CookieJar. + :rtype: CookieJar + """ + + return cookiejar_from_dict(cookie_dict, cj) + + +def get_encodings_from_content(content: str) -> list[str]: + """Returns encodings from given content string. + + :param content: bytestring to extract encodings from. + """ + warnings.warn( + ( + "In requests 3.0, get_encodings_from_content will be removed. For " + "more information, please see the discussion on issue #2266. (This" + " warning should only appear once.)" + ), + DeprecationWarning, + ) + + charset_re = re.compile(r']', flags=re.I) + pragma_re = re.compile(r']', flags=re.I) + xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]') + + return ( + charset_re.findall(content) + + pragma_re.findall(content) + + xml_re.findall(content) + ) + + +def _parse_content_type_header(header: str) -> tuple[str, dict[str, Any]]: + """Returns content type and parameters from given header. + + :param header: string + :return: tuple containing content type and dictionary of + parameters. + """ + + tokens = header.split(";") + content_type, params = tokens[0].strip(), tokens[1:] + params_dict: dict[str, str | bool] = {} + strip_chars = "\"' " + + for param in params: + param = param.strip() + if param and (idx := param.find("=")) != -1: + key = param[:idx].strip(strip_chars) + value = param[idx + 1 :].strip(strip_chars) + params_dict[key.lower()] = value + return content_type, params_dict + + +def get_encoding_from_headers(headers: CaseInsensitiveDict[str]) -> str | None: + """Returns encodings from given HTTP Header Dict. + + :param headers: dictionary to extract encoding from. + :rtype: str + """ + + content_type = headers.get("content-type") + + if not content_type: + return None + + content_type, params = _parse_content_type_header(content_type) + + if "charset" in params: + return params["charset"].strip("'\"") + + if "text" in content_type: + return "ISO-8859-1" + + if "application/json" in content_type: + # Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset + return "utf-8" + + +def stream_decode_response_unicode( + iterator: Iterable[bytes], r: Response +) -> Generator[str | bytes, None, None]: + """Stream decodes an iterator.""" + + if r.encoding is None: + yield from iterator + return + + decoder = codecs.getincrementaldecoder(r.encoding)(errors="replace") + for chunk in iterator: + rv = decoder.decode(chunk) + if rv: + yield rv + rv = decoder.decode(b"", final=True) + if rv: + yield rv + + +@overload +def iter_slices( + string: bytes, slice_length: int | None +) -> Generator[bytes, None, None]: ... +@overload +def iter_slices( + string: str, slice_length: int | None +) -> Generator[str, None, None]: ... +def iter_slices( + string: bytes | str, slice_length: int | None +) -> Generator[bytes | str, None, None]: + """Iterate over slices of a string.""" + pos = 0 + if slice_length is None or slice_length <= 0: + slice_length = len(string) + while pos < len(string): + yield string[pos : pos + slice_length] + pos += slice_length + + +def get_unicode_from_response(r: Response) -> str | bytes | None: + """Returns the requested content back in unicode. + + :param r: Response object to get unicode content from. + + Tried: + + 1. charset from content-type + 2. fall back and replace all unicode characters + + :rtype: str + """ + warnings.warn( + ( + "In requests 3.0, get_unicode_from_response will be removed. For " + "more information, please see the discussion on issue #2266. (This" + " warning should only appear once.)" + ), + DeprecationWarning, + ) + if r.content is None: # type: ignore[reportUnnecessaryComparison] + return None + + tried_encodings: list[str] = [] + + # Try charset from content-type + encoding = get_encoding_from_headers(r.headers) + + if encoding: + try: + return str(r.content, encoding) + except UnicodeError: + tried_encodings.append(encoding) + + # Fall back: + try: + return str(r.content, encoding or "utf-8", errors="replace") + except TypeError: + return r.content + + +# The unreserved URI characters (RFC 3986) +UNRESERVED_SET: Final = frozenset( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~" +) + + +def unquote_unreserved(uri: str) -> str: + """Un-escape any percent-escape sequences in a URI that are unreserved + characters. This leaves all reserved, illegal and non-ASCII bytes encoded. + + :rtype: str + """ + parts = uri.split("%") + for i in range(1, len(parts)): + h = parts[i][0:2] + if len(h) == 2 and h.isalnum(): + try: + c = chr(int(h, 16)) + except ValueError: + raise InvalidURL(f"Invalid percent-escape sequence: '{h}'") + + if c in UNRESERVED_SET: + parts[i] = c + parts[i][2:] + else: + parts[i] = f"%{parts[i]}" + else: + parts[i] = f"%{parts[i]}" + return "".join(parts) + + +def requote_uri(uri: str) -> str: + """Re-quote the given URI. + + This function passes the given URI through an unquote/quote cycle to + ensure that it is fully and consistently quoted. + + :rtype: str + """ + safe_with_percent = "!#$%&'()*+,/:;=?@[]~" + safe_without_percent = "!#$&'()*+,/:;=?@[]~" + try: + # Unquote only the unreserved characters + # Then quote only illegal characters (do not quote reserved, + # unreserved, or '%') + return quote(unquote_unreserved(uri), safe=safe_with_percent) + except InvalidURL: + # We couldn't unquote the given URI, so let's try quoting it, but + # there may be unquoted '%'s in the URI. We need to make sure they're + # properly quoted so they do not cause issues elsewhere. + return quote(uri, safe=safe_without_percent) + + +def address_in_network(ip: str, net: str) -> bool: + """This function allows you to check if an IP belongs to a network subnet + + Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 + returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 + + :rtype: bool + """ + ipaddr = struct.unpack("=L", socket.inet_aton(ip))[0] + netaddr, bits = net.split("/") + netmask = struct.unpack("=L", socket.inet_aton(dotted_netmask(int(bits))))[0] + network = struct.unpack("=L", socket.inet_aton(netaddr))[0] & netmask + return (ipaddr & netmask) == (network & netmask) + + +def dotted_netmask(mask: int) -> str: + """Converts mask from /xx format to xxx.xxx.xxx.xxx + + Example: if mask is 24 function returns 255.255.255.0 + + :rtype: str + """ + bits = 0xFFFFFFFF ^ (1 << 32 - mask) - 1 + return socket.inet_ntoa(struct.pack(">I", bits)) + + +def is_ipv4_address(string_ip: str) -> bool: + """ + :rtype: bool + """ + try: + socket.inet_aton(string_ip) + except OSError: + return False + return True + + +def is_valid_cidr(string_network: str) -> bool: + """ + Very simple check of the cidr format in no_proxy variable. + + :rtype: bool + """ + if string_network.count("/") == 1: + try: + mask = int(string_network.split("/")[1]) + except ValueError: + return False + + if mask < 1 or mask > 32: + return False + + try: + socket.inet_aton(string_network.split("/")[0]) + except OSError: + return False + else: + return False + return True + + +@contextlib.contextmanager +def set_environ(env_name: str, value: str | None) -> Generator[None, None, None]: + """Set the environment variable 'env_name' to 'value' + + Save previous value, yield, and then restore the previous value stored in + the environment variable 'env_name'. + + If 'value' is None, do nothing""" + value_changed = value is not None + old_value: str | None = None + if value_changed: + old_value = os.environ.get(env_name) + os.environ[env_name] = value + try: + yield + finally: + if value_changed: + if old_value is None: + del os.environ[env_name] + else: + os.environ[env_name] = old_value + + +def should_bypass_proxies(url: str, no_proxy: str | None) -> bool: + """ + Returns whether we should bypass proxies or not. + + :rtype: bool + """ + + # Prioritize lowercase environment variables over uppercase + # to keep a consistent behaviour with other http projects (curl, wget). + def get_proxy(key: str) -> str | None: + return os.environ.get(key) or os.environ.get(key.upper()) + + # First check whether no_proxy is defined. If it is, check that the URL + # we're getting isn't in the no_proxy list. + no_proxy_arg = no_proxy + if no_proxy is None: + no_proxy = get_proxy("no_proxy") + parsed = urlparse(url) + hostname = parsed.hostname + + if hostname is None: + # URLs don't always have hostnames, e.g. file:/// urls. + return True + + if no_proxy: + # We need to check whether we match here. We need to see if we match + # the end of the hostname, both with and without the port. + no_proxy_hosts = (host for host in no_proxy.replace(" ", "").split(",") if host) + + if is_ipv4_address(hostname): + for proxy_ip in no_proxy_hosts: + if is_valid_cidr(proxy_ip): + if address_in_network(hostname, proxy_ip): + return True + elif hostname == proxy_ip: + # If no_proxy ip was defined in plain IP notation instead of cidr notation & + # matches the IP of the index + return True + else: + host_with_port = hostname + if parsed.port: + host_with_port += f":{parsed.port}" + + for host in no_proxy_hosts: + host = host.lstrip(".") + if hostname == host or host_with_port == host: + return True + host = "." + host + if hostname.endswith(host) or host_with_port.endswith(host): + return True + + with set_environ("no_proxy", no_proxy_arg): + try: + bypass = proxy_bypass(hostname) + except (TypeError, socket.gaierror): + bypass = False + + if bypass: + return True + + return False + + +def get_environ_proxies(url: str, no_proxy: str | None = None) -> dict[str, str]: + """ + Return a dict of environment proxies. + + :rtype: dict + """ + if should_bypass_proxies(url, no_proxy=no_proxy): + return {} + else: + return getproxies() + + +def select_proxy(url: str, proxies: dict[str, str] | None) -> str | None: + """Select a proxy for the url, if applicable. + + :param url: The url being for the request + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs + """ + proxies = proxies or {} + urlparts = urlparse(url) + if urlparts.hostname is None: + return proxies.get(urlparts.scheme, proxies.get("all")) + + proxy_keys = [ + urlparts.scheme + "://" + urlparts.hostname, + urlparts.scheme, + "all://" + urlparts.hostname, + "all", + ] + proxy = None + for proxy_key in proxy_keys: + if proxy_key in proxies: + proxy = proxies[proxy_key] + break + + return proxy + + +def resolve_proxies( + request: Request | PreparedRequest, + proxies: dict[str, str] | None, + trust_env: bool = True, +) -> dict[str, str]: + """This method takes proxy information from a request and configuration + input to resolve a mapping of target proxies. This will consider settings + such as NO_PROXY to strip proxy configurations. + + :param request: Request or PreparedRequest + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs + :param trust_env: Boolean declaring whether to trust environment configs + + :rtype: dict + """ + proxies = proxies if proxies is not None else {} + url = cast(str, request.url) + scheme = urlparse(url).scheme + no_proxy = proxies.get("no_proxy") + new_proxies = proxies.copy() + + if trust_env and not should_bypass_proxies(url, no_proxy=no_proxy): + environ_proxies = get_environ_proxies(url, no_proxy=no_proxy) + + proxy = environ_proxies.get(scheme, environ_proxies.get("all")) + + if proxy: + new_proxies.setdefault(scheme, proxy) + return new_proxies + + +def default_user_agent(name: str = "python-requests") -> str: + """ + Return a string representing the default user agent. + + :rtype: str + """ + return f"{name}/{__version__}" + + +def default_headers() -> CaseInsensitiveDict[str]: + """ + :rtype: requests.structures.CaseInsensitiveDict + """ + return CaseInsensitiveDict( + { + "User-Agent": default_user_agent(), + "Accept-Encoding": DEFAULT_ACCEPT_ENCODING, + "Accept": "*/*", + "Connection": "keep-alive", + } + ) + + +def parse_header_links(value: str) -> list[dict[str, str]]: + """Return a list of parsed link headers proxies. + + i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" + + :rtype: list + """ + + links: list[dict[str, str]] = [] + + replace_chars = " '\"" + + value = value.strip(replace_chars) + if not value: + return links + + for val in re.split(", *<", value): + try: + url, params = val.split(";", 1) + except ValueError: + url, params = val, "" + + link: dict[str, str] = {"url": url.strip("<> '\"")} + + for param in params.split(";"): + try: + key, value = param.split("=") + except ValueError: + break + + link[key.strip(replace_chars)] = value.strip(replace_chars) + + links.append(link) + + return links + + +# Null bytes; no need to recreate these on each call to guess_json_utf +_null = "\x00".encode("ascii") # encoding to ASCII for Python 3 +_null2 = _null * 2 +_null3 = _null * 3 + + +def guess_json_utf(data: bytes) -> str | None: + """ + :rtype: str + """ + # JSON always starts with two ASCII characters, so detection is as + # easy as counting the nulls and from their location and count + # determine the encoding. Also detect a BOM, if present. + sample = data[:4] + if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE): + return "utf-32" # BOM included + if sample[:3] == codecs.BOM_UTF8: + return "utf-8-sig" # BOM included, MS style (discouraged) + if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE): + return "utf-16" # BOM included + nullcount = sample.count(_null) + if nullcount == 0: + return "utf-8" + if nullcount == 2: + if sample[::2] == _null2: # 1st and 3rd are null + return "utf-16-be" + if sample[1::2] == _null2: # 2nd and 4th are null + return "utf-16-le" + # Did not detect 2 valid UTF-16 ascii-range characters + if nullcount == 3: + if sample[:3] == _null3: + return "utf-32-be" + if sample[1:] == _null3: + return "utf-32-le" + # Did not detect a valid UTF-32 ascii-range character + return None + + +def prepend_scheme_if_needed(url: str, new_scheme: str) -> str: + """Given a URL that may or may not have a scheme, prepend the given scheme. + Does not replace a present scheme with the one provided as an argument. + + :rtype: str + """ + parsed = parse_url(url) + scheme, auth, _host, _port, path, query, fragment = parsed + + # A defect in urlparse determines that there isn't a netloc present in some + # urls. We previously assumed parsing was overly cautious, and swapped the + # netloc and path. Due to a lack of tests on the original defect, this is + # maintained with parse_url for backwards compatibility. + netloc = parsed.netloc + if not netloc: + netloc, path = path, netloc + + if auth: + # parse_url doesn't provide the netloc with auth + # so we'll add it ourselves. + netloc = cast(str, netloc) + netloc = "@".join([auth, netloc]) + if scheme is None: + scheme = new_scheme + if path is None: + path = "" + + return urlunparse((scheme, netloc, path, "", query, fragment)) + + +def get_auth_from_url(url: str) -> tuple[str, str]: + """Given a url with authentication components, extract them into a tuple of + username,password. + + :rtype: (str,str) + """ + parsed = urlparse(url) + + try: + # except handles parsed.username/password being None + auth = (unquote(parsed.username), unquote(parsed.password)) # type: ignore[arg-type] + except (AttributeError, TypeError): + auth = ("", "") + + return auth + + +def check_header_validity(header: tuple[str | bytes, str | bytes]) -> None: + """Verifies that header parts don't contain leading whitespace + reserved characters, or return characters. + + :param header: tuple, in the format (name, value). + """ + name, value = header + _validate_header_part(header, name, 0) + _validate_header_part(header, value, 1) + + +def _validate_header_part( + header: tuple[str | bytes, str | bytes], + header_part: str | bytes, + header_validator_index: int, +) -> None: + if isinstance(header_part, str): + validator = _HEADER_VALIDATORS_STR[header_validator_index] + elif isinstance(header_part, bytes): # type: ignore[reportUnnecessaryIsInstance] + # runtime guard for non-str/bytes input + validator = _HEADER_VALIDATORS_BYTE[header_validator_index] + else: + raise InvalidHeader( + f"Header part ({header_part!r}) from {header} " + f"must be of type str or bytes, not {type(header_part)}" + ) + + if not validator.match(header_part): # type: ignore[arg-type] + header_kind = "name" if header_validator_index == 0 else "value" + raise InvalidHeader( + f"Invalid leading whitespace, reserved character(s), or return " + f"character(s) in header {header_kind}: {header_part!r}" + ) + + +def urldefragauth(url: str) -> str: + """ + Given a url remove the fragment and the authentication part. + + :rtype: str + """ + scheme, netloc, path, params, query, _fragment = urlparse(url) + + # see func:`prepend_scheme_if_needed` + if not netloc: + netloc, path = path, netloc + + netloc = netloc.rsplit("@", 1)[-1] + + return urlunparse((scheme, netloc, path, params, query, "")) + + +def rewind_body(prepared_request: PreparedRequest) -> None: + """Move file pointer back to its recorded starting position + so it can be read again on redirect. + """ + body_seek = getattr(prepared_request.body, "seek", None) + if body_seek is not None and isinstance( + prepared_request._body_position, # type: ignore[reportPrivateUsage] + integer_types, + ): + try: + body_seek(prepared_request._body_position) # type: ignore[reportPrivateUsage] + except OSError: + raise UnrewindableBodyError( + "An error occurred when rewinding request body for redirect." + ) + else: + raise UnrewindableBodyError("Unable to rewind request body for redirect.") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6baa93272553d515f0c7f5750cd8df91d1e6a215 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth1_auth.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth1_auth.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d27499d197eaf4dc42593d5c2321548dd03a388 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth1_auth.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth1_session.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth1_session.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..572a4d2586b2cbbb3a477933f6728d2fd96740a9 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth1_session.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth2_auth.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth2_auth.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20aa96782b7bc33fef226ce78a95101461812297 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth2_auth.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth2_session.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth2_session.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..95b400268683fdf0c717622f2e1e97625ad04deb Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/__pycache__/oauth2_session.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8815ea0b8eec8630d6cf957f91796df695e365bf --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__init__.py @@ -0,0 +1,9 @@ +# ruff: noqa: F401 +from .facebook import facebook_compliance_fix +from .fitbit import fitbit_compliance_fix +from .slack import slack_compliance_fix +from .instagram import instagram_compliance_fix +from .mailchimp import mailchimp_compliance_fix +from .weibo import weibo_compliance_fix +from .plentymarkets import plentymarkets_compliance_fix +from .ebay import ebay_compliance_fix diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bc1cfb5af290dbe4dc6ee920b313eeb719a9ae33 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/douban.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/douban.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13c7dc004221dad867140d317b22223005722a8f Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/douban.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/ebay.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/ebay.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f430c5366689387b022085fd58162f93c2f0922 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/ebay.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/facebook.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/facebook.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e38514181433c07c654c016e33c4eb1d28c4c5ee Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/facebook.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/fitbit.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/fitbit.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a70420543e9760fb7c31d4b714b582907ca05f38 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/fitbit.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/instagram.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/instagram.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f69ec117c111300868256eca6a09e33701a4280 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/instagram.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/mailchimp.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/mailchimp.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6d44d0169cc932fe11d3dfe37f963bdd24bd75d Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/mailchimp.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/plentymarkets.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/plentymarkets.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1025a2bcbcbf8c2adb0c242154f443bbd04b5ed1 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/plentymarkets.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/slack.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/slack.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39ef73121c83490e96d3427e7b82e50d50520091 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/slack.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/weibo.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/weibo.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec39fe9f8e61deaba854c30a76692a95135486ef Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/__pycache__/weibo.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/douban.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/douban.py new file mode 100644 index 0000000000000000000000000000000000000000..c8b99c721e9bb09e3a0127bb90e09f53814d714c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/douban.py @@ -0,0 +1,15 @@ +import json + + +def douban_compliance_fix(session): + def fix_token_type(r): + token = json.loads(r.text) + token.setdefault("token_type", "Bearer") + fixed_token = json.dumps(token) + r._content = fixed_token.encode() + return r + + session._client_default_token_placement = "query" + session.register_compliance_hook("access_token_response", fix_token_type) + + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/ebay.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/ebay.py new file mode 100644 index 0000000000000000000000000000000000000000..ef33f39101bd97ab2926b13289f8ff3886265fb1 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/ebay.py @@ -0,0 +1,22 @@ +import json + + +def ebay_compliance_fix(session): + def _compliance_fix(response): + token = json.loads(response.text) + + # eBay responds with non-compliant token types. + # https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html + # https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html + # Modify these to be "Bearer". + if token.get("token_type") in ["Application Access Token", "User Access Token"]: + token["token_type"] = "Bearer" + fixed_token = json.dumps(token) + response._content = fixed_token.encode() + + return response + + session.register_compliance_hook("access_token_response", _compliance_fix) + session.register_compliance_hook("refresh_token_response", _compliance_fix) + + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/facebook.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/facebook.py new file mode 100644 index 0000000000000000000000000000000000000000..f44558a83902a76022c38f2310a7eddb39cee150 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/facebook.py @@ -0,0 +1,27 @@ +from json import dumps +from urllib.parse import parse_qsl + + +def facebook_compliance_fix(session): + def _compliance_fix(r): + # if Facebook claims to be sending us json, let's trust them. + if "application/json" in r.headers.get("content-type", {}): + return r + + # Facebook returns a content-type of text/plain when sending their + # x-www-form-urlencoded responses, along with a 200. If not, let's + # assume we're getting JSON and bail on the fix. + if "text/plain" in r.headers.get("content-type", {}) and r.status_code == 200: + token = dict(parse_qsl(r.text, keep_blank_values=True)) + else: + return r + + expires = token.get("expires") + if expires is not None: + token["expires_in"] = expires + token["token_type"] = "Bearer" + r._content = dumps(token).encode() + return r + + session.register_compliance_hook("access_token_response", _compliance_fix) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/fitbit.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/fitbit.py new file mode 100644 index 0000000000000000000000000000000000000000..aacc68bfbb1b80be304d21a0f4d4a57cbb7db54b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/fitbit.py @@ -0,0 +1,23 @@ +""" +The Fitbit API breaks from the OAuth2 RFC standard by returning an "errors" +object list, rather than a single "error" string. This puts hooks in place so +that oauthlib can process an error in the results from access token and refresh +token responses. This is necessary to prevent getting the generic red herring +MissingTokenError. +""" + +from json import loads, dumps + + +def fitbit_compliance_fix(session): + def _missing_error(r): + token = loads(r.text) + if "errors" in token: + # Set the error to the first one we have + token["error"] = token["errors"][0]["errorType"] + r._content = dumps(token).encode() + return r + + session.register_compliance_hook("access_token_response", _missing_error) + session.register_compliance_hook("refresh_token_response", _missing_error) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/instagram.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/instagram.py new file mode 100644 index 0000000000000000000000000000000000000000..7d5a2ad447eda3bbcefe65f417e1f9d82848c27e --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/instagram.py @@ -0,0 +1,23 @@ +from urllib.parse import urlparse, parse_qs + +from oauthlib.common import add_params_to_uri + + +def instagram_compliance_fix(session): + def _non_compliant_param_name(url, headers, data): + # If the user has already specified the token in the URL + # then there's nothing to do. + # If the specified token is different from ``session.access_token``, + # we assume the user intends to override the access token. + url_query = dict(parse_qs(urlparse(url).query)) + token = url_query.get("access_token") + if token: + # Nothing to do, just return. + return url, headers, data + + token = [("access_token", session.access_token)] + url = add_params_to_uri(url, token) + return url, headers, data + + session.register_compliance_hook("protected_request", _non_compliant_param_name) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/mailchimp.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/mailchimp.py new file mode 100644 index 0000000000000000000000000000000000000000..0d602659c646203a012f107e5651087762b93d37 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/mailchimp.py @@ -0,0 +1,21 @@ +import json + + +def mailchimp_compliance_fix(session): + def _null_scope(r): + token = json.loads(r.text) + if "scope" in token and token["scope"] is None: + token.pop("scope") + r._content = json.dumps(token).encode() + return r + + def _non_zero_expiration(r): + token = json.loads(r.text) + if "expires_in" in token and token["expires_in"] == 0: + token["expires_in"] = 3600 + r._content = json.dumps(token).encode() + return r + + session.register_compliance_hook("access_token_response", _null_scope) + session.register_compliance_hook("access_token_response", _non_zero_expiration) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py new file mode 100644 index 0000000000000000000000000000000000000000..859f0566a5be32fb1a8d2f013c8205800bb84e23 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py @@ -0,0 +1,27 @@ +from json import dumps, loads +import re + + +def plentymarkets_compliance_fix(session): + def _to_snake_case(n): + return re.sub("(.)([A-Z][a-z]+)", r"\1_\2", n).lower() + + def _compliance_fix(r): + # Plenty returns the Token in CamelCase instead of _ + if ( + "application/json" in r.headers.get("content-type", {}) + and r.status_code == 200 + ): + token = loads(r.text) + else: + return r + + fixed_token = {} + for k, v in token.items(): + fixed_token[_to_snake_case(k)] = v + + r._content = dumps(fixed_token).encode() + return r + + session.register_compliance_hook("access_token_response", _compliance_fix) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/slack.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/slack.py new file mode 100644 index 0000000000000000000000000000000000000000..9095a470cd1ccb7783bd3129286310920c1e2b62 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/slack.py @@ -0,0 +1,34 @@ +from urllib.parse import urlparse, parse_qs + +from oauthlib.common import add_params_to_uri + + +def slack_compliance_fix(session): + def _non_compliant_param_name(url, headers, data): + # If the user has already specified the token, either in the URL + # or in a data dictionary, then there's nothing to do. + # If the specified token is different from ``session.access_token``, + # we assume the user intends to override the access token. + url_query = dict(parse_qs(urlparse(url).query)) + token = url_query.get("token") + if not token and isinstance(data, dict): + token = data.get("token") + + if token: + # Nothing to do, just return. + return url, headers, data + + if not data: + data = {"token": session.access_token} + elif isinstance(data, dict): + data["token"] = session.access_token + else: + # ``data`` is something other than a dict: maybe a stream, + # maybe a file object, maybe something else. We can't easily + # modify it, so we'll set the token by modifying the URL instead. + token = [("token", session.access_token)] + url = add_params_to_uri(url, token) + return url, headers, data + + session.register_compliance_hook("protected_request", _non_compliant_param_name) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/weibo.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/weibo.py new file mode 100644 index 0000000000000000000000000000000000000000..f1623fd6d768e5c5cdb91485f01a58c184040833 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_oauthlib/compliance_fixes/weibo.py @@ -0,0 +1,13 @@ +from json import loads, dumps + + +def weibo_compliance_fix(session): + def _missing_token_type(r): + token = loads(r.text) + token["token_type"] = "Bearer" + r._content = dumps(token).encode() + return r + + session._client.default_token_placement = "query" + session.register_compliance_hook("access_token_response", _missing_token_type) + return session diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5579eb4a4a5611c44596e5ad9f440b6f5298ff75 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/appengine.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/appengine.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de7b54380a2127bb1f5d9752653ecfb5660df6d2 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/appengine.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/fingerprint.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/fingerprint.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6052cb846544c2b67f1a8b3acf2929e22228b78a Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/fingerprint.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/host_header_ssl.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/host_header_ssl.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74c7490cdaabae23b81fefcde6dc97c9f9ded676 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/host_header_ssl.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/socket_options.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/socket_options.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0eac4dec1672c0c4112e6d1d232f274eed3bb704 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/socket_options.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/source.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/source.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ebcdd63782a314e4dd8890159a2da24d9612c108 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/source.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/ssl.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/ssl.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..afb42ab128864d2e0c11101f017f682dc2347747 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/ssl.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/x509.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/x509.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d1a03ebbe3941f3615123a8aaf324100cd022a2 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/adapters/__pycache__/x509.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..346fb31f6f95f0f7734ede5dfe71ac879137f872 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/_digest_auth_compat.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/_digest_auth_compat.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7c08a115ee9cd77edeb63731d809c5798baf669 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/_digest_auth_compat.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/guess.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/guess.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59f21b7865f000138b3dd7533afd052cac789194 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/guess.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/handler.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/handler.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28d7087e0126aecfce927f50188121595b678fbd Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/handler.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/http_proxy_digest.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/http_proxy_digest.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c336478a5f994887167847f0f50141cc5db8bc27 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/auth/__pycache__/http_proxy_digest.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/cookies/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/cookies/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f86cd8f6a0625a0dc274bb49fe038df6cd0ab2d5 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/cookies/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/cookies/__pycache__/forgetful.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/cookies/__pycache__/forgetful.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15ce54971807ed735f3ade71276c95ab13b3ec67 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/cookies/__pycache__/forgetful.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb64cea4da518d4150ebe7d90e35e20115e70d99 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/stream.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/stream.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ac1f8d1b28c0dafb9eb587d7415340b8061abc7 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/stream.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5415863ae2e13c91034642477c2db738d98053e1 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/__init__.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..56c005e2d18de5332b2077fc635fa2da1140fcef Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/__init__.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/decoder.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/decoder.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8379c7e200c30cf844eef83e1f4954d43d79463 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/decoder.cpython-311.pyc differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/encoder.cpython-311.pyc b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/encoder.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caa2ac05f1423c57adc0f2ca009ae532b32671cc Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/requests_toolbelt/multipart/__pycache__/encoder.cpython-311.pyc differ