diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/AvifImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/AvifImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..2ff8439b53d6e920255829e2514a025e7435cec0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/AvifImagePlugin.py @@ -0,0 +1,293 @@ +from __future__ import annotations + +import os +from io import BytesIO +from typing import IO + +from . import ExifTags, Image, ImageFile + +try: + from . import _avif + + SUPPORTED = True +except ImportError: + SUPPORTED = False + +# Decoder options as module globals, until there is a way to pass parameters +# to Image.open (see https://github.com/python-pillow/Pillow/issues/569) +DECODE_CODEC_CHOICE = "auto" +DEFAULT_MAX_THREADS = 0 + + +def get_codec_version(codec_name: str) -> str | None: + versions = _avif.codec_versions() + for version in versions.split(", "): + if version.split(" [")[0] == codec_name: + return version.split(":")[-1].split(" ")[0] + return None + + +def _accept(prefix: bytes) -> bool | str: + if prefix[4:8] != b"ftyp": + return False + major_brand = prefix[8:12] + if major_brand in ( + # coding brands + b"avif", + b"avis", + # We accept files with AVIF container brands; we can't yet know if + # the ftyp box has the correct compatible brands, but if it doesn't + # then the plugin will raise a SyntaxError which Pillow will catch + # before moving on to the next plugin that accepts the file. + # + # Also, because this file might not actually be an AVIF file, we + # don't raise an error if AVIF support isn't properly compiled. + b"mif1", + b"msf1", + ): + if not SUPPORTED: + return ( + "image file could not be identified because AVIF support not installed" + ) + return True + return False + + +def _get_default_max_threads() -> int: + if DEFAULT_MAX_THREADS: + return DEFAULT_MAX_THREADS + if hasattr(os, "sched_getaffinity"): + return len(os.sched_getaffinity(0)) + else: + return os.cpu_count() or 1 + + +class AvifImageFile(ImageFile.ImageFile): + format = "AVIF" + format_description = "AVIF image" + __frame = -1 + + def _open(self) -> None: + if not SUPPORTED: + msg = "image file could not be opened because AVIF support not installed" + raise SyntaxError(msg) + + if DECODE_CODEC_CHOICE != "auto" and not _avif.decoder_codec_available( + DECODE_CODEC_CHOICE + ): + msg = "Invalid opening codec" + raise ValueError(msg) + + assert self.fp is not None + self._decoder = _avif.AvifDecoder( + self.fp.read(), + DECODE_CODEC_CHOICE, + _get_default_max_threads(), + ) + + # Get info from decoder + self._size, self.n_frames, self._mode, icc, exif, exif_orientation, xmp = ( + self._decoder.get_info() + ) + self.is_animated = self.n_frames > 1 + + if icc: + self.info["icc_profile"] = icc + if xmp: + self.info["xmp"] = xmp + + if exif_orientation != 1 or exif: + exif_data = Image.Exif() + if exif: + exif_data.load(exif) + original_orientation = exif_data.get(ExifTags.Base.Orientation, 1) + else: + original_orientation = 1 + if exif_orientation != original_orientation: + exif_data[ExifTags.Base.Orientation] = exif_orientation + exif = exif_data.tobytes() + if exif: + self.info["exif"] = exif + self.seek(0) + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + + # Set tile + self.__frame = frame + self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.mode)] + + def load(self) -> Image.core.PixelAccess | None: + if self.tile: + # We need to load the image data for this frame + data, timescale, pts_in_timescales, duration_in_timescales = ( + self._decoder.get_frame(self.__frame) + ) + self.info["timestamp"] = round(1000 * (pts_in_timescales / timescale)) + self.info["duration"] = round(1000 * (duration_in_timescales / timescale)) + + if self.fp and self._exclusive_fp: + self.fp.close() + self.fp = BytesIO(data) + + return super().load() + + def load_seek(self, pos: int) -> None: + pass + + def tell(self) -> int: + return self.__frame + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + _save(im, fp, filename, save_all=True) + + +def _save( + im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False +) -> None: + info = im.encoderinfo.copy() + if save_all: + append_images = list(info.get("append_images", [])) + else: + append_images = [] + + total = 0 + for ims in [im] + append_images: + total += getattr(ims, "n_frames", 1) + + quality = info.get("quality", 75) + if not isinstance(quality, int) or quality < 0 or quality > 100: + msg = "Invalid quality setting" + raise ValueError(msg) + + duration = info.get("duration", 0) + subsampling = info.get("subsampling", "4:2:0") + speed = info.get("speed", 6) + max_threads = info.get("max_threads", _get_default_max_threads()) + codec = info.get("codec", "auto") + if codec != "auto" and not _avif.encoder_codec_available(codec): + msg = "Invalid saving codec" + raise ValueError(msg) + range_ = info.get("range", "full") + tile_rows_log2 = info.get("tile_rows", 0) + tile_cols_log2 = info.get("tile_cols", 0) + alpha_premultiplied = bool(info.get("alpha_premultiplied", False)) + autotiling = bool(info.get("autotiling", tile_rows_log2 == tile_cols_log2 == 0)) + + icc_profile = info.get("icc_profile", im.info.get("icc_profile")) + exif_orientation = 1 + if exif := info.get("exif"): + if isinstance(exif, Image.Exif): + exif_data = exif + else: + exif_data = Image.Exif() + exif_data.load(exif) + if ExifTags.Base.Orientation in exif_data: + exif_orientation = exif_data.pop(ExifTags.Base.Orientation) + exif = exif_data.tobytes() if exif_data else b"" + elif isinstance(exif, Image.Exif): + exif = exif_data.tobytes() + + xmp = info.get("xmp") + + if isinstance(xmp, str): + xmp = xmp.encode("utf-8") + + advanced = info.get("advanced") + if advanced is not None: + if isinstance(advanced, dict): + advanced = advanced.items() + try: + advanced = tuple(advanced) + except TypeError: + invalid = True + else: + invalid = any(not isinstance(v, tuple) or len(v) != 2 for v in advanced) + if invalid: + msg = ( + "advanced codec options must be a dict of key-value string " + "pairs or a series of key-value two-tuples" + ) + raise ValueError(msg) + + # Setup the AVIF encoder + enc = _avif.AvifEncoder( + im.size, + subsampling, + quality, + speed, + max_threads, + codec, + range_, + tile_rows_log2, + tile_cols_log2, + alpha_premultiplied, + autotiling, + icc_profile or b"", + exif or b"", + exif_orientation, + xmp or b"", + advanced, + ) + + # Add each frame + frame_idx = 0 + frame_duration = 0 + cur_idx = im.tell() + is_single_frame = total == 1 + try: + for ims in [im] + append_images: + # Get number of frames in this image + nfr = getattr(ims, "n_frames", 1) + + for idx in range(nfr): + ims.seek(idx) + + # Make sure image mode is supported + frame = ims + rawmode = ims.mode + if ims.mode not in {"RGB", "RGBA"}: + rawmode = "RGBA" if ims.has_transparency_data else "RGB" + frame = ims.convert(rawmode) + + # Update frame duration + if isinstance(duration, (list, tuple)): + frame_duration = duration[frame_idx] + else: + frame_duration = duration + + # Append the frame to the animation encoder + enc.add( + frame.tobytes("raw", rawmode), + frame_duration, + frame.size, + rawmode, + is_single_frame, + ) + + # Update frame index + frame_idx += 1 + + if not save_all: + break + + finally: + im.seek(cur_idx) + + # Get the final output from the encoder + data = enc.finish() + if data is None: + msg = "cannot write file as AVIF (encoder returned None)" + raise OSError(msg) + + fp.write(data) + + +Image.register_open(AvifImageFile.format, AvifImageFile, _accept) +if SUPPORTED: + Image.register_save(AvifImageFile.format, _save) + Image.register_save_all(AvifImageFile.format, _save_all) + Image.register_extensions(AvifImageFile.format, [".avif", ".avifs"]) + Image.register_mime(AvifImageFile.format, "image/avif") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BdfFontFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BdfFontFile.py new file mode 100644 index 0000000000000000000000000000000000000000..2c9dabc00c4b8be21a62da2cc7925ab63ac7f5c3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BdfFontFile.py @@ -0,0 +1,123 @@ +# +# The Python Imaging Library +# $Id$ +# +# bitmap distribution font (bdf) file parser +# +# history: +# 1996-05-16 fl created (as bdf2pil) +# 1997-08-25 fl converted to FontFile driver +# 2001-05-25 fl removed bogus __init__ call +# 2002-11-20 fl robustification (from Kevin Cazabon, Dmitry Vasiliev) +# 2003-04-22 fl more robustification (from Graham Dumpleton) +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1997-2003 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# + +""" +Parse X Bitmap Distribution Format (BDF) +""" + +from __future__ import annotations + +from typing import BinaryIO + +from . import FontFile, Image + + +def bdf_char( + f: BinaryIO, +) -> ( + tuple[ + str, + int, + tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]], + Image.Image, + ] + | None +): + # skip to STARTCHAR + while True: + s = f.readline() + if not s: + return None + if s.startswith(b"STARTCHAR"): + break + id = s[9:].strip().decode("ascii") + + # load symbol properties + props = {} + while True: + s = f.readline() + if not s or s.startswith(b"BITMAP"): + break + i = s.find(b" ") + props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii") + + # load bitmap + bitmap = bytearray() + while True: + s = f.readline() + if not s or s.startswith(b"ENDCHAR"): + break + bitmap += s[:-1] + + # The word BBX + # followed by the width in x (BBw), height in y (BBh), + # and x and y displacement (BBxoff0, BByoff0) + # of the lower left corner from the origin of the character. + width, height, x_disp, y_disp = (int(p) for p in props["BBX"].split()) + + # The word DWIDTH + # followed by the width in x and y of the character in device pixels. + dwx, dwy = (int(p) for p in props["DWIDTH"].split()) + + bbox = ( + (dwx, dwy), + (x_disp, -y_disp - height, width + x_disp, -y_disp), + (0, 0, width, height), + ) + + try: + im = Image.frombytes("1", (width, height), bitmap, "hex", "1") + except ValueError: + # deal with zero-width characters + im = Image.new("1", (width, height)) + + return id, int(props["ENCODING"]), bbox, im + + +class BdfFontFile(FontFile.FontFile): + """Font file plugin for the X11 BDF format.""" + + def __init__(self, fp: BinaryIO) -> None: + super().__init__() + + s = fp.readline() + if not s.startswith(b"STARTFONT 2.1"): + msg = "not a valid BDF file" + raise SyntaxError(msg) + + props = {} + comments = [] + + while True: + s = fp.readline() + if not s or s.startswith(b"ENDPROPERTIES"): + break + i = s.find(b" ") + props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii") + if s[:i] in [b"COMMENT", b"COPYRIGHT"]: + if s.find(b"LogicalFontDescription") < 0: + comments.append(s[i + 1 : -1].decode("ascii")) + + while True: + c = bdf_char(fp) + if not c: + break + id, ch, (xy, dst, src), im = c + if 0 <= ch < len(self.glyph): + self.glyph[ch] = xy, dst, src, im diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BlpImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BlpImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..417346b36aa6d59208289c6e191924ba507afafc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BlpImagePlugin.py @@ -0,0 +1,498 @@ +""" +Blizzard Mipmap Format (.blp) +Jerome Leclanche + +The contents of this file are hereby released in the public domain (CC0) +Full text of the CC0 license: + https://creativecommons.org/publicdomain/zero/1.0/ + +BLP1 files, used mostly in Warcraft III, are not fully supported. +All types of BLP2 files used in World of Warcraft are supported. + +The BLP file structure consists of a header, up to 16 mipmaps of the +texture + +Texture sizes must be powers of two, though the two dimensions do +not have to be equal; 512x256 is valid, but 512x200 is not. +The first mipmap (mipmap #0) is the full size image; each subsequent +mipmap halves both dimensions. The final mipmap should be 1x1. + +BLP files come in many different flavours: +* JPEG-compressed (type == 0) - only supported for BLP1. +* RAW images (type == 1, encoding == 1). Each mipmap is stored as an + array of 8-bit values, one per pixel, left to right, top to bottom. + Each value is an index to the palette. +* DXT-compressed (type == 1, encoding == 2): +- DXT1 compression is used if alpha_encoding == 0. + - An additional alpha bit is used if alpha_depth == 1. + - DXT3 compression is used if alpha_encoding == 1. + - DXT5 compression is used if alpha_encoding == 7. +""" + +from __future__ import annotations + +import abc +import os +import struct +from enum import IntEnum +from io import BytesIO +from typing import IO + +from . import Image, ImageFile + + +class Format(IntEnum): + JPEG = 0 + + +class Encoding(IntEnum): + UNCOMPRESSED = 1 + DXT = 2 + UNCOMPRESSED_RAW_BGRA = 3 + + +class AlphaEncoding(IntEnum): + DXT1 = 0 + DXT3 = 1 + DXT5 = 7 + + +def unpack_565(i: int) -> tuple[int, int, int]: + return ((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3 + + +def decode_dxt1( + data: bytes, alpha: bool = False +) -> tuple[bytearray, bytearray, bytearray, bytearray]: + """ + input: one "row" of data (i.e. will produce 4*width pixels) + """ + + blocks = len(data) // 8 # number of blocks in row + ret = (bytearray(), bytearray(), bytearray(), bytearray()) + + for block_index in range(blocks): + # Decode next 8-byte block. + idx = block_index * 8 + color0, color1, bits = struct.unpack_from("> 2 + + a = 0xFF + if control == 0: + r, g, b = r0, g0, b0 + elif control == 1: + r, g, b = r1, g1, b1 + elif control == 2: + if color0 > color1: + r = (2 * r0 + r1) // 3 + g = (2 * g0 + g1) // 3 + b = (2 * b0 + b1) // 3 + else: + r = (r0 + r1) // 2 + g = (g0 + g1) // 2 + b = (b0 + b1) // 2 + elif control == 3: + if color0 > color1: + r = (2 * r1 + r0) // 3 + g = (2 * g1 + g0) // 3 + b = (2 * b1 + b0) // 3 + else: + r, g, b, a = 0, 0, 0, 0 + + if alpha: + ret[j].extend([r, g, b, a]) + else: + ret[j].extend([r, g, b]) + + return ret + + +def decode_dxt3(data: bytes) -> tuple[bytearray, bytearray, bytearray, bytearray]: + """ + input: one "row" of data (i.e. will produce 4*width pixels) + """ + + blocks = len(data) // 16 # number of blocks in row + ret = (bytearray(), bytearray(), bytearray(), bytearray()) + + for block_index in range(blocks): + idx = block_index * 16 + block = data[idx : idx + 16] + # Decode next 16-byte block. + bits = struct.unpack_from("<8B", block) + color0, color1 = struct.unpack_from(">= 4 + else: + high = True + a &= 0xF + a *= 17 # We get a value between 0 and 15 + + color_code = (code >> 2 * (4 * j + i)) & 0x03 + + if color_code == 0: + r, g, b = r0, g0, b0 + elif color_code == 1: + r, g, b = r1, g1, b1 + elif color_code == 2: + r = (2 * r0 + r1) // 3 + g = (2 * g0 + g1) // 3 + b = (2 * b0 + b1) // 3 + elif color_code == 3: + r = (2 * r1 + r0) // 3 + g = (2 * g1 + g0) // 3 + b = (2 * b1 + b0) // 3 + + ret[j].extend([r, g, b, a]) + + return ret + + +def decode_dxt5(data: bytes) -> tuple[bytearray, bytearray, bytearray, bytearray]: + """ + input: one "row" of data (i.e. will produce 4 * width pixels) + """ + + blocks = len(data) // 16 # number of blocks in row + ret = (bytearray(), bytearray(), bytearray(), bytearray()) + + for block_index in range(blocks): + idx = block_index * 16 + block = data[idx : idx + 16] + # Decode next 16-byte block. + a0, a1 = struct.unpack_from("> alphacode_index) & 0x07 + elif alphacode_index == 15: + alphacode = (alphacode2 >> 15) | ((alphacode1 << 1) & 0x06) + else: # alphacode_index >= 18 and alphacode_index <= 45 + alphacode = (alphacode1 >> (alphacode_index - 16)) & 0x07 + + if alphacode == 0: + a = a0 + elif alphacode == 1: + a = a1 + elif a0 > a1: + a = ((8 - alphacode) * a0 + (alphacode - 1) * a1) // 7 + elif alphacode == 6: + a = 0 + elif alphacode == 7: + a = 255 + else: + a = ((6 - alphacode) * a0 + (alphacode - 1) * a1) // 5 + + color_code = (code >> 2 * (4 * j + i)) & 0x03 + + if color_code == 0: + r, g, b = r0, g0, b0 + elif color_code == 1: + r, g, b = r1, g1, b1 + elif color_code == 2: + r = (2 * r0 + r1) // 3 + g = (2 * g0 + g1) // 3 + b = (2 * b0 + b1) // 3 + elif color_code == 3: + r = (2 * r1 + r0) // 3 + g = (2 * g1 + g0) // 3 + b = (2 * b1 + b0) // 3 + + ret[j].extend([r, g, b, a]) + + return ret + + +class BLPFormatError(NotImplementedError): + pass + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith((b"BLP1", b"BLP2")) + + +class BlpImageFile(ImageFile.ImageFile): + """ + Blizzard Mipmap Format + """ + + format = "BLP" + format_description = "Blizzard Mipmap Format" + + def _open(self) -> None: + assert self.fp is not None + self.magic = self.fp.read(4) + if not _accept(self.magic): + msg = f"Bad BLP magic {repr(self.magic)}" + raise BLPFormatError(msg) + + compression = struct.unpack(" tuple[int, int]: + try: + self._read_header() + self._load() + except struct.error as e: + msg = "Truncated BLP file" + raise OSError(msg) from e + return -1, 0 + + @abc.abstractmethod + def _load(self) -> None: + pass + + def _read_header(self) -> None: + self._offsets = struct.unpack("<16I", self._safe_read(16 * 4)) + self._lengths = struct.unpack("<16I", self._safe_read(16 * 4)) + + def _safe_read(self, length: int) -> bytes: + assert self.fd is not None + return ImageFile._safe_read(self.fd, length) + + def _read_palette(self) -> list[tuple[int, int, int, int]]: + ret = [] + for i in range(256): + try: + b, g, r, a = struct.unpack("<4B", self._safe_read(4)) + except struct.error: + break + ret.append((b, g, r, a)) + return ret + + def _read_bgra( + self, palette: list[tuple[int, int, int, int]], alpha: bool + ) -> bytearray: + data = bytearray() + _data = BytesIO(self._safe_read(self._lengths[0])) + while True: + try: + (offset,) = struct.unpack(" None: + self._compression, self._encoding, alpha = self.args + + if self._compression == Format.JPEG: + self._decode_jpeg_stream() + + elif self._compression == 1: + if self._encoding in (4, 5): + palette = self._read_palette() + data = self._read_bgra(palette, alpha) + self.set_as_raw(data) + else: + msg = f"Unsupported BLP encoding {repr(self._encoding)}" + raise BLPFormatError(msg) + else: + msg = f"Unsupported BLP compression {repr(self._encoding)}" + raise BLPFormatError(msg) + + def _decode_jpeg_stream(self) -> None: + from .JpegImagePlugin import JpegImageFile + + (jpeg_header_size,) = struct.unpack(" None: + self._compression, self._encoding, alpha, self._alpha_encoding = self.args + + palette = self._read_palette() + + assert self.fd is not None + self.fd.seek(self._offsets[0]) + + if self._compression == 1: + # Uncompressed or DirectX compression + + if self._encoding == Encoding.UNCOMPRESSED: + data = self._read_bgra(palette, alpha) + + elif self._encoding == Encoding.DXT: + data = bytearray() + if self._alpha_encoding == AlphaEncoding.DXT1: + linesize = (self.state.xsize + 3) // 4 * 8 + for yb in range((self.state.ysize + 3) // 4): + for d in decode_dxt1(self._safe_read(linesize), alpha): + data += d + + elif self._alpha_encoding == AlphaEncoding.DXT3: + linesize = (self.state.xsize + 3) // 4 * 16 + for yb in range((self.state.ysize + 3) // 4): + for d in decode_dxt3(self._safe_read(linesize)): + data += d + + elif self._alpha_encoding == AlphaEncoding.DXT5: + linesize = (self.state.xsize + 3) // 4 * 16 + for yb in range((self.state.ysize + 3) // 4): + for d in decode_dxt5(self._safe_read(linesize)): + data += d + else: + msg = f"Unsupported alpha encoding {repr(self._alpha_encoding)}" + raise BLPFormatError(msg) + else: + msg = f"Unknown BLP encoding {repr(self._encoding)}" + raise BLPFormatError(msg) + + else: + msg = f"Unknown BLP compression {repr(self._compression)}" + raise BLPFormatError(msg) + + self.set_as_raw(data) + + +class BLPEncoder(ImageFile.PyEncoder): + _pushes_fd = True + + def _write_palette(self) -> bytes: + data = b"" + assert self.im is not None + palette = self.im.getpalette("RGBA", "RGBA") + for i in range(len(palette) // 4): + r, g, b, a = palette[i * 4 : (i + 1) * 4] + data += struct.pack("<4B", b, g, r, a) + while len(data) < 256 * 4: + data += b"\x00" * 4 + return data + + def encode(self, bufsize: int) -> tuple[int, int, bytes]: + palette_data = self._write_palette() + + offset = 20 + 16 * 4 * 2 + len(palette_data) + data = struct.pack("<16I", offset, *((0,) * 15)) + + assert self.im is not None + w, h = self.im.size + data += struct.pack("<16I", w * h, *((0,) * 15)) + + data += palette_data + + for y in range(h): + for x in range(w): + data += struct.pack(" None: + if im.mode != "P": + msg = "Unsupported BLP image mode" + raise ValueError(msg) + + magic = b"BLP1" if im.encoderinfo.get("blp_version") == "BLP1" else b"BLP2" + fp.write(magic) + + assert im.palette is not None + fp.write(struct.pack(" mode, rawmode + 1: ("P", "P;1"), + 4: ("P", "P;4"), + 8: ("P", "P"), + 16: ("RGB", "BGR;15"), + 24: ("RGB", "BGR"), + 32: ("RGB", "BGRX"), +} + +USE_RAW_ALPHA = False + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"BM") + + +def _dib_accept(prefix: bytes) -> bool: + return i32(prefix) in [12, 40, 52, 56, 64, 108, 124] + + +# ============================================================================= +# Image plugin for the Windows BMP format. +# ============================================================================= +class BmpImageFile(ImageFile.ImageFile): + """Image plugin for the Windows Bitmap format (BMP)""" + + # ------------------------------------------------------------- Description + format_description = "Windows Bitmap" + format = "BMP" + + # -------------------------------------------------- BMP Compression values + COMPRESSIONS = {"RAW": 0, "RLE8": 1, "RLE4": 2, "BITFIELDS": 3, "JPEG": 4, "PNG": 5} + for k, v in COMPRESSIONS.items(): + vars()[k] = v + + def _bitmap(self, header: int = 0, offset: int = 0) -> None: + """Read relevant info about the BMP""" + assert self.fp is not None + read, seek = self.fp.read, self.fp.seek + if header: + seek(header) + # read bmp header size @offset 14 (this is part of the header size) + file_info: dict[str, bool | int | tuple[int, ...]] = { + "header_size": i32(read(4)), + "direction": -1, + } + + # -------------------- If requested, read header at a specific position + # read the rest of the bmp header, without its size + assert isinstance(file_info["header_size"], int) + header_data = ImageFile._safe_read(self.fp, file_info["header_size"] - 4) + + # ------------------------------- Windows Bitmap v2, IBM OS/2 Bitmap v1 + # ----- This format has different offsets because of width/height types + # 12: BITMAPCOREHEADER/OS21XBITMAPHEADER + if file_info["header_size"] == 12: + file_info["width"] = i16(header_data, 0) + file_info["height"] = i16(header_data, 2) + file_info["planes"] = i16(header_data, 4) + file_info["bits"] = i16(header_data, 6) + file_info["compression"] = self.COMPRESSIONS["RAW"] + file_info["palette_padding"] = 3 + + # --------------------------------------------- Windows Bitmap v3 to v5 + # 40: BITMAPINFOHEADER + # 52: BITMAPV2HEADER + # 56: BITMAPV3HEADER + # 64: BITMAPCOREHEADER2/OS22XBITMAPHEADER + # 108: BITMAPV4HEADER + # 124: BITMAPV5HEADER + elif file_info["header_size"] in (40, 52, 56, 64, 108, 124): + file_info["y_flip"] = header_data[7] == 0xFF + file_info["direction"] = 1 if file_info["y_flip"] else -1 + file_info["width"] = i32(header_data, 0) + file_info["height"] = ( + i32(header_data, 4) + if not file_info["y_flip"] + else 2**32 - i32(header_data, 4) + ) + file_info["planes"] = i16(header_data, 8) + file_info["bits"] = i16(header_data, 10) + file_info["compression"] = i32(header_data, 12) + # byte size of pixel data + file_info["data_size"] = i32(header_data, 16) + file_info["pixels_per_meter"] = ( + i32(header_data, 20), + i32(header_data, 24), + ) + file_info["colors"] = i32(header_data, 28) + file_info["palette_padding"] = 4 + assert isinstance(file_info["pixels_per_meter"], tuple) + self.info["dpi"] = tuple(x / 39.3701 for x in file_info["pixels_per_meter"]) + if file_info["compression"] == self.COMPRESSIONS["BITFIELDS"]: + masks = ["r_mask", "g_mask", "b_mask"] + if len(header_data) >= 48: + if len(header_data) >= 52: + masks.append("a_mask") + else: + file_info["a_mask"] = 0x0 + for idx, mask in enumerate(masks): + file_info[mask] = i32(header_data, 36 + idx * 4) + else: + # 40 byte headers only have the three components in the + # bitfields masks, ref: + # https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx + # See also + # https://github.com/python-pillow/Pillow/issues/1293 + # There is a 4th component in the RGBQuad, in the alpha + # location, but it is listed as a reserved component, + # and it is not generally an alpha channel + file_info["a_mask"] = 0x0 + for mask in masks: + file_info[mask] = i32(read(4)) + assert isinstance(file_info["r_mask"], int) + assert isinstance(file_info["g_mask"], int) + assert isinstance(file_info["b_mask"], int) + assert isinstance(file_info["a_mask"], int) + file_info["rgb_mask"] = ( + file_info["r_mask"], + file_info["g_mask"], + file_info["b_mask"], + ) + file_info["rgba_mask"] = ( + file_info["r_mask"], + file_info["g_mask"], + file_info["b_mask"], + file_info["a_mask"], + ) + else: + msg = f"Unsupported BMP header type ({file_info['header_size']})" + raise OSError(msg) + + # ------------------ Special case : header is reported 40, which + # ---------------------- is shorter than real size for bpp >= 16 + assert isinstance(file_info["width"], int) + assert isinstance(file_info["height"], int) + self._size = file_info["width"], file_info["height"] + + # ------- If color count was not found in the header, compute from bits + assert isinstance(file_info["bits"], int) + if not file_info.get("colors", 0): + file_info["colors"] = 1 << file_info["bits"] + assert isinstance(file_info["palette_padding"], int) + assert isinstance(file_info["colors"], int) + if offset == 14 + file_info["header_size"] and file_info["bits"] <= 8: + offset += file_info["palette_padding"] * file_info["colors"] + + # ---------------------- Check bit depth for unusual unsupported values + self._mode, raw_mode = BIT2MODE.get(file_info["bits"], ("", "")) + if not self.mode: + msg = f"Unsupported BMP pixel depth ({file_info['bits']})" + raise OSError(msg) + + # ---------------- Process BMP with Bitfields compression (not palette) + decoder_name = "raw" + if file_info["compression"] == self.COMPRESSIONS["BITFIELDS"]: + SUPPORTED: dict[int, list[tuple[int, ...]]] = { + 32: [ + (0xFF0000, 0xFF00, 0xFF, 0x0), + (0xFF000000, 0xFF0000, 0xFF00, 0x0), + (0xFF000000, 0xFF00, 0xFF, 0x0), + (0xFF000000, 0xFF0000, 0xFF00, 0xFF), + (0xFF, 0xFF00, 0xFF0000, 0xFF000000), + (0xFF0000, 0xFF00, 0xFF, 0xFF000000), + (0xFF000000, 0xFF00, 0xFF, 0xFF0000), + (0x0, 0x0, 0x0, 0x0), + ], + 24: [(0xFF0000, 0xFF00, 0xFF)], + 16: [(0xF800, 0x7E0, 0x1F), (0x7C00, 0x3E0, 0x1F)], + } + MASK_MODES = { + (32, (0xFF0000, 0xFF00, 0xFF, 0x0)): "BGRX", + (32, (0xFF000000, 0xFF0000, 0xFF00, 0x0)): "XBGR", + (32, (0xFF000000, 0xFF00, 0xFF, 0x0)): "BGXR", + (32, (0xFF000000, 0xFF0000, 0xFF00, 0xFF)): "ABGR", + (32, (0xFF, 0xFF00, 0xFF0000, 0xFF000000)): "RGBA", + (32, (0xFF0000, 0xFF00, 0xFF, 0xFF000000)): "BGRA", + (32, (0xFF000000, 0xFF00, 0xFF, 0xFF0000)): "BGAR", + (32, (0x0, 0x0, 0x0, 0x0)): "BGRA", + (24, (0xFF0000, 0xFF00, 0xFF)): "BGR", + (16, (0xF800, 0x7E0, 0x1F)): "BGR;16", + (16, (0x7C00, 0x3E0, 0x1F)): "BGR;15", + } + if file_info["bits"] in SUPPORTED: + if ( + file_info["bits"] == 32 + and file_info["rgba_mask"] in SUPPORTED[file_info["bits"]] + ): + assert isinstance(file_info["rgba_mask"], tuple) + raw_mode = MASK_MODES[(file_info["bits"], file_info["rgba_mask"])] + self._mode = "RGBA" if "A" in raw_mode else self.mode + elif ( + file_info["bits"] in (24, 16) + and file_info["rgb_mask"] in SUPPORTED[file_info["bits"]] + ): + assert isinstance(file_info["rgb_mask"], tuple) + raw_mode = MASK_MODES[(file_info["bits"], file_info["rgb_mask"])] + else: + msg = "Unsupported BMP bitfields layout" + raise OSError(msg) + else: + msg = "Unsupported BMP bitfields layout" + raise OSError(msg) + elif file_info["compression"] == self.COMPRESSIONS["RAW"]: + if file_info["bits"] == 32 and ( + header == 22 or USE_RAW_ALPHA # 32-bit .cur offset + ): + raw_mode, self._mode = "BGRA", "RGBA" + elif file_info["compression"] in ( + self.COMPRESSIONS["RLE8"], + self.COMPRESSIONS["RLE4"], + ): + decoder_name = "bmp_rle" + else: + msg = f"Unsupported BMP compression ({file_info['compression']})" + raise OSError(msg) + + # --------------- Once the header is processed, process the palette/LUT + if self.mode == "P": # Paletted for 1, 4 and 8 bit images + # ---------------------------------------------------- 1-bit images + if not (0 < file_info["colors"] <= 65536): + msg = f"Unsupported BMP Palette size ({file_info['colors']})" + raise OSError(msg) + else: + padding = file_info["palette_padding"] + palette = read(padding * file_info["colors"]) + grayscale = True + indices = ( + (0, 255) + if file_info["colors"] == 2 + else list(range(file_info["colors"])) + ) + + # ----------------- Check if grayscale and ignore palette if so + for ind, val in enumerate(indices): + rgb = palette[ind * padding : ind * padding + 3] + if rgb != o8(val) * 3: + grayscale = False + + # ------- If all colors are gray, white or black, ditch palette + if grayscale: + self._mode = "1" if file_info["colors"] == 2 else "L" + raw_mode = self.mode + else: + self._mode = "P" + self.palette = ImagePalette.raw( + "BGRX" if padding == 4 else "BGR", palette + ) + + # ---------------------------- Finally set the tile data for the plugin + self.info["compression"] = file_info["compression"] + args: list[Any] = [raw_mode] + if decoder_name == "bmp_rle": + args.append(file_info["compression"] == self.COMPRESSIONS["RLE4"]) + else: + assert isinstance(file_info["width"], int) + args.append(((file_info["width"] * file_info["bits"] + 31) >> 3) & (~3)) + args.append(file_info["direction"]) + self.tile = [ + ImageFile._Tile( + decoder_name, + (0, 0, file_info["width"], file_info["height"]), + offset or self.fp.tell(), + tuple(args), + ) + ] + + def _open(self) -> None: + """Open file, check magic number and read header""" + # read 14 bytes: magic number, filesize, reserved, header final offset + assert self.fp is not None + head_data = self.fp.read(14) + # choke if the file does not have the required magic bytes + if not _accept(head_data): + msg = "Not a BMP file" + raise SyntaxError(msg) + # read the start position of the BMP image data (u32) + offset = i32(head_data, 10) + # load bitmap information (offset=raster info) + self._bitmap(offset=offset) + + +class BmpRleDecoder(ImageFile.PyDecoder): + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + rle4 = self.args[1] + data = bytearray() + x = 0 + dest_length = self.state.xsize * self.state.ysize + while len(data) < dest_length: + pixels = self.fd.read(1) + byte = self.fd.read(1) + if not pixels or not byte: + break + num_pixels = pixels[0] + if num_pixels: + # encoded mode + if x + num_pixels > self.state.xsize: + # Too much data for row + num_pixels = max(0, self.state.xsize - x) + if rle4: + first_pixel = o8(byte[0] >> 4) + second_pixel = o8(byte[0] & 0x0F) + for index in range(num_pixels): + if index % 2 == 0: + data += first_pixel + else: + data += second_pixel + else: + data += byte * num_pixels + x += num_pixels + else: + if byte[0] == 0: + # end of line + while len(data) % self.state.xsize != 0: + data += b"\x00" + x = 0 + elif byte[0] == 1: + # end of bitmap + break + elif byte[0] == 2: + # delta + bytes_read = self.fd.read(2) + if len(bytes_read) < 2: + break + right, up = bytes_read + data += b"\x00" * (right + up * self.state.xsize) + x = len(data) % self.state.xsize + else: + # absolute mode + if rle4: + # 2 pixels per byte + byte_count = byte[0] // 2 + bytes_read = self.fd.read(byte_count) + for byte_read in bytes_read: + data += o8(byte_read >> 4) + data += o8(byte_read & 0x0F) + else: + byte_count = byte[0] + bytes_read = self.fd.read(byte_count) + data += bytes_read + if len(bytes_read) < byte_count: + break + x += byte[0] + + # align to 16-bit word boundary + if self.fd.tell() % 2 != 0: + self.fd.seek(1, os.SEEK_CUR) + rawmode = "L" if self.mode == "L" else "P" + self.set_as_raw(bytes(data), rawmode, (0, self.args[-1])) + return -1, 0 + + +# ============================================================================= +# Image plugin for the DIB format (BMP alias) +# ============================================================================= +class DibImageFile(BmpImageFile): + format = "DIB" + format_description = "Windows Bitmap" + + def _open(self) -> None: + self._bitmap() + + +# +# -------------------------------------------------------------------- +# Write BMP file + + +SAVE = { + "1": ("1", 1, 2), + "L": ("L", 8, 256), + "P": ("P", 8, 256), + "RGB": ("BGR", 24, 0), + "RGBA": ("BGRA", 32, 0), +} + + +def _dib_save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + _save(im, fp, filename, False) + + +def _save( + im: Image.Image, fp: IO[bytes], filename: str | bytes, bitmap_header: bool = True +) -> None: + try: + rawmode, bits, colors = SAVE[im.mode] + except KeyError as e: + msg = f"cannot write mode {im.mode} as BMP" + raise OSError(msg) from e + + info = im.encoderinfo + + dpi = info.get("dpi", (96, 96)) + + # 1 meter == 39.3701 inches + ppm = tuple(int(x * 39.3701 + 0.5) for x in dpi) + + stride = ((im.size[0] * bits + 7) // 8 + 3) & (~3) + header = 40 # or 64 for OS/2 version 2 + image = stride * im.size[1] + + if im.mode == "1": + palette = b"".join(o8(i) * 3 + b"\x00" for i in (0, 255)) + elif im.mode == "L": + palette = b"".join(o8(i) * 3 + b"\x00" for i in range(256)) + elif im.mode == "P": + palette = im.im.getpalette("RGB", "BGRX") + colors = len(palette) // 4 + else: + palette = None + + # bitmap header + if bitmap_header: + offset = 14 + header + colors * 4 + file_size = offset + image + if file_size > 2**32 - 1: + msg = "File size is too large for the BMP format" + raise ValueError(msg) + fp.write( + b"BM" # file type (magic) + + o32(file_size) # file size + + o32(0) # reserved + + o32(offset) # image data offset + ) + + # bitmap info header + fp.write( + o32(header) # info header size + + o32(im.size[0]) # width + + o32(im.size[1]) # height + + o16(1) # planes + + o16(bits) # depth + + o32(0) # compression (0=uncompressed) + + o32(image) # size of bitmap + + o32(ppm[0]) # resolution + + o32(ppm[1]) # resolution + + o32(colors) # colors used + + o32(colors) # colors important + ) + + fp.write(b"\0" * (header - 40)) # padding (for OS/2 format) + + if palette: + fp.write(palette) + + ImageFile._save( + im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, stride, -1))] + ) + + +# +# -------------------------------------------------------------------- +# Registry + + +Image.register_open(BmpImageFile.format, BmpImageFile, _accept) +Image.register_save(BmpImageFile.format, _save) + +Image.register_extension(BmpImageFile.format, ".bmp") + +Image.register_mime(BmpImageFile.format, "image/bmp") + +Image.register_decoder("bmp_rle", BmpRleDecoder) + +Image.register_open(DibImageFile.format, DibImageFile, _dib_accept) +Image.register_save(DibImageFile.format, _dib_save) + +Image.register_extension(DibImageFile.format, ".dib") + +Image.register_mime(DibImageFile.format, "image/bmp") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BufrStubImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BufrStubImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..ff2e4e623f273f03e19dcfe7f20ea26bfae6ddc4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/BufrStubImagePlugin.py @@ -0,0 +1,72 @@ +# +# The Python Imaging Library +# $Id$ +# +# BUFR stub adapter +# +# Copyright (c) 1996-2003 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +from typing import IO + +from . import Image, ImageFile + +_handler = None + + +def register_handler(handler: ImageFile.StubHandler | None) -> None: + """ + Install application-specific BUFR image handler. + + :param handler: Handler object. + """ + global _handler + _handler = handler + + +# -------------------------------------------------------------------- +# Image adapter + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith((b"BUFR", b"ZCZC")) + + +class BufrStubImageFile(ImageFile.StubImageFile): + format = "BUFR" + format_description = "BUFR" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(4)): + msg = "Not a BUFR file" + raise SyntaxError(msg) + + self.fp.seek(-4, os.SEEK_CUR) + + # make something up + self._mode = "F" + self._size = 1, 1 + + def _load(self) -> ImageFile.StubHandler | None: + return _handler + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if _handler is None or not hasattr(_handler, "save"): + msg = "BUFR save handler not installed" + raise OSError(msg) + _handler.save(im, fp, filename) + + +# -------------------------------------------------------------------- +# Registry + +Image.register_open(BufrStubImageFile.format, BufrStubImageFile, _accept) +Image.register_save(BufrStubImageFile.format, _save) + +Image.register_extension(BufrStubImageFile.format, ".bufr") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ContainerIO.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ContainerIO.py new file mode 100644 index 0000000000000000000000000000000000000000..9c6f07a7b46f2ee5d98ab0c562b5ab1611cfa333 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ContainerIO.py @@ -0,0 +1,173 @@ +# +# The Python Imaging Library. +# $Id$ +# +# a class to read from a container file +# +# History: +# 1995-06-18 fl Created +# 1995-09-07 fl Added readline(), readlines() +# +# Copyright (c) 1997-2001 by Secret Labs AB +# Copyright (c) 1995 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +from collections.abc import Iterable +from typing import IO, AnyStr, NoReturn + + +class ContainerIO(IO[AnyStr]): + """ + A file object that provides read access to a part of an existing + file (for example a TAR file). + """ + + def __init__(self, file: IO[AnyStr], offset: int, length: int) -> None: + """ + Create file object. + + :param file: Existing file. + :param offset: Start of region, in bytes. + :param length: Size of region, in bytes. + """ + self.fh: IO[AnyStr] = file + self.pos = 0 + self.offset = offset + self.length = length + self.fh.seek(offset) + + ## + # Always false. + + def isatty(self) -> bool: + return False + + def seekable(self) -> bool: + return True + + def seek(self, offset: int, mode: int = io.SEEK_SET) -> int: + """ + Move file pointer. + + :param offset: Offset in bytes. + :param mode: Starting position. Use 0 for beginning of region, 1 + for current offset, and 2 for end of region. You cannot move + the pointer outside the defined region. + :returns: Offset from start of region, in bytes. + """ + if mode == 1: + self.pos = self.pos + offset + elif mode == 2: + self.pos = self.length + offset + else: + self.pos = offset + # clamp + self.pos = max(0, min(self.pos, self.length)) + self.fh.seek(self.offset + self.pos) + return self.pos + + def tell(self) -> int: + """ + Get current file pointer. + + :returns: Offset from start of region, in bytes. + """ + return self.pos + + def readable(self) -> bool: + return True + + def read(self, n: int = -1) -> AnyStr: + """ + Read data. + + :param n: Number of bytes to read. If omitted, zero or negative, + read until end of region. + :returns: An 8-bit string. + """ + if n > 0: + n = min(n, self.length - self.pos) + else: + n = self.length - self.pos + if n <= 0: # EOF + return b"" if "b" in self.fh.mode else "" # type: ignore[return-value] + self.pos = self.pos + n + return self.fh.read(n) + + def readline(self, n: int = -1) -> AnyStr: + """ + Read a line of text. + + :param n: Number of bytes to read. If omitted, zero or negative, + read until end of line. + :returns: An 8-bit string. + """ + s: AnyStr = b"" if "b" in self.fh.mode else "" # type: ignore[assignment] + newline_character = b"\n" if "b" in self.fh.mode else "\n" + while True: + c = self.read(1) + if not c: + break + s = s + c + if c == newline_character or len(s) == n: + break + return s + + def readlines(self, n: int | None = -1) -> list[AnyStr]: + """ + Read multiple lines of text. + + :param n: Number of lines to read. If omitted, zero, negative or None, + read until end of region. + :returns: A list of 8-bit strings. + """ + lines = [] + while True: + s = self.readline() + if not s: + break + lines.append(s) + if len(lines) == n: + break + return lines + + def writable(self) -> bool: + return False + + def write(self, b: AnyStr) -> NoReturn: + raise NotImplementedError() + + def writelines(self, lines: Iterable[AnyStr]) -> NoReturn: + raise NotImplementedError() + + def truncate(self, size: int | None = None) -> int: + raise NotImplementedError() + + def __enter__(self) -> ContainerIO[AnyStr]: + return self + + def __exit__(self, *args: object) -> None: + self.close() + + def __iter__(self) -> ContainerIO[AnyStr]: + return self + + def __next__(self) -> AnyStr: + line = self.readline() + if not line: + msg = "end of region" + raise StopIteration(msg) + return line + + def fileno(self) -> int: + return self.fh.fileno() + + def flush(self) -> None: + self.fh.flush() + + def close(self) -> None: + self.fh.close() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/CurImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/CurImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..b952b2178b22dc0fe95b26ada49458cee9c12b78 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/CurImagePlugin.py @@ -0,0 +1,75 @@ +# +# The Python Imaging Library. +# $Id$ +# +# Windows Cursor support for PIL +# +# notes: +# uses BmpImagePlugin.py to read the bitmap data. +# +# history: +# 96-05-27 fl Created +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import BmpImagePlugin, Image +from ._binary import i16le as i16 +from ._binary import i32le as i32 + +# +# -------------------------------------------------------------------- + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"\0\0\2\0") + + +## +# Image plugin for Windows Cursor files. + + +class CurImageFile(BmpImagePlugin.BmpImageFile): + format = "CUR" + format_description = "Windows Cursor" + + def _open(self) -> None: + assert self.fp is not None + offset = self.fp.tell() + + # check magic + s = self.fp.read(6) + if not _accept(s): + msg = "not a CUR file" + raise SyntaxError(msg) + + # pick the largest cursor in the file + m = b"" + for i in range(i16(s, 4)): + s = self.fp.read(16) + if not m: + m = s + elif s[0] > m[0] and s[1] > m[1]: + m = s + if not m: + msg = "No cursors were found" + raise TypeError(msg) + + # load as bitmap + self._bitmap(i32(m, 12) + offset) + + # patch up the bitmap height + self._size = self.size[0], self.size[1] // 2 + self.tile = [self.tile[0]._replace(extents=(0, 0) + self.size)] + + +# +# -------------------------------------------------------------------- + +Image.register_open(CurImageFile.format, CurImageFile, _accept) + +Image.register_extension(CurImageFile.format, ".cur") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/DcxImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/DcxImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..bfe731fcee114a32302e325807baff86e2c7c10d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/DcxImagePlugin.py @@ -0,0 +1,84 @@ +# +# The Python Imaging Library. +# $Id$ +# +# DCX file handling +# +# DCX is a container file format defined by Intel, commonly used +# for fax applications. Each DCX file consists of a directory +# (a list of file offsets) followed by a set of (usually 1-bit) +# PCX files. +# +# History: +# 1995-09-09 fl Created +# 1996-03-20 fl Properly derived from PcxImageFile. +# 1998-07-15 fl Renamed offset attribute to avoid name clash +# 2002-07-30 fl Fixed file handling +# +# Copyright (c) 1997-98 by Secret Labs AB. +# Copyright (c) 1995-96 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image +from ._binary import i32le as i32 +from ._util import DeferredError +from .PcxImagePlugin import PcxImageFile + +MAGIC = 0x3ADE68B1 # QUIZ: what's this value, then? + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 4 and i32(prefix) == MAGIC + + +## +# Image plugin for the Intel DCX format. + + +class DcxImageFile(PcxImageFile): + format = "DCX" + format_description = "Intel DCX" + _close_exclusive_fp_after_loading = False + + def _open(self) -> None: + # Header + assert self.fp is not None + s = self.fp.read(4) + if not _accept(s): + msg = "not a DCX file" + raise SyntaxError(msg) + + # Component directory + self._offset = [] + for i in range(1024): + offset = i32(self.fp.read(4)) + if not offset: + break + self._offset.append(offset) + + self._fp = self.fp + self.frame = -1 + self.n_frames = len(self._offset) + self.is_animated = self.n_frames > 1 + self.seek(0) + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + if isinstance(self._fp, DeferredError): + raise self._fp.ex + self.frame = frame + self.fp = self._fp + self.fp.seek(self._offset[frame]) + PcxImageFile._open(self) + + def tell(self) -> int: + return self.frame + + +Image.register_open(DcxImageFile.format, DcxImageFile, _accept) + +Image.register_extension(DcxImageFile.format, ".dcx") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/DdsImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/DdsImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..6183164acde31e40607d1bc1b3f29ab19d08335a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/DdsImagePlugin.py @@ -0,0 +1,625 @@ +""" +A Pillow plugin for .dds files (S3TC-compressed aka DXTC) +Jerome Leclanche + +Documentation: +https://web.archive.org/web/20170802060935/http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt + +The contents of this file are hereby released in the public domain (CC0) +Full text of the CC0 license: +https://creativecommons.org/publicdomain/zero/1.0/ +""" + +from __future__ import annotations + +import struct +import sys +from enum import IntEnum, IntFlag +from typing import IO + +from . import Image, ImageFile, ImagePalette +from ._binary import i32le as i32 +from ._binary import o8 +from ._binary import o32le as o32 + +# Magic ("DDS ") +DDS_MAGIC = 0x20534444 + + +# DDS flags +class DDSD(IntFlag): + CAPS = 0x1 + HEIGHT = 0x2 + WIDTH = 0x4 + PITCH = 0x8 + PIXELFORMAT = 0x1000 + MIPMAPCOUNT = 0x20000 + LINEARSIZE = 0x80000 + DEPTH = 0x800000 + + +# DDS caps +class DDSCAPS(IntFlag): + COMPLEX = 0x8 + TEXTURE = 0x1000 + MIPMAP = 0x400000 + + +class DDSCAPS2(IntFlag): + CUBEMAP = 0x200 + CUBEMAP_POSITIVEX = 0x400 + CUBEMAP_NEGATIVEX = 0x800 + CUBEMAP_POSITIVEY = 0x1000 + CUBEMAP_NEGATIVEY = 0x2000 + CUBEMAP_POSITIVEZ = 0x4000 + CUBEMAP_NEGATIVEZ = 0x8000 + VOLUME = 0x200000 + + +# Pixel Format +class DDPF(IntFlag): + ALPHAPIXELS = 0x1 + ALPHA = 0x2 + FOURCC = 0x4 + PALETTEINDEXED8 = 0x20 + RGB = 0x40 + LUMINANCE = 0x20000 + + +# dxgiformat.h +class DXGI_FORMAT(IntEnum): + UNKNOWN = 0 + R32G32B32A32_TYPELESS = 1 + R32G32B32A32_FLOAT = 2 + R32G32B32A32_UINT = 3 + R32G32B32A32_SINT = 4 + R32G32B32_TYPELESS = 5 + R32G32B32_FLOAT = 6 + R32G32B32_UINT = 7 + R32G32B32_SINT = 8 + R16G16B16A16_TYPELESS = 9 + R16G16B16A16_FLOAT = 10 + R16G16B16A16_UNORM = 11 + R16G16B16A16_UINT = 12 + R16G16B16A16_SNORM = 13 + R16G16B16A16_SINT = 14 + R32G32_TYPELESS = 15 + R32G32_FLOAT = 16 + R32G32_UINT = 17 + R32G32_SINT = 18 + R32G8X24_TYPELESS = 19 + D32_FLOAT_S8X24_UINT = 20 + R32_FLOAT_X8X24_TYPELESS = 21 + X32_TYPELESS_G8X24_UINT = 22 + R10G10B10A2_TYPELESS = 23 + R10G10B10A2_UNORM = 24 + R10G10B10A2_UINT = 25 + R11G11B10_FLOAT = 26 + R8G8B8A8_TYPELESS = 27 + R8G8B8A8_UNORM = 28 + R8G8B8A8_UNORM_SRGB = 29 + R8G8B8A8_UINT = 30 + R8G8B8A8_SNORM = 31 + R8G8B8A8_SINT = 32 + R16G16_TYPELESS = 33 + R16G16_FLOAT = 34 + R16G16_UNORM = 35 + R16G16_UINT = 36 + R16G16_SNORM = 37 + R16G16_SINT = 38 + R32_TYPELESS = 39 + D32_FLOAT = 40 + R32_FLOAT = 41 + R32_UINT = 42 + R32_SINT = 43 + R24G8_TYPELESS = 44 + D24_UNORM_S8_UINT = 45 + R24_UNORM_X8_TYPELESS = 46 + X24_TYPELESS_G8_UINT = 47 + R8G8_TYPELESS = 48 + R8G8_UNORM = 49 + R8G8_UINT = 50 + R8G8_SNORM = 51 + R8G8_SINT = 52 + R16_TYPELESS = 53 + R16_FLOAT = 54 + D16_UNORM = 55 + R16_UNORM = 56 + R16_UINT = 57 + R16_SNORM = 58 + R16_SINT = 59 + R8_TYPELESS = 60 + R8_UNORM = 61 + R8_UINT = 62 + R8_SNORM = 63 + R8_SINT = 64 + A8_UNORM = 65 + R1_UNORM = 66 + R9G9B9E5_SHAREDEXP = 67 + R8G8_B8G8_UNORM = 68 + G8R8_G8B8_UNORM = 69 + BC1_TYPELESS = 70 + BC1_UNORM = 71 + BC1_UNORM_SRGB = 72 + BC2_TYPELESS = 73 + BC2_UNORM = 74 + BC2_UNORM_SRGB = 75 + BC3_TYPELESS = 76 + BC3_UNORM = 77 + BC3_UNORM_SRGB = 78 + BC4_TYPELESS = 79 + BC4_UNORM = 80 + BC4_SNORM = 81 + BC5_TYPELESS = 82 + BC5_UNORM = 83 + BC5_SNORM = 84 + B5G6R5_UNORM = 85 + B5G5R5A1_UNORM = 86 + B8G8R8A8_UNORM = 87 + B8G8R8X8_UNORM = 88 + R10G10B10_XR_BIAS_A2_UNORM = 89 + B8G8R8A8_TYPELESS = 90 + B8G8R8A8_UNORM_SRGB = 91 + B8G8R8X8_TYPELESS = 92 + B8G8R8X8_UNORM_SRGB = 93 + BC6H_TYPELESS = 94 + BC6H_UF16 = 95 + BC6H_SF16 = 96 + BC7_TYPELESS = 97 + BC7_UNORM = 98 + BC7_UNORM_SRGB = 99 + AYUV = 100 + Y410 = 101 + Y416 = 102 + NV12 = 103 + P010 = 104 + P016 = 105 + OPAQUE_420 = 106 + YUY2 = 107 + Y210 = 108 + Y216 = 109 + NV11 = 110 + AI44 = 111 + IA44 = 112 + P8 = 113 + A8P8 = 114 + B4G4R4A4_UNORM = 115 + P208 = 130 + V208 = 131 + V408 = 132 + SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189 + SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190 + + +class D3DFMT(IntEnum): + UNKNOWN = 0 + R8G8B8 = 20 + A8R8G8B8 = 21 + X8R8G8B8 = 22 + R5G6B5 = 23 + X1R5G5B5 = 24 + A1R5G5B5 = 25 + A4R4G4B4 = 26 + R3G3B2 = 27 + A8 = 28 + A8R3G3B2 = 29 + X4R4G4B4 = 30 + A2B10G10R10 = 31 + A8B8G8R8 = 32 + X8B8G8R8 = 33 + G16R16 = 34 + A2R10G10B10 = 35 + A16B16G16R16 = 36 + A8P8 = 40 + P8 = 41 + L8 = 50 + A8L8 = 51 + A4L4 = 52 + V8U8 = 60 + L6V5U5 = 61 + X8L8V8U8 = 62 + Q8W8V8U8 = 63 + V16U16 = 64 + A2W10V10U10 = 67 + D16_LOCKABLE = 70 + D32 = 71 + D15S1 = 73 + D24S8 = 75 + D24X8 = 77 + D24X4S4 = 79 + D16 = 80 + D32F_LOCKABLE = 82 + D24FS8 = 83 + D32_LOCKABLE = 84 + S8_LOCKABLE = 85 + L16 = 81 + VERTEXDATA = 100 + INDEX16 = 101 + INDEX32 = 102 + Q16W16V16U16 = 110 + R16F = 111 + G16R16F = 112 + A16B16G16R16F = 113 + R32F = 114 + G32R32F = 115 + A32B32G32R32F = 116 + CxV8U8 = 117 + A1 = 118 + A2B10G10R10_XR_BIAS = 119 + BINARYBUFFER = 199 + + UYVY = i32(b"UYVY") + R8G8_B8G8 = i32(b"RGBG") + YUY2 = i32(b"YUY2") + G8R8_G8B8 = i32(b"GRGB") + DXT1 = i32(b"DXT1") + DXT2 = i32(b"DXT2") + DXT3 = i32(b"DXT3") + DXT4 = i32(b"DXT4") + DXT5 = i32(b"DXT5") + DX10 = i32(b"DX10") + BC4S = i32(b"BC4S") + BC4U = i32(b"BC4U") + BC5S = i32(b"BC5S") + BC5U = i32(b"BC5U") + ATI1 = i32(b"ATI1") + ATI2 = i32(b"ATI2") + MULTI2_ARGB8 = i32(b"MET1") + + +# Backward compatibility layer +module = sys.modules[__name__] +for item in DDSD: + assert item.name is not None + setattr(module, f"DDSD_{item.name}", item.value) +for item1 in DDSCAPS: + assert item1.name is not None + setattr(module, f"DDSCAPS_{item1.name}", item1.value) +for item2 in DDSCAPS2: + assert item2.name is not None + setattr(module, f"DDSCAPS2_{item2.name}", item2.value) +for item3 in DDPF: + assert item3.name is not None + setattr(module, f"DDPF_{item3.name}", item3.value) + +DDS_FOURCC = DDPF.FOURCC +DDS_RGB = DDPF.RGB +DDS_RGBA = DDPF.RGB | DDPF.ALPHAPIXELS +DDS_LUMINANCE = DDPF.LUMINANCE +DDS_LUMINANCEA = DDPF.LUMINANCE | DDPF.ALPHAPIXELS +DDS_ALPHA = DDPF.ALPHA +DDS_PAL8 = DDPF.PALETTEINDEXED8 + +DDS_HEADER_FLAGS_TEXTURE = DDSD.CAPS | DDSD.HEIGHT | DDSD.WIDTH | DDSD.PIXELFORMAT +DDS_HEADER_FLAGS_MIPMAP = DDSD.MIPMAPCOUNT +DDS_HEADER_FLAGS_VOLUME = DDSD.DEPTH +DDS_HEADER_FLAGS_PITCH = DDSD.PITCH +DDS_HEADER_FLAGS_LINEARSIZE = DDSD.LINEARSIZE + +DDS_HEIGHT = DDSD.HEIGHT +DDS_WIDTH = DDSD.WIDTH + +DDS_SURFACE_FLAGS_TEXTURE = DDSCAPS.TEXTURE +DDS_SURFACE_FLAGS_MIPMAP = DDSCAPS.COMPLEX | DDSCAPS.MIPMAP +DDS_SURFACE_FLAGS_CUBEMAP = DDSCAPS.COMPLEX + +DDS_CUBEMAP_POSITIVEX = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_POSITIVEX +DDS_CUBEMAP_NEGATIVEX = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_NEGATIVEX +DDS_CUBEMAP_POSITIVEY = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_POSITIVEY +DDS_CUBEMAP_NEGATIVEY = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_NEGATIVEY +DDS_CUBEMAP_POSITIVEZ = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_POSITIVEZ +DDS_CUBEMAP_NEGATIVEZ = DDSCAPS2.CUBEMAP | DDSCAPS2.CUBEMAP_NEGATIVEZ + +DXT1_FOURCC = D3DFMT.DXT1 +DXT3_FOURCC = D3DFMT.DXT3 +DXT5_FOURCC = D3DFMT.DXT5 + +DXGI_FORMAT_R8G8B8A8_TYPELESS = DXGI_FORMAT.R8G8B8A8_TYPELESS +DXGI_FORMAT_R8G8B8A8_UNORM = DXGI_FORMAT.R8G8B8A8_UNORM +DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = DXGI_FORMAT.R8G8B8A8_UNORM_SRGB +DXGI_FORMAT_BC5_TYPELESS = DXGI_FORMAT.BC5_TYPELESS +DXGI_FORMAT_BC5_UNORM = DXGI_FORMAT.BC5_UNORM +DXGI_FORMAT_BC5_SNORM = DXGI_FORMAT.BC5_SNORM +DXGI_FORMAT_BC6H_UF16 = DXGI_FORMAT.BC6H_UF16 +DXGI_FORMAT_BC6H_SF16 = DXGI_FORMAT.BC6H_SF16 +DXGI_FORMAT_BC7_TYPELESS = DXGI_FORMAT.BC7_TYPELESS +DXGI_FORMAT_BC7_UNORM = DXGI_FORMAT.BC7_UNORM +DXGI_FORMAT_BC7_UNORM_SRGB = DXGI_FORMAT.BC7_UNORM_SRGB + + +class DdsImageFile(ImageFile.ImageFile): + format = "DDS" + format_description = "DirectDraw Surface" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(4)): + msg = "not a DDS file" + raise SyntaxError(msg) + (header_size,) = struct.unpack(" None: + pass + + +class DdsRgbDecoder(ImageFile.PyDecoder): + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + bitcount, masks = self.args + + # Some masks will be padded with zeros, e.g. R 0b11 G 0b1100 + # Calculate how many zeros each mask is padded with + mask_offsets = [] + # And the maximum value of each channel without the padding + mask_totals = [] + for mask in masks: + offset = 0 + if mask != 0: + while mask >> (offset + 1) << (offset + 1) == mask: + offset += 1 + mask_offsets.append(offset) + mask_totals.append(mask >> offset) + + data = bytearray() + bytecount = bitcount // 8 + dest_length = self.state.xsize * self.state.ysize * len(masks) + while len(data) < dest_length: + value = int.from_bytes(self.fd.read(bytecount), "little") + for i, mask in enumerate(masks): + masked_value = value & mask + # Remove the zero padding, and scale it to 8 bits + data += o8( + int(((masked_value >> mask_offsets[i]) / mask_totals[i]) * 255) + if mask_totals[i] + else 0 + ) + self.set_as_raw(data) + return -1, 0 + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode not in ("RGB", "RGBA", "L", "LA"): + msg = f"cannot write mode {im.mode} as DDS" + raise OSError(msg) + + flags = DDSD.CAPS | DDSD.HEIGHT | DDSD.WIDTH | DDSD.PIXELFORMAT + bitcount = len(im.getbands()) * 8 + pixel_format = im.encoderinfo.get("pixel_format") + args: tuple[int] | str + if pixel_format: + codec_name = "bcn" + flags |= DDSD.LINEARSIZE + pitch = (im.width + 3) * 4 + rgba_mask = [0, 0, 0, 0] + pixel_flags = DDPF.FOURCC + if pixel_format == "DXT1": + fourcc = D3DFMT.DXT1 + args = (1,) + elif pixel_format == "DXT3": + fourcc = D3DFMT.DXT3 + args = (2,) + elif pixel_format == "DXT5": + fourcc = D3DFMT.DXT5 + args = (3,) + else: + fourcc = D3DFMT.DX10 + if pixel_format == "BC2": + args = (2,) + dxgi_format = DXGI_FORMAT.BC2_TYPELESS + elif pixel_format == "BC3": + args = (3,) + dxgi_format = DXGI_FORMAT.BC3_TYPELESS + elif pixel_format == "BC5": + args = (5,) + dxgi_format = DXGI_FORMAT.BC5_TYPELESS + if im.mode != "RGB": + msg = "only RGB mode can be written as BC5" + raise OSError(msg) + else: + msg = f"cannot write pixel format {pixel_format}" + raise OSError(msg) + else: + codec_name = "raw" + flags |= DDSD.PITCH + pitch = (im.width * bitcount + 7) // 8 + + alpha = im.mode[-1] == "A" + if im.mode[0] == "L": + pixel_flags = DDPF.LUMINANCE + args = im.mode + if alpha: + rgba_mask = [0x000000FF, 0x000000FF, 0x000000FF] + else: + rgba_mask = [0xFF000000, 0xFF000000, 0xFF000000] + else: + pixel_flags = DDPF.RGB + args = im.mode[::-1] + rgba_mask = [0x00FF0000, 0x0000FF00, 0x000000FF] + + if alpha: + r, g, b, a = im.split() + im = Image.merge("RGBA", (a, r, g, b)) + if alpha: + pixel_flags |= DDPF.ALPHAPIXELS + rgba_mask.append(0xFF000000 if alpha else 0) + + fourcc = D3DFMT.UNKNOWN + fp.write( + o32(DDS_MAGIC) + + struct.pack( + "<7I", + 124, # header size + flags, # flags + im.height, + im.width, + pitch, + 0, # depth + 0, # mipmaps + ) + + struct.pack("11I", *((0,) * 11)) # reserved + # pfsize, pfflags, fourcc, bitcount + + struct.pack("<4I", 32, pixel_flags, fourcc, bitcount) + + struct.pack("<4I", *rgba_mask) # dwRGBABitMask + + struct.pack("<5I", DDSCAPS.TEXTURE, 0, 0, 0, 0) + ) + if fourcc == D3DFMT.DX10: + fp.write( + # dxgi_format, 2D resource, misc, array size, straight alpha + struct.pack("<5I", dxgi_format, 3, 0, 0, 1) + ) + ImageFile._save(im, fp, [ImageFile._Tile(codec_name, (0, 0) + im.size, 0, args)]) + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"DDS ") + + +Image.register_open(DdsImageFile.format, DdsImageFile, _accept) +Image.register_decoder("dds_rgb", DdsRgbDecoder) +Image.register_save(DdsImageFile.format, _save) +Image.register_extension(DdsImageFile.format, ".dds") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/EpsImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/EpsImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..41a071937fac6aaaf45cca3717bf6aa5983a57c6 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/EpsImagePlugin.py @@ -0,0 +1,481 @@ +# +# The Python Imaging Library. +# $Id$ +# +# EPS file handling +# +# History: +# 1995-09-01 fl Created (0.1) +# 1996-05-18 fl Don't choke on "atend" fields, Ghostscript interface (0.2) +# 1996-08-22 fl Don't choke on floating point BoundingBox values +# 1996-08-23 fl Handle files from Macintosh (0.3) +# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4) +# 2003-09-07 fl Check gs.close status (from Federico Di Gregorio) (0.5) +# 2014-05-07 e Handling of EPS with binary preview and fixed resolution +# resizing +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1995-2003 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +import os +import re +import subprocess +import sys +import tempfile +from typing import IO + +from . import Image, ImageFile +from ._binary import i32le as i32 + +# -------------------------------------------------------------------- + + +split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$") +field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$") + +gs_binary: str | bool | None = None +gs_windows_binary = None + + +def has_ghostscript() -> bool: + global gs_binary, gs_windows_binary + if gs_binary is None: + if sys.platform.startswith("win"): + if gs_windows_binary is None: + import shutil + + for binary in ("gswin32c", "gswin64c", "gs"): + if shutil.which(binary) is not None: + gs_windows_binary = binary + break + else: + gs_windows_binary = False + gs_binary = gs_windows_binary + else: + try: + subprocess.check_call(["gs", "--version"], stdout=subprocess.DEVNULL) + gs_binary = "gs" + except OSError: + gs_binary = False + return gs_binary is not False + + +def Ghostscript( + tile: list[ImageFile._Tile], + size: tuple[int, int], + fp: IO[bytes], + scale: int = 1, + transparency: bool = False, +) -> Image.core.ImagingCore: + """Render an image using Ghostscript""" + global gs_binary + if not has_ghostscript(): + msg = "Unable to locate Ghostscript on paths" + raise OSError(msg) + assert isinstance(gs_binary, str) + + # Unpack decoder tile + args = tile[0].args + assert isinstance(args, tuple) + length, bbox = args + + # Hack to support hi-res rendering + scale = int(scale) or 1 + width = size[0] * scale + height = size[1] * scale + # resolution is dependent on bbox and size + res_x = 72.0 * width / (bbox[2] - bbox[0]) + res_y = 72.0 * height / (bbox[3] - bbox[1]) + + out_fd, outfile = tempfile.mkstemp() + os.close(out_fd) + + infile_temp = None + if hasattr(fp, "name") and os.path.exists(fp.name): + infile = fp.name + else: + in_fd, infile_temp = tempfile.mkstemp() + os.close(in_fd) + infile = infile_temp + + # Ignore length and offset! + # Ghostscript can read it + # Copy whole file to read in Ghostscript + with open(infile_temp, "wb") as f: + # fetch length of fp + fp.seek(0, io.SEEK_END) + fsize = fp.tell() + # ensure start position + # go back + fp.seek(0) + lengthfile = fsize + while lengthfile > 0: + s = fp.read(min(lengthfile, 100 * 1024)) + if not s: + break + lengthfile -= len(s) + f.write(s) + + if transparency: + # "RGBA" + device = "pngalpha" + else: + # "pnmraw" automatically chooses between + # PBM ("1"), PGM ("L"), and PPM ("RGB"). + device = "pnmraw" + + # Build Ghostscript command + command = [ + gs_binary, + "-q", # quiet mode + f"-g{width:d}x{height:d}", # set output geometry (pixels) + f"-r{res_x:f}x{res_y:f}", # set input DPI (dots per inch) + "-dBATCH", # exit after processing + "-dNOPAUSE", # don't pause between pages + "-dSAFER", # safe mode + f"-sDEVICE={device}", + f"-sOutputFile={outfile}", # output file + # adjust for image origin + "-c", + f"{-bbox[0]} {-bbox[1]} translate", + "-f", + infile, # input file + # showpage (see https://bugs.ghostscript.com/show_bug.cgi?id=698272) + "-c", + "showpage", + ] + + # push data through Ghostscript + try: + startupinfo = None + if sys.platform.startswith("win"): + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + subprocess.check_call(command, startupinfo=startupinfo) + with Image.open(outfile) as out_im: + out_im.load() + return out_im.im.copy() + finally: + try: + os.unlink(outfile) + if infile_temp: + os.unlink(infile_temp) + except OSError: + pass + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"%!PS") or ( + len(prefix) >= 4 and i32(prefix) == 0xC6D3D0C5 + ) + + +## +# Image plugin for Encapsulated PostScript. This plugin supports only +# a few variants of this format. + + +class EpsImageFile(ImageFile.ImageFile): + """EPS File Parser for the Python Imaging Library""" + + format = "EPS" + format_description = "Encapsulated Postscript" + + mode_map = {1: "L", 2: "LAB", 3: "RGB", 4: "CMYK"} + + def _open(self) -> None: + assert self.fp is not None + length, offset = self._find_offset(self.fp) + + # go to offset - start of "%!PS" + self.fp.seek(offset) + + self._mode = "RGB" + + # When reading header comments, the first comment is used. + # When reading trailer comments, the last comment is used. + bounding_box: list[int] | None = None + imagedata_size: tuple[int, int] | None = None + + byte_arr = bytearray(255) + bytes_mv = memoryview(byte_arr) + bytes_read = 0 + reading_header_comments = True + reading_trailer_comments = False + trailer_reached = False + + def check_required_header_comments() -> None: + """ + The EPS specification requires that some headers exist. + This should be checked when the header comments formally end, + when image data starts, or when the file ends, whichever comes first. + """ + if "PS-Adobe" not in self.info: + msg = 'EPS header missing "%!PS-Adobe" comment' + raise SyntaxError(msg) + if "BoundingBox" not in self.info: + msg = 'EPS header missing "%%BoundingBox" comment' + raise SyntaxError(msg) + + def read_comment(s: str) -> bool: + nonlocal bounding_box, reading_trailer_comments + try: + m = split.match(s) + except re.error as e: + msg = "not an EPS file" + raise SyntaxError(msg) from e + + if not m: + return False + + k, v = m.group(1, 2) + self.info[k] = v + if k == "BoundingBox": + if v == "(atend)": + reading_trailer_comments = True + elif not bounding_box or (trailer_reached and reading_trailer_comments): + try: + # Note: The DSC spec says that BoundingBox + # fields should be integers, but some drivers + # put floating point values there anyway. + bounding_box = [int(float(i)) for i in v.split()] + except Exception: + pass + return True + + while True: + byte = self.fp.read(1) + if byte == b"": + # if we didn't read a byte we must be at the end of the file + if bytes_read == 0: + if reading_header_comments: + check_required_header_comments() + break + elif byte in b"\r\n": + # if we read a line ending character, ignore it and parse what + # we have already read. if we haven't read any other characters, + # continue reading + if bytes_read == 0: + continue + else: + # ASCII/hexadecimal lines in an EPS file must not exceed + # 255 characters, not including line ending characters + if bytes_read >= 255: + # only enforce this for lines starting with a "%", + # otherwise assume it's binary data + if byte_arr[0] == ord("%"): + msg = "not an EPS file" + raise SyntaxError(msg) + else: + if reading_header_comments: + check_required_header_comments() + reading_header_comments = False + # reset bytes_read so we can keep reading + # data until the end of the line + bytes_read = 0 + byte_arr[bytes_read] = byte[0] + bytes_read += 1 + continue + + if reading_header_comments: + # Load EPS header + + # if this line doesn't start with a "%", + # or does start with "%%EndComments", + # then we've reached the end of the header/comments + if byte_arr[0] != ord("%") or bytes_mv[:13] == b"%%EndComments": + check_required_header_comments() + reading_header_comments = False + continue + + s = str(bytes_mv[:bytes_read], "latin-1") + if not read_comment(s): + m = field.match(s) + if m: + k = m.group(1) + if k.startswith("PS-Adobe"): + self.info["PS-Adobe"] = k[9:] + else: + self.info[k] = "" + elif s[0] == "%": + # handle non-DSC PostScript comments that some + # tools mistakenly put in the Comments section + pass + else: + msg = "bad EPS header" + raise OSError(msg) + elif bytes_mv[:11] == b"%ImageData:": + # Check for an "ImageData" descriptor + # https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035096 + + # If we've already read an "ImageData" descriptor, + # don't read another one. + if imagedata_size: + bytes_read = 0 + continue + + # Values: + # columns + # rows + # bit depth (1 or 8) + # mode (1: L, 2: LAB, 3: RGB, 4: CMYK) + # number of padding channels + # block size (number of bytes per row per channel) + # binary/ascii (1: binary, 2: ascii) + # data start identifier (the image data follows after a single line + # consisting only of this quoted value) + image_data_values = byte_arr[11:bytes_read].split(None, 7) + columns, rows, bit_depth, mode_id = ( + int(value) for value in image_data_values[:4] + ) + + if bit_depth == 1: + self._mode = "1" + elif bit_depth == 8: + try: + self._mode = self.mode_map[mode_id] + except ValueError: + break + else: + break + + # Parse the columns and rows after checking the bit depth and mode + # in case the bit depth and/or mode are invalid. + imagedata_size = columns, rows + elif bytes_mv[:5] == b"%%EOF": + break + elif trailer_reached and reading_trailer_comments: + # Load EPS trailer + s = str(bytes_mv[:bytes_read], "latin-1") + read_comment(s) + elif bytes_mv[:9] == b"%%Trailer": + trailer_reached = True + elif bytes_mv[:14] == b"%%BeginBinary:": + bytecount = int(byte_arr[14:bytes_read]) + self.fp.seek(bytecount, os.SEEK_CUR) + bytes_read = 0 + + # A "BoundingBox" is always required, + # even if an "ImageData" descriptor size exists. + if not bounding_box: + msg = "cannot determine EPS bounding box" + raise OSError(msg) + + # An "ImageData" size takes precedence over the "BoundingBox". + self._size = imagedata_size or ( + bounding_box[2] - bounding_box[0], + bounding_box[3] - bounding_box[1], + ) + + self.tile = [ + ImageFile._Tile("eps", (0, 0) + self.size, offset, (length, bounding_box)) + ] + + def _find_offset(self, fp: IO[bytes]) -> tuple[int, int]: + s = fp.read(4) + + if s == b"%!PS": + # for HEAD without binary preview + fp.seek(0, io.SEEK_END) + length = fp.tell() + offset = 0 + elif i32(s) == 0xC6D3D0C5: + # FIX for: Some EPS file not handled correctly / issue #302 + # EPS can contain binary data + # or start directly with latin coding + # more info see: + # https://web.archive.org/web/20160528181353/http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf + s = fp.read(8) + offset = i32(s) + length = i32(s, 4) + else: + msg = "not an EPS file" + raise SyntaxError(msg) + + return length, offset + + def load( + self, scale: int = 1, transparency: bool = False + ) -> Image.core.PixelAccess | None: + # Load EPS via Ghostscript + if self.tile: + assert self.fp is not None + self.im = Ghostscript(self.tile, self.size, self.fp, scale, transparency) + self._mode = self.im.mode + self._size = self.im.size + self.tile = [] + return Image.Image.load(self) + + def load_seek(self, pos: int) -> None: + # we can't incrementally load, so force ImageFile.parser to + # use our custom load method by defining this method. + pass + + +# -------------------------------------------------------------------- + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes, eps: int = 1) -> None: + """EPS Writer for the Python Imaging Library.""" + + # make sure image data is available + im.load() + + # determine PostScript image mode + if im.mode == "L": + operator = (8, 1, b"image") + elif im.mode == "RGB": + operator = (8, 3, b"false 3 colorimage") + elif im.mode == "CMYK": + operator = (8, 4, b"false 4 colorimage") + else: + msg = "image mode is not supported" + raise ValueError(msg) + + if eps: + # write EPS header + fp.write(b"%!PS-Adobe-3.0 EPSF-3.0\n") + fp.write(b"%%Creator: PIL 0.1 EpsEncode\n") + # fp.write("%%CreationDate: %s"...) + fp.write(b"%%%%BoundingBox: 0 0 %d %d\n" % im.size) + fp.write(b"%%Pages: 1\n") + fp.write(b"%%EndComments\n") + fp.write(b"%%Page: 1 1\n") + fp.write(b"%%ImageData: %d %d " % im.size) + fp.write(b'%d %d 0 1 1 "%s"\n' % operator) + + # image header + fp.write(b"gsave\n") + fp.write(b"10 dict begin\n") + fp.write(b"/buf %d string def\n" % (im.size[0] * operator[1])) + fp.write(b"%d %d scale\n" % im.size) + fp.write(b"%d %d 8\n" % im.size) # <= bits + fp.write(b"[%d 0 0 -%d 0 %d]\n" % (im.size[0], im.size[1], im.size[1])) + fp.write(b"{ currentfile buf readhexstring pop } bind\n") + fp.write(operator[2] + b"\n") + if hasattr(fp, "flush"): + fp.flush() + + ImageFile._save(im, fp, [ImageFile._Tile("eps", (0, 0) + im.size)]) + + fp.write(b"\n%%%%EndBinary\n") + fp.write(b"grestore end\n") + if hasattr(fp, "flush"): + fp.flush() + + +# -------------------------------------------------------------------- + + +Image.register_open(EpsImageFile.format, EpsImageFile, _accept) + +Image.register_save(EpsImageFile.format, _save) + +Image.register_extensions(EpsImageFile.format, [".ps", ".eps"]) + +Image.register_mime(EpsImageFile.format, "application/postscript") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ExifTags.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ExifTags.py new file mode 100644 index 0000000000000000000000000000000000000000..eddcb51e703164d540ab90ab2538d069155f494d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ExifTags.py @@ -0,0 +1,384 @@ +# +# The Python Imaging Library. +# $Id$ +# +# EXIF tags +# +# Copyright (c) 2003 by Secret Labs AB +# +# See the README file for information on usage and redistribution. +# + +""" +This module provides constants and clear-text names for various +well-known EXIF tags. +""" + +from __future__ import annotations + +from enum import IntEnum + + +class Base(IntEnum): + # possibly incomplete + InteropIndex = 0x0001 + ProcessingSoftware = 0x000B + NewSubfileType = 0x00FE + SubfileType = 0x00FF + ImageWidth = 0x0100 + ImageLength = 0x0101 + BitsPerSample = 0x0102 + Compression = 0x0103 + PhotometricInterpretation = 0x0106 + Thresholding = 0x0107 + CellWidth = 0x0108 + CellLength = 0x0109 + FillOrder = 0x010A + DocumentName = 0x010D + ImageDescription = 0x010E + Make = 0x010F + Model = 0x0110 + StripOffsets = 0x0111 + Orientation = 0x0112 + SamplesPerPixel = 0x0115 + RowsPerStrip = 0x0116 + StripByteCounts = 0x0117 + MinSampleValue = 0x0118 + MaxSampleValue = 0x0119 + XResolution = 0x011A + YResolution = 0x011B + PlanarConfiguration = 0x011C + PageName = 0x011D + FreeOffsets = 0x0120 + FreeByteCounts = 0x0121 + GrayResponseUnit = 0x0122 + GrayResponseCurve = 0x0123 + T4Options = 0x0124 + T6Options = 0x0125 + ResolutionUnit = 0x0128 + PageNumber = 0x0129 + TransferFunction = 0x012D + Software = 0x0131 + DateTime = 0x0132 + Artist = 0x013B + HostComputer = 0x013C + Predictor = 0x013D + WhitePoint = 0x013E + PrimaryChromaticities = 0x013F + ColorMap = 0x0140 + HalftoneHints = 0x0141 + TileWidth = 0x0142 + TileLength = 0x0143 + TileOffsets = 0x0144 + TileByteCounts = 0x0145 + SubIFDs = 0x014A + InkSet = 0x014C + InkNames = 0x014D + NumberOfInks = 0x014E + DotRange = 0x0150 + TargetPrinter = 0x0151 + ExtraSamples = 0x0152 + SampleFormat = 0x0153 + SMinSampleValue = 0x0154 + SMaxSampleValue = 0x0155 + TransferRange = 0x0156 + ClipPath = 0x0157 + XClipPathUnits = 0x0158 + YClipPathUnits = 0x0159 + Indexed = 0x015A + JPEGTables = 0x015B + OPIProxy = 0x015F + JPEGProc = 0x0200 + JpegIFOffset = 0x0201 + JpegIFByteCount = 0x0202 + JpegRestartInterval = 0x0203 + JpegLosslessPredictors = 0x0205 + JpegPointTransforms = 0x0206 + JpegQTables = 0x0207 + JpegDCTables = 0x0208 + JpegACTables = 0x0209 + YCbCrCoefficients = 0x0211 + YCbCrSubSampling = 0x0212 + YCbCrPositioning = 0x0213 + ReferenceBlackWhite = 0x0214 + XMLPacket = 0x02BC + RelatedImageFileFormat = 0x1000 + RelatedImageWidth = 0x1001 + RelatedImageLength = 0x1002 + Rating = 0x4746 + RatingPercent = 0x4749 + ImageID = 0x800D + CFARepeatPatternDim = 0x828D + BatteryLevel = 0x828F + Copyright = 0x8298 + ExposureTime = 0x829A + FNumber = 0x829D + IPTCNAA = 0x83BB + ImageResources = 0x8649 + ExifOffset = 0x8769 + InterColorProfile = 0x8773 + ExposureProgram = 0x8822 + SpectralSensitivity = 0x8824 + GPSInfo = 0x8825 + ISOSpeedRatings = 0x8827 + OECF = 0x8828 + Interlace = 0x8829 + TimeZoneOffset = 0x882A + SelfTimerMode = 0x882B + SensitivityType = 0x8830 + StandardOutputSensitivity = 0x8831 + RecommendedExposureIndex = 0x8832 + ISOSpeed = 0x8833 + ISOSpeedLatitudeyyy = 0x8834 + ISOSpeedLatitudezzz = 0x8835 + ExifVersion = 0x9000 + DateTimeOriginal = 0x9003 + DateTimeDigitized = 0x9004 + OffsetTime = 0x9010 + OffsetTimeOriginal = 0x9011 + OffsetTimeDigitized = 0x9012 + ComponentsConfiguration = 0x9101 + CompressedBitsPerPixel = 0x9102 + ShutterSpeedValue = 0x9201 + ApertureValue = 0x9202 + BrightnessValue = 0x9203 + ExposureBiasValue = 0x9204 + MaxApertureValue = 0x9205 + SubjectDistance = 0x9206 + MeteringMode = 0x9207 + LightSource = 0x9208 + Flash = 0x9209 + FocalLength = 0x920A + Noise = 0x920D + ImageNumber = 0x9211 + SecurityClassification = 0x9212 + ImageHistory = 0x9213 + TIFFEPStandardID = 0x9216 + MakerNote = 0x927C + UserComment = 0x9286 + SubsecTime = 0x9290 + SubsecTimeOriginal = 0x9291 + SubsecTimeDigitized = 0x9292 + AmbientTemperature = 0x9400 + Humidity = 0x9401 + Pressure = 0x9402 + WaterDepth = 0x9403 + Acceleration = 0x9404 + CameraElevationAngle = 0x9405 + XPTitle = 0x9C9B + XPComment = 0x9C9C + XPAuthor = 0x9C9D + XPKeywords = 0x9C9E + XPSubject = 0x9C9F + FlashPixVersion = 0xA000 + ColorSpace = 0xA001 + ExifImageWidth = 0xA002 + ExifImageHeight = 0xA003 + RelatedSoundFile = 0xA004 + ExifInteroperabilityOffset = 0xA005 + FlashEnergy = 0xA20B + SpatialFrequencyResponse = 0xA20C + FocalPlaneXResolution = 0xA20E + FocalPlaneYResolution = 0xA20F + FocalPlaneResolutionUnit = 0xA210 + SubjectLocation = 0xA214 + ExposureIndex = 0xA215 + SensingMethod = 0xA217 + FileSource = 0xA300 + SceneType = 0xA301 + CFAPattern = 0xA302 + CustomRendered = 0xA401 + ExposureMode = 0xA402 + WhiteBalance = 0xA403 + DigitalZoomRatio = 0xA404 + FocalLengthIn35mmFilm = 0xA405 + SceneCaptureType = 0xA406 + GainControl = 0xA407 + Contrast = 0xA408 + Saturation = 0xA409 + Sharpness = 0xA40A + DeviceSettingDescription = 0xA40B + SubjectDistanceRange = 0xA40C + ImageUniqueID = 0xA420 + CameraOwnerName = 0xA430 + BodySerialNumber = 0xA431 + LensSpecification = 0xA432 + LensMake = 0xA433 + LensModel = 0xA434 + LensSerialNumber = 0xA435 + CompositeImage = 0xA460 + CompositeImageCount = 0xA461 + CompositeImageExposureTimes = 0xA462 + Gamma = 0xA500 + PrintImageMatching = 0xC4A5 + DNGVersion = 0xC612 + DNGBackwardVersion = 0xC613 + UniqueCameraModel = 0xC614 + LocalizedCameraModel = 0xC615 + CFAPlaneColor = 0xC616 + CFALayout = 0xC617 + LinearizationTable = 0xC618 + BlackLevelRepeatDim = 0xC619 + BlackLevel = 0xC61A + BlackLevelDeltaH = 0xC61B + BlackLevelDeltaV = 0xC61C + WhiteLevel = 0xC61D + DefaultScale = 0xC61E + DefaultCropOrigin = 0xC61F + DefaultCropSize = 0xC620 + ColorMatrix1 = 0xC621 + ColorMatrix2 = 0xC622 + CameraCalibration1 = 0xC623 + CameraCalibration2 = 0xC624 + ReductionMatrix1 = 0xC625 + ReductionMatrix2 = 0xC626 + AnalogBalance = 0xC627 + AsShotNeutral = 0xC628 + AsShotWhiteXY = 0xC629 + BaselineExposure = 0xC62A + BaselineNoise = 0xC62B + BaselineSharpness = 0xC62C + BayerGreenSplit = 0xC62D + LinearResponseLimit = 0xC62E + CameraSerialNumber = 0xC62F + LensInfo = 0xC630 + ChromaBlurRadius = 0xC631 + AntiAliasStrength = 0xC632 + ShadowScale = 0xC633 + DNGPrivateData = 0xC634 + MakerNoteSafety = 0xC635 + CalibrationIlluminant1 = 0xC65A + CalibrationIlluminant2 = 0xC65B + BestQualityScale = 0xC65C + RawDataUniqueID = 0xC65D + OriginalRawFileName = 0xC68B + OriginalRawFileData = 0xC68C + ActiveArea = 0xC68D + MaskedAreas = 0xC68E + AsShotICCProfile = 0xC68F + AsShotPreProfileMatrix = 0xC690 + CurrentICCProfile = 0xC691 + CurrentPreProfileMatrix = 0xC692 + ColorimetricReference = 0xC6BF + CameraCalibrationSignature = 0xC6F3 + ProfileCalibrationSignature = 0xC6F4 + AsShotProfileName = 0xC6F6 + NoiseReductionApplied = 0xC6F7 + ProfileName = 0xC6F8 + ProfileHueSatMapDims = 0xC6F9 + ProfileHueSatMapData1 = 0xC6FA + ProfileHueSatMapData2 = 0xC6FB + ProfileToneCurve = 0xC6FC + ProfileEmbedPolicy = 0xC6FD + ProfileCopyright = 0xC6FE + ForwardMatrix1 = 0xC714 + ForwardMatrix2 = 0xC715 + PreviewApplicationName = 0xC716 + PreviewApplicationVersion = 0xC717 + PreviewSettingsName = 0xC718 + PreviewSettingsDigest = 0xC719 + PreviewColorSpace = 0xC71A + PreviewDateTime = 0xC71B + RawImageDigest = 0xC71C + OriginalRawFileDigest = 0xC71D + SubTileBlockSize = 0xC71E + RowInterleaveFactor = 0xC71F + ProfileLookTableDims = 0xC725 + ProfileLookTableData = 0xC726 + OpcodeList1 = 0xC740 + OpcodeList2 = 0xC741 + OpcodeList3 = 0xC74E + NoiseProfile = 0xC761 + FrameRate = 0xC764 + + +"""Maps EXIF tags to tag names.""" +TAGS = { + **{i.value: i.name for i in Base}, + 0x920C: "SpatialFrequencyResponse", + 0x9214: "SubjectLocation", + 0x9215: "ExposureIndex", + 0x828E: "CFAPattern", + 0x920B: "FlashEnergy", + 0x9216: "TIFF/EPStandardID", +} + + +class GPS(IntEnum): + GPSVersionID = 0x00 + GPSLatitudeRef = 0x01 + GPSLatitude = 0x02 + GPSLongitudeRef = 0x03 + GPSLongitude = 0x04 + GPSAltitudeRef = 0x05 + GPSAltitude = 0x06 + GPSTimeStamp = 0x07 + GPSSatellites = 0x08 + GPSStatus = 0x09 + GPSMeasureMode = 0x0A + GPSDOP = 0x0B + GPSSpeedRef = 0x0C + GPSSpeed = 0x0D + GPSTrackRef = 0x0E + GPSTrack = 0x0F + GPSImgDirectionRef = 0x10 + GPSImgDirection = 0x11 + GPSMapDatum = 0x12 + GPSDestLatitudeRef = 0x13 + GPSDestLatitude = 0x14 + GPSDestLongitudeRef = 0x15 + GPSDestLongitude = 0x16 + GPSDestBearingRef = 0x17 + GPSDestBearing = 0x18 + GPSDestDistanceRef = 0x19 + GPSDestDistance = 0x1A + GPSProcessingMethod = 0x1B + GPSAreaInformation = 0x1C + GPSDateStamp = 0x1D + GPSDifferential = 0x1E + GPSHPositioningError = 0x1F + + +"""Maps EXIF GPS tags to tag names.""" +GPSTAGS = {i.value: i.name for i in GPS} + + +class Interop(IntEnum): + InteropIndex = 0x0001 + InteropVersion = 0x0002 + RelatedImageFileFormat = 0x1000 + RelatedImageWidth = 0x1001 + RelatedImageHeight = 0x1002 + + +class IFD(IntEnum): + Exif = 0x8769 + GPSInfo = 0x8825 + MakerNote = 0x927C + Makernote = 0x927C # Deprecated + Interop = 0xA005 + IFD1 = -1 + + +class LightSource(IntEnum): + Unknown = 0x00 + Daylight = 0x01 + Fluorescent = 0x02 + Tungsten = 0x03 + Flash = 0x04 + Fine = 0x09 + Cloudy = 0x0A + Shade = 0x0B + DaylightFluorescent = 0x0C + DayWhiteFluorescent = 0x0D + CoolWhiteFluorescent = 0x0E + WhiteFluorescent = 0x0F + StandardLightA = 0x11 + StandardLightB = 0x12 + StandardLightC = 0x13 + D55 = 0x14 + D65 = 0x15 + D75 = 0x16 + D50 = 0x17 + ISO = 0x18 + Other = 0xFF diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FitsImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FitsImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..de8aaf55845807c49676d4da97c0bc160f336740 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FitsImagePlugin.py @@ -0,0 +1,153 @@ +# +# The Python Imaging Library +# $Id$ +# +# FITS file handling +# +# Copyright (c) 1998-2003 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import gzip +import math + +from . import Image, ImageFile + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"SIMPLE") + + +class FitsImageFile(ImageFile.ImageFile): + format = "FITS" + format_description = "FITS" + + def _open(self) -> None: + assert self.fp is not None + + headers: dict[bytes, bytes] = {} + header_in_progress = False + decoder_name = "" + while True: + header = self.fp.read(80) + if not header: + msg = "Truncated FITS file" + raise OSError(msg) + keyword = header[:8].strip() + if keyword in (b"SIMPLE", b"XTENSION"): + header_in_progress = True + elif headers and not header_in_progress: + # This is now a data unit + break + elif keyword == b"END": + # Seek to the end of the header unit + self.fp.seek(math.ceil(self.fp.tell() / 2880) * 2880) + if not decoder_name: + decoder_name, offset, args = self._parse_headers(headers) + + header_in_progress = False + continue + + if decoder_name: + # Keep going to read past the headers + continue + + value = header[8:].split(b"/")[0].strip() + if value.startswith(b"="): + value = value[1:].strip() + if not headers and (not _accept(keyword) or value != b"T"): + msg = "Not a FITS file" + raise SyntaxError(msg) + headers[keyword] = value + + if not decoder_name: + msg = "No image data" + raise ValueError(msg) + + offset += self.fp.tell() - 80 + self.tile = [ImageFile._Tile(decoder_name, (0, 0) + self.size, offset, args)] + + def _get_size( + self, headers: dict[bytes, bytes], prefix: bytes + ) -> tuple[int, int] | None: + naxis = int(headers[prefix + b"NAXIS"]) + if naxis == 0: + return None + + if naxis == 1: + return 1, int(headers[prefix + b"NAXIS1"]) + else: + return int(headers[prefix + b"NAXIS1"]), int(headers[prefix + b"NAXIS2"]) + + def _parse_headers( + self, headers: dict[bytes, bytes] + ) -> tuple[str, int, tuple[str | int, ...]]: + prefix = b"" + decoder_name = "raw" + offset = 0 + if ( + headers.get(b"XTENSION") == b"'BINTABLE'" + and headers.get(b"ZIMAGE") == b"T" + and headers[b"ZCMPTYPE"] == b"'GZIP_1 '" + ): + no_prefix_size = self._get_size(headers, prefix) or (0, 0) + number_of_bits = int(headers[b"BITPIX"]) + offset = no_prefix_size[0] * no_prefix_size[1] * (number_of_bits // 8) + + prefix = b"Z" + decoder_name = "fits_gzip" + + size = self._get_size(headers, prefix) + if not size: + return "", 0, () + + self._size = size + + number_of_bits = int(headers[prefix + b"BITPIX"]) + if number_of_bits == 8: + self._mode = "L" + elif number_of_bits == 16: + self._mode = "I;16" + elif number_of_bits == 32: + self._mode = "I" + elif number_of_bits in (-32, -64): + self._mode = "F" + + args: tuple[str | int, ...] + if decoder_name == "raw": + args = (self.mode, 0, -1) + else: + args = (number_of_bits,) + return decoder_name, offset, args + + +class FitsGzipDecoder(ImageFile.PyDecoder): + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + with gzip.open(self.fd) as fp: + value = fp.read(self.state.xsize * self.state.ysize * 4) + + rows = [] + offset = 0 + number_of_bits = min(self.args[0] // 8, 4) + for y in range(self.state.ysize): + row = bytearray() + for x in range(self.state.xsize): + row += value[offset + (4 - number_of_bits) : offset + 4] + offset += 4 + rows.append(row) + self.set_as_raw(bytes([pixel for row in rows[::-1] for pixel in row])) + return -1, 0 + + +# -------------------------------------------------------------------- +# Registry + +Image.register_open(FitsImageFile.format, FitsImageFile, _accept) +Image.register_decoder("fits_gzip", FitsGzipDecoder) + +Image.register_extensions(FitsImageFile.format, [".fit", ".fits"]) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FliImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FliImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..cdd0a6a5c9205494d6ba795f021ee969e17d4f48 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FliImagePlugin.py @@ -0,0 +1,184 @@ +# +# The Python Imaging Library. +# $Id$ +# +# FLI/FLC file handling. +# +# History: +# 95-09-01 fl Created +# 97-01-03 fl Fixed parser, setup decoder tile +# 98-07-15 fl Renamed offset attribute to avoid name clash +# +# Copyright (c) Secret Labs AB 1997-98. +# Copyright (c) Fredrik Lundh 1995-97. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os + +from . import Image, ImageFile, ImagePalette +from ._binary import i16le as i16 +from ._binary import i32le as i32 +from ._binary import o8 +from ._util import DeferredError + +# +# decoder + + +def _accept(prefix: bytes) -> bool: + return ( + len(prefix) >= 16 + and i16(prefix, 4) in [0xAF11, 0xAF12] + and i16(prefix, 14) in [0, 3] # flags + ) + + +## +# Image plugin for the FLI/FLC animation format. Use the seek +# method to load individual frames. + + +class FliImageFile(ImageFile.ImageFile): + format = "FLI" + format_description = "Autodesk FLI/FLC Animation" + _close_exclusive_fp_after_loading = False + + def _open(self) -> None: + # HEAD + assert self.fp is not None + s = self.fp.read(128) + if not ( + _accept(s) + and s[20:22] == b"\x00" * 2 + and s[42:80] == b"\x00" * 38 + and s[88:] == b"\x00" * 40 + ): + msg = "not an FLI/FLC file" + raise SyntaxError(msg) + + # frames + self.n_frames = i16(s, 6) + self.is_animated = self.n_frames > 1 + + # image characteristics + self._mode = "P" + self._size = i16(s, 8), i16(s, 10) + + # animation speed + duration = i32(s, 16) + magic = i16(s, 4) + if magic == 0xAF11: + duration = (duration * 1000) // 70 + self.info["duration"] = duration + + # look for palette + palette = [(a, a, a) for a in range(256)] + + s = self.fp.read(16) + + self.__offset = 128 + + if i16(s, 4) == 0xF100: + # prefix chunk; ignore it + self.fp.seek(self.__offset + i32(s)) + s = self.fp.read(16) + + if i16(s, 4) == 0xF1FA: + # look for palette chunk + number_of_subchunks = i16(s, 6) + chunk_size: int | None = None + for _ in range(number_of_subchunks): + if chunk_size is not None: + self.fp.seek(chunk_size - 6, os.SEEK_CUR) + s = self.fp.read(6) + chunk_type = i16(s, 4) + if chunk_type in (4, 11): + self._palette(palette, 2 if chunk_type == 11 else 0) + break + chunk_size = i32(s) + if not chunk_size: + break + + self.palette = ImagePalette.raw( + "RGB", b"".join(o8(r) + o8(g) + o8(b) for (r, g, b) in palette) + ) + + # set things up to decode first frame + self.__frame = -1 + self._fp = self.fp + self.__rewind = self.fp.tell() + self.seek(0) + + def _palette(self, palette: list[tuple[int, int, int]], shift: int) -> None: + # load palette + + i = 0 + assert self.fp is not None + for e in range(i16(self.fp.read(2))): + s = self.fp.read(2) + i = i + s[0] + n = s[1] + if n == 0: + n = 256 + s = self.fp.read(n * 3) + for n in range(0, len(s), 3): + r = s[n] << shift + g = s[n + 1] << shift + b = s[n + 2] << shift + palette[i] = (r, g, b) + i += 1 + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + if frame < self.__frame: + self._seek(0) + + for f in range(self.__frame + 1, frame + 1): + self._seek(f) + + def _seek(self, frame: int) -> None: + if isinstance(self._fp, DeferredError): + raise self._fp.ex + if frame == 0: + self.__frame = -1 + self._fp.seek(self.__rewind) + self.__offset = 128 + else: + # ensure that the previous frame was loaded + self.load() + + if frame != self.__frame + 1: + msg = f"cannot seek to frame {frame}" + raise ValueError(msg) + self.__frame = frame + + # move to next frame + self.fp = self._fp + self.fp.seek(self.__offset) + + s = self.fp.read(4) + if not s: + msg = "missing frame size" + raise EOFError(msg) + + framesize = i32(s) + + self.decodermaxblock = framesize + self.tile = [ImageFile._Tile("fli", (0, 0) + self.size, self.__offset)] + + self.__offset += framesize + + def tell(self) -> int: + return self.__frame + + +# +# registry + +Image.register_open(FliImageFile.format, FliImageFile, _accept) + +Image.register_extensions(FliImageFile.format, [".fli", ".flc"]) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FontFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FontFile.py new file mode 100644 index 0000000000000000000000000000000000000000..43d6c8bb331f55505b52e6c82755caf6bfc35b90 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FontFile.py @@ -0,0 +1,159 @@ +# +# The Python Imaging Library +# $Id$ +# +# base class for raster font file parsers +# +# history: +# 1997-06-05 fl created +# 1997-08-19 fl restrict image width +# +# Copyright (c) 1997-1998 by Secret Labs AB +# Copyright (c) 1997-1998 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +from typing import BinaryIO + +from . import Image, ImageFont, _binary + +WIDTH = 800 + + +def puti16( + fp: BinaryIO, values: tuple[int, int, int, int, int, int, int, int, int, int] +) -> None: + """Write network order (big-endian) 16-bit sequence""" + for v in values: + if v < 0: + v += 65536 + fp.write(_binary.o16be(v)) + + +class FontFile: + """Base class for raster font file handlers.""" + + bitmap: Image.Image | None = None + + def __init__(self) -> None: + self.info: dict[bytes, bytes | int] = {} + self.glyph: list[ + tuple[ + tuple[int, int], + tuple[int, int, int, int], + tuple[int, int, int, int], + Image.Image, + ] + | None + ] = [None] * 256 + + def __getitem__(self, ix: int) -> ( + tuple[ + tuple[int, int], + tuple[int, int, int, int], + tuple[int, int, int, int], + Image.Image, + ] + | None + ): + return self.glyph[ix] + + def compile(self) -> None: + """Create metrics and bitmap""" + + if self.bitmap: + return + + # create bitmap large enough to hold all data + h = w = maxwidth = 0 + lines = 1 + for glyph in self.glyph: + if glyph: + d, dst, src, im = glyph + h = max(h, src[3] - src[1]) + w = w + (src[2] - src[0]) + if w > WIDTH: + lines += 1 + w = src[2] - src[0] + maxwidth = max(maxwidth, w) + + xsize = maxwidth + ysize = lines * h + + if xsize == 0 and ysize == 0: + return + + self.ysize = h + + # paste glyphs into bitmap + self.bitmap = Image.new("1", (xsize, ysize)) + self.metrics: list[ + tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]] + | None + ] = [None] * 256 + x = y = 0 + for i in range(256): + glyph = self[i] + if glyph: + d, dst, src, im = glyph + xx = src[2] - src[0] + x0, y0 = x, y + x = x + xx + if x > WIDTH: + x, y = 0, y + h + x0, y0 = x, y + x = xx + s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0 + self.bitmap.paste(im.crop(src), s) + self.metrics[i] = d, dst, s + + def _encode_metrics(self) -> bytes: + values: list[int] = [] + for i in range(256): + m = self.metrics[i] + if m: + values.extend(m[0] + m[1] + m[2]) + else: + values.extend((0,) * 10) + + data = bytearray() + for v in values: + if v < 0: + v += 65536 + data += _binary.o16be(v) + return bytes(data) + + def save(self, filename: str) -> None: + """Save font""" + + self.compile() + + # font data + if not self.bitmap: + msg = "No bitmap created" + raise ValueError(msg) + self.bitmap.save(os.path.splitext(filename)[0] + ".pbm", "PNG") + + # font metrics + with open(os.path.splitext(filename)[0] + ".pil", "wb") as fp: + fp.write(b"PILfont\n") + fp.write(f";;;;;;{self.ysize};\n".encode("ascii")) # HACK!!! + fp.write(b"DATA\n") + fp.write(self._encode_metrics()) + + def to_imagefont(self) -> ImageFont.ImageFont: + """Convert to ImageFont""" + + self.compile() + + # font data + if not self.bitmap: + msg = "No bitmap created" + raise ValueError(msg) + + imagefont = ImageFont.ImageFont() + imagefont._load(self.bitmap, self._encode_metrics()) + return imagefont diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FpxImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FpxImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..bda5c62b442ea4acfa5572175650ae205043dfca --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FpxImagePlugin.py @@ -0,0 +1,258 @@ +# +# THIS IS WORK IN PROGRESS +# +# The Python Imaging Library. +# $Id$ +# +# FlashPix support for PIL +# +# History: +# 97-01-25 fl Created (reads uncompressed RGB images only) +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1997. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import olefile + +from . import Image, ImageFile +from ._binary import i32le as i32 + +# we map from colour field tuples to (mode, rawmode) descriptors +MODES = { + # opacity + (0x00007FFE,): ("A", "L"), + # monochrome + (0x00010000,): ("L", "L"), + (0x00018000, 0x00017FFE): ("RGBA", "LA"), + # photo YCC + (0x00020000, 0x00020001, 0x00020002): ("RGB", "YCC;P"), + (0x00028000, 0x00028001, 0x00028002, 0x00027FFE): ("RGBA", "YCCA;P"), + # standard RGB (NIFRGB) + (0x00030000, 0x00030001, 0x00030002): ("RGB", "RGB"), + (0x00038000, 0x00038001, 0x00038002, 0x00037FFE): ("RGBA", "RGBA"), +} + + +# +# -------------------------------------------------------------------- + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(olefile.MAGIC) + + +## +# Image plugin for the FlashPix images. + + +class FpxImageFile(ImageFile.ImageFile): + format = "FPX" + format_description = "FlashPix" + + def _open(self) -> None: + # + # read the OLE directory and see if this is a likely + # to be a FlashPix file + + assert self.fp is not None + try: + self.ole = olefile.OleFileIO(self.fp) + except OSError as e: + msg = "not an FPX file; invalid OLE file" + raise SyntaxError(msg) from e + + root = self.ole.root + if not root or root.clsid != "56616700-C154-11CE-8553-00AA00A1F95B": + msg = "not an FPX file; bad root CLSID" + raise SyntaxError(msg) + + self._open_index(1) + + def _open_index(self, index: int = 1) -> None: + # + # get the Image Contents Property Set + + prop = self.ole.getproperties( + [f"Data Object Store {index:06d}", "\005Image Contents"] + ) + + # size (highest resolution) + + assert isinstance(prop[0x1000002], int) + assert isinstance(prop[0x1000003], int) + self._size = prop[0x1000002], prop[0x1000003] + + size = max(self.size) + i = 1 + while size > 64: + size = size // 2 + i += 1 + self.maxid = i - 1 + + # mode. instead of using a single field for this, flashpix + # requires you to specify the mode for each channel in each + # resolution subimage, and leaves it to the decoder to make + # sure that they all match. for now, we'll cheat and assume + # that this is always the case. + + id = self.maxid << 16 + + s = prop[0x2000002 | id] + + if not isinstance(s, bytes) or (bands := i32(s, 4)) > 4: + msg = "Invalid number of bands" + raise OSError(msg) + + # note: for now, we ignore the "uncalibrated" flag + colors = tuple(i32(s, 8 + i * 4) & 0x7FFFFFFF for i in range(bands)) + + self._mode, self.rawmode = MODES[colors] + + # load JPEG tables, if any + self.jpeg = {} + for i in range(256): + id = 0x3000001 | (i << 16) + if id in prop: + self.jpeg[i] = prop[id] + + self._open_subimage(1, self.maxid) + + def _open_subimage(self, index: int = 1, subimage: int = 0) -> None: + # + # setup tile descriptors for a given subimage + + stream = [ + f"Data Object Store {index:06d}", + f"Resolution {subimage:04d}", + "Subimage 0000 Header", + ] + + fp = self.ole.openstream(stream) + + # skip prefix + fp.read(28) + + # header stream + s = fp.read(36) + + size = i32(s, 4), i32(s, 8) + # tilecount = i32(s, 12) + xtile, ytile = i32(s, 16), i32(s, 20) + # channels = i32(s, 24) + offset = i32(s, 28) + length = i32(s, 32) + + if size != self.size: + msg = "subimage mismatch" + raise OSError(msg) + + # get tile descriptors + fp.seek(28 + offset) + s = fp.read(i32(s, 12) * length) + + x = y = 0 + xsize, ysize = size + self.tile = [] + + for i in range(0, len(s), length): + x1 = min(xsize, x + xtile) + y1 = min(ysize, y + ytile) + + compression = i32(s, i + 8) + + if compression == 0: + self.tile.append( + ImageFile._Tile( + "raw", + (x, y, x1, y1), + i32(s, i) + 28, + self.rawmode, + ) + ) + + elif compression == 1: + # FIXME: the fill decoder is not implemented + self.tile.append( + ImageFile._Tile( + "fill", + (x, y, x1, y1), + i32(s, i) + 28, + (self.rawmode, s[12:16]), + ) + ) + + elif compression == 2: + internal_color_conversion = s[14] + jpeg_tables = s[15] + rawmode = self.rawmode + + if internal_color_conversion: + # The image is stored as usual (usually YCbCr). + if rawmode == "RGBA": + # For "RGBA", data is stored as YCbCrA based on + # negative RGB. The following trick works around + # this problem : + jpegmode, rawmode = "YCbCrK", "CMYK" + else: + jpegmode = None # let the decoder decide + + else: + # The image is stored as defined by rawmode + jpegmode = rawmode + + self.tile.append( + ImageFile._Tile( + "jpeg", + (x, y, x1, y1), + i32(s, i) + 28, + (rawmode, jpegmode), + ) + ) + + # FIXME: jpeg tables are tile dependent; the prefix + # data must be placed in the tile descriptor itself! + + if jpeg_tables: + self.tile_prefix = self.jpeg[jpeg_tables] + + else: + msg = "unknown/invalid compression" + raise OSError(msg) + + x += xtile + if x >= xsize: + x, y = 0, y + ytile + if y >= ysize: + break # isn't really required + + assert self.fp is not None + self.stream = stream + self._fp = self.fp + self.fp = None + + def load(self) -> Image.core.PixelAccess | None: + if not self.fp: + self.fp = self.ole.openstream(self.stream[:2] + ["Subimage 0000 Data"]) + + return ImageFile.ImageFile.load(self) + + def close(self) -> None: + self.ole.close() + super().close() + + def __exit__(self, *args: object) -> None: + self.ole.close() + super().__exit__() + + +# +# -------------------------------------------------------------------- + + +Image.register_open(FpxImageFile.format, FpxImageFile, _accept) + +Image.register_extension(FpxImageFile.format, ".fpx") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FtexImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FtexImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..21117249b1f4525c24ca5a5af3b2b0cfccb7c0f0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/FtexImagePlugin.py @@ -0,0 +1,115 @@ +""" +A Pillow loader for .ftc and .ftu files (FTEX) +Jerome Leclanche + +The contents of this file are hereby released in the public domain (CC0) +Full text of the CC0 license: + https://creativecommons.org/publicdomain/zero/1.0/ + +Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001 + +The textures used for 3D objects in Independence War 2: Edge Of Chaos are in a +packed custom format called FTEX. This file format uses file extensions FTC +and FTU. +* FTC files are compressed textures (using standard texture compression). +* FTU files are not compressed. +Texture File Format +The FTC and FTU texture files both use the same format. This +has the following structure: +{header} +{format_directory} +{data} +Where: +{header} = { + u32:magic, + u32:version, + u32:width, + u32:height, + u32:mipmap_count, + u32:format_count +} + +* The "magic" number is "FTEX". +* "width" and "height" are the dimensions of the texture. +* "mipmap_count" is the number of mipmaps in the texture. +* "format_count" is the number of texture formats (different versions of the +same texture) in this file. + +{format_directory} = format_count * { u32:format, u32:where } + +The format value is 0 for DXT1 compressed textures and 1 for 24-bit RGB +uncompressed textures. +The texture data for a format starts at the position "where" in the file. + +Each set of texture data in the file has the following structure: +{data} = format_count * { u32:mipmap_size, mipmap_size * { u8 } } +* "mipmap_size" is the number of bytes in that mip level. For compressed +textures this is the size of the texture data compressed with DXT1. For 24 bit +uncompressed textures, this is 3 * width * height. Following this are the image +bytes for that mipmap level. + +Note: All data is stored in little-Endian (Intel) byte order. +""" + +from __future__ import annotations + +import struct +from enum import IntEnum +from io import BytesIO + +from . import Image, ImageFile + +MAGIC = b"FTEX" + + +class Format(IntEnum): + DXT1 = 0 + UNCOMPRESSED = 1 + + +class FtexImageFile(ImageFile.ImageFile): + format = "FTEX" + format_description = "Texture File Format (IW2:EOC)" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(4)): + msg = "not an FTEX file" + raise SyntaxError(msg) + struct.unpack(" None: + pass + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(MAGIC) + + +Image.register_open(FtexImageFile.format, FtexImageFile, _accept) +Image.register_extensions(FtexImageFile.format, [".ftc", ".ftu"]) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GbrImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GbrImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..3791dddfff9db010298bec223605813c0363183a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GbrImagePlugin.py @@ -0,0 +1,103 @@ +# +# The Python Imaging Library +# +# load a GIMP brush file +# +# History: +# 96-03-14 fl Created +# 16-01-08 es Version 2 +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996. +# Copyright (c) Eric Soroos 2016. +# +# See the README file for information on usage and redistribution. +# +# +# See https://github.com/GNOME/gimp/blob/mainline/devel-docs/gbr.txt for +# format documentation. +# +# This code Interprets version 1 and 2 .gbr files. +# Version 1 files are obsolete, and should not be used for new +# brushes. +# Version 2 files are saved by GIMP v2.8 (at least) +# Version 3 files have a format specifier of 18 for 16bit floats in +# the color depth field. This is currently unsupported by Pillow. +from __future__ import annotations + +from . import Image, ImageFile +from ._binary import i32be as i32 + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 8 and i32(prefix, 0) >= 20 and i32(prefix, 4) in (1, 2) + + +## +# Image plugin for the GIMP brush format. + + +class GbrImageFile(ImageFile.ImageFile): + format = "GBR" + format_description = "GIMP brush file" + + def _open(self) -> None: + assert self.fp is not None + header_size = i32(self.fp.read(4)) + if header_size < 20: + msg = "not a GIMP brush" + raise SyntaxError(msg) + version = i32(self.fp.read(4)) + if version not in (1, 2): + msg = f"Unsupported GIMP brush version: {version}" + raise SyntaxError(msg) + + width = i32(self.fp.read(4)) + height = i32(self.fp.read(4)) + color_depth = i32(self.fp.read(4)) + if width == 0 or height == 0: + msg = "not a GIMP brush" + raise SyntaxError(msg) + if color_depth not in (1, 4): + msg = f"Unsupported GIMP brush color depth: {color_depth}" + raise SyntaxError(msg) + + if version == 1: + comment_length = header_size - 20 + else: + comment_length = header_size - 28 + magic_number = self.fp.read(4) + if magic_number != b"GIMP": + msg = "not a GIMP brush, bad magic number" + raise SyntaxError(msg) + self.info["spacing"] = i32(self.fp.read(4)) + + self.info["comment"] = self.fp.read(comment_length)[:-1] + + if color_depth == 1: + self._mode = "L" + else: + self._mode = "RGBA" + + self._size = width, height + + # Image might not be small + Image._decompression_bomb_check(self.size) + + # Data is an uncompressed block of w * h * bytes/pixel + self._data_size = width * height * color_depth + + def load(self) -> Image.core.PixelAccess | None: + if self._im is None: + assert self.fp is not None + self.im = Image.core.new(self.mode, self.size) + self.frombytes(self.fp.read(self._data_size)) + return Image.Image.load(self) + + +# +# registry + + +Image.register_open(GbrImageFile.format, GbrImageFile, _accept) +Image.register_extension(GbrImageFile.format, ".gbr") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GdImageFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GdImageFile.py new file mode 100644 index 0000000000000000000000000000000000000000..da34131b0cce8a62d5b93388950d5f40762ab72c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GdImageFile.py @@ -0,0 +1,103 @@ +# +# The Python Imaging Library. +# $Id$ +# +# GD file handling +# +# History: +# 1996-04-12 fl Created +# +# Copyright (c) 1997 by Secret Labs AB. +# Copyright (c) 1996 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# + + +""" +.. note:: + This format cannot be automatically recognized, so the + class is not registered for use with :py:func:`PIL.Image.open()`. To open a + gd file, use the :py:func:`PIL.GdImageFile.open()` function instead. + +.. warning:: + THE GD FORMAT IS NOT DESIGNED FOR DATA INTERCHANGE. This + implementation is provided for convenience and demonstrational + purposes only. +""" + +from __future__ import annotations + +from typing import IO + +from . import ImageFile, ImagePalette, UnidentifiedImageError +from ._binary import i16be as i16 +from ._binary import i32be as i32 +from ._typing import StrOrBytesPath + + +class GdImageFile(ImageFile.ImageFile): + """ + Image plugin for the GD uncompressed format. Note that this format + is not supported by the standard :py:func:`PIL.Image.open()` function. To use + this plugin, you have to import the :py:mod:`PIL.GdImageFile` module and + use the :py:func:`PIL.GdImageFile.open()` function. + """ + + format = "GD" + format_description = "GD uncompressed images" + + def _open(self) -> None: + # Header + assert self.fp is not None + + s = self.fp.read(1037) + + if i16(s) not in [65534, 65535]: + msg = "Not a valid GD 2.x .gd file" + raise SyntaxError(msg) + + self._mode = "P" + self._size = i16(s, 2), i16(s, 4) + + true_color = s[6] + true_color_offset = 2 if true_color else 0 + + # transparency index + tindex = i32(s, 7 + true_color_offset) + if tindex < 256: + self.info["transparency"] = tindex + + self.palette = ImagePalette.raw( + "RGBX", s[7 + true_color_offset + 6 : 7 + true_color_offset + 6 + 256 * 4] + ) + + self.tile = [ + ImageFile._Tile( + "raw", + (0, 0) + self.size, + 7 + true_color_offset + 6 + 256 * 4, + "L", + ) + ] + + +def open(fp: StrOrBytesPath | IO[bytes], mode: str = "r") -> GdImageFile: + """ + Load texture from a GD image file. + + :param fp: GD file name, or an opened file handle. + :param mode: Optional mode. In this version, if the mode argument + is given, it must be "r". + :returns: An image instance. + :raises OSError: If the image could not be read. + """ + if mode != "r": + msg = "bad mode" + raise ValueError(msg) + + try: + return GdImageFile(fp) + except SyntaxError as e: + msg = "cannot identify this image file" + raise UnidentifiedImageError(msg) from e diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GifImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GifImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..96498eac98d61275784d682c3d6625909735002f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GifImagePlugin.py @@ -0,0 +1,1223 @@ +# +# The Python Imaging Library. +# $Id$ +# +# GIF file handling +# +# History: +# 1995-09-01 fl Created +# 1996-12-14 fl Added interlace support +# 1996-12-30 fl Added animation support +# 1997-01-05 fl Added write support, fixed local colour map bug +# 1997-02-23 fl Make sure to load raster data in getdata() +# 1997-07-05 fl Support external decoder (0.4) +# 1998-07-09 fl Handle all modes when saving (0.5) +# 1998-07-15 fl Renamed offset attribute to avoid name clash +# 2001-04-16 fl Added rewind support (seek to frame 0) (0.6) +# 2001-04-17 fl Added palette optimization (0.7) +# 2002-06-06 fl Added transparency support for save (0.8) +# 2004-02-24 fl Disable interlacing for small images +# +# Copyright (c) 1997-2004 by Secret Labs AB +# Copyright (c) 1995-2004 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import itertools +import math +import os +import subprocess +from enum import IntEnum +from functools import cached_property +from typing import Any, NamedTuple, cast + +from . import ( + Image, + ImageChops, + ImageFile, + ImageMath, + ImageOps, + ImagePalette, + ImageSequence, +) +from ._binary import i16le as i16 +from ._binary import o8 +from ._binary import o16le as o16 +from ._util import DeferredError + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import IO, Literal + + from . import _imaging + from ._typing import Buffer + + +class LoadingStrategy(IntEnum): + """.. versionadded:: 9.1.0""" + + RGB_AFTER_FIRST = 0 + RGB_AFTER_DIFFERENT_PALETTE_ONLY = 1 + RGB_ALWAYS = 2 + + +#: .. versionadded:: 9.1.0 +LOADING_STRATEGY = LoadingStrategy.RGB_AFTER_FIRST + +# -------------------------------------------------------------------- +# Identify/read GIF files + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith((b"GIF87a", b"GIF89a")) + + +## +# Image plugin for GIF images. This plugin supports both GIF87 and +# GIF89 images. + + +class GifImageFile(ImageFile.ImageFile): + format = "GIF" + format_description = "Compuserve GIF" + _close_exclusive_fp_after_loading = False + + global_palette = None + + def data(self) -> bytes | None: + assert self.fp is not None + s = self.fp.read(1) + if s and s[0]: + return self.fp.read(s[0]) + return None + + def _is_palette_needed(self, p: bytes) -> bool: + for i in range(0, len(p), 3): + if not (i // 3 == p[i] == p[i + 1] == p[i + 2]): + return True + return False + + def _open(self) -> None: + # Screen + assert self.fp is not None + s = self.fp.read(13) + if not _accept(s): + msg = "not a GIF file" + raise SyntaxError(msg) + + self.info["version"] = s[:6] + self._size = i16(s, 6), i16(s, 8) + flags = s[10] + bits = (flags & 7) + 1 + + if flags & 128: + # get global palette + self.info["background"] = s[11] + # check if palette contains colour indices + p = self.fp.read(3 << bits) + if self._is_palette_needed(p): + palette = ImagePalette.raw("RGB", p) + self.global_palette = self.palette = palette + + self._fp = self.fp # FIXME: hack + self.__rewind = self.fp.tell() + self._n_frames: int | None = None + self._seek(0) # get ready to read first frame + + @property + def n_frames(self) -> int: + if self._n_frames is None: + current = self.tell() + try: + while True: + self._seek(self.tell() + 1, False) + except EOFError: + self._n_frames = self.tell() + 1 + self.seek(current) + return self._n_frames + + @cached_property + def is_animated(self) -> bool: + if self._n_frames is not None: + return self._n_frames != 1 + + current = self.tell() + if current: + return True + + try: + self._seek(1, False) + is_animated = True + except EOFError: + is_animated = False + + self.seek(current) + return is_animated + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + if frame < self.__frame: + self._im = None + self._seek(0) + + last_frame = self.__frame + try: + for f in range(self.__frame + 1, frame + 1): + self._seek(f) + except EOFError as e: + self.seek(last_frame) + msg = "no more images in GIF file" + raise EOFError(msg) from e + + def _seek(self, frame: int, update_image: bool = True) -> None: + if isinstance(self._fp, DeferredError): + raise self._fp.ex + if frame == 0: + # rewind + self.__offset = 0 + self.dispose: _imaging.ImagingCore | None = None + self.__frame = -1 + self._fp.seek(self.__rewind) + self.disposal_method = 0 + if "comment" in self.info: + del self.info["comment"] + else: + # ensure that the previous frame was loaded + if self.tile and update_image: + self.load() + + if frame != self.__frame + 1: + msg = f"cannot seek to frame {frame}" + raise ValueError(msg) + + self.fp = self._fp + if self.__offset: + # backup to last frame + self.fp.seek(self.__offset) + while self.data(): + pass + self.__offset = 0 + + s = self.fp.read(1) + if not s or s == b";": + msg = "no more images in GIF file" + raise EOFError(msg) + + palette: ImagePalette.ImagePalette | Literal[False] | None = None + + info: dict[str, Any] = {} + frame_transparency = None + interlace = None + frame_dispose_extent = None + while True: + if not s: + s = self.fp.read(1) + if not s or s == b";": + break + + elif s == b"!": + # + # extensions + # + s = self.fp.read(1) + block = self.data() + if s[0] == 249 and block is not None: + # + # graphic control extension + # + flags = block[0] + if flags & 1: + frame_transparency = block[3] + info["duration"] = i16(block, 1) * 10 + + # disposal method - find the value of bits 4 - 6 + dispose_bits = 0b00011100 & flags + dispose_bits = dispose_bits >> 2 + if dispose_bits: + # only set the dispose if it is not + # unspecified. I'm not sure if this is + # correct, but it seems to prevent the last + # frame from looking odd for some animations + self.disposal_method = dispose_bits + elif s[0] == 254: + # + # comment extension + # + comment = b"" + + # Read this comment block + while block: + comment += block + block = self.data() + + if "comment" in info: + # If multiple comment blocks in frame, separate with \n + info["comment"] += b"\n" + comment + else: + info["comment"] = comment + s = b"" + continue + elif s[0] == 255 and frame == 0 and block is not None: + # + # application extension + # + info["extension"] = block, self.fp.tell() + if block.startswith(b"NETSCAPE2.0"): + block = self.data() + if block and len(block) >= 3 and block[0] == 1: + self.info["loop"] = i16(block, 1) + while self.data(): + pass + + elif s == b",": + # + # local image + # + s = self.fp.read(9) + + # extent + x0, y0 = i16(s, 0), i16(s, 2) + x1, y1 = x0 + i16(s, 4), y0 + i16(s, 6) + if (x1 > self.size[0] or y1 > self.size[1]) and update_image: + self._size = max(x1, self.size[0]), max(y1, self.size[1]) + Image._decompression_bomb_check(self._size) + frame_dispose_extent = x0, y0, x1, y1 + flags = s[8] + + interlace = (flags & 64) != 0 + + if flags & 128: + bits = (flags & 7) + 1 + p = self.fp.read(3 << bits) + if self._is_palette_needed(p): + palette = ImagePalette.raw("RGB", p) + else: + palette = False + + # image data + bits = self.fp.read(1)[0] + self.__offset = self.fp.tell() + break + s = b"" + + if interlace is None: + msg = "image not found in GIF frame" + raise EOFError(msg) + + self.__frame = frame + if not update_image: + return + + self.tile = [] + + if self.dispose: + self.im.paste(self.dispose, self.dispose_extent) + + self._frame_palette = palette if palette is not None else self.global_palette + self._frame_transparency = frame_transparency + if frame == 0: + if self._frame_palette: + if LOADING_STRATEGY == LoadingStrategy.RGB_ALWAYS: + self._mode = "RGBA" if frame_transparency is not None else "RGB" + else: + self._mode = "P" + else: + self._mode = "L" + + if palette: + self.palette = palette + elif self.global_palette: + from copy import copy + + self.palette = copy(self.global_palette) + else: + self.palette = None + else: + if self.mode == "P": + if ( + LOADING_STRATEGY != LoadingStrategy.RGB_AFTER_DIFFERENT_PALETTE_ONLY + or palette + ): + if "transparency" in self.info: + self.im.putpalettealpha(self.info["transparency"], 0) + self.im = self.im.convert("RGBA", Image.Dither.FLOYDSTEINBERG) + self._mode = "RGBA" + del self.info["transparency"] + else: + self._mode = "RGB" + self.im = self.im.convert("RGB", Image.Dither.FLOYDSTEINBERG) + + def _rgb(color: int) -> tuple[int, int, int]: + if self._frame_palette: + if color * 3 + 3 > len(self._frame_palette.palette): + color = 0 + return cast( + tuple[int, int, int], + tuple(self._frame_palette.palette[color * 3 : color * 3 + 3]), + ) + else: + return (color, color, color) + + self.dispose = None + self.dispose_extent: tuple[int, int, int, int] | None = frame_dispose_extent + if self.dispose_extent and self.disposal_method >= 2: + try: + if self.disposal_method == 2: + # replace with background colour + + # only dispose the extent in this frame + x0, y0, x1, y1 = self.dispose_extent + dispose_size = (x1 - x0, y1 - y0) + + Image._decompression_bomb_check(dispose_size) + + # by convention, attempt to use transparency first + dispose_mode = "P" + color = self.info.get("transparency", frame_transparency) + if color is not None: + if self.mode in ("RGB", "RGBA"): + dispose_mode = "RGBA" + color = _rgb(color) + (0,) + else: + color = self.info.get("background", 0) + if self.mode in ("RGB", "RGBA"): + dispose_mode = "RGB" + color = _rgb(color) + self.dispose = Image.core.fill(dispose_mode, dispose_size, color) + else: + # replace with previous contents + if self._im is not None: + # only dispose the extent in this frame + self.dispose = self._crop(self.im, self.dispose_extent) + elif frame_transparency is not None: + x0, y0, x1, y1 = self.dispose_extent + dispose_size = (x1 - x0, y1 - y0) + + Image._decompression_bomb_check(dispose_size) + dispose_mode = "P" + color = frame_transparency + if self.mode in ("RGB", "RGBA"): + dispose_mode = "RGBA" + color = _rgb(frame_transparency) + (0,) + self.dispose = Image.core.fill( + dispose_mode, dispose_size, color + ) + except AttributeError: + pass + + if interlace is not None: + transparency = -1 + if frame_transparency is not None: + if frame == 0: + if LOADING_STRATEGY != LoadingStrategy.RGB_ALWAYS: + self.info["transparency"] = frame_transparency + elif self.mode not in ("RGB", "RGBA"): + transparency = frame_transparency + self.tile = [ + ImageFile._Tile( + "gif", + (x0, y0, x1, y1), + self.__offset, + (bits, interlace, transparency), + ) + ] + + if info.get("comment"): + self.info["comment"] = info["comment"] + for k in ["duration", "extension"]: + if k in info: + self.info[k] = info[k] + elif k in self.info: + del self.info[k] + + def load_prepare(self) -> None: + temp_mode = "P" if self._frame_palette else "L" + self._prev_im = None + if self.__frame == 0: + if self._frame_transparency is not None: + self.im = Image.core.fill( + temp_mode, self.size, self._frame_transparency + ) + elif self.mode in ("RGB", "RGBA"): + self._prev_im = self.im + if self._frame_palette: + self.im = Image.core.fill("P", self.size, self._frame_transparency or 0) + self.im.putpalette("RGB", *self._frame_palette.getdata()) + else: + self._im = None + if not self._prev_im and self._im is not None and self.size != self.im.size: + expanded_im = Image.core.fill(self.im.mode, self.size) + if self._frame_palette: + expanded_im.putpalette("RGB", *self._frame_palette.getdata()) + expanded_im.paste(self.im, (0, 0) + self.im.size) + + self.im = expanded_im + self._mode = temp_mode + self._frame_palette = None + + super().load_prepare() + + def load_end(self) -> None: + if self.__frame == 0: + if self.mode == "P" and LOADING_STRATEGY == LoadingStrategy.RGB_ALWAYS: + if self._frame_transparency is not None: + self.im.putpalettealpha(self._frame_transparency, 0) + self._mode = "RGBA" + else: + self._mode = "RGB" + self.im = self.im.convert(self.mode, Image.Dither.FLOYDSTEINBERG) + return + if not self._prev_im: + return + if self.size != self._prev_im.size: + if self._frame_transparency is not None: + expanded_im = Image.core.fill("RGBA", self.size) + else: + expanded_im = Image.core.fill("P", self.size) + expanded_im.putpalette("RGB", "RGB", self.im.getpalette()) + expanded_im = expanded_im.convert("RGB") + expanded_im.paste(self._prev_im, (0, 0) + self._prev_im.size) + + self._prev_im = expanded_im + assert self._prev_im is not None + if self._frame_transparency is not None: + if self.mode == "L": + frame_im = self.im.convert_transparent("LA", self._frame_transparency) + else: + self.im.putpalettealpha(self._frame_transparency, 0) + frame_im = self.im.convert("RGBA") + else: + frame_im = self.im.convert("RGB") + + assert self.dispose_extent is not None + frame_im = self._crop(frame_im, self.dispose_extent) + + self.im = self._prev_im + self._mode = self.im.mode + if frame_im.mode in ("LA", "RGBA"): + self.im.paste(frame_im, self.dispose_extent, frame_im) + else: + self.im.paste(frame_im, self.dispose_extent) + + def tell(self) -> int: + return self.__frame + + +# -------------------------------------------------------------------- +# Write GIF files + + +RAWMODE = {"1": "L", "L": "L", "P": "P"} + + +def _normalize_mode(im: Image.Image) -> Image.Image: + """ + Takes an image (or frame), returns an image in a mode that is appropriate + for saving in a Gif. + + It may return the original image, or it may return an image converted to + palette or 'L' mode. + + :param im: Image object + :returns: Image object + """ + if im.mode in RAWMODE: + im.load() + return im + if Image.getmodebase(im.mode) == "RGB": + im = im.convert("P", palette=Image.Palette.ADAPTIVE) + assert im.palette is not None + if im.palette.mode == "RGBA": + for rgba in im.palette.colors: + if rgba[3] == 0: + im.info["transparency"] = im.palette.colors[rgba] + break + return im + return im.convert("L") + + +_Palette = bytes | bytearray | list[int] | ImagePalette.ImagePalette + + +def _normalize_palette( + im: Image.Image, palette: _Palette | None, info: dict[str, Any] +) -> Image.Image: + """ + Normalizes the palette for image. + - Sets the palette to the incoming palette, if provided. + - Ensures that there's a palette for L mode images + - Optimizes the palette if necessary/desired. + + :param im: Image object + :param palette: bytes object containing the source palette, or .... + :param info: encoderinfo + :returns: Image object + """ + source_palette = None + if palette: + # a bytes palette + if isinstance(palette, (bytes, bytearray, list)): + source_palette = bytearray(palette[:768]) + if isinstance(palette, ImagePalette.ImagePalette): + source_palette = bytearray(palette.palette) + + if im.mode == "P": + if not source_palette: + im_palette = im.getpalette(None) + assert im_palette is not None + source_palette = bytearray(im_palette) + else: # L-mode + if not source_palette: + source_palette = bytearray(i // 3 for i in range(768)) + im.palette = ImagePalette.ImagePalette("RGB", palette=source_palette) + assert source_palette is not None + + if palette: + used_palette_colors: list[int | None] = [] + assert im.palette is not None + for i in range(0, len(source_palette), 3): + source_color = tuple(source_palette[i : i + 3]) + index = im.palette.colors.get(source_color) + if index in used_palette_colors: + index = None + used_palette_colors.append(index) + for i, index in enumerate(used_palette_colors): + if index is None: + for j in range(len(used_palette_colors)): + if j not in used_palette_colors: + used_palette_colors[i] = j + break + dest_map: list[int] = [] + for index in used_palette_colors: + assert index is not None + dest_map.append(index) + im = im.remap_palette(dest_map) + else: + optimized_palette_colors = _get_optimize(im, info) + if optimized_palette_colors is not None: + im = im.remap_palette(optimized_palette_colors, source_palette) + if "transparency" in info: + try: + info["transparency"] = optimized_palette_colors.index( + info["transparency"] + ) + except ValueError: + del info["transparency"] + return im + + assert im.palette is not None + im.palette.palette = source_palette + return im + + +def _write_single_frame( + im: Image.Image, + fp: IO[bytes], + palette: _Palette | None, +) -> None: + im_out = _normalize_mode(im) + for k, v in im_out.info.items(): + if isinstance(k, str): + im.encoderinfo.setdefault(k, v) + im_out = _normalize_palette(im_out, palette, im.encoderinfo) + + for s in _get_global_header(im_out, im.encoderinfo): + fp.write(s) + + # local image header + flags = 0 + if get_interlace(im): + flags = flags | 64 + _write_local_header(fp, im, (0, 0), flags) + + im_out.encoderconfig = (8, get_interlace(im)) + ImageFile._save( + im_out, fp, [ImageFile._Tile("gif", (0, 0) + im.size, 0, RAWMODE[im_out.mode])] + ) + + fp.write(b"\0") # end of image data + + +def _getbbox( + base_im: Image.Image, im_frame: Image.Image +) -> tuple[Image.Image, tuple[int, int, int, int] | None]: + palette_bytes = [ + bytes(im.palette.palette) if im.palette else b"" for im in (base_im, im_frame) + ] + if palette_bytes[0] != palette_bytes[1]: + im_frame = im_frame.convert("RGBA") + base_im = base_im.convert("RGBA") + delta = ImageChops.subtract_modulo(im_frame, base_im) + return delta, delta.getbbox(alpha_only=False) + + +class _Frame(NamedTuple): + im: Image.Image + bbox: tuple[int, int, int, int] | None + encoderinfo: dict[str, Any] + + +def _write_multiple_frames( + im: Image.Image, fp: IO[bytes], palette: _Palette | None +) -> bool: + duration = im.encoderinfo.get("duration") + disposal = im.encoderinfo.get("disposal", im.info.get("disposal")) + + im_frames: list[_Frame] = [] + previous_im: Image.Image | None = None + frame_count = 0 + background_im = None + for imSequence in itertools.chain([im], im.encoderinfo.get("append_images", [])): + for im_frame in ImageSequence.Iterator(imSequence): + # a copy is required here since seek can still mutate the image + im_frame = _normalize_mode(im_frame.copy()) + if frame_count == 0: + for k, v in im_frame.info.items(): + if k == "transparency": + continue + if isinstance(k, str): + im.encoderinfo.setdefault(k, v) + + encoderinfo = im.encoderinfo.copy() + if "transparency" in im_frame.info: + encoderinfo.setdefault("transparency", im_frame.info["transparency"]) + im_frame = _normalize_palette(im_frame, palette, encoderinfo) + if isinstance(duration, (list, tuple)): + encoderinfo["duration"] = duration[frame_count] + elif duration is None and "duration" in im_frame.info: + encoderinfo["duration"] = im_frame.info["duration"] + if isinstance(disposal, (list, tuple)): + encoderinfo["disposal"] = disposal[frame_count] + frame_count += 1 + + diff_frame = None + if im_frames and previous_im: + # delta frame + delta, bbox = _getbbox(previous_im, im_frame) + if not bbox: + # This frame is identical to the previous frame + if encoderinfo.get("duration"): + im_frames[-1].encoderinfo["duration"] += encoderinfo["duration"] + continue + if im_frames[-1].encoderinfo.get("disposal") == 2: + # To appear correctly in viewers using a convention, + # only consider transparency, and not background color + color = im.encoderinfo.get( + "transparency", im.info.get("transparency") + ) + if color is not None: + if background_im is None: + background = _get_background(im_frame, color) + background_im = Image.new("P", im_frame.size, background) + first_palette = im_frames[0].im.palette + assert first_palette is not None + background_im.putpalette(first_palette, first_palette.mode) + bbox = _getbbox(background_im, im_frame)[1] + else: + bbox = (0, 0) + im_frame.size + elif encoderinfo.get("optimize") and im_frame.mode != "1": + if "transparency" not in encoderinfo: + assert im_frame.palette is not None + try: + encoderinfo["transparency"] = ( + im_frame.palette._new_color_index(im_frame) + ) + except ValueError: + pass + if "transparency" in encoderinfo: + # When the delta is zero, fill the image with transparency + diff_frame = im_frame.copy() + fill = Image.new("P", delta.size, encoderinfo["transparency"]) + if delta.mode == "RGBA": + r, g, b, a = delta.split() + mask = ImageMath.lambda_eval( + lambda args: args["convert"]( + args["max"]( + args["max"]( + args["max"](args["r"], args["g"]), args["b"] + ), + args["a"], + ) + * 255, + "1", + ), + r=r, + g=g, + b=b, + a=a, + ) + else: + if delta.mode == "P": + # Convert to L without considering palette + delta_l = Image.new("L", delta.size) + delta_l.putdata(delta.get_flattened_data()) + delta = delta_l + mask = ImageMath.lambda_eval( + lambda args: args["convert"](args["im"] * 255, "1"), + im=delta, + ) + diff_frame.paste(fill, mask=ImageOps.invert(mask)) + else: + bbox = None + previous_im = im_frame + im_frames.append(_Frame(diff_frame or im_frame, bbox, encoderinfo)) + + if len(im_frames) == 1: + if "duration" in im.encoderinfo: + # Since multiple frames will not be written, use the combined duration + im.encoderinfo["duration"] = im_frames[0].encoderinfo["duration"] + return False + + for frame_data in im_frames: + im_frame = frame_data.im + if not frame_data.bbox: + # global header + for s in _get_global_header(im_frame, frame_data.encoderinfo): + fp.write(s) + offset = (0, 0) + else: + # compress difference + if not palette: + frame_data.encoderinfo["include_color_table"] = True + + if frame_data.bbox != (0, 0) + im_frame.size: + im_frame = im_frame.crop(frame_data.bbox) + offset = frame_data.bbox[:2] + _write_frame_data(fp, im_frame, offset, frame_data.encoderinfo) + return True + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + _save(im, fp, filename, save_all=True) + + +def _save( + im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False +) -> None: + # header + if "palette" in im.encoderinfo or "palette" in im.info: + palette = im.encoderinfo.get("palette", im.info.get("palette")) + else: + palette = None + im.encoderinfo.setdefault("optimize", True) + + if not save_all or not _write_multiple_frames(im, fp, palette): + _write_single_frame(im, fp, palette) + + fp.write(b";") # end of file + + if hasattr(fp, "flush"): + fp.flush() + + +def get_interlace(im: Image.Image) -> int: + interlace = im.encoderinfo.get("interlace", 1) + + # workaround for @PIL153 + if min(im.size) < 16: + interlace = 0 + + return interlace + + +def _write_local_header( + fp: IO[bytes], im: Image.Image, offset: tuple[int, int], flags: int +) -> None: + try: + transparency = im.encoderinfo["transparency"] + except KeyError: + transparency = None + + if "duration" in im.encoderinfo: + duration = int(im.encoderinfo["duration"] / 10) + else: + duration = 0 + + disposal = int(im.encoderinfo.get("disposal", 0)) + + if transparency is not None or duration != 0 or disposal: + packed_flag = 1 if transparency is not None else 0 + packed_flag |= disposal << 2 + + fp.write( + b"!" + + o8(249) # extension intro + + o8(4) # length + + o8(packed_flag) # packed fields + + o16(duration) # duration + + o8(transparency or 0) # transparency index + + o8(0) + ) + + include_color_table = im.encoderinfo.get("include_color_table") + if include_color_table: + palette_bytes = _get_palette_bytes(im) + color_table_size = _get_color_table_size(palette_bytes) + if color_table_size: + flags = flags | 128 # local color table flag + flags = flags | color_table_size + + fp.write( + b"," + + o16(offset[0]) # offset + + o16(offset[1]) + + o16(im.size[0]) # size + + o16(im.size[1]) + + o8(flags) # flags + ) + if include_color_table and color_table_size: + fp.write(_get_header_palette(palette_bytes)) + fp.write(o8(8)) # bits + + +def _save_netpbm(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + # Unused by default. + # To use, uncomment the register_save call at the end of the file. + # + # If you need real GIF compression and/or RGB quantization, you + # can use the external NETPBM/PBMPLUS utilities. See comments + # below for information on how to enable this. + tempfile = im._dump() + + try: + with open(filename, "wb") as f: + if im.mode != "RGB": + subprocess.check_call( + ["ppmtogif", tempfile], stdout=f, stderr=subprocess.DEVNULL + ) + else: + # Pipe ppmquant output into ppmtogif + # "ppmquant 256 %s | ppmtogif > %s" % (tempfile, filename) + quant_cmd = ["ppmquant", "256", tempfile] + togif_cmd = ["ppmtogif"] + quant_proc = subprocess.Popen( + quant_cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL + ) + togif_proc = subprocess.Popen( + togif_cmd, + stdin=quant_proc.stdout, + stdout=f, + stderr=subprocess.DEVNULL, + ) + + # Allow ppmquant to receive SIGPIPE if ppmtogif exits + assert quant_proc.stdout is not None + quant_proc.stdout.close() + + retcode = quant_proc.wait() + if retcode: + raise subprocess.CalledProcessError(retcode, quant_cmd) + + retcode = togif_proc.wait() + if retcode: + raise subprocess.CalledProcessError(retcode, togif_cmd) + finally: + try: + os.unlink(tempfile) + except OSError: + pass + + +# Force optimization so that we can test performance against +# cases where it took lots of memory and time previously. +_FORCE_OPTIMIZE = False + + +def _get_optimize(im: Image.Image, info: dict[str, Any]) -> list[int] | None: + """ + Palette optimization is a potentially expensive operation. + + This function determines if the palette should be optimized using + some heuristics, then returns the list of palette entries in use. + + :param im: Image object + :param info: encoderinfo + :returns: list of indexes of palette entries in use, or None + """ + if ( + im.mode in ("P", "L") + and info + and info.get("optimize") + and im.width != 0 + and im.height != 0 + ): + # Potentially expensive operation. + + # The palette saves 3 bytes per color not used, but palette + # lengths are restricted to 3*(2**N) bytes. Max saving would + # be 768 -> 6 bytes if we went all the way down to 2 colors. + # * If we're over 128 colors, we can't save any space. + # * If there aren't any holes, it's not worth collapsing. + # * If we have a 'large' image, the palette is in the noise. + + # create the new palette if not every color is used + optimise = _FORCE_OPTIMIZE or im.mode == "L" + if optimise or im.width * im.height < 512 * 512: + # check which colors are used + used_palette_colors = [] + for i, count in enumerate(im.histogram()): + if count: + used_palette_colors.append(i) + + if optimise or max(used_palette_colors) >= len(used_palette_colors): + return used_palette_colors + + assert im.palette is not None + num_palette_colors = len(im.palette.palette) // Image.getmodebands( + im.palette.mode + ) + current_palette_size = 1 << (num_palette_colors - 1).bit_length() + if ( + # check that the palette would become smaller when saved + len(used_palette_colors) <= current_palette_size // 2 + # check that the palette is not already the smallest possible size + and current_palette_size > 2 + ): + return used_palette_colors + return None + + +def _get_color_table_size(palette_bytes: bytes) -> int: + # calculate the palette size for the header + if not palette_bytes: + return 0 + elif len(palette_bytes) < 9: + return 1 + else: + return math.ceil(math.log(len(palette_bytes) // 3, 2)) - 1 + + +def _get_header_palette(palette_bytes: bytes) -> bytes: + """ + Returns the palette, null padded to the next power of 2 (*3) bytes + suitable for direct inclusion in the GIF header + + :param palette_bytes: Unpadded palette bytes, in RGBRGB form + :returns: Null padded palette + """ + color_table_size = _get_color_table_size(palette_bytes) + + # add the missing amount of bytes + # the palette has to be 2< 0: + palette_bytes += o8(0) * 3 * actual_target_size_diff + return palette_bytes + + +def _get_palette_bytes(im: Image.Image) -> bytes: + """ + Gets the palette for inclusion in the gif header + + :param im: Image object + :returns: Bytes, len<=768 suitable for inclusion in gif header + """ + if not im.palette: + return b"" + + palette = bytes(im.palette.palette) + if im.palette.mode == "RGBA": + palette = b"".join(palette[i * 4 : i * 4 + 3] for i in range(len(palette) // 3)) + return palette + + +def _get_background( + im: Image.Image, + info_background: int | tuple[int, int, int] | tuple[int, int, int, int] | None, +) -> int: + background = 0 + if info_background: + if isinstance(info_background, tuple): + # WebPImagePlugin stores an RGBA value in info["background"] + # So it must be converted to the same format as GifImagePlugin's + # info["background"] - a global color table index + assert im.palette is not None + try: + background = im.palette.getcolor(info_background, im) + except ValueError as e: + if str(e) not in ( + # If all 256 colors are in use, + # then there is no need for the background color + "cannot allocate more than 256 colors", + # Ignore non-opaque WebP background + "cannot add non-opaque RGBA color to RGB palette", + ): + raise + else: + background = info_background + return background + + +def _get_global_header(im: Image.Image, info: dict[str, Any]) -> list[bytes]: + """Return a list of strings representing a GIF header""" + + # Header Block + # https://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp + + version = b"87a" + if im.info.get("version") == b"89a" or ( + info + and ( + "transparency" in info + or info.get("loop") is not None + or info.get("duration") + or info.get("comment") + ) + ): + version = b"89a" + + background = _get_background(im, info.get("background")) + + palette_bytes = _get_palette_bytes(im) + color_table_size = _get_color_table_size(palette_bytes) + + header = [ + b"GIF" # signature + + version # version + + o16(im.size[0]) # canvas width + + o16(im.size[1]), # canvas height + # Logical Screen Descriptor + # size of global color table + global color table flag + o8(color_table_size + 128), # packed fields + # background + reserved/aspect + o8(background) + o8(0), + # Global Color Table + _get_header_palette(palette_bytes), + ] + if info.get("loop") is not None: + header.append( + b"!" + + o8(255) # extension intro + + o8(11) + + b"NETSCAPE2.0" + + o8(3) + + o8(1) + + o16(info["loop"]) # number of loops + + o8(0) + ) + if info.get("comment"): + comment_block = b"!" + o8(254) # extension intro + + comment = info["comment"] + if isinstance(comment, str): + comment = comment.encode() + for i in range(0, len(comment), 255): + subblock = comment[i : i + 255] + comment_block += o8(len(subblock)) + subblock + + comment_block += o8(0) + header.append(comment_block) + return header + + +def _write_frame_data( + fp: IO[bytes], + im_frame: Image.Image, + offset: tuple[int, int], + params: dict[str, Any], +) -> None: + try: + im_frame.encoderinfo = params + + # local image header + _write_local_header(fp, im_frame, offset, 0) + + ImageFile._save( + im_frame, + fp, + [ImageFile._Tile("gif", (0, 0) + im_frame.size, 0, RAWMODE[im_frame.mode])], + ) + + fp.write(b"\0") # end of image data + finally: + del im_frame.encoderinfo + + +# -------------------------------------------------------------------- +# Legacy GIF utilities + + +def getheader( + im: Image.Image, palette: _Palette | None = None, info: dict[str, Any] | None = None +) -> tuple[list[bytes], list[int] | None]: + """ + Legacy Method to get Gif data from image. + + Warning:: May modify image data. + + :param im: Image object + :param palette: bytes object containing the source palette, or .... + :param info: encoderinfo + :returns: tuple of(list of header items, optimized palette) + + """ + if info is None: + info = {} + + used_palette_colors = _get_optimize(im, info) + + if "background" not in info and "background" in im.info: + info["background"] = im.info["background"] + + im_mod = _normalize_palette(im, palette, info) + im.palette = im_mod.palette + im.im = im_mod.im + header = _get_global_header(im, info) + + return header, used_palette_colors + + +def getdata( + im: Image.Image, offset: tuple[int, int] = (0, 0), **params: Any +) -> list[bytes]: + """ + Legacy Method + + Return a list of strings representing this image. + The first string is a local image header, the rest contains + encoded image data. + + To specify duration, add the time in milliseconds, + e.g. ``getdata(im_frame, duration=1000)`` + + :param im: Image object + :param offset: Tuple of (x, y) pixels. Defaults to (0, 0) + :param \\**params: e.g. duration or other encoder info parameters + :returns: List of bytes containing GIF encoded frame data + + """ + from io import BytesIO + + class Collector(BytesIO): + data = [] + + def write(self, data: Buffer) -> int: + self.data.append(data) + return len(data) + + im.load() # make sure raster data is available + + fp = Collector() + + _write_frame_data(fp, im, offset, params) + + return fp.data + + +# -------------------------------------------------------------------- +# Registry + +Image.register_open(GifImageFile.format, GifImageFile, _accept) +Image.register_save(GifImageFile.format, _save) +Image.register_save_all(GifImageFile.format, _save_all) +Image.register_extension(GifImageFile.format, ".gif") +Image.register_mime(GifImageFile.format, "image/gif") + +# +# Uncomment the following line if you wish to use NETPBM/PBMPLUS +# instead of the built-in "uncompressed" GIF encoder + +# Image.register_save(GifImageFile.format, _save_netpbm) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GimpGradientFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GimpGradientFile.py new file mode 100644 index 0000000000000000000000000000000000000000..ff5604caab9d8a161ef25eb204d474819e785ebb --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GimpGradientFile.py @@ -0,0 +1,154 @@ +# +# Python Imaging Library +# $Id$ +# +# stuff to read (and render) GIMP gradient files +# +# History: +# 97-08-23 fl Created +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1997. +# +# See the README file for information on usage and redistribution. +# + +""" +Stuff to translate curve segments to palette values (derived from +the corresponding code in GIMP, written by Federico Mena Quintero. +See the GIMP distribution for more information.) +""" + +from __future__ import annotations + +from math import log, pi, sin, sqrt + +from ._binary import o8 + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from typing import IO + +EPSILON = 1e-10 +"""""" # Enable auto-doc for data member + + +def linear(middle: float, pos: float) -> float: + if pos <= middle: + if middle < EPSILON: + return 0.0 + else: + return 0.5 * pos / middle + else: + pos = pos - middle + middle = 1.0 - middle + if middle < EPSILON: + return 1.0 + else: + return 0.5 + 0.5 * pos / middle + + +def curved(middle: float, pos: float) -> float: + return pos ** (log(0.5) / log(max(middle, EPSILON))) + + +def sine(middle: float, pos: float) -> float: + return (sin((-pi / 2.0) + pi * linear(middle, pos)) + 1.0) / 2.0 + + +def sphere_increasing(middle: float, pos: float) -> float: + return sqrt(1.0 - (linear(middle, pos) - 1.0) ** 2) + + +def sphere_decreasing(middle: float, pos: float) -> float: + return 1.0 - sqrt(1.0 - linear(middle, pos) ** 2) + + +SEGMENTS = [linear, curved, sine, sphere_increasing, sphere_decreasing] +"""""" # Enable auto-doc for data member + + +class GradientFile: + gradient: ( + list[ + tuple[ + float, + float, + float, + list[float], + list[float], + Callable[[float, float], float], + ] + ] + | None + ) = None + + def getpalette(self, entries: int = 256) -> tuple[bytes, str]: + assert self.gradient is not None + palette = [] + + ix = 0 + x0, x1, xm, rgb0, rgb1, segment = self.gradient[ix] + + for i in range(entries): + x = i / (entries - 1) + + while x1 < x: + ix += 1 + x0, x1, xm, rgb0, rgb1, segment = self.gradient[ix] + + w = x1 - x0 + + if w < EPSILON: + scale = segment(0.5, 0.5) + else: + scale = segment((xm - x0) / w, (x - x0) / w) + + # expand to RGBA + r = o8(int(255 * ((rgb1[0] - rgb0[0]) * scale + rgb0[0]) + 0.5)) + g = o8(int(255 * ((rgb1[1] - rgb0[1]) * scale + rgb0[1]) + 0.5)) + b = o8(int(255 * ((rgb1[2] - rgb0[2]) * scale + rgb0[2]) + 0.5)) + a = o8(int(255 * ((rgb1[3] - rgb0[3]) * scale + rgb0[3]) + 0.5)) + + # add to palette + palette.append(r + g + b + a) + + return b"".join(palette), "RGBA" + + +class GimpGradientFile(GradientFile): + """File handler for GIMP's gradient format.""" + + def __init__(self, fp: IO[bytes]) -> None: + if not fp.readline().startswith(b"GIMP Gradient"): + msg = "not a GIMP gradient file" + raise SyntaxError(msg) + + line = fp.readline() + + # GIMP 1.2 gradient files don't contain a name, but GIMP 1.3 files do + if line.startswith(b"Name: "): + line = fp.readline().strip() + + count = int(line) + + self.gradient = [] + + for i in range(count): + s = fp.readline().split() + w = [float(x) for x in s[:11]] + + x0, x1 = w[0], w[2] + xm = w[1] + rgb0 = w[3:7] + rgb1 = w[7:11] + + segment = SEGMENTS[int(s[11])] + cspace = int(s[12]) + + if cspace != 0: + msg = "cannot handle HSV colour space" + raise OSError(msg) + + self.gradient.append((x0, x1, xm, rgb0, rgb1, segment)) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GimpPaletteFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GimpPaletteFile.py new file mode 100644 index 0000000000000000000000000000000000000000..28b77fe5b916c6006587564031b86a7b9fc45a23 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GimpPaletteFile.py @@ -0,0 +1,75 @@ +# +# Python Imaging Library +# $Id$ +# +# stuff to read GIMP palette files +# +# History: +# 1997-08-23 fl Created +# 2004-09-07 fl Support GIMP 2.0 palette files. +# +# Copyright (c) Secret Labs AB 1997-2004. All rights reserved. +# Copyright (c) Fredrik Lundh 1997-2004. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import re +from io import BytesIO + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import IO + + +class GimpPaletteFile: + """File handler for GIMP's palette format.""" + + rawmode = "RGB" + + def _read(self, fp: IO[bytes], limit: bool = True) -> None: + if not fp.readline().startswith(b"GIMP Palette"): + msg = "not a GIMP palette file" + raise SyntaxError(msg) + + palette: list[int] = [] + i = 0 + while True: + if limit and i == 256 + 3: + break + + i += 1 + s = fp.readline() + if not s: + break + + # skip fields and comment lines + if re.match(rb"\w+:|#", s): + continue + if limit and len(s) > 100: + msg = "bad palette file" + raise SyntaxError(msg) + + v = s.split(maxsplit=3) + if len(v) < 3: + msg = "bad palette entry" + raise ValueError(msg) + + palette += (int(v[i]) for i in range(3)) + if limit and len(palette) == 768: + break + + self.palette = bytes(palette) + + def __init__(self, fp: IO[bytes]) -> None: + self._read(fp) + + @classmethod + def frombytes(cls, data: bytes) -> GimpPaletteFile: + self = cls.__new__(cls) + self._read(BytesIO(data), False) + return self + + def getpalette(self) -> tuple[bytes, str]: + return self.palette, self.rawmode diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GribStubImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GribStubImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..a2551032621115d01ae2a8b1c768ae24fb3804ed --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/GribStubImagePlugin.py @@ -0,0 +1,72 @@ +# +# The Python Imaging Library +# $Id$ +# +# GRIB stub adapter +# +# Copyright (c) 1996-2003 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +from typing import IO + +from . import Image, ImageFile + +_handler = None + + +def register_handler(handler: ImageFile.StubHandler | None) -> None: + """ + Install application-specific GRIB image handler. + + :param handler: Handler object. + """ + global _handler + _handler = handler + + +# -------------------------------------------------------------------- +# Image adapter + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 8 and prefix.startswith(b"GRIB") and prefix[7] == 1 + + +class GribStubImageFile(ImageFile.StubImageFile): + format = "GRIB" + format_description = "GRIB" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(8)): + msg = "Not a GRIB file" + raise SyntaxError(msg) + + self.fp.seek(-8, os.SEEK_CUR) + + # make something up + self._mode = "F" + self._size = 1, 1 + + def _load(self) -> ImageFile.StubHandler | None: + return _handler + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if _handler is None or not hasattr(_handler, "save"): + msg = "GRIB save handler not installed" + raise OSError(msg) + _handler.save(im, fp, filename) + + +# -------------------------------------------------------------------- +# Registry + +Image.register_open(GribStubImageFile.format, GribStubImageFile, _accept) +Image.register_save(GribStubImageFile.format, _save) + +Image.register_extension(GribStubImageFile.format, ".grib") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Hdf5StubImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Hdf5StubImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..e51de1bb9d51aea24be5df7cf9619a6150c4b05f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Hdf5StubImagePlugin.py @@ -0,0 +1,72 @@ +# +# The Python Imaging Library +# $Id$ +# +# HDF5 stub adapter +# +# Copyright (c) 2000-2003 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +from typing import IO + +from . import Image, ImageFile + +_handler = None + + +def register_handler(handler: ImageFile.StubHandler | None) -> None: + """ + Install application-specific HDF5 image handler. + + :param handler: Handler object. + """ + global _handler + _handler = handler + + +# -------------------------------------------------------------------- +# Image adapter + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"\x89HDF\r\n\x1a\n") + + +class HDF5StubImageFile(ImageFile.StubImageFile): + format = "HDF5" + format_description = "HDF5" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(8)): + msg = "Not an HDF file" + raise SyntaxError(msg) + + self.fp.seek(-8, os.SEEK_CUR) + + # make something up + self._mode = "F" + self._size = 1, 1 + + def _load(self) -> ImageFile.StubHandler | None: + return _handler + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if _handler is None or not hasattr(_handler, "save"): + msg = "HDF5 save handler not installed" + raise OSError(msg) + _handler.save(im, fp, filename) + + +# -------------------------------------------------------------------- +# Registry + +Image.register_open(HDF5StubImageFile.format, HDF5StubImageFile, _accept) +Image.register_save(HDF5StubImageFile.format, _save) + +Image.register_extensions(HDF5StubImageFile.format, [".h5", ".hdf"]) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IcnsImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IcnsImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..1c1f88734e7037ecfad497b167ab2b3386fb03cf --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IcnsImagePlugin.py @@ -0,0 +1,401 @@ +# +# The Python Imaging Library. +# $Id$ +# +# macOS icns file decoder, based on icns.py by Bob Ippolito. +# +# history: +# 2004-10-09 fl Turned into a PIL plugin; removed 2.3 dependencies. +# 2020-04-04 Allow saving on all operating systems. +# +# Copyright (c) 2004 by Bob Ippolito. +# Copyright (c) 2004 by Secret Labs. +# Copyright (c) 2004 by Fredrik Lundh. +# Copyright (c) 2014 by Alastair Houghton. +# Copyright (c) 2020 by Pan Jing. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +import os +import struct +import sys +from typing import IO + +from . import Image, ImageFile, PngImagePlugin, features + +enable_jpeg2k = features.check_codec("jpg_2000") +if enable_jpeg2k: + from . import Jpeg2KImagePlugin + +MAGIC = b"icns" +HEADERSIZE = 8 + + +def nextheader(fobj: IO[bytes]) -> tuple[bytes, int]: + return struct.unpack(">4sI", fobj.read(HEADERSIZE)) + + +def read_32t( + fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] +) -> dict[str, Image.Image]: + # The 128x128 icon seems to have an extra header for some reason. + start, length = start_length + fobj.seek(start) + sig = fobj.read(4) + if sig != b"\x00\x00\x00\x00": + msg = "Unknown signature, expecting 0x00000000" + raise SyntaxError(msg) + return read_32(fobj, (start + 4, length - 4), size) + + +def read_32( + fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] +) -> dict[str, Image.Image]: + """ + Read a 32bit RGB icon resource. Seems to be either uncompressed or + an RLE packbits-like scheme. + """ + start, length = start_length + fobj.seek(start) + pixel_size = (size[0] * size[2], size[1] * size[2]) + sizesq = pixel_size[0] * pixel_size[1] + if length == sizesq * 3: + # uncompressed ("RGBRGBGB") + indata = fobj.read(length) + im = Image.frombuffer("RGB", pixel_size, indata, "raw", "RGB", 0, 1) + else: + # decode image + im = Image.new("RGB", pixel_size, None) + for band_ix in range(3): + data = [] + bytesleft = sizesq + while bytesleft > 0: + byte = fobj.read(1) + if not byte: + break + byte_int = byte[0] + if byte_int & 0x80: + blocksize = byte_int - 125 + byte = fobj.read(1) + data.extend([byte] * blocksize) + else: + blocksize = byte_int + 1 + data.append(fobj.read(blocksize)) + bytesleft -= blocksize + if bytesleft <= 0: + break + if bytesleft != 0: + msg = f"Error reading channel [{repr(bytesleft)} left]" + raise SyntaxError(msg) + band = Image.frombuffer("L", pixel_size, b"".join(data), "raw", "L", 0, 1) + im.im.putband(band.im, band_ix) + return {"RGB": im} + + +def read_mk( + fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] +) -> dict[str, Image.Image]: + # Alpha masks seem to be uncompressed + start = start_length[0] + fobj.seek(start) + pixel_size = (size[0] * size[2], size[1] * size[2]) + sizesq = pixel_size[0] * pixel_size[1] + band = Image.frombuffer("L", pixel_size, fobj.read(sizesq), "raw", "L", 0, 1) + return {"A": band} + + +def read_png_or_jpeg2000( + fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int] +) -> dict[str, Image.Image]: + start, length = start_length + fobj.seek(start) + sig = fobj.read(12) + + im: Image.Image + if sig.startswith(b"\x89PNG\x0d\x0a\x1a\x0a"): + fobj.seek(start) + im = PngImagePlugin.PngImageFile(fobj) + Image._decompression_bomb_check(im.size) + return {"RGBA": im} + elif ( + sig.startswith((b"\xff\x4f\xff\x51", b"\x0d\x0a\x87\x0a")) + or sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a" + ): + if not enable_jpeg2k: + msg = ( + "Unsupported icon subimage format (rebuild PIL " + "with JPEG 2000 support to fix this)" + ) + raise ValueError(msg) + # j2k, jpc or j2c + fobj.seek(start) + jp2kstream = fobj.read(length) + f = io.BytesIO(jp2kstream) + im = Jpeg2KImagePlugin.Jpeg2KImageFile(f) + Image._decompression_bomb_check(im.size) + if im.mode != "RGBA": + im = im.convert("RGBA") + return {"RGBA": im} + else: + msg = "Unsupported icon subimage format" + raise ValueError(msg) + + +class IcnsFile: + SIZES = { + (512, 512, 2): [(b"ic10", read_png_or_jpeg2000)], + (512, 512, 1): [(b"ic09", read_png_or_jpeg2000)], + (256, 256, 2): [(b"ic14", read_png_or_jpeg2000)], + (256, 256, 1): [(b"ic08", read_png_or_jpeg2000)], + (128, 128, 2): [(b"ic13", read_png_or_jpeg2000)], + (128, 128, 1): [ + (b"ic07", read_png_or_jpeg2000), + (b"it32", read_32t), + (b"t8mk", read_mk), + ], + (64, 64, 1): [(b"icp6", read_png_or_jpeg2000)], + (32, 32, 2): [(b"ic12", read_png_or_jpeg2000)], + (48, 48, 1): [(b"ih32", read_32), (b"h8mk", read_mk)], + (32, 32, 1): [ + (b"icp5", read_png_or_jpeg2000), + (b"il32", read_32), + (b"l8mk", read_mk), + ], + (16, 16, 2): [(b"ic11", read_png_or_jpeg2000)], + (16, 16, 1): [ + (b"icp4", read_png_or_jpeg2000), + (b"is32", read_32), + (b"s8mk", read_mk), + ], + } + + def __init__(self, fobj: IO[bytes]) -> None: + """ + fobj is a file-like object as an icns resource + """ + # signature : (start, length) + self.dct = {} + self.fobj = fobj + sig, filesize = nextheader(fobj) + if not _accept(sig): + msg = "not an icns file" + raise SyntaxError(msg) + i = HEADERSIZE + while i < filesize: + sig, blocksize = nextheader(fobj) + if blocksize <= 0: + msg = "invalid block header" + raise SyntaxError(msg) + i += HEADERSIZE + blocksize -= HEADERSIZE + self.dct[sig] = (i, blocksize) + fobj.seek(blocksize, io.SEEK_CUR) + i += blocksize + + def itersizes(self) -> list[tuple[int, int, int]]: + sizes = [] + for size, fmts in self.SIZES.items(): + for fmt, reader in fmts: + if fmt in self.dct: + sizes.append(size) + break + return sizes + + def bestsize(self) -> tuple[int, int, int]: + sizes = self.itersizes() + if not sizes: + msg = "No 32bit icon resources found" + raise SyntaxError(msg) + return max(sizes) + + def dataforsize(self, size: tuple[int, int, int]) -> dict[str, Image.Image]: + """ + Get an icon resource as {channel: array}. Note that + the arrays are bottom-up like windows bitmaps and will likely + need to be flipped or transposed in some way. + """ + dct = {} + for code, reader in self.SIZES[size]: + desc = self.dct.get(code) + if desc is not None: + dct.update(reader(self.fobj, desc, size)) + return dct + + def getimage( + self, size: tuple[int, int] | tuple[int, int, int] | None = None + ) -> Image.Image: + if size is None: + size = self.bestsize() + elif len(size) == 2: + size = (size[0], size[1], 1) + channels = self.dataforsize(size) + + im = channels.get("RGBA") + if im: + return im + + im = channels["RGB"].copy() + try: + im.putalpha(channels["A"]) + except KeyError: + pass + return im + + +## +# Image plugin for Mac OS icons. + + +class IcnsImageFile(ImageFile.ImageFile): + """ + PIL image support for Mac OS .icns files. + Chooses the best resolution, but will possibly load + a different size image if you mutate the size attribute + before calling 'load'. + + The info dictionary has a key 'sizes' that is a list + of sizes that the icns file has. + """ + + format = "ICNS" + format_description = "Mac OS icns resource" + + def _open(self) -> None: + assert self.fp is not None + self.icns = IcnsFile(self.fp) + self._mode = "RGBA" + self.info["sizes"] = self.icns.itersizes() + self.best_size = self.icns.bestsize() + self.size = ( + self.best_size[0] * self.best_size[2], + self.best_size[1] * self.best_size[2], + ) + + @property + def size(self) -> tuple[int, int]: + return self._size + + @size.setter + def size(self, value: tuple[int, int]) -> None: + # Check that a matching size exists, + # or that there is a scale that would create a size that matches + for size in self.info["sizes"]: + simple_size = size[0] * size[2], size[1] * size[2] + scale = simple_size[0] // value[0] + if simple_size[1] / value[1] == scale: + self._size = value + return + msg = "This is not one of the allowed sizes of this image" + raise ValueError(msg) + + def load(self, scale: int | None = None) -> Image.core.PixelAccess | None: + if scale is not None: + width, height = self.size[:2] + self.size = width * scale, height * scale + self.best_size = width, height, scale + + px = Image.Image.load(self) + if self._im is not None and self.im.size == self.size: + # Already loaded + return px + self.load_prepare() + # This is likely NOT the best way to do it, but whatever. + im = self.icns.getimage(self.best_size) + + # If this is a PNG or JPEG 2000, it won't be loaded yet + px = im.load() + + self.im = im.im + self._mode = im.mode + self.size = im.size + + return px + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + """ + Saves the image as a series of PNG files, + that are then combined into a .icns file. + """ + if hasattr(fp, "flush"): + fp.flush() + + sizes = { + b"ic07": 128, + b"ic08": 256, + b"ic09": 512, + b"ic10": 1024, + b"ic11": 32, + b"ic12": 64, + b"ic13": 256, + b"ic14": 512, + } + provided_images = {im.width: im for im in im.encoderinfo.get("append_images", [])} + size_streams = {} + for size in set(sizes.values()): + image = ( + provided_images[size] + if size in provided_images + else im.resize((size, size)) + ) + + temp = io.BytesIO() + image.save(temp, "png") + size_streams[size] = temp.getvalue() + + entries = [] + for type, size in sizes.items(): + stream = size_streams[size] + entries.append((type, HEADERSIZE + len(stream), stream)) + + # Header + fp.write(MAGIC) + file_length = HEADERSIZE # Header + file_length += HEADERSIZE + 8 * len(entries) # TOC + file_length += sum(entry[1] for entry in entries) + fp.write(struct.pack(">i", file_length)) + + # TOC + fp.write(b"TOC ") + fp.write(struct.pack(">i", HEADERSIZE + len(entries) * HEADERSIZE)) + for entry in entries: + fp.write(entry[0]) + fp.write(struct.pack(">i", entry[1])) + + # Data + for entry in entries: + fp.write(entry[0]) + fp.write(struct.pack(">i", entry[1])) + fp.write(entry[2]) + + if hasattr(fp, "flush"): + fp.flush() + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(MAGIC) + + +Image.register_open(IcnsImageFile.format, IcnsImageFile, _accept) +Image.register_extension(IcnsImageFile.format, ".icns") + +Image.register_save(IcnsImageFile.format, _save) +Image.register_mime(IcnsImageFile.format, "image/icns") + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Syntax: python3 IcnsImagePlugin.py [file]") + sys.exit() + + with open(sys.argv[1], "rb") as fp: + imf = IcnsImageFile(fp) + for size in imf.info["sizes"]: + width, height, scale = imf.size = size + imf.save(f"out-{width}-{height}-{scale}.png") + with Image.open(sys.argv[1]) as im: + im.save("out.png") + if sys.platform == "windows": + os.startfile("out.png") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IcoImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IcoImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..a04b16d5b0561e9d8c815fde2b78a999d5dc5afe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IcoImagePlugin.py @@ -0,0 +1,396 @@ +# +# The Python Imaging Library. +# $Id$ +# +# Windows Icon support for PIL +# +# History: +# 96-05-27 fl Created +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# + +# This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis +# . +# https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki +# +# Copyright 2008 Bryan Davis +# +# 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 +# +# https://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. + +# Icon format references: +# * https://en.wikipedia.org/wiki/ICO_(file_format) +# * https://msdn.microsoft.com/en-us/library/ms997538.aspx +from __future__ import annotations + +import warnings +from io import BytesIO +from math import ceil, log +from typing import IO, NamedTuple + +from . import BmpImagePlugin, Image, ImageFile, PngImagePlugin +from ._binary import i16le as i16 +from ._binary import i32le as i32 +from ._binary import o8 +from ._binary import o16le as o16 +from ._binary import o32le as o32 + +# +# -------------------------------------------------------------------- + +_MAGIC = b"\0\0\1\0" + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + fp.write(_MAGIC) # (2+2) + bmp = im.encoderinfo.get("bitmap_format") == "bmp" + sizes = im.encoderinfo.get( + "sizes", + [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)], + ) + frames = [] + provided_ims = [im] + im.encoderinfo.get("append_images", []) + width, height = im.size + for size in sorted(set(sizes)): + if size[0] > width or size[1] > height or size[0] > 256 or size[1] > 256: + continue + + for provided_im in provided_ims: + if provided_im.size != size: + continue + frames.append(provided_im) + if bmp: + bits = BmpImagePlugin.SAVE[provided_im.mode][1] + bits_used = [bits] + for other_im in provided_ims: + if other_im.size != size: + continue + bits = BmpImagePlugin.SAVE[other_im.mode][1] + if bits not in bits_used: + # Another image has been supplied for this size + # with a different bit depth + frames.append(other_im) + bits_used.append(bits) + break + else: + # TODO: invent a more convenient method for proportional scalings + frame = provided_im.copy() + frame.thumbnail(size, Image.Resampling.LANCZOS, reducing_gap=None) + frames.append(frame) + fp.write(o16(len(frames))) # idCount(2) + offset = fp.tell() + len(frames) * 16 + for frame in frames: + width, height = frame.size + # 0 means 256 + fp.write(o8(width if width < 256 else 0)) # bWidth(1) + fp.write(o8(height if height < 256 else 0)) # bHeight(1) + + bits, colors = BmpImagePlugin.SAVE[frame.mode][1:] if bmp else (32, 0) + fp.write(o8(colors)) # bColorCount(1) + fp.write(b"\0") # bReserved(1) + fp.write(b"\0\0") # wPlanes(2) + fp.write(o16(bits)) # wBitCount(2) + + image_io = BytesIO() + if bmp: + frame.save(image_io, "dib") + + if bits != 32: + and_mask = Image.new("1", size) + ImageFile._save( + and_mask, + image_io, + [ImageFile._Tile("raw", (0, 0) + size, 0, ("1", 0, -1))], + ) + else: + frame.save(image_io, "png") + image_io.seek(0) + image_bytes = image_io.read() + if bmp: + image_bytes = image_bytes[:8] + o32(height * 2) + image_bytes[12:] + bytes_len = len(image_bytes) + fp.write(o32(bytes_len)) # dwBytesInRes(4) + fp.write(o32(offset)) # dwImageOffset(4) + current = fp.tell() + fp.seek(offset) + fp.write(image_bytes) + offset = offset + bytes_len + fp.seek(current) + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(_MAGIC) + + +class IconHeader(NamedTuple): + width: int + height: int + nb_color: int + reserved: int + planes: int + bpp: int + size: int + offset: int + dim: tuple[int, int] + square: int + color_depth: int + + +class IcoFile: + def __init__(self, buf: IO[bytes]) -> None: + """ + Parse image from file-like object containing ico file data + """ + + # check magic + s = buf.read(6) + if not _accept(s): + msg = "not an ICO file" + raise SyntaxError(msg) + + self.buf = buf + self.entry = [] + + # Number of items in file + self.nb_items = i16(s, 4) + + # Get headers for each item + for i in range(self.nb_items): + s = buf.read(16) + + # See Wikipedia + width = s[0] or 256 + height = s[1] or 256 + + # No. of colors in image (0 if >=8bpp) + nb_color = s[2] + bpp = i16(s, 6) + icon_header = IconHeader( + width=width, + height=height, + nb_color=nb_color, + reserved=s[3], + planes=i16(s, 4), + bpp=i16(s, 6), + size=i32(s, 8), + offset=i32(s, 12), + dim=(width, height), + square=width * height, + # See Wikipedia notes about color depth. + # We need this just to differ images with equal sizes + color_depth=bpp or (nb_color != 0 and ceil(log(nb_color, 2))) or 256, + ) + + self.entry.append(icon_header) + + self.entry = sorted(self.entry, key=lambda x: x.color_depth) + # ICO images are usually squares + self.entry = sorted(self.entry, key=lambda x: x.square, reverse=True) + + def sizes(self) -> set[tuple[int, int]]: + """ + Get a set of all available icon sizes and color depths. + """ + return {(h.width, h.height) for h in self.entry} + + def getentryindex(self, size: tuple[int, int], bpp: int | bool = False) -> int: + for i, h in enumerate(self.entry): + if size == h.dim and (bpp is False or bpp == h.color_depth): + return i + return 0 + + def getimage(self, size: tuple[int, int], bpp: int | bool = False) -> Image.Image: + """ + Get an image from the icon + """ + return self.frame(self.getentryindex(size, bpp)) + + def frame(self, idx: int) -> Image.Image: + """ + Get an image from frame idx + """ + + header = self.entry[idx] + + self.buf.seek(header.offset) + data = self.buf.read(8) + self.buf.seek(header.offset) + + im: Image.Image + if data[:8] == PngImagePlugin._MAGIC: + # png frame + im = PngImagePlugin.PngImageFile(self.buf) + Image._decompression_bomb_check(im.size) + else: + # XOR + AND mask bmp frame + im = BmpImagePlugin.DibImageFile(self.buf) + Image._decompression_bomb_check(im.size) + + # change tile dimension to only encompass XOR image + im._size = (im.size[0], int(im.size[1] / 2)) + d, e, o, a = im.tile[0] + im.tile[0] = ImageFile._Tile(d, (0, 0) + im.size, o, a) + + # figure out where AND mask image starts + if header.bpp == 32: + # 32-bit color depth icon image allows semitransparent areas + # PIL's DIB format ignores transparency bits, recover them. + # The DIB is packed in BGRX byte order where X is the alpha + # channel. + + # Back up to start of bmp data + self.buf.seek(o) + # extract every 4th byte (eg. 3,7,11,15,...) + alpha_bytes = self.buf.read(im.size[0] * im.size[1] * 4)[3::4] + + # convert to an 8bpp grayscale image + try: + mask = Image.frombuffer( + "L", # 8bpp + im.size, # (w, h) + alpha_bytes, # source chars + "raw", # raw decoder + ("L", 0, -1), # 8bpp inverted, unpadded, reversed + ) + except ValueError: + if ImageFile.LOAD_TRUNCATED_IMAGES: + mask = None + else: + raise + else: + # get AND image from end of bitmap + w = im.size[0] + if (w % 32) > 0: + # bitmap row data is aligned to word boundaries + w += 32 - (im.size[0] % 32) + + # the total mask data is + # padded row size * height / bits per char + + total_bytes = int((w * im.size[1]) / 8) + and_mask_offset = header.offset + header.size - total_bytes + + self.buf.seek(and_mask_offset) + mask_data = self.buf.read(total_bytes) + + # convert raw data to image + try: + mask = Image.frombuffer( + "1", # 1 bpp + im.size, # (w, h) + mask_data, # source chars + "raw", # raw decoder + ("1;I", int(w / 8), -1), # 1bpp inverted, padded, reversed + ) + except ValueError: + if ImageFile.LOAD_TRUNCATED_IMAGES: + mask = None + else: + raise + + # now we have two images, im is XOR image and mask is AND image + + # apply mask image as alpha channel + if mask: + im = im.convert("RGBA") + im.putalpha(mask) + + return im + + +## +# Image plugin for Windows Icon files. + + +class IcoImageFile(ImageFile.ImageFile): + """ + PIL read-only image support for Microsoft Windows .ico files. + + By default the largest resolution image in the file will be loaded. This + can be changed by altering the 'size' attribute before calling 'load'. + + The info dictionary has a key 'sizes' that is a list of the sizes available + in the icon file. + + Handles classic, XP and Vista icon formats. + + When saving, PNG compression is used. Support for this was only added in + Windows Vista. If you are unable to view the icon in Windows, convert the + image to "RGBA" mode before saving. + + This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis + . + https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki + """ + + format = "ICO" + format_description = "Windows Icon" + + def _open(self) -> None: + assert self.fp is not None + self.ico = IcoFile(self.fp) + self.info["sizes"] = self.ico.sizes() + self.size = self.ico.entry[0].dim + self.load() + + @property + def size(self) -> tuple[int, int]: + return self._size + + @size.setter + def size(self, value: tuple[int, int]) -> None: + if value not in self.info["sizes"]: + msg = "This is not one of the allowed sizes of this image" + raise ValueError(msg) + self._size = value + + def load(self) -> Image.core.PixelAccess | None: + if self._im is not None and self.im.size == self.size: + # Already loaded + return Image.Image.load(self) + im = self.ico.getimage(self.size) + # if tile is PNG, it won't really be loaded yet + im.load() + self.im = im.im + self._mode = im.mode + if im.palette: + self.palette = im.palette + if im.size != self.size: + warnings.warn("Image was not the expected size") + + index = self.ico.getentryindex(self.size) + sizes = list(self.info["sizes"]) + sizes[index] = im.size + self.info["sizes"] = set(sizes) + + self.size = im.size + return Image.Image.load(self) + + def load_seek(self, pos: int) -> None: + # Flag the ImageFile.Parser so that it + # just does all the decode at the end. + pass + + +# +# -------------------------------------------------------------------- + + +Image.register_open(IcoImageFile.format, IcoImageFile, _accept) +Image.register_save(IcoImageFile.format, _save) +Image.register_extension(IcoImageFile.format, ".ico") + +Image.register_mime(IcoImageFile.format, "image/x-icon") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..4bfff0b5dc57a589ab958dcb6b219df9b55bce49 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImImagePlugin.py @@ -0,0 +1,390 @@ +# +# The Python Imaging Library. +# $Id$ +# +# IFUNC IM file handling for PIL +# +# history: +# 1995-09-01 fl Created. +# 1997-01-03 fl Save palette images +# 1997-01-08 fl Added sequence support +# 1997-01-23 fl Added P and RGB save support +# 1997-05-31 fl Read floating point images +# 1997-06-22 fl Save floating point images +# 1997-08-27 fl Read and save 1-bit images +# 1998-06-25 fl Added support for RGB+LUT images +# 1998-07-02 fl Added support for YCC images +# 1998-07-15 fl Renamed offset attribute to avoid name clash +# 1998-12-29 fl Added I;16 support +# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7) +# 2003-09-26 fl Added LA/PA support +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1995-2001 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +import re +from typing import IO, Any + +from . import Image, ImageFile, ImagePalette +from ._util import DeferredError + +# -------------------------------------------------------------------- +# Standard tags + +COMMENT = "Comment" +DATE = "Date" +EQUIPMENT = "Digitalization equipment" +FRAMES = "File size (no of images)" +LUT = "Lut" +NAME = "Name" +SCALE = "Scale (x,y)" +SIZE = "Image size (x*y)" +MODE = "Image type" + +TAGS = { + COMMENT: 0, + DATE: 0, + EQUIPMENT: 0, + FRAMES: 0, + LUT: 0, + NAME: 0, + SCALE: 0, + SIZE: 0, + MODE: 0, +} + +OPEN = { + # ifunc93/p3cfunc formats + "0 1 image": ("1", "1"), + "L 1 image": ("1", "1"), + "Greyscale image": ("L", "L"), + "Grayscale image": ("L", "L"), + "RGB image": ("RGB", "RGB;L"), + "RLB image": ("RGB", "RLB"), + "RYB image": ("RGB", "RLB"), + "B1 image": ("1", "1"), + "B2 image": ("P", "P;2"), + "B4 image": ("P", "P;4"), + "X 24 image": ("RGB", "RGB"), + "L 32 S image": ("I", "I;32"), + "L 32 F image": ("F", "F;32"), + # old p3cfunc formats + "RGB3 image": ("RGB", "RGB;T"), + "RYB3 image": ("RGB", "RYB;T"), + # extensions + "LA image": ("LA", "LA;L"), + "PA image": ("LA", "PA;L"), + "RGBA image": ("RGBA", "RGBA;L"), + "RGBX image": ("RGB", "RGBX;L"), + "CMYK image": ("CMYK", "CMYK;L"), + "YCC image": ("YCbCr", "YCbCr;L"), +} + +# ifunc95 extensions +for i in ["8", "8S", "16", "16S", "32", "32F"]: + OPEN[f"L {i} image"] = ("F", f"F;{i}") + OPEN[f"L*{i} image"] = ("F", f"F;{i}") +for i in ["16", "16L", "16B"]: + OPEN[f"L {i} image"] = (f"I;{i}", f"I;{i}") + OPEN[f"L*{i} image"] = (f"I;{i}", f"I;{i}") +for i in ["32S"]: + OPEN[f"L {i} image"] = ("I", f"I;{i}") + OPEN[f"L*{i} image"] = ("I", f"I;{i}") +for j in range(2, 33): + OPEN[f"L*{j} image"] = ("F", f"F;{j}") + + +# -------------------------------------------------------------------- +# Read IM directory + +split = re.compile(rb"^([A-Za-z][^:]*):[ \t]*(.*)[ \t]*$") + + +def number(s: Any) -> float: + try: + return int(s) + except ValueError: + return float(s) + + +## +# Image plugin for the IFUNC IM file format. + + +class ImImageFile(ImageFile.ImageFile): + format = "IM" + format_description = "IFUNC Image Memory" + _close_exclusive_fp_after_loading = False + + def _open(self) -> None: + # Quick rejection: if there's not an LF among the first + # 100 bytes, this is (probably) not a text header. + + assert self.fp is not None + if b"\n" not in self.fp.read(100): + msg = "not an IM file" + raise SyntaxError(msg) + self.fp.seek(0) + + n = 0 + + # Default values + self.info[MODE] = "L" + self.info[SIZE] = (512, 512) + self.info[FRAMES] = 1 + + self.rawmode = "L" + + while True: + s = self.fp.read(1) + + # Some versions of IFUNC uses \n\r instead of \r\n... + if s == b"\r": + continue + + if not s or s == b"\0" or s == b"\x1a": + break + + # FIXME: this may read whole file if not a text file + s = s + self.fp.readline() + + if len(s) > 100: + msg = "not an IM file" + raise SyntaxError(msg) + + if s.endswith(b"\r\n"): + s = s[:-2] + elif s.endswith(b"\n"): + s = s[:-1] + + try: + m = split.match(s) + except re.error as e: + msg = "not an IM file" + raise SyntaxError(msg) from e + + if m: + k, v = m.group(1, 2) + + # Don't know if this is the correct encoding, + # but a decent guess (I guess) + k = k.decode("latin-1", "replace") + v = v.decode("latin-1", "replace") + + # Convert value as appropriate + if k in [FRAMES, SCALE, SIZE]: + v = v.replace("*", ",") + v = tuple(map(number, v.split(","))) + if len(v) == 1: + v = v[0] + elif k == MODE and v in OPEN: + v, self.rawmode = OPEN[v] + + # Add to dictionary. Note that COMMENT tags are + # combined into a list of strings. + if k == COMMENT: + if k in self.info: + self.info[k].append(v) + else: + self.info[k] = [v] + else: + self.info[k] = v + + if k in TAGS: + n += 1 + + else: + msg = f"Syntax error in IM header: {s.decode('ascii', 'replace')}" + raise SyntaxError(msg) + + if not n: + msg = "Not an IM file" + raise SyntaxError(msg) + + # Basic attributes + self._size = self.info[SIZE] + self._mode = self.info[MODE] + + # Skip forward to start of image data + while s and not s.startswith(b"\x1a"): + s = self.fp.read(1) + if not s: + msg = "File truncated" + raise SyntaxError(msg) + + if LUT in self.info: + # convert lookup table to palette or lut attribute + palette = self.fp.read(768) + greyscale = 1 # greyscale palette + linear = 1 # linear greyscale palette + for i in range(256): + if palette[i] == palette[i + 256] == palette[i + 512]: + if palette[i] != i: + linear = 0 + else: + greyscale = 0 + if self.mode in ["L", "LA", "P", "PA"]: + if greyscale: + if not linear: + self.lut = list(palette[:256]) + else: + if self.mode in ["L", "P"]: + self._mode = self.rawmode = "P" + elif self.mode in ["LA", "PA"]: + self._mode = "PA" + self.rawmode = "PA;L" + self.palette = ImagePalette.raw("RGB;L", palette) + elif self.mode == "RGB": + if not greyscale or not linear: + self.lut = list(palette) + + self.frame = 0 + + self.__offset = offs = self.fp.tell() + + self._fp = self.fp # FIXME: hack + + if self.rawmode.startswith("F;"): + # ifunc95 formats + try: + # use bit decoder (if necessary) + bits = int(self.rawmode[2:]) + if bits not in [8, 16, 32]: + self.tile = [ + ImageFile._Tile( + "bit", (0, 0) + self.size, offs, (bits, 8, 3, 0, -1) + ) + ] + return + except ValueError: + pass + + if self.rawmode in ["RGB;T", "RYB;T"]: + # Old LabEye/3PC files. Would be very surprised if anyone + # ever stumbled upon such a file ;-) + size = self.size[0] * self.size[1] + self.tile = [ + ImageFile._Tile("raw", (0, 0) + self.size, offs, ("G", 0, -1)), + ImageFile._Tile("raw", (0, 0) + self.size, offs + size, ("R", 0, -1)), + ImageFile._Tile( + "raw", (0, 0) + self.size, offs + 2 * size, ("B", 0, -1) + ), + ] + else: + # LabEye/IFUNC files + self.tile = [ + ImageFile._Tile("raw", (0, 0) + self.size, offs, (self.rawmode, 0, -1)) + ] + + @property + def n_frames(self) -> int: + return self.info[FRAMES] + + @property + def is_animated(self) -> bool: + return self.info[FRAMES] > 1 + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + if isinstance(self._fp, DeferredError): + raise self._fp.ex + + self.frame = frame + + if self.mode == "1": + bits = 1 + else: + bits = 8 * len(self.mode) + + size = ((self.size[0] * bits + 7) // 8) * self.size[1] + offs = self.__offset + frame * size + + self.fp = self._fp + + self.tile = [ + ImageFile._Tile("raw", (0, 0) + self.size, offs, (self.rawmode, 0, -1)) + ] + + def tell(self) -> int: + return self.frame + + +# +# -------------------------------------------------------------------- +# Save IM files + + +SAVE = { + # mode: (im type, raw mode) + "1": ("0 1", "1"), + "L": ("Greyscale", "L"), + "LA": ("LA", "LA;L"), + "P": ("Greyscale", "P"), + "PA": ("LA", "PA;L"), + "I": ("L 32S", "I;32S"), + "I;16": ("L 16", "I;16"), + "I;16L": ("L 16L", "I;16L"), + "I;16B": ("L 16B", "I;16B"), + "F": ("L 32F", "F;32F"), + "RGB": ("RGB", "RGB;L"), + "RGBA": ("RGBA", "RGBA;L"), + "RGBX": ("RGBX", "RGBX;L"), + "CMYK": ("CMYK", "CMYK;L"), + "YCbCr": ("YCC", "YCbCr;L"), +} + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + try: + image_type, rawmode = SAVE[im.mode] + except KeyError as e: + msg = f"Cannot save {im.mode} images as IM" + raise ValueError(msg) from e + + frames = im.encoderinfo.get("frames", 1) + + fp.write(f"Image type: {image_type} image\r\n".encode("ascii")) + if filename: + # Each line must be 100 characters or less, + # or: SyntaxError("not an IM file") + # 8 characters are used for "Name: " and "\r\n" + # Keep just the filename, ditch the potentially overlong path + if isinstance(filename, bytes): + filename = filename.decode("ascii") + name, ext = os.path.splitext(os.path.basename(filename)) + name = "".join([name[: 92 - len(ext)], ext]) + + fp.write(f"Name: {name}\r\n".encode("ascii")) + fp.write(f"Image size (x*y): {im.size[0]}*{im.size[1]}\r\n".encode("ascii")) + fp.write(f"File size (no of images): {frames}\r\n".encode("ascii")) + if im.mode in ["P", "PA"]: + fp.write(b"Lut: 1\r\n") + fp.write(b"\000" * (511 - fp.tell()) + b"\032") + if im.mode in ["P", "PA"]: + im_palette = im.im.getpalette("RGB", "RGB;L") + colors = len(im_palette) // 3 + palette = b"" + for i in range(3): + palette += im_palette[colors * i : colors * (i + 1)] + palette += b"\x00" * (256 - colors) + fp.write(palette) # 768 bytes + ImageFile._save( + im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, 0, -1))] + ) + + +# +# -------------------------------------------------------------------- +# Registry + + +Image.register_open(ImImageFile.format, ImImageFile) +Image.register_save(ImImageFile.format, _save) + +Image.register_extension(ImImageFile.format, ".im") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Image.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Image.py new file mode 100644 index 0000000000000000000000000000000000000000..b261c469e773240055d7651d3ff6c1679654c95c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Image.py @@ -0,0 +1,4381 @@ +# +# The Python Imaging Library. +# $Id$ +# +# the Image class wrapper +# +# partial release history: +# 1995-09-09 fl Created +# 1996-03-11 fl PIL release 0.0 (proof of concept) +# 1996-04-30 fl PIL release 0.1b1 +# 1999-07-28 fl PIL release 1.0 final +# 2000-06-07 fl PIL release 1.1 +# 2000-10-20 fl PIL release 1.1.1 +# 2001-05-07 fl PIL release 1.1.2 +# 2002-03-15 fl PIL release 1.1.3 +# 2003-05-10 fl PIL release 1.1.4 +# 2005-03-28 fl PIL release 1.1.5 +# 2006-12-02 fl PIL release 1.1.6 +# 2009-11-15 fl PIL release 1.1.7 +# +# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved. +# Copyright (c) 1995-2009 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# + +from __future__ import annotations + +import abc +import atexit +import builtins +import io +import logging +import math +import os +import re +import struct +import sys +import tempfile +import warnings +from collections.abc import MutableMapping +from enum import IntEnum +from typing import IO, Protocol, cast + +# VERSION was removed in Pillow 6.0.0. +# PILLOW_VERSION was removed in Pillow 9.0.0. +# Use __version__ instead. +from . import ( + ExifTags, + ImageMode, + TiffTags, + UnidentifiedImageError, + __version__, + _plugins, +) +from ._binary import i32le, o32be, o32le +from ._deprecate import deprecate +from ._util import DeferredError, is_path + +ElementTree: ModuleType | None +try: + from defusedxml import ElementTree +except ImportError: + ElementTree = None + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable, Iterator, Sequence + from types import ModuleType + from typing import Any, Literal + +logger = logging.getLogger(__name__) + + +class DecompressionBombWarning(RuntimeWarning): + pass + + +class DecompressionBombError(Exception): + pass + + +WARN_POSSIBLE_FORMATS: bool = False + +# Limit to around a quarter gigabyte for a 24-bit (3 bpp) image +MAX_IMAGE_PIXELS: int | None = int(1024 * 1024 * 1024 // 4 // 3) + + +try: + # If the _imaging C module is not present, Pillow will not load. + # Note that other modules should not refer to _imaging directly; + # import Image and use the Image.core variable instead. + # Also note that Image.core is not a publicly documented interface, + # and should be considered private and subject to change. + from . import _imaging as core + + if __version__ != getattr(core, "PILLOW_VERSION", None): + msg = ( + "The _imaging extension was built for another version of Pillow or PIL:\n" + f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n" + f"Pillow version: {__version__}" + ) + raise ImportError(msg) + +except ImportError as v: + # Explanations for ways that we know we might have an import error + if str(v).startswith("Module use of python"): + # The _imaging C module is present, but not compiled for + # the right version (windows only). Print a warning, if + # possible. + warnings.warn( + "The _imaging extension was built for another version of Python.", + RuntimeWarning, + ) + elif str(v).startswith("The _imaging extension"): + warnings.warn(str(v), RuntimeWarning) + # Fail here anyway. Don't let people run with a mostly broken Pillow. + # see docs/porting.rst + raise + + +# +# Constants + + +# transpose +class Transpose(IntEnum): + FLIP_LEFT_RIGHT = 0 + FLIP_TOP_BOTTOM = 1 + ROTATE_90 = 2 + ROTATE_180 = 3 + ROTATE_270 = 4 + TRANSPOSE = 5 + TRANSVERSE = 6 + + +# transforms (also defined in Imaging.h) +class Transform(IntEnum): + AFFINE = 0 + EXTENT = 1 + PERSPECTIVE = 2 + QUAD = 3 + MESH = 4 + + +# resampling filters (also defined in Imaging.h) +class Resampling(IntEnum): + NEAREST = 0 + BOX = 4 + BILINEAR = 2 + HAMMING = 5 + BICUBIC = 3 + LANCZOS = 1 + + +_filters_support = { + Resampling.BOX: 0.5, + Resampling.BILINEAR: 1.0, + Resampling.HAMMING: 1.0, + Resampling.BICUBIC: 2.0, + Resampling.LANCZOS: 3.0, +} + + +# dithers +class Dither(IntEnum): + NONE = 0 + ORDERED = 1 # Not yet implemented + RASTERIZE = 2 # Not yet implemented + FLOYDSTEINBERG = 3 # default + + +# palettes/quantizers +class Palette(IntEnum): + WEB = 0 + ADAPTIVE = 1 + + +class Quantize(IntEnum): + MEDIANCUT = 0 + MAXCOVERAGE = 1 + FASTOCTREE = 2 + LIBIMAGEQUANT = 3 + + +module = sys.modules[__name__] +for enum in (Transpose, Transform, Resampling, Dither, Palette, Quantize): + for item in enum: + setattr(module, item.name, item.value) + + +if hasattr(core, "DEFAULT_STRATEGY"): + DEFAULT_STRATEGY = core.DEFAULT_STRATEGY + FILTERED = core.FILTERED + HUFFMAN_ONLY = core.HUFFMAN_ONLY + RLE = core.RLE + FIXED = core.FIXED + + +# -------------------------------------------------------------------- +# Registries + +TYPE_CHECKING = False +if TYPE_CHECKING: + import mmap + from xml.etree.ElementTree import Element + + from IPython.lib.pretty import PrettyPrinter + + from . import ImageFile, ImageFilter, ImagePalette, ImageQt, TiffImagePlugin + from ._typing import CapsuleType, NumpyArray, StrOrBytesPath +ID: list[str] = [] +OPEN: dict[ + str, + tuple[ + Callable[[IO[bytes], str | bytes], ImageFile.ImageFile], + Callable[[bytes], bool | str] | None, + ], +] = {} +MIME: dict[str, str] = {} +SAVE: dict[str, Callable[[Image, IO[bytes], str | bytes], None]] = {} +SAVE_ALL: dict[str, Callable[[Image, IO[bytes], str | bytes], None]] = {} +EXTENSION: dict[str, str] = {} +DECODERS: dict[str, type[ImageFile.PyDecoder]] = {} +ENCODERS: dict[str, type[ImageFile.PyEncoder]] = {} + +# -------------------------------------------------------------------- +# Modes + +_ENDIAN = "<" if sys.byteorder == "little" else ">" + + +def _conv_type_shape(im: Image) -> tuple[tuple[int, ...], str]: + m = ImageMode.getmode(im.mode) + shape: tuple[int, ...] = (im.height, im.width) + extra = len(m.bands) + if extra != 1: + shape += (extra,) + return shape, m.typestr + + +MODES = [ + "1", + "CMYK", + "F", + "HSV", + "I", + "I;16", + "I;16B", + "I;16L", + "I;16N", + "L", + "LA", + "La", + "LAB", + "P", + "PA", + "RGB", + "RGBA", + "RGBa", + "RGBX", + "YCbCr", +] + +# raw modes that may be memory mapped. NOTE: if you change this, you +# may have to modify the stride calculation in map.c too! +_MAPMODES = ("L", "P", "RGBX", "RGBA", "CMYK", "I;16", "I;16L", "I;16B") + + +def getmodebase(mode: str) -> str: + """ + Gets the "base" mode for given mode. This function returns "L" for + images that contain grayscale data, and "RGB" for images that + contain color data. + + :param mode: Input mode. + :returns: "L" or "RGB". + :exception KeyError: If the input mode was not a standard mode. + """ + return ImageMode.getmode(mode).basemode + + +def getmodetype(mode: str) -> str: + """ + Gets the storage type mode. Given a mode, this function returns a + single-layer mode suitable for storing individual bands. + + :param mode: Input mode. + :returns: "L", "I", or "F". + :exception KeyError: If the input mode was not a standard mode. + """ + return ImageMode.getmode(mode).basetype + + +def getmodebandnames(mode: str) -> tuple[str, ...]: + """ + Gets a list of individual band names. Given a mode, this function returns + a tuple containing the names of individual bands (use + :py:method:`~PIL.Image.getmodetype` to get the mode used to store each + individual band. + + :param mode: Input mode. + :returns: A tuple containing band names. The length of the tuple + gives the number of bands in an image of the given mode. + :exception KeyError: If the input mode was not a standard mode. + """ + return ImageMode.getmode(mode).bands + + +def getmodebands(mode: str) -> int: + """ + Gets the number of individual bands for this mode. + + :param mode: Input mode. + :returns: The number of bands in this mode. + :exception KeyError: If the input mode was not a standard mode. + """ + return len(ImageMode.getmode(mode).bands) + + +# -------------------------------------------------------------------- +# Helpers + +_initialized = 0 + +# Mapping from file extension to plugin module name for lazy importing +_EXTENSION_PLUGIN: dict[str, str] = { + # Common formats (preinit) + ".bmp": "BmpImagePlugin", + ".dib": "BmpImagePlugin", + ".gif": "GifImagePlugin", + ".jfif": "JpegImagePlugin", + ".jpe": "JpegImagePlugin", + ".jpg": "JpegImagePlugin", + ".jpeg": "JpegImagePlugin", + ".pbm": "PpmImagePlugin", + ".pgm": "PpmImagePlugin", + ".pnm": "PpmImagePlugin", + ".ppm": "PpmImagePlugin", + ".pfm": "PpmImagePlugin", + ".png": "PngImagePlugin", + ".apng": "PngImagePlugin", + # Less common formats (init) + ".avif": "AvifImagePlugin", + ".avifs": "AvifImagePlugin", + ".blp": "BlpImagePlugin", + ".bufr": "BufrStubImagePlugin", + ".cur": "CurImagePlugin", + ".dcx": "DcxImagePlugin", + ".dds": "DdsImagePlugin", + ".ps": "EpsImagePlugin", + ".eps": "EpsImagePlugin", + ".fit": "FitsImagePlugin", + ".fits": "FitsImagePlugin", + ".fli": "FliImagePlugin", + ".flc": "FliImagePlugin", + ".fpx": "FpxImagePlugin", + ".ftc": "FtexImagePlugin", + ".ftu": "FtexImagePlugin", + ".gbr": "GbrImagePlugin", + ".grib": "GribStubImagePlugin", + ".h5": "Hdf5StubImagePlugin", + ".hdf": "Hdf5StubImagePlugin", + ".icns": "IcnsImagePlugin", + ".ico": "IcoImagePlugin", + ".im": "ImImagePlugin", + ".iim": "IptcImagePlugin", + ".jp2": "Jpeg2KImagePlugin", + ".j2k": "Jpeg2KImagePlugin", + ".jpc": "Jpeg2KImagePlugin", + ".jpf": "Jpeg2KImagePlugin", + ".jpx": "Jpeg2KImagePlugin", + ".j2c": "Jpeg2KImagePlugin", + ".mic": "MicImagePlugin", + ".mpg": "MpegImagePlugin", + ".mpeg": "MpegImagePlugin", + ".mpo": "MpoImagePlugin", + ".msp": "MspImagePlugin", + ".palm": "PalmImagePlugin", + ".pcd": "PcdImagePlugin", + ".pcx": "PcxImagePlugin", + ".pdf": "PdfImagePlugin", + ".pxr": "PixarImagePlugin", + ".psd": "PsdImagePlugin", + ".qoi": "QoiImagePlugin", + ".bw": "SgiImagePlugin", + ".rgb": "SgiImagePlugin", + ".rgba": "SgiImagePlugin", + ".sgi": "SgiImagePlugin", + ".ras": "SunImagePlugin", + ".tga": "TgaImagePlugin", + ".icb": "TgaImagePlugin", + ".vda": "TgaImagePlugin", + ".vst": "TgaImagePlugin", + ".tif": "TiffImagePlugin", + ".tiff": "TiffImagePlugin", + ".webp": "WebPImagePlugin", + ".wmf": "WmfImagePlugin", + ".emf": "WmfImagePlugin", + ".xbm": "XbmImagePlugin", + ".xpm": "XpmImagePlugin", +} + + +def _import_plugin_for_extension(ext: str | bytes) -> bool: + """Import only the plugin needed for a specific file extension.""" + if not ext: + return False + + if isinstance(ext, bytes): + ext = ext.decode() + ext = ext.lower() + if ext in EXTENSION: + return True + + plugin = _EXTENSION_PLUGIN.get(ext) + if plugin is None: + return False + + try: + logger.debug("Importing %s", plugin) + __import__(f"{__spec__.parent}.{plugin}", globals(), locals(), []) + return True + except ImportError as e: + logger.debug("Image: failed to import %s: %s", plugin, e) + return False + + +def preinit() -> None: + """ + Explicitly loads BMP, GIF, JPEG, PPM and PNG file format drivers. + + It is called when opening or saving images. + """ + + global _initialized + if _initialized >= 1: + return + + try: + from . import BmpImagePlugin + + assert BmpImagePlugin + except ImportError: + pass + try: + from . import GifImagePlugin + + assert GifImagePlugin + except ImportError: + pass + try: + from . import JpegImagePlugin + + assert JpegImagePlugin + except ImportError: + pass + try: + from . import PpmImagePlugin + + assert PpmImagePlugin + except ImportError: + pass + try: + from . import PngImagePlugin + + assert PngImagePlugin + except ImportError: + pass + + _initialized = 1 + + +def init() -> bool: + """ + Explicitly initializes the Python Imaging Library. This function + loads all available file format drivers. + + It is called when opening or saving images if :py:meth:`~preinit()` is + insufficient, and by :py:meth:`~PIL.features.pilinfo`. + """ + + global _initialized + if _initialized >= 2: + return False + + for plugin in _plugins: + try: + logger.debug("Importing %s", plugin) + __import__(f"{__spec__.parent}.{plugin}", globals(), locals(), []) + except ImportError as e: # noqa: PERF203 + logger.debug("Image: failed to import %s: %s", plugin, e) + + if OPEN or SAVE: + _initialized = 2 + return True + return False + + +# -------------------------------------------------------------------- +# Codec factories (used by tobytes/frombytes and ImageFile.load) + + +def _getdecoder( + mode: str, decoder_name: str, args: Any, extra: tuple[Any, ...] = () +) -> core.ImagingDecoder | ImageFile.PyDecoder: + # tweak arguments + if args is None: + args = () + elif not isinstance(args, tuple): + args = (args,) + + try: + decoder = DECODERS[decoder_name] + except KeyError: + pass + else: + return decoder(mode, *args + extra) + + try: + # get decoder + decoder = getattr(core, f"{decoder_name}_decoder") + except AttributeError as e: + msg = f"decoder {decoder_name} not available" + raise OSError(msg) from e + return decoder(mode, *args + extra) + + +def _getencoder( + mode: str, encoder_name: str, args: Any, extra: tuple[Any, ...] = () +) -> core.ImagingEncoder | ImageFile.PyEncoder: + # tweak arguments + if args is None: + args = () + elif not isinstance(args, tuple): + args = (args,) + + try: + encoder = ENCODERS[encoder_name] + except KeyError: + pass + else: + return encoder(mode, *args + extra) + + try: + # get encoder + encoder = getattr(core, f"{encoder_name}_encoder") + except AttributeError as e: + msg = f"encoder {encoder_name} not available" + raise OSError(msg) from e + return encoder(mode, *args + extra) + + +# -------------------------------------------------------------------- +# Simple expression analyzer + + +class ImagePointTransform: + """ + Used with :py:meth:`~PIL.Image.Image.point` for single band images with more than + 8 bits, this represents an affine transformation, where the value is multiplied by + ``scale`` and ``offset`` is added. + """ + + def __init__(self, scale: float, offset: float) -> None: + self.scale = scale + self.offset = offset + + def __neg__(self) -> ImagePointTransform: + return ImagePointTransform(-self.scale, -self.offset) + + def __add__(self, other: ImagePointTransform | float) -> ImagePointTransform: + if isinstance(other, ImagePointTransform): + return ImagePointTransform( + self.scale + other.scale, self.offset + other.offset + ) + return ImagePointTransform(self.scale, self.offset + other) + + __radd__ = __add__ + + def __sub__(self, other: ImagePointTransform | float) -> ImagePointTransform: + return self + -other + + def __rsub__(self, other: ImagePointTransform | float) -> ImagePointTransform: + return other + -self + + def __mul__(self, other: ImagePointTransform | float) -> ImagePointTransform: + if isinstance(other, ImagePointTransform): + return NotImplemented + return ImagePointTransform(self.scale * other, self.offset * other) + + __rmul__ = __mul__ + + def __truediv__(self, other: ImagePointTransform | float) -> ImagePointTransform: + if isinstance(other, ImagePointTransform): + return NotImplemented + return ImagePointTransform(self.scale / other, self.offset / other) + + +def _getscaleoffset( + expr: Callable[[ImagePointTransform], ImagePointTransform | float], +) -> tuple[float, float]: + a = expr(ImagePointTransform(1, 0)) + return (a.scale, a.offset) if isinstance(a, ImagePointTransform) else (0, a) + + +# -------------------------------------------------------------------- +# Implementation wrapper + + +class SupportsGetData(Protocol): + def getdata( + self, + ) -> tuple[Transform, Sequence[int]]: ... + + +class Image: + """ + This class represents an image object. To create + :py:class:`~PIL.Image.Image` objects, use the appropriate factory + functions. There's hardly ever any reason to call the Image constructor + directly. + + * :py:func:`~PIL.Image.open` + * :py:func:`~PIL.Image.new` + * :py:func:`~PIL.Image.frombytes` + """ + + format: str | None = None + format_description: str | None = None + _close_exclusive_fp_after_loading = True + + def __init__(self) -> None: + # FIXME: take "new" parameters / other image? + self._im: core.ImagingCore | DeferredError | None = None + self._mode = "" + self._size = (0, 0) + self.palette: ImagePalette.ImagePalette | None = None + self.info: dict[str | tuple[int, int], Any] = {} + self.readonly = 0 + self._exif: Exif | None = None + + @property + def im(self) -> core.ImagingCore: + if isinstance(self._im, DeferredError): + raise self._im.ex + assert self._im is not None + return self._im + + @im.setter + def im(self, im: core.ImagingCore) -> None: + self._im = im + + @property + def width(self) -> int: + return self.size[0] + + @property + def height(self) -> int: + return self.size[1] + + @property + def size(self) -> tuple[int, int]: + return self._size + + @property + def mode(self) -> str: + return self._mode + + @property + def readonly(self) -> int: + return (self._im and self._im.readonly) or self._readonly + + @readonly.setter + def readonly(self, readonly: int) -> None: + self._readonly = readonly + + def _new(self, im: core.ImagingCore) -> Image: + new = Image() + new.im = im + new._mode = im.mode + new._size = im.size + if im.mode in ("P", "PA"): + if self.palette: + new.palette = self.palette.copy() + else: + from . import ImagePalette + + new.palette = ImagePalette.ImagePalette() + new.info = self.info.copy() + return new + + # Context manager support + def __enter__(self) -> Image: + return self + + def __exit__(self, *args: object) -> None: + pass + + def close(self) -> None: + """ + This operation will destroy the image core and release its memory. + The image data will be unusable afterward. + + This function is required to close images that have multiple frames or + have not had their file read and closed by the + :py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for + more information. + """ + if getattr(self, "map", None): + if sys.platform == "win32" and hasattr(sys, "pypy_version_info"): + self.map.close() + self.map: mmap.mmap | None = None + + # Instead of simply setting to None, we're setting up a + # deferred error that will better explain that the core image + # object is gone. + self._im = DeferredError(ValueError("Operation on closed image")) + + def _copy(self) -> None: + self.load() + self.im = self.im.copy() + self.readonly = 0 + + def _ensure_mutable(self) -> None: + if self.readonly: + self._copy() + else: + self.load() + + def _dump( + self, file: str | None = None, format: str | None = None, **options: Any + ) -> str: + suffix = "" + if format: + suffix = f".{format}" + + if not file: + f, filename = tempfile.mkstemp(suffix) + os.close(f) + else: + filename = file + if not filename.endswith(suffix): + filename = filename + suffix + + self.load() + + if not format or format == "PPM": + self.im.save_ppm(filename) + else: + self.save(filename, format, **options) + + return filename + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return False + assert isinstance(other, Image) + return ( + self.mode == other.mode + and self.size == other.size + and self.info == other.info + and self.getpalette() == other.getpalette() + and self.tobytes() == other.tobytes() + ) + + def __repr__(self) -> str: + return ( + f"<{self.__class__.__module__}.{self.__class__.__name__} " + f"image mode={self.mode} size={self.size[0]}x{self.size[1]} " + f"at 0x{id(self):X}>" + ) + + def _repr_pretty_(self, p: PrettyPrinter, cycle: bool) -> None: + """IPython plain text display support""" + + # Same as __repr__ but without unpredictable id(self), + # to keep Jupyter notebook `text/plain` output stable. + p.text( + f"<{self.__class__.__module__}.{self.__class__.__name__} " + f"image mode={self.mode} size={self.size[0]}x{self.size[1]}>" + ) + + def _repr_image(self, image_format: str, **kwargs: Any) -> bytes | None: + """Helper function for iPython display hook. + + :param image_format: Image format. + :returns: image as bytes, saved into the given format. + """ + b = io.BytesIO() + try: + self.save(b, image_format, **kwargs) + except Exception: + return None + return b.getvalue() + + def _repr_png_(self) -> bytes | None: + """iPython display hook support for PNG format. + + :returns: PNG version of the image as bytes + """ + return self._repr_image("PNG", compress_level=1) + + def _repr_jpeg_(self) -> bytes | None: + """iPython display hook support for JPEG format. + + :returns: JPEG version of the image as bytes + """ + return self._repr_image("JPEG") + + @property + def __array_interface__(self) -> dict[str, str | bytes | int | tuple[int, ...]]: + # numpy array interface support + new: dict[str, str | bytes | int | tuple[int, ...]] = {"version": 3} + if self.mode == "1": + # Binary images need to be extended from bits to bytes + # See: https://github.com/python-pillow/Pillow/issues/350 + new["data"] = self.tobytes("raw", "L") + else: + new["data"] = self.tobytes() + new["shape"], new["typestr"] = _conv_type_shape(self) + return new + + def __arrow_c_schema__(self) -> object: + self.load() + return self.im.__arrow_c_schema__() + + def __arrow_c_array__( + self, requested_schema: object | None = None + ) -> tuple[object, object]: + self.load() + return (self.im.__arrow_c_schema__(), self.im.__arrow_c_array__()) + + def __getstate__(self) -> list[Any]: + im_data = self.tobytes() # load image first + return [self.info, self.mode, self.size, self.getpalette(), im_data] + + def __setstate__(self, state: list[Any]) -> None: + Image.__init__(self) + info, mode, size, palette, data = state[:5] + self.info = info + self._mode = mode + self._size = size + self.im = core.new(mode, size) + if mode in ("L", "LA", "P", "PA") and palette: + self.putpalette(palette) + self.frombytes(data) + + def tobytes(self, encoder_name: str = "raw", *args: Any) -> bytes: + """ + Return image as a bytes object. + + .. warning:: + + This method returns raw image data derived from Pillow's internal + storage. For compressed image data (e.g. PNG, JPEG) use + :meth:`~.save`, with a BytesIO parameter for in-memory data. + + :param encoder_name: What encoder to use. + + The default is to use the standard "raw" encoder. + To see how this packs pixel data into the returned + bytes, see :file:`libImaging/Pack.c`. + + A list of C encoders can be seen under codecs + section of the function array in + :file:`_imaging.c`. Python encoders are registered + within the relevant plugins. + :param args: Extra arguments to the encoder. + :returns: A :py:class:`bytes` object. + """ + + encoder_args: Any = args + if len(encoder_args) == 1 and isinstance(encoder_args[0], tuple): + # may pass tuple instead of argument list + encoder_args = encoder_args[0] + + if encoder_name == "raw" and encoder_args == (): + encoder_args = self.mode + + self.load() + + if self.width == 0 or self.height == 0: + return b"" + + # unpack data + e = _getencoder(self.mode, encoder_name, encoder_args) + e.setimage(self.im, (0, 0) + self.size) + + from . import ImageFile + + bufsize = max(ImageFile.MAXBLOCK, self.size[0] * 4) # see RawEncode.c + + output = [] + while True: + bytes_consumed, errcode, data = e.encode(bufsize) + output.append(data) + if errcode: + break + if errcode < 0: + msg = f"encoder error {errcode} in tobytes" + raise RuntimeError(msg) + + return b"".join(output) + + def tobitmap(self, name: str = "image") -> bytes: + """ + Returns the image converted to an X11 bitmap. + + .. note:: This method only works for mode "1" images. + + :param name: The name prefix to use for the bitmap variables. + :returns: A string containing an X11 bitmap. + :raises ValueError: If the mode is not "1" + """ + + self.load() + if self.mode != "1": + msg = "not a bitmap" + raise ValueError(msg) + data = self.tobytes("xbm") + return b"".join( + [ + f"#define {name}_width {self.size[0]}\n".encode("ascii"), + f"#define {name}_height {self.size[1]}\n".encode("ascii"), + f"static char {name}_bits[] = {{\n".encode("ascii"), + data, + b"};", + ] + ) + + def frombytes( + self, + data: bytes | bytearray | SupportsArrayInterface, + decoder_name: str = "raw", + *args: Any, + ) -> None: + """ + Loads this image with pixel data from a bytes object. + + This method is similar to the :py:func:`~PIL.Image.frombytes` function, + but loads data into this image instead of creating a new image object. + """ + + if self.width == 0 or self.height == 0: + return + + decoder_args: Any = args + if len(decoder_args) == 1 and isinstance(decoder_args[0], tuple): + # may pass tuple instead of argument list + decoder_args = decoder_args[0] + + # default format + if decoder_name == "raw" and decoder_args == (): + decoder_args = self.mode + + # unpack data + d = _getdecoder(self.mode, decoder_name, decoder_args) + d.setimage(self.im, (0, 0) + self.size) + s = d.decode(data) + + if s[0] >= 0: + msg = "not enough image data" + raise ValueError(msg) + if s[1] != 0: + msg = "cannot decode image data" + raise ValueError(msg) + + def load(self) -> core.PixelAccess | None: + """ + Allocates storage for the image and loads the pixel data. In + normal cases, you don't need to call this method, since the + Image class automatically loads an opened image when it is + accessed for the first time. + + If the file associated with the image was opened by Pillow, then this + method will close it. The exception to this is if the image has + multiple frames, in which case the file will be left open for seek + operations. See :ref:`file-handling` for more information. + + :returns: An image access object. + :rtype: :py:class:`.PixelAccess` + """ + if self._im is not None and self.palette and self.palette.dirty: + # realize palette + mode, arr = self.palette.getdata() + self.im.putpalette(self.palette.mode, mode, arr) + self.palette.dirty = 0 + self.palette.rawmode = None + if "transparency" in self.info and mode in ("LA", "PA"): + if isinstance(self.info["transparency"], int): + self.im.putpalettealpha(self.info["transparency"], 0) + else: + self.im.putpalettealphas(self.info["transparency"]) + self.palette.mode = "RGBA" + elif self.palette.mode != mode: + # If the palette rawmode is different to the mode, + # then update the Python palette data + self.palette.palette = self.im.getpalette( + self.palette.mode, self.palette.mode + ) + + if self._im is not None: + return self.im.pixel_access(self.readonly) + return None + + def verify(self) -> None: + """ + Verifies the contents of a file. For data read from a file, this + method attempts to determine if the file is broken, without + actually decoding the image data. If this method finds any + problems, it raises suitable exceptions. If you need to load + the image after using this method, you must reopen the image + file. + """ + pass + + def convert( + self, + mode: str | None = None, + matrix: tuple[float, ...] | None = None, + dither: Dither | None = None, + palette: Palette = Palette.WEB, + colors: int = 256, + ) -> Image: + """ + Returns a converted copy of this image. For the "P" mode, this + method translates pixels through the palette. If mode is + omitted, a mode is chosen so that all information in the image + and the palette can be represented without a palette. + + This supports all possible conversions between "L", "RGB" and "CMYK". The + ``matrix`` argument only supports "L" and "RGB". + + When translating a color image to grayscale (mode "L"), + the library uses the ITU-R 601-2 luma transform:: + + L = R * 299/1000 + G * 587/1000 + B * 114/1000 + + The default method of converting a grayscale ("L") or "RGB" + image into a bilevel (mode "1") image uses Floyd-Steinberg + dither to approximate the original image luminosity levels. If + dither is ``None``, all values larger than 127 are set to 255 (white), + all other values to 0 (black). To use other thresholds, use the + :py:meth:`~PIL.Image.Image.point` method. + + When converting from "RGBA" to "P" without a ``matrix`` argument, + this passes the operation to :py:meth:`~PIL.Image.Image.quantize`, + and ``dither`` and ``palette`` are ignored. + + When converting from "PA", if an "RGBA" palette is present, the alpha + channel from the image will be used instead of the values from the palette. + + :param mode: The requested mode. See: :ref:`concept-modes`. + :param matrix: An optional conversion matrix. If given, this + should be 4- or 12-tuple containing floating point values. + :param dither: Dithering method, used when converting from + mode "RGB" to "P" or from "RGB" or "L" to "1". + Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG` + (default). Note that this is not used when ``matrix`` is supplied. + :param palette: Palette to use when converting from mode "RGB" + to "P". Available palettes are :data:`Palette.WEB` or + :data:`Palette.ADAPTIVE`. + :param colors: Number of colors to use for the :data:`Palette.ADAPTIVE` + palette. Defaults to 256. + :rtype: :py:class:`~PIL.Image.Image` + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + self.load() + + has_transparency = "transparency" in self.info + if not mode and self.mode == "P": + # determine default mode + if self.palette: + mode = self.palette.mode + else: + mode = "RGB" + if mode == "RGB" and has_transparency: + mode = "RGBA" + if not mode or (mode == self.mode and not matrix): + return self.copy() + + if matrix: + # matrix conversion + if mode not in ("L", "RGB"): + msg = "illegal conversion" + raise ValueError(msg) + im = self.im.convert_matrix(mode, matrix) + new_im = self._new(im) + if has_transparency and self.im.bands == 3: + transparency = new_im.info["transparency"] + + def convert_transparency( + m: tuple[float, ...], v: tuple[int, int, int] + ) -> int: + value = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * 0.5 + return max(0, min(255, int(value))) + + if mode == "L": + transparency = convert_transparency(matrix, transparency) + elif len(mode) == 3: + transparency = tuple( + convert_transparency(matrix[i * 4 : i * 4 + 4], transparency) + for i in range(len(transparency)) + ) + new_im.info["transparency"] = transparency + return new_im + + if self.mode == "RGBA": + if mode == "P": + return self.quantize(colors) + elif mode == "PA": + r, g, b, a = self.split() + rgb = merge("RGB", (r, g, b)) + p = rgb.quantize(colors) + return merge("PA", (p, a)) + + trns = None + delete_trns = False + # transparency handling + if has_transparency: + if (self.mode in ("1", "L", "I", "I;16") and mode in ("LA", "RGBA")) or ( + self.mode == "RGB" and mode in ("La", "LA", "RGBa", "RGBA") + ): + # Use transparent conversion to promote from transparent + # color to an alpha channel. + new_im = self._new( + self.im.convert_transparent(mode, self.info["transparency"]) + ) + del new_im.info["transparency"] + return new_im + elif self.mode in ("L", "RGB", "P") and mode in ("L", "RGB", "P"): + t = self.info["transparency"] + if isinstance(t, bytes): + # Dragons. This can't be represented by a single color + warnings.warn( + "Palette images with Transparency expressed in bytes should be " + "converted to RGBA images" + ) + delete_trns = True + else: + # get the new transparency color. + # use existing conversions + trns_im = new(self.mode, (1, 1)) + if self.mode == "P": + assert self.palette is not None + trns_im.putpalette(self.palette, self.palette.mode) + if isinstance(t, tuple): + err = "Couldn't allocate a palette color for transparency" + assert trns_im.palette is not None + try: + t = trns_im.palette.getcolor(t, self) + except ValueError as e: + if str(e) == "cannot allocate more than 256 colors": + # If all 256 colors are in use, + # then there is no need for transparency + t = None + else: + raise ValueError(err) from e + if t is None: + trns = None + else: + trns_im.putpixel((0, 0), t) + + if mode in ("L", "RGB"): + trns_im = trns_im.convert(mode) + else: + # can't just retrieve the palette number, got to do it + # after quantization. + trns_im = trns_im.convert("RGB") + trns = trns_im.getpixel((0, 0)) + + elif self.mode == "P" and mode in ("LA", "PA", "RGBA"): + t = self.info["transparency"] + delete_trns = True + + if isinstance(t, bytes): + self.im.putpalettealphas(t) + elif isinstance(t, int): + self.im.putpalettealpha(t, 0) + else: + msg = "Transparency for P mode should be bytes or int" + raise ValueError(msg) + + if mode == "P" and palette == Palette.ADAPTIVE: + im = self.im.quantize(colors) + new_im = self._new(im) + from . import ImagePalette + + new_im.palette = ImagePalette.ImagePalette( + "RGB", new_im.im.getpalette("RGB") + ) + if delete_trns: + # This could possibly happen if we requantize to fewer colors. + # The transparency would be totally off in that case. + del new_im.info["transparency"] + if trns is not None: + try: + new_im.info["transparency"] = new_im.palette.getcolor( + cast(tuple[int, ...], trns), # trns was converted to RGB + new_im, + ) + except Exception: + # if we can't make a transparent color, don't leave the old + # transparency hanging around to mess us up. + del new_im.info["transparency"] + warnings.warn("Couldn't allocate palette entry for transparency") + return new_im + + if "LAB" in (self.mode, mode): + im = self + if mode == "LAB": + if im.mode not in ("RGB", "RGBA", "RGBX"): + im = im.convert("RGBA") + other_mode = im.mode + else: + other_mode = mode + if other_mode in ("RGB", "RGBA", "RGBX"): + from . import ImageCms + + srgb = ImageCms.createProfile("sRGB") + lab = ImageCms.createProfile("LAB") + profiles = [lab, srgb] if im.mode == "LAB" else [srgb, lab] + transform = ImageCms.buildTransform( + profiles[0], profiles[1], im.mode, mode + ) + return transform.apply(im) + + # colorspace conversion + if dither is None: + dither = Dither.FLOYDSTEINBERG + + try: + im = self.im.convert(mode, dither) + except ValueError: + try: + # normalize source image and try again + modebase = getmodebase(self.mode) + if modebase == self.mode: + raise + im = self.im.convert(modebase) + im = im.convert(mode, dither) + except KeyError as e: + msg = "illegal conversion" + raise ValueError(msg) from e + + new_im = self._new(im) + if mode in ("P", "PA") and palette != Palette.ADAPTIVE: + from . import ImagePalette + + new_im.palette = ImagePalette.ImagePalette("RGB", im.getpalette("RGB")) + if delete_trns: + # crash fail if we leave a bytes transparency in an rgb/l mode. + del new_im.info["transparency"] + if trns is not None: + if new_im.mode == "P" and new_im.palette: + try: + new_im.info["transparency"] = new_im.palette.getcolor( + cast(tuple[int, ...], trns), new_im # trns was converted to RGB + ) + except ValueError as e: + del new_im.info["transparency"] + if str(e) != "cannot allocate more than 256 colors": + # If all 256 colors are in use, + # then there is no need for transparency + warnings.warn( + "Couldn't allocate palette entry for transparency" + ) + else: + new_im.info["transparency"] = trns + return new_im + + def quantize( + self, + colors: int = 256, + method: int | None = None, + kmeans: int = 0, + palette: Image | None = None, + dither: Dither = Dither.FLOYDSTEINBERG, + ) -> Image: + """ + Convert the image to 'P' mode with the specified number + of colors. + + :param colors: The desired number of colors, <= 256 + :param method: :data:`Quantize.MEDIANCUT` (median cut), + :data:`Quantize.MAXCOVERAGE` (maximum coverage), + :data:`Quantize.FASTOCTREE` (fast octree), + :data:`Quantize.LIBIMAGEQUANT` (libimagequant; check support + using :py:func:`PIL.features.check_feature` with + ``feature="libimagequant"``). + + By default, :data:`Quantize.MEDIANCUT` will be used. + + The exception to this is RGBA images. :data:`Quantize.MEDIANCUT` + and :data:`Quantize.MAXCOVERAGE` do not support RGBA images, so + :data:`Quantize.FASTOCTREE` is used by default instead. + :param kmeans: Integer greater than or equal to zero. + :param palette: Quantize to the palette of given + :py:class:`PIL.Image.Image`. + :param dither: Dithering method, used when converting from + mode "RGB" to "P" or from "RGB" or "L" to "1". + Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG` + (default). + :returns: A new image + """ + + self.load() + + if method is None: + # defaults: + method = Quantize.MEDIANCUT + if self.mode == "RGBA": + method = Quantize.FASTOCTREE + + if self.mode == "RGBA" and method not in ( + Quantize.FASTOCTREE, + Quantize.LIBIMAGEQUANT, + ): + # Caller specified an invalid mode. + msg = ( + "Fast Octree (method == 2) and libimagequant (method == 3) " + "are the only valid methods for quantizing RGBA images" + ) + raise ValueError(msg) + + if palette: + # use palette from reference image + palette.load() + if palette.mode != "P": + msg = "bad mode for palette image" + raise ValueError(msg) + if self.mode not in {"RGB", "L"}: + msg = "only RGB or L mode images can be quantized to a palette" + raise ValueError(msg) + im = self.im.convert("P", dither, palette.im) + new_im = self._new(im) + assert palette.palette is not None + new_im.palette = palette.palette.copy() + return new_im + + if kmeans < 0: + msg = "kmeans must not be negative" + raise ValueError(msg) + + im = self._new(self.im.quantize(colors, method, kmeans)) + + from . import ImagePalette + + mode = im.im.getpalettemode() + palette_data = im.im.getpalette(mode, mode)[: colors * len(mode)] + im.palette = ImagePalette.ImagePalette(mode, palette_data) + + return im + + def copy(self) -> Image: + """ + Copies this image. Use this method if you wish to paste things + into an image, but still retain the original. + + :rtype: :py:class:`~PIL.Image.Image` + :returns: An :py:class:`~PIL.Image.Image` object. + """ + self.load() + return self._new(self.im.copy()) + + __copy__ = copy + + def crop(self, box: tuple[float, float, float, float] | None = None) -> Image: + """ + Returns a rectangular region from this image. The box is a + 4-tuple defining the left, upper, right, and lower pixel + coordinate. See :ref:`coordinate-system`. + + Note: Prior to Pillow 3.4.0, this was a lazy operation. + + :param box: The crop rectangle, as a (left, upper, right, lower)-tuple. + :rtype: :py:class:`~PIL.Image.Image` + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + if box is None: + return self.copy() + + if box[2] < box[0]: + msg = "Coordinate 'right' is less than 'left'" + raise ValueError(msg) + elif box[3] < box[1]: + msg = "Coordinate 'lower' is less than 'upper'" + raise ValueError(msg) + + self.load() + return self._new(self._crop(self.im, box)) + + def _crop( + self, im: core.ImagingCore, box: tuple[float, float, float, float] + ) -> core.ImagingCore: + """ + Returns a rectangular region from the core image object im. + + This is equivalent to calling im.crop((x0, y0, x1, y1)), but + includes additional sanity checks. + + :param im: a core image object + :param box: The crop rectangle, as a (left, upper, right, lower)-tuple. + :returns: A core image object. + """ + + x0, y0, x1, y1 = map(int, map(round, box)) + + absolute_values = (abs(x1 - x0), abs(y1 - y0)) + + _decompression_bomb_check(absolute_values) + + return im.crop((x0, y0, x1, y1)) + + def draft( + self, mode: str | None, size: tuple[int, int] | None + ) -> tuple[str, tuple[int, int, float, float]] | None: + """ + Configures the image file loader so it returns a version of the + image that as closely as possible matches the given mode and + size. For example, you can use this method to convert a color + JPEG to grayscale while loading it. + + If any changes are made, returns a tuple with the chosen ``mode`` and + ``box`` with coordinates of the original image within the altered one. + + Note that this method modifies the :py:class:`~PIL.Image.Image` object + in place. If the image has already been loaded, this method has no + effect. + + Note: This method is not implemented for most images. It is + currently implemented only for JPEG and MPO images. + + :param mode: The requested mode. + :param size: The requested size in pixels, as a 2-tuple: + (width, height). + """ + pass + + def filter(self, filter: ImageFilter.Filter | type[ImageFilter.Filter]) -> Image: + """ + Filters this image using the given filter. For a list of + available filters, see the :py:mod:`~PIL.ImageFilter` module. + + :param filter: Filter kernel. + :returns: An :py:class:`~PIL.Image.Image` object.""" + + from . import ImageFilter + + self.load() + + if callable(filter): + filter = filter() + if not hasattr(filter, "filter"): + msg = "filter argument should be ImageFilter.Filter instance or class" + raise TypeError(msg) + + multiband = isinstance(filter, ImageFilter.MultibandFilter) + if self.im.bands == 1 or multiband: + return self._new(filter.filter(self.im)) + + ims = [ + self._new(filter.filter(self.im.getband(c))) for c in range(self.im.bands) + ] + return merge(self.mode, ims) + + def getbands(self) -> tuple[str, ...]: + """ + Returns a tuple containing the name of each band in this image. + For example, ``getbands`` on an RGB image returns ("R", "G", "B"). + + :returns: A tuple containing band names. + :rtype: tuple + """ + return ImageMode.getmode(self.mode).bands + + def getbbox(self, *, alpha_only: bool = True) -> tuple[int, int, int, int] | None: + """ + Calculates the bounding box of the non-zero regions in the + image. + + :param alpha_only: Optional flag, defaulting to ``True``. + If ``True`` and the image has an alpha channel, trim transparent pixels. + Otherwise, trim pixels when all channels are zero. + Keyword-only argument. + :returns: The bounding box is returned as a 4-tuple defining the + left, upper, right, and lower pixel coordinate. See + :ref:`coordinate-system`. If the image is completely empty, this + method returns None. + + """ + + self.load() + return self.im.getbbox(alpha_only) + + def getcolors( + self, maxcolors: int = 256 + ) -> list[tuple[int, tuple[int, ...]]] | list[tuple[int, float]] | None: + """ + Returns a list of colors used in this image. + + The colors will be in the image's mode. For example, an RGB image will + return a tuple of (red, green, blue) color values, and a P image will + return the index of the color in the palette. + + :param maxcolors: Maximum number of colors. If this number is + exceeded, this method returns None. The default limit is + 256 colors. + :returns: An unsorted list of (count, pixel) values. + """ + + self.load() + if self.mode in ("1", "L", "P"): + h = self.im.histogram() + out: list[tuple[int, float]] = [(h[i], i) for i in range(256) if h[i]] + if len(out) > maxcolors: + return None + return out + return self.im.getcolors(maxcolors) + + def getdata(self, band: int | None = None) -> core.ImagingCore: + """ + Returns the contents of this image as a sequence object + containing pixel values. The sequence object is flattened, so + that values for line one follow directly after the values of + line zero, and so on. + + Note that the sequence object returned by this method is an + internal PIL data type, which only supports certain sequence + operations. To convert it to an ordinary sequence (e.g. for + printing), use ``list(im.getdata())``. + + :param band: What band to return. The default is to return + all bands. To return a single band, pass in the index + value (e.g. 0 to get the "R" band from an "RGB" image). + :returns: A sequence-like object. + """ + deprecate("Image.Image.getdata", 14, "get_flattened_data") + + self.load() + if band is not None: + return self.im.getband(band) + return self.im # could be abused + + def get_flattened_data( + self, band: int | None = None + ) -> tuple[tuple[int, ...], ...] | tuple[float, ...]: + """ + Returns the contents of this image as a tuple containing pixel values. + The sequence object is flattened, so that values for line one follow + directly after the values of line zero, and so on. + + :param band: What band to return. The default is to return + all bands. To return a single band, pass in the index + value (e.g. 0 to get the "R" band from an "RGB" image). + :returns: A tuple containing pixel values. + """ + self.load() + if band is not None: + return tuple(self.im.getband(band)) + return tuple(self.im) + + def getextrema(self) -> tuple[float, float] | tuple[tuple[int, int], ...]: + """ + Gets the minimum and maximum pixel values for each band in + the image. + + :returns: For a single-band image, a 2-tuple containing the + minimum and maximum pixel value. For a multi-band image, + a tuple containing one 2-tuple for each band. + """ + + self.load() + if self.im.bands > 1: + return tuple(self.im.getband(i).getextrema() for i in range(self.im.bands)) + return self.im.getextrema() + + def getxmp(self) -> dict[str, Any]: + """ + Returns a dictionary containing the XMP tags. + Requires defusedxml to be installed. + + :returns: XMP tags in a dictionary. + """ + + def get_name(tag: str) -> str: + return re.sub("^{[^}]+}", "", tag) + + def get_value(element: Element) -> str | dict[str, Any] | None: + value: dict[str, Any] = {get_name(k): v for k, v in element.attrib.items()} + children = list(element) + if children: + for child in children: + name = get_name(child.tag) + child_value = get_value(child) + if name in value: + if not isinstance(value[name], list): + value[name] = [value[name]] + value[name].append(child_value) + else: + value[name] = child_value + elif value: + if element.text: + value["text"] = element.text + else: + return element.text + return value + + if ElementTree is None: + warnings.warn("XMP data cannot be read without defusedxml dependency") + return {} + if "xmp" not in self.info: + return {} + root = ElementTree.fromstring(self.info["xmp"].rstrip(b"\x00 ")) + return {get_name(root.tag): get_value(root)} + + def getexif(self) -> Exif: + """ + Gets EXIF data from the image. + + :returns: an :py:class:`~PIL.Image.Exif` object. + """ + if self._exif is None: + self._exif = Exif() + elif self._exif._loaded: + return self._exif + self._exif._loaded = True + + exif_info = self.info.get("exif") + if exif_info is None: + if "Raw profile type exif" in self.info: + exif_info = bytes.fromhex( + "".join(self.info["Raw profile type exif"].split("\n")[3:]) + ) + elif hasattr(self, "tag_v2"): + from . import TiffImagePlugin + + assert isinstance(self, TiffImagePlugin.TiffImageFile) + self._exif.bigtiff = self.tag_v2._bigtiff + self._exif.endian = self.tag_v2._endian + + assert self.fp is not None + self._exif.load_from_fp(self.fp, self.tag_v2._offset) + if exif_info is not None: + self._exif.load(exif_info) + + # XMP tags + if ExifTags.Base.Orientation not in self._exif: + xmp_tags = self.info.get("XML:com.adobe.xmp") + pattern: str | bytes = r'tiff:Orientation(="|>)([0-9])' + if not xmp_tags and (xmp_tags := self.info.get("xmp")): + pattern = rb'tiff:Orientation(="|>)([0-9])' + if xmp_tags: + match = re.search(pattern, xmp_tags) + if match: + self._exif[ExifTags.Base.Orientation] = int(match[2]) + + return self._exif + + def _reload_exif(self) -> None: + if self._exif is None or not self._exif._loaded: + return + self._exif._loaded = False + self.getexif() + + def get_child_images(self) -> list[ImageFile.ImageFile]: + from . import ImageFile + + deprecate("Image.Image.get_child_images", 13) + return ImageFile.ImageFile.get_child_images(self) # type: ignore[arg-type] + + def getim(self) -> CapsuleType: + """ + Returns a capsule that points to the internal image memory. + + :returns: A capsule object. + """ + + self.load() + return self.im.ptr + + def getpalette(self, rawmode: str | None = "RGB") -> list[int] | None: + """ + Returns the image palette as a list. + + :param rawmode: The mode in which to return the palette. ``None`` will + return the palette in its current mode. + + .. versionadded:: 9.1.0 + + :returns: A list of color values [r, g, b, ...], or None if the + image has no palette. + """ + + self.load() + try: + mode = self.im.getpalettemode() + except ValueError: + return None # no palette + if rawmode is None: + rawmode = mode + return list(self.im.getpalette(mode, rawmode)) + + @property + def has_transparency_data(self) -> bool: + """ + Determine if an image has transparency data, whether in the form of an + alpha channel, a palette with an alpha channel, or a "transparency" key + in the info dictionary. + + Note the image might still appear solid, if all of the values shown + within are opaque. + + :returns: A boolean. + """ + if ( + self.mode in ("LA", "La", "PA", "RGBA", "RGBa") + or "transparency" in self.info + ): + return True + if self.mode == "P": + assert self.palette is not None + return self.palette.mode.endswith("A") + return False + + def apply_transparency(self) -> None: + """ + If a P mode image has a "transparency" key in the info dictionary, + remove the key and instead apply the transparency to the palette. + Otherwise, the image is unchanged. + """ + if self.mode != "P" or "transparency" not in self.info: + return + + from . import ImagePalette + + palette = self.getpalette("RGBA") + assert palette is not None + transparency = self.info["transparency"] + if isinstance(transparency, bytes): + for i, alpha in enumerate(transparency): + palette[i * 4 + 3] = alpha + else: + palette[transparency * 4 + 3] = 0 + self.palette = ImagePalette.ImagePalette("RGBA", bytes(palette)) + self.palette.dirty = 1 + + del self.info["transparency"] + + def getpixel( + self, xy: tuple[int, int] | list[int] + ) -> float | tuple[int, ...] | None: + """ + Returns the pixel value at a given position. + + :param xy: The coordinate, given as (x, y). See + :ref:`coordinate-system`. + :returns: The pixel value. If the image is a multi-layer image, + this method returns a tuple. + """ + + self.load() + return self.im.getpixel(tuple(xy)) + + def getprojection(self) -> tuple[list[int], list[int]]: + """ + Get projection to x and y axes + + :returns: Two sequences, indicating where there are non-zero + pixels along the X-axis and the Y-axis, respectively. + """ + + self.load() + x, y = self.im.getprojection() + return list(x), list(y) + + def histogram( + self, mask: Image | None = None, extrema: tuple[float, float] | None = None + ) -> list[int]: + """ + Returns a histogram for the image. The histogram is returned as a + list of pixel counts, one for each pixel value in the source + image. Counts are grouped into 256 bins for each band, even if + the image has more than 8 bits per band. If the image has more + than one band, the histograms for all bands are concatenated (for + example, the histogram for an "RGB" image contains 768 values). + + A bilevel image (mode "1") is treated as a grayscale ("L") image + by this method. + + If a mask is provided, the method returns a histogram for those + parts of the image where the mask image is non-zero. The mask + image must have the same size as the image, and be either a + bi-level image (mode "1") or a grayscale image ("L"). + + :param mask: An optional mask. + :param extrema: An optional tuple of manually-specified extrema. + :returns: A list containing pixel counts. + """ + self.load() + if mask: + mask.load() + return self.im.histogram((0, 0), mask.im) + if self.mode in ("I", "F"): + return self.im.histogram( + extrema if extrema is not None else self.getextrema() + ) + return self.im.histogram() + + def entropy( + self, mask: Image | None = None, extrema: tuple[float, float] | None = None + ) -> float: + """ + Calculates and returns the entropy for the image. + + A bilevel image (mode "1") is treated as a grayscale ("L") + image by this method. + + If a mask is provided, the method employs the histogram for + those parts of the image where the mask image is non-zero. + The mask image must have the same size as the image, and be + either a bi-level image (mode "1") or a grayscale image ("L"). + + :param mask: An optional mask. + :param extrema: An optional tuple of manually-specified extrema. + :returns: A float value representing the image entropy + """ + self.load() + if mask: + mask.load() + return self.im.entropy((0, 0), mask.im) + if self.mode in ("I", "F"): + return self.im.entropy( + extrema if extrema is not None else self.getextrema() + ) + return self.im.entropy() + + def paste( + self, + im: Image | str | float | tuple[float, ...], + box: Image | tuple[int, int, int, int] | tuple[int, int] | None = None, + mask: Image | None = None, + ) -> None: + """ + Pastes another image into this image. The box argument is either + a 2-tuple giving the upper left corner, a 4-tuple defining the + left, upper, right, and lower pixel coordinate, or None (same as + (0, 0)). See :ref:`coordinate-system`. If a 4-tuple is given, the size + of the pasted image must match the size of the region. + + If the modes don't match, the pasted image is converted to the mode of + this image (see the :py:meth:`~PIL.Image.Image.convert` method for + details). + + Instead of an image, the source can be a integer or tuple + containing pixel values. The method then fills the region + with the given color. When creating RGB images, you can + also use color strings as supported by the ImageColor module. See + :ref:`colors` for more information. + + If a mask is given, this method updates only the regions + indicated by the mask. You can use either "1", "L", "LA", "RGBA" + or "RGBa" images (if present, the alpha band is used as mask). + Where the mask is 255, the given image is copied as is. Where + the mask is 0, the current value is preserved. Intermediate + values will mix the two images together, including their alpha + channels if they have them. + + See :py:meth:`~PIL.Image.Image.alpha_composite` if you want to + combine images with respect to their alpha channels. + + :param im: Source image or pixel value (integer, float or tuple). + :param box: An optional 4-tuple giving the region to paste into. + If a 2-tuple is used instead, it's treated as the upper left + corner. If omitted or None, the source is pasted into the + upper left corner. + + If an image is given as the second argument and there is no + third, the box defaults to (0, 0), and the second argument + is interpreted as a mask image. + :param mask: An optional mask image. + """ + + if isinstance(box, Image): + if mask is not None: + msg = "If using second argument as mask, third argument must be None" + raise ValueError(msg) + # abbreviated paste(im, mask) syntax + mask = box + box = None + + if box is None: + box = (0, 0) + + if len(box) == 2: + # upper left corner given; get size from image or mask + if isinstance(im, Image): + size = im.size + elif isinstance(mask, Image): + size = mask.size + else: + # FIXME: use self.size here? + msg = "cannot determine region size; use 4-item box" + raise ValueError(msg) + box += (box[0] + size[0], box[1] + size[1]) + + source: core.ImagingCore | str | float | tuple[float, ...] + if isinstance(im, str): + from . import ImageColor + + source = ImageColor.getcolor(im, self.mode) + elif isinstance(im, Image): + im.load() + if self.mode != im.mode: + if self.mode != "RGB" or im.mode not in ("LA", "RGBA", "RGBa"): + # should use an adapter for this! + im = im.convert(self.mode) + source = im.im + else: + source = im + + self._ensure_mutable() + + if mask: + mask.load() + self.im.paste(source, box, mask.im) + else: + self.im.paste(source, box) + + def alpha_composite( + self, im: Image, dest: Sequence[int] = (0, 0), source: Sequence[int] = (0, 0) + ) -> None: + """'In-place' analog of Image.alpha_composite. Composites an image + onto this image. + + :param im: image to composite over this one + :param dest: Optional 2 tuple (left, top) specifying the upper + left corner in this (destination) image. + :param source: Optional 2 (left, top) tuple for the upper left + corner in the overlay source image, or 4 tuple (left, top, right, + bottom) for the bounds of the source rectangle + + Performance Note: Not currently implemented in-place in the core layer. + """ + + if not isinstance(source, (list, tuple)): + msg = "Source must be a list or tuple" + raise ValueError(msg) + if not isinstance(dest, (list, tuple)): + msg = "Destination must be a list or tuple" + raise ValueError(msg) + + if len(source) == 4: + overlay_crop_box = tuple(source) + elif len(source) == 2: + overlay_crop_box = tuple(source) + im.size + else: + msg = "Source must be a sequence of length 2 or 4" + raise ValueError(msg) + + if not len(dest) == 2: + msg = "Destination must be a sequence of length 2" + raise ValueError(msg) + if min(source) < 0: + msg = "Source must be non-negative" + raise ValueError(msg) + + # over image, crop if it's not the whole image. + if overlay_crop_box == (0, 0) + im.size: + overlay = im + else: + overlay = im.crop(overlay_crop_box) + + # target for the paste + box = tuple(dest) + (dest[0] + overlay.width, dest[1] + overlay.height) + + # destination image. don't copy if we're using the whole image. + if box == (0, 0) + self.size: + background = self + else: + background = self.crop(box) + + result = alpha_composite(background, overlay) + self.paste(result, box) + + def point( + self, + lut: ( + Sequence[float] + | NumpyArray + | Callable[[int], float] + | Callable[[ImagePointTransform], ImagePointTransform | float] + | ImagePointHandler + ), + mode: str | None = None, + ) -> Image: + """ + Maps this image through a lookup table or function. + + :param lut: A lookup table, containing 256 (or 65536 if + self.mode=="I" and mode == "L") values per band in the + image. A function can be used instead, it should take a + single argument. The function is called once for each + possible pixel value, and the resulting table is applied to + all bands of the image. + + It may also be an :py:class:`~PIL.Image.ImagePointHandler` + object:: + + class Example(Image.ImagePointHandler): + def point(self, im: Image) -> Image: + # Return result + :param mode: Output mode (default is same as input). This can only be used if + the source image has mode "L" or "P", and the output has mode "1" or the + source image mode is "I" and the output mode is "L". + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + self.load() + + if isinstance(lut, ImagePointHandler): + return lut.point(self) + + if callable(lut): + # if it isn't a list, it should be a function + if self.mode in ("I", "I;16", "F"): + # check if the function can be used with point_transform + # UNDONE wiredfool -- I think this prevents us from ever doing + # a gamma function point transform on > 8bit images. + scale, offset = _getscaleoffset(lut) # type: ignore[arg-type] + return self._new(self.im.point_transform(scale, offset)) + # for other modes, convert the function to a table + flatLut = [lut(i) for i in range(256)] * self.im.bands # type: ignore[arg-type] + else: + flatLut = lut + + if self.mode == "F": + # FIXME: _imaging returns a confusing error message for this case + msg = "point operation not supported for this mode" + raise ValueError(msg) + + if mode != "F": + flatLut = [round(i) for i in flatLut] + return self._new(self.im.point(flatLut, mode)) + + def putalpha(self, alpha: Image | int) -> None: + """ + Adds or replaces the alpha layer in this image. If the image + does not have an alpha layer, it's converted to "LA" or "RGBA". + The new layer must be either "L" or "1". + + :param alpha: The new alpha layer. This can either be an "L" or "1" + image having the same size as this image, or an integer. + """ + + self._ensure_mutable() + + if self.mode not in ("LA", "PA", "RGBA"): + # attempt to promote self to a matching alpha mode + try: + mode = getmodebase(self.mode) + "A" + try: + self.im.setmode(mode) + except (AttributeError, ValueError) as e: + # do things the hard way + im = self.im.convert(mode) + if im.mode not in ("LA", "PA", "RGBA"): + msg = "alpha channel could not be added" + raise ValueError(msg) from e # sanity check + self.im = im + self._mode = self.im.mode + except KeyError as e: + msg = "illegal image mode" + raise ValueError(msg) from e + + if self.mode in ("LA", "PA"): + band = 1 + else: + band = 3 + + if isinstance(alpha, Image): + # alpha layer + if alpha.mode not in ("1", "L"): + msg = "illegal image mode" + raise ValueError(msg) + alpha.load() + if alpha.mode == "1": + alpha = alpha.convert("L") + else: + # constant alpha + try: + self.im.fillband(band, alpha) + except (AttributeError, ValueError): + # do things the hard way + alpha = new("L", self.size, alpha) + else: + return + + self.im.putband(alpha.im, band) + + def putdata( + self, + data: Sequence[float] | Sequence[Sequence[int]] | core.ImagingCore | NumpyArray, + scale: float = 1.0, + offset: float = 0.0, + ) -> None: + """ + Copies pixel data from a flattened sequence object into the image. The + values should start at the upper left corner (0, 0), continue to the + end of the line, followed directly by the first value of the second + line, and so on. Data will be read until either the image or the + sequence ends. The scale and offset values are used to adjust the + sequence values: **pixel = value*scale + offset**. + + :param data: A flattened sequence object. See :ref:`colors` for more + information about values. + :param scale: An optional scale value. The default is 1.0. + :param offset: An optional offset value. The default is 0.0. + """ + + self._ensure_mutable() + + self.im.putdata(data, scale, offset) + + def putpalette( + self, + data: ImagePalette.ImagePalette | bytes | Sequence[int], + rawmode: str = "RGB", + ) -> None: + """ + Attaches a palette to this image. The image must be a "P", "PA", "L" + or "LA" image. + + The palette sequence must contain at most 256 colors, made up of one + integer value for each channel in the raw mode. + For example, if the raw mode is "RGB", then it can contain at most 768 + values, made up of red, green and blue values for the corresponding pixel + index in the 256 colors. + If the raw mode is "RGBA", then it can contain at most 1024 values, + containing red, green, blue and alpha values. + + Alternatively, an 8-bit string may be used instead of an integer sequence. + + :param data: A palette sequence (either a list or a string). + :param rawmode: The raw mode of the palette. Either "RGB", "RGBA", "CMYK", or a + mode that can be transformed to one of those modes (e.g. "R", "RGBA;L"). + """ + from . import ImagePalette + + if self.mode not in ("L", "LA", "P", "PA"): + msg = "illegal image mode" + raise ValueError(msg) + if isinstance(data, ImagePalette.ImagePalette): + if data.rawmode is not None: + palette = ImagePalette.raw(data.rawmode, data.palette) + else: + palette = ImagePalette.ImagePalette(palette=data.palette) + palette.dirty = 1 + else: + if not isinstance(data, bytes): + data = bytes(data) + palette = ImagePalette.raw(rawmode, data) + self._mode = "PA" if "A" in self.mode else "P" + self.palette = palette + if rawmode.startswith("CMYK"): + self.palette.mode = "CMYK" + elif "A" in rawmode: + self.palette.mode = "RGBA" + else: + self.palette.mode = "RGB" + self.load() # install new palette + + def putpixel( + self, xy: tuple[int, int], value: float | tuple[int, ...] | list[int] + ) -> None: + """ + Modifies the pixel at the given position. The color is given as + a single numerical value for single-band images, and a tuple for + multi-band images. In addition to this, RGB and RGBA tuples are + accepted for P and PA images. See :ref:`colors` for more information. + + Note that this method is relatively slow. For more extensive changes, + use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw` + module instead. + + See: + + * :py:meth:`~PIL.Image.Image.paste` + * :py:meth:`~PIL.Image.Image.putdata` + * :py:mod:`~PIL.ImageDraw` + + :param xy: The pixel coordinate, given as (x, y). See + :ref:`coordinate-system`. + :param value: The pixel value. + """ + + self._ensure_mutable() + + if ( + self.mode in ("P", "PA") + and isinstance(value, (list, tuple)) + and len(value) in [3, 4] + ): + # RGB or RGBA value for a P or PA image + if self.mode == "PA": + alpha = value[3] if len(value) == 4 else 255 + value = value[:3] + assert self.palette is not None + palette_index = self.palette.getcolor(tuple(value), self) + value = (palette_index, alpha) if self.mode == "PA" else palette_index + return self.im.putpixel(xy, value) + + def remap_palette( + self, dest_map: list[int], source_palette: bytes | bytearray | None = None + ) -> Image: + """ + Rewrites the image to reorder the palette. + + :param dest_map: A list of indexes into the original palette. + e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))`` + is the identity transform. + :param source_palette: Bytes or None. + :returns: An :py:class:`~PIL.Image.Image` object. + + """ + from . import ImagePalette + + if self.mode not in ("L", "P"): + msg = "illegal image mode" + raise ValueError(msg) + + bands = 3 + palette_mode = "RGB" + if source_palette is None: + if self.mode == "P": + self.load() + palette_mode = self.im.getpalettemode() + if palette_mode == "RGBA": + bands = 4 + source_palette = self.im.getpalette(palette_mode, palette_mode) + else: # L-mode + source_palette = bytearray(i // 3 for i in range(768)) + elif len(source_palette) > 768: + bands = 4 + palette_mode = "RGBA" + + palette_bytes = b"" + new_positions = [0] * 256 + + # pick only the used colors from the palette + for i, oldPosition in enumerate(dest_map): + palette_bytes += source_palette[ + oldPosition * bands : oldPosition * bands + bands + ] + new_positions[oldPosition] = i + + # replace the palette color id of all pixel with the new id + + # Palette images are [0..255], mapped through a 1 or 3 + # byte/color map. We need to remap the whole image + # from palette 1 to palette 2. New_positions is + # an array of indexes into palette 1. Palette 2 is + # palette 1 with any holes removed. + + # We're going to leverage the convert mechanism to use the + # C code to remap the image from palette 1 to palette 2, + # by forcing the source image into 'L' mode and adding a + # mapping 'L' mode palette, then converting back to 'L' + # sans palette thus converting the image bytes, then + # assigning the optimized RGB palette. + + # perf reference, 9500x4000 gif, w/~135 colors + # 14 sec prepatch, 1 sec postpatch with optimization forced. + + mapping_palette = bytearray(new_positions) + + m_im = self.copy() + m_im._mode = "P" + + m_im.palette = ImagePalette.ImagePalette( + palette_mode, palette=mapping_palette * bands + ) + # possibly set palette dirty, then + # m_im.putpalette(mapping_palette, 'L') # converts to 'P' + # or just force it. + # UNDONE -- this is part of the general issue with palettes + m_im.im.putpalette(palette_mode, palette_mode + ";L", m_im.palette.tobytes()) + + m_im = m_im.convert("L") + + m_im.putpalette(palette_bytes, palette_mode) + m_im.palette = ImagePalette.ImagePalette(palette_mode, palette=palette_bytes) + + if "transparency" in self.info: + try: + m_im.info["transparency"] = dest_map.index(self.info["transparency"]) + except ValueError: + if "transparency" in m_im.info: + del m_im.info["transparency"] + + return m_im + + def _get_safe_box( + self, + size: tuple[int, int], + resample: Resampling, + box: tuple[float, float, float, float], + ) -> tuple[int, int, int, int]: + """Expands the box so it includes adjacent pixels + that may be used by resampling with the given resampling filter. + """ + filter_support = _filters_support[resample] - 0.5 + scale_x = (box[2] - box[0]) / size[0] + scale_y = (box[3] - box[1]) / size[1] + support_x = filter_support * scale_x + support_y = filter_support * scale_y + + return ( + max(0, int(box[0] - support_x)), + max(0, int(box[1] - support_y)), + min(self.size[0], math.ceil(box[2] + support_x)), + min(self.size[1], math.ceil(box[3] + support_y)), + ) + + def resize( + self, + size: tuple[int, int] | list[int] | NumpyArray, + resample: int | None = None, + box: tuple[float, float, float, float] | None = None, + reducing_gap: float | None = None, + ) -> Image: + """ + Returns a resized copy of this image. + + :param size: The requested size in pixels, as a tuple or array: + (width, height). + :param resample: An optional resampling filter. This can be + one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, + :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`, + :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`. + If the image has mode "1" or "P", it is always set to + :py:data:`Resampling.NEAREST`. Otherwise, the default filter is + :py:data:`Resampling.BICUBIC`. See: :ref:`concept-filters`. + :param box: An optional 4-tuple of floats providing + the source image region to be scaled. + The values must be within (0, 0, width, height) rectangle. + If omitted or None, the entire source is used. + :param reducing_gap: Apply optimization by resizing the image + in two steps. First, reducing the image by integer times + using :py:meth:`~PIL.Image.Image.reduce`. + Second, resizing using regular resampling. The last step + changes size no less than by ``reducing_gap`` times. + ``reducing_gap`` may be None (no first step is performed) + or should be greater than 1.0. The bigger ``reducing_gap``, + the closer the result to the fair resampling. + The smaller ``reducing_gap``, the faster resizing. + With ``reducing_gap`` greater or equal to 3.0, the result is + indistinguishable from fair resampling in most cases. + The default value is None (no optimization). + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + if resample is None: + resample = Resampling.BICUBIC + elif resample not in ( + Resampling.NEAREST, + Resampling.BILINEAR, + Resampling.BICUBIC, + Resampling.LANCZOS, + Resampling.BOX, + Resampling.HAMMING, + ): + msg = f"Unknown resampling filter ({resample})." + + filters = [ + f"{filter[1]} ({filter[0]})" + for filter in ( + (Resampling.NEAREST, "Image.Resampling.NEAREST"), + (Resampling.LANCZOS, "Image.Resampling.LANCZOS"), + (Resampling.BILINEAR, "Image.Resampling.BILINEAR"), + (Resampling.BICUBIC, "Image.Resampling.BICUBIC"), + (Resampling.BOX, "Image.Resampling.BOX"), + (Resampling.HAMMING, "Image.Resampling.HAMMING"), + ) + ] + msg += f" Use {', '.join(filters[:-1])} or {filters[-1]}" + raise ValueError(msg) + + if reducing_gap is not None and reducing_gap < 1.0: + msg = "reducing_gap must be 1.0 or greater" + raise ValueError(msg) + + if box is None: + box = (0, 0) + self.size + + size = tuple(size) + if self.size == size and box == (0, 0) + self.size: + return self.copy() + + if self.mode in ("1", "P"): + resample = Resampling.NEAREST + + if self.mode in ["LA", "RGBA"] and resample != Resampling.NEAREST: + im = self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode]) + im = im.resize(size, resample, box) + return im.convert(self.mode) + + self.load() + + if reducing_gap is not None and resample != Resampling.NEAREST: + factor_x = int((box[2] - box[0]) / size[0] / reducing_gap) or 1 + factor_y = int((box[3] - box[1]) / size[1] / reducing_gap) or 1 + if factor_x > 1 or factor_y > 1: + reduce_box = self._get_safe_box(size, cast(Resampling, resample), box) + factor = (factor_x, factor_y) + self = ( + self.reduce(factor, box=reduce_box) + if callable(self.reduce) + else Image.reduce(self, factor, box=reduce_box) + ) + box = ( + (box[0] - reduce_box[0]) / factor_x, + (box[1] - reduce_box[1]) / factor_y, + (box[2] - reduce_box[0]) / factor_x, + (box[3] - reduce_box[1]) / factor_y, + ) + + if self.size[1] > self.size[0] * 100 and size[1] < self.size[1]: + im = self.im.resize( + (self.size[0], size[1]), resample, (0, box[1], self.size[0], box[3]) + ) + im = im.resize(size, resample, (box[0], 0, box[2], size[1])) + else: + im = self.im.resize(size, resample, box) + return self._new(im) + + def reduce( + self, + factor: int | tuple[int, int], + box: tuple[int, int, int, int] | None = None, + ) -> Image: + """ + Returns a copy of the image reduced ``factor`` times. + If the size of the image is not dividable by ``factor``, + the resulting size will be rounded up. + + :param factor: A greater than 0 integer or tuple of two integers + for width and height separately. + :param box: An optional 4-tuple of ints providing + the source image region to be reduced. + The values must be within ``(0, 0, width, height)`` rectangle. + If omitted or ``None``, the entire source is used. + """ + if not isinstance(factor, (list, tuple)): + factor = (factor, factor) + + if box is None: + box = (0, 0) + self.size + + if factor == (1, 1) and box == (0, 0) + self.size: + return self.copy() + + if self.mode in ["LA", "RGBA"]: + im = self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode]) + im = im.reduce(factor, box) + return im.convert(self.mode) + + self.load() + + return self._new(self.im.reduce(factor, box)) + + def rotate( + self, + angle: float, + resample: Resampling = Resampling.NEAREST, + expand: int | bool = False, + center: tuple[float, float] | None = None, + translate: tuple[int, int] | None = None, + fillcolor: float | tuple[float, ...] | str | None = None, + ) -> Image: + """ + Returns a rotated copy of this image. This method returns a + copy of this image, rotated the given number of degrees counter + clockwise around its centre. + + :param angle: In degrees counter clockwise. + :param resample: An optional resampling filter. This can be + one of :py:data:`Resampling.NEAREST` (use nearest neighbour), + :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2 + environment), or :py:data:`Resampling.BICUBIC` (cubic spline + interpolation in a 4x4 environment). If omitted, or if the image has + mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`. + See :ref:`concept-filters`. + :param expand: Optional expansion flag. If true, expands the output + image to make it large enough to hold the entire rotated image. + If false or omitted, make the output image the same size as the + input image. Note that the expand flag assumes rotation around + the center and no translation. + :param center: Optional center of rotation (a 2-tuple). Origin is + the upper left corner. Default is the center of the image. + :param translate: An optional post-rotate translation (a 2-tuple). + :param fillcolor: An optional color for area outside the rotated image. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + angle = angle % 360.0 + + # Fast paths regardless of filter, as long as we're not + # translating or changing the center. + if not (center or translate): + if angle == 0: + return self.copy() + if angle == 180: + return self.transpose(Transpose.ROTATE_180) + if angle in (90, 270) and (expand or self.width == self.height): + return self.transpose( + Transpose.ROTATE_90 if angle == 90 else Transpose.ROTATE_270 + ) + + # Calculate the affine matrix. Note that this is the reverse + # transformation (from destination image to source) because we + # want to interpolate the (discrete) destination pixel from + # the local area around the (floating) source pixel. + + # The matrix we actually want (note that it operates from the right): + # (1, 0, tx) (1, 0, cx) ( cos a, sin a, 0) (1, 0, -cx) + # (0, 1, ty) * (0, 1, cy) * (-sin a, cos a, 0) * (0, 1, -cy) + # (0, 0, 1) (0, 0, 1) ( 0, 0, 1) (0, 0, 1) + + # The reverse matrix is thus: + # (1, 0, cx) ( cos -a, sin -a, 0) (1, 0, -cx) (1, 0, -tx) + # (0, 1, cy) * (-sin -a, cos -a, 0) * (0, 1, -cy) * (0, 1, -ty) + # (0, 0, 1) ( 0, 0, 1) (0, 0, 1) (0, 0, 1) + + # In any case, the final translation may be updated at the end to + # compensate for the expand flag. + + w, h = self.size + + if translate is None: + post_trans = (0, 0) + else: + post_trans = translate + if center is None: + center = (w / 2, h / 2) + + angle = -math.radians(angle) + matrix = [ + round(math.cos(angle), 15), + round(math.sin(angle), 15), + 0.0, + round(-math.sin(angle), 15), + round(math.cos(angle), 15), + 0.0, + ] + + def transform(x: float, y: float, matrix: list[float]) -> tuple[float, float]: + a, b, c, d, e, f = matrix + return a * x + b * y + c, d * x + e * y + f + + matrix[2], matrix[5] = transform( + -center[0] - post_trans[0], -center[1] - post_trans[1], matrix + ) + matrix[2] += center[0] + matrix[5] += center[1] + + if expand: + # calculate output size + xx = [] + yy = [] + for x, y in ((0, 0), (w, 0), (w, h), (0, h)): + transformed_x, transformed_y = transform(x, y, matrix) + xx.append(transformed_x) + yy.append(transformed_y) + nw = math.ceil(max(xx)) - math.floor(min(xx)) + nh = math.ceil(max(yy)) - math.floor(min(yy)) + + # We multiply a translation matrix from the right. Because of its + # special form, this is the same as taking the image of the + # translation vector as new translation vector. + matrix[2], matrix[5] = transform(-(nw - w) / 2.0, -(nh - h) / 2.0, matrix) + w, h = nw, nh + + return self.transform( + (w, h), Transform.AFFINE, matrix, resample, fillcolor=fillcolor + ) + + def save( + self, fp: StrOrBytesPath | IO[bytes], format: str | None = None, **params: Any + ) -> None: + """ + Saves this image under the given filename. If no format is + specified, the format to use is determined from the filename + extension, if possible. + + Keyword options can be used to provide additional instructions + to the writer. If a writer doesn't recognise an option, it is + silently ignored. The available options are described in the + :doc:`image format documentation + <../handbook/image-file-formats>` for each writer. + + You can use a file object instead of a filename. In this case, + you must always specify the format. The file object must + implement the ``seek``, ``tell``, and ``write`` + methods, and be opened in binary mode. + + :param fp: A filename (string), os.PathLike object or file object. + :param format: Optional format override. If omitted, the + format to use is determined from the filename extension. + If a file object was used instead of a filename, this + parameter should always be used. + :param params: Extra parameters to the image writer. These can also be + set on the image itself through ``encoderinfo``. This is useful when + saving multiple images:: + + # Saving XMP data to a single image + from PIL import Image + red = Image.new("RGB", (1, 1), "#f00") + red.save("out.mpo", xmp=b"test") + + # Saving XMP data to the second frame of an image + from PIL import Image + black = Image.new("RGB", (1, 1)) + red = Image.new("RGB", (1, 1), "#f00") + red.encoderinfo = {"xmp": b"test"} + black.save("out.mpo", save_all=True, append_images=[red]) + :returns: None + :exception ValueError: If the output format could not be determined + from the file name. Use the format option to solve this. + :exception OSError: If the file could not be written. The file + may have been created, and may contain partial data. + """ + + filename: str | bytes = "" + open_fp = False + if is_path(fp): + filename = os.fspath(fp) + open_fp = True + elif fp == sys.stdout: + try: + fp = sys.stdout.buffer + except AttributeError: + pass + if not filename and hasattr(fp, "name") and is_path(fp.name): + # only set the name for metadata purposes + filename = os.fspath(fp.name) + + if format: + preinit() + else: + filename_ext = os.path.splitext(filename)[1].lower() + ext = ( + filename_ext.decode() + if isinstance(filename_ext, bytes) + else filename_ext + ) + + # Try importing only the plugin for this extension first + if not _import_plugin_for_extension(ext): + preinit() + + if ext not in EXTENSION: + init() + try: + format = EXTENSION[ext] + except KeyError as e: + msg = f"unknown file extension: {ext}" + raise ValueError(msg) from e + + from . import ImageFile + + # may mutate self! + if isinstance(self, ImageFile.ImageFile) and os.path.abspath( + filename + ) == os.path.abspath(self.filename): + self._ensure_mutable() + else: + self.load() + + save_all = params.pop("save_all", None) + self._default_encoderinfo = params + encoderinfo = getattr(self, "encoderinfo", {}) + self._attach_default_encoderinfo(self) + self.encoderconfig: tuple[Any, ...] = () + + if format.upper() not in SAVE: + init() + if save_all or ( + save_all is None + and params.get("append_images") + and format.upper() in SAVE_ALL + ): + save_handler = SAVE_ALL[format.upper()] + else: + save_handler = SAVE[format.upper()] + + created = False + if open_fp: + created = not os.path.exists(filename) + if params.get("append", False): + # Open also for reading ("+"), because TIFF save_all + # writer needs to go back and edit the written data. + fp = builtins.open(filename, "r+b") + else: + fp = builtins.open(filename, "w+b") + else: + fp = cast(IO[bytes], fp) + + try: + save_handler(self, fp, filename) + except Exception: + if open_fp: + fp.close() + if created: + try: + os.remove(filename) + except PermissionError: + pass + raise + finally: + self.encoderinfo = encoderinfo + if open_fp: + fp.close() + + def _attach_default_encoderinfo(self, im: Image) -> dict[str, Any]: + encoderinfo = getattr(self, "encoderinfo", {}) + self.encoderinfo = {**im._default_encoderinfo, **encoderinfo} + return encoderinfo + + def seek(self, frame: int) -> None: + """ + Seeks to the given frame in this sequence file. If you seek + beyond the end of the sequence, the method raises an + ``EOFError`` exception. When a sequence file is opened, the + library automatically seeks to frame 0. + + See :py:meth:`~PIL.Image.Image.tell`. + + If defined, :attr:`~PIL.Image.Image.n_frames` refers to the + number of available frames. + + :param frame: Frame number, starting at 0. + :exception EOFError: If the call attempts to seek beyond the end + of the sequence. + """ + + # overridden by file handlers + if frame != 0: + msg = "no more images in file" + raise EOFError(msg) + + def show(self, title: str | None = None) -> None: + """ + Displays this image. This method is mainly intended for debugging purposes. + + This method calls :py:func:`PIL.ImageShow.show` internally. You can use + :py:func:`PIL.ImageShow.register` to override its default behaviour. + + The image is first saved to a temporary file. By default, it will be in + PNG format. + + On Unix, the image is then opened using the **xdg-open**, **display**, + **gm**, **eog** or **xv** utility, depending on which one can be found. + + On macOS, the image is opened with the native Preview application. + + On Windows, the image is opened with the standard PNG display utility. + + :param title: Optional title to use for the image window, where possible. + """ + + from . import ImageShow + + ImageShow.show(self, title) + + def split(self) -> tuple[Image, ...]: + """ + Split this image into individual bands. This method returns a + tuple of individual image bands from an image. For example, + splitting an "RGB" image creates three new images each + containing a copy of one of the original bands (red, green, + blue). + + If you need only one band, :py:meth:`~PIL.Image.Image.getchannel` + method can be more convenient and faster. + + :returns: A tuple containing bands. + """ + + self.load() + if self.im.bands == 1: + return (self.copy(),) + return tuple(map(self._new, self.im.split())) + + def getchannel(self, channel: int | str) -> Image: + """ + Returns an image containing a single channel of the source image. + + :param channel: What channel to return. Could be index + (0 for "R" channel of "RGB") or channel name + ("A" for alpha channel of "RGBA"). + :returns: An image in "L" mode. + + .. versionadded:: 4.3.0 + """ + self.load() + + if isinstance(channel, str): + try: + channel = self.getbands().index(channel) + except ValueError as e: + msg = f'The image has no channel "{channel}"' + raise ValueError(msg) from e + + return self._new(self.im.getband(channel)) + + def tell(self) -> int: + """ + Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`. + + If defined, :attr:`~PIL.Image.Image.n_frames` refers to the + number of available frames. + + :returns: Frame number, starting with 0. + """ + return 0 + + def thumbnail( + self, + size: tuple[float, float], + resample: Resampling = Resampling.BICUBIC, + reducing_gap: float | None = 2.0, + ) -> None: + """ + Make this image into a thumbnail. This method modifies the + image to contain a thumbnail version of itself, no larger than + the given size. This method calculates an appropriate thumbnail + size to preserve the aspect of the image, calls the + :py:meth:`~PIL.Image.Image.draft` method to configure the file reader + (where applicable), and finally resizes the image. + + Note that this function modifies the :py:class:`~PIL.Image.Image` + object in place. If you need to use the full resolution image as well, + apply this method to a :py:meth:`~PIL.Image.Image.copy` of the original + image. + + :param size: The requested size in pixels, as a 2-tuple: + (width, height). + :param resample: Optional resampling filter. This can be one + of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, + :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`, + :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`. + If omitted, it defaults to :py:data:`Resampling.BICUBIC`. + (was :py:data:`Resampling.NEAREST` prior to version 2.5.0). + See: :ref:`concept-filters`. + :param reducing_gap: Apply optimization by resizing the image + in two steps. First, reducing the image by integer times + using :py:meth:`~PIL.Image.Image.reduce` or + :py:meth:`~PIL.Image.Image.draft` for JPEG images. + Second, resizing using regular resampling. The last step + changes size no less than by ``reducing_gap`` times. + ``reducing_gap`` may be None (no first step is performed) + or should be greater than 1.0. The bigger ``reducing_gap``, + the closer the result to the fair resampling. + The smaller ``reducing_gap``, the faster resizing. + With ``reducing_gap`` greater or equal to 3.0, the result is + indistinguishable from fair resampling in most cases. + The default value is 2.0 (very close to fair resampling + while still being faster in many cases). + :returns: None + """ + + provided_size = tuple(map(math.floor, size)) + + def preserve_aspect_ratio() -> tuple[int, int] | None: + def round_aspect(number: float, key: Callable[[int], float]) -> int: + return max(min(math.floor(number), math.ceil(number), key=key), 1) + + x, y = provided_size + if x >= self.width and y >= self.height: + return None + + aspect = self.width / self.height + if x / y >= aspect: + x = round_aspect(y * aspect, key=lambda n: abs(aspect - n / y)) + else: + y = round_aspect( + x / aspect, key=lambda n: 0 if n == 0 else abs(aspect - x / n) + ) + return x, y + + preserved_size = preserve_aspect_ratio() + if preserved_size is None: + return + final_size = preserved_size + + box = None + if reducing_gap is not None: + res = self.draft( + None, (int(size[0] * reducing_gap), int(size[1] * reducing_gap)) + ) + if res is not None: + box = res[1] + + if self.size != final_size: + im = self.resize(final_size, resample, box=box, reducing_gap=reducing_gap) + + self.im = im.im + self._size = final_size + self._mode = self.im.mode + + self.readonly = 0 + + # FIXME: the different transform methods need further explanation + # instead of bloating the method docs, add a separate chapter. + def transform( + self, + size: tuple[int, int], + method: Transform | ImageTransformHandler | SupportsGetData, + data: Sequence[Any] | None = None, + resample: int = Resampling.NEAREST, + fill: int = 1, + fillcolor: float | tuple[float, ...] | str | None = None, + ) -> Image: + """ + Transforms this image. This method creates a new image with the + given size, and the same mode as the original, and copies data + to the new image using the given transform. + + :param size: The output size in pixels, as a 2-tuple: + (width, height). + :param method: The transformation method. This is one of + :py:data:`Transform.EXTENT` (cut out a rectangular subregion), + :py:data:`Transform.AFFINE` (affine transform), + :py:data:`Transform.PERSPECTIVE` (perspective transform), + :py:data:`Transform.QUAD` (map a quadrilateral to a rectangle), or + :py:data:`Transform.MESH` (map a number of source quadrilaterals + in one operation). + + It may also be an :py:class:`~PIL.Image.ImageTransformHandler` + object:: + + class Example(Image.ImageTransformHandler): + def transform(self, size, data, resample, fill=1): + # Return result + + Implementations of :py:class:`~PIL.Image.ImageTransformHandler` + for some of the :py:class:`Transform` methods are provided + in :py:mod:`~PIL.ImageTransform`. + + It may also be an object with a ``method.getdata`` method + that returns a tuple supplying new ``method`` and ``data`` values:: + + class Example: + def getdata(self): + method = Image.Transform.EXTENT + data = (0, 0, 100, 100) + return method, data + :param data: Extra data to the transformation method. + :param resample: Optional resampling filter. It can be one of + :py:data:`Resampling.NEAREST` (use nearest neighbour), + :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2 + environment), or :py:data:`Resampling.BICUBIC` (cubic spline + interpolation in a 4x4 environment). If omitted, or if the image + has mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`. + See: :ref:`concept-filters`. + :param fill: If ``method`` is an + :py:class:`~PIL.Image.ImageTransformHandler` object, this is one of + the arguments passed to it. Otherwise, it is unused. + :param fillcolor: Optional fill color for the area outside the + transform in the output image. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + if self.mode in ("LA", "RGBA") and resample != Resampling.NEAREST: + return ( + self.convert({"LA": "La", "RGBA": "RGBa"}[self.mode]) + .transform(size, method, data, resample, fill, fillcolor) + .convert(self.mode) + ) + + if isinstance(method, ImageTransformHandler): + return method.transform(size, self, resample=resample, fill=fill) + + if hasattr(method, "getdata"): + # compatibility w. old-style transform objects + method, data = method.getdata() + + if data is None: + msg = "missing method data" + raise ValueError(msg) + + im = new(self.mode, size, fillcolor) + if self.mode == "P" and self.palette: + im.palette = self.palette.copy() + im.info = self.info.copy() + if method == Transform.MESH: + # list of quads + for box, quad in data: + im.__transformer( + box, self, Transform.QUAD, quad, resample, fillcolor is None + ) + else: + im.__transformer( + (0, 0) + size, self, method, data, resample, fillcolor is None + ) + + return im + + def __transformer( + self, + box: tuple[int, int, int, int], + image: Image, + method: Transform, + data: Sequence[float], + resample: int = Resampling.NEAREST, + fill: bool = True, + ) -> None: + w = box[2] - box[0] + h = box[3] - box[1] + + if method == Transform.AFFINE: + data = data[:6] + + elif method == Transform.EXTENT: + # convert extent to an affine transform + x0, y0, x1, y1 = data + xs = (x1 - x0) / w + ys = (y1 - y0) / h + method = Transform.AFFINE + data = (xs, 0, x0, 0, ys, y0) + + elif method == Transform.PERSPECTIVE: + data = data[:8] + + elif method == Transform.QUAD: + # quadrilateral warp. data specifies the four corners + # given as NW, SW, SE, and NE. + nw = data[:2] + sw = data[2:4] + se = data[4:6] + ne = data[6:8] + x0, y0 = nw + As = 1.0 / w + At = 1.0 / h + data = ( + x0, + (ne[0] - x0) * As, + (sw[0] - x0) * At, + (se[0] - sw[0] - ne[0] + x0) * As * At, + y0, + (ne[1] - y0) * As, + (sw[1] - y0) * At, + (se[1] - sw[1] - ne[1] + y0) * As * At, + ) + + else: + msg = "unknown transformation method" + raise ValueError(msg) + + if resample not in ( + Resampling.NEAREST, + Resampling.BILINEAR, + Resampling.BICUBIC, + ): + if resample in (Resampling.BOX, Resampling.HAMMING, Resampling.LANCZOS): + unusable: dict[int, str] = { + Resampling.BOX: "Image.Resampling.BOX", + Resampling.HAMMING: "Image.Resampling.HAMMING", + Resampling.LANCZOS: "Image.Resampling.LANCZOS", + } + msg = unusable[resample] + f" ({resample}) cannot be used." + else: + msg = f"Unknown resampling filter ({resample})." + + filters = [ + f"{filter[1]} ({filter[0]})" + for filter in ( + (Resampling.NEAREST, "Image.Resampling.NEAREST"), + (Resampling.BILINEAR, "Image.Resampling.BILINEAR"), + (Resampling.BICUBIC, "Image.Resampling.BICUBIC"), + ) + ] + msg += f" Use {', '.join(filters[:-1])} or {filters[-1]}" + raise ValueError(msg) + + image.load() + + self.load() + + if image.mode in ("1", "P"): + resample = Resampling.NEAREST + + self.im.transform(box, image.im, method, data, resample, fill) + + def transpose(self, method: Transpose) -> Image: + """ + Transpose image (flip or rotate in 90 degree steps) + + :param method: One of :py:data:`Transpose.FLIP_LEFT_RIGHT`, + :py:data:`Transpose.FLIP_TOP_BOTTOM`, :py:data:`Transpose.ROTATE_90`, + :py:data:`Transpose.ROTATE_180`, :py:data:`Transpose.ROTATE_270`, + :py:data:`Transpose.TRANSPOSE` or :py:data:`Transpose.TRANSVERSE`. + :returns: Returns a flipped or rotated copy of this image. + """ + + self.load() + return self._new(self.im.transpose(method)) + + def effect_spread(self, distance: int) -> Image: + """ + Randomly spread pixels in an image. + + :param distance: Distance to spread pixels. + """ + self.load() + return self._new(self.im.effect_spread(distance)) + + def toqimage(self) -> ImageQt.ImageQt: + """Returns a QImage copy of this image""" + from . import ImageQt + + if not ImageQt.qt_is_installed: + msg = "Qt bindings are not installed" + raise ImportError(msg) + return ImageQt.toqimage(self) + + def toqpixmap(self) -> ImageQt.QPixmap: + """Returns a QPixmap copy of this image""" + from . import ImageQt + + if not ImageQt.qt_is_installed: + msg = "Qt bindings are not installed" + raise ImportError(msg) + return ImageQt.toqpixmap(self) + + +# -------------------------------------------------------------------- +# Abstract handlers. + + +class ImagePointHandler(abc.ABC): + """ + Used as a mixin by point transforms + (for use with :py:meth:`~PIL.Image.Image.point`) + """ + + @abc.abstractmethod + def point(self, im: Image) -> Image: + pass + + +class ImageTransformHandler(abc.ABC): + """ + Used as a mixin by geometry transforms + (for use with :py:meth:`~PIL.Image.Image.transform`) + """ + + @abc.abstractmethod + def transform( + self, + size: tuple[int, int], + image: Image, + **options: Any, + ) -> Image: + pass + + +# -------------------------------------------------------------------- +# Factories + + +def _check_size(size: Any) -> None: + """ + Common check to enforce type and sanity check on size tuples + + :param size: Should be a 2 tuple of (width, height) + :returns: None, or raises a ValueError + """ + + if not isinstance(size, (list, tuple)): + msg = "Size must be a list or tuple" + raise ValueError(msg) + if len(size) != 2: + msg = "Size must be a sequence of length 2" + raise ValueError(msg) + if size[0] < 0 or size[1] < 0: + msg = "Width and height must be >= 0" + raise ValueError(msg) + + +def new( + mode: str, + size: tuple[int, int] | list[int], + color: float | tuple[float, ...] | str | None = 0, +) -> Image: + """ + Creates a new image with the given mode and size. + + :param mode: The mode to use for the new image. See: + :ref:`concept-modes`. + :param size: A 2-tuple, containing (width, height) in pixels. + :param color: What color to use for the image. Default is black. If given, + this should be a single integer or floating point value for single-band + modes, and a tuple for multi-band modes (one value per band). When + creating RGB or HSV images, you can also use color strings as supported + by the ImageColor module. See :ref:`colors` for more information. If the + color is None, the image is not initialised. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + _check_size(size) + + if color is None: + # don't initialize + return Image()._new(core.new(mode, size)) + + if isinstance(color, str): + # css3-style specifier + + from . import ImageColor + + color = ImageColor.getcolor(color, mode) + + im = Image() + if ( + mode == "P" + and isinstance(color, (list, tuple)) + and all(isinstance(i, int) for i in color) + ): + color_ints: tuple[int, ...] = cast(tuple[int, ...], tuple(color)) + if len(color_ints) == 3 or len(color_ints) == 4: + # RGB or RGBA value for a P image + from . import ImagePalette + + im.palette = ImagePalette.ImagePalette() + color = im.palette.getcolor(color_ints) + return im._new(core.fill(mode, size, color)) + + +def frombytes( + mode: str, + size: tuple[int, int], + data: bytes | bytearray | SupportsArrayInterface, + decoder_name: str = "raw", + *args: Any, +) -> Image: + """ + Creates a copy of an image memory from pixel data in a buffer. + + In its simplest form, this function takes three arguments + (mode, size, and unpacked pixel data). + + You can also use any pixel decoder supported by PIL. For more + information on available decoders, see the section + :ref:`Writing Your Own File Codec `. + + Note that this function decodes pixel data only, not entire images. + If you have an entire image in a string, wrap it in a + :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load + it. + + :param mode: The image mode. See: :ref:`concept-modes`. + :param size: The image size. + :param data: A byte buffer containing raw data for the given mode. + :param decoder_name: What decoder to use. + :param args: Additional parameters for the given decoder. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + _check_size(size) + + im = new(mode, size) + if im.width != 0 and im.height != 0: + decoder_args: Any = args + if len(decoder_args) == 1 and isinstance(decoder_args[0], tuple): + # may pass tuple instead of argument list + decoder_args = decoder_args[0] + + if decoder_name == "raw" and decoder_args == (): + decoder_args = mode + + im.frombytes(data, decoder_name, decoder_args) + return im + + +def frombuffer( + mode: str, + size: tuple[int, int], + data: bytes | SupportsArrayInterface, + decoder_name: str = "raw", + *args: Any, +) -> Image: + """ + Creates an image memory referencing pixel data in a byte buffer. + + This function is similar to :py:func:`~PIL.Image.frombytes`, but uses data + in the byte buffer, where possible. This means that changes to the + original buffer object are reflected in this image). Not all modes can + share memory; supported modes include "L", "RGBX", "RGBA", and "CMYK". + + Note that this function decodes pixel data only, not entire images. + If you have an entire image file in a string, wrap it in a + :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it. + + The default parameters used for the "raw" decoder differs from that used for + :py:func:`~PIL.Image.frombytes`. This is a bug, and will probably be fixed in a + future release. The current release issues a warning if you do this; to disable + the warning, you should provide the full set of parameters. See below for details. + + :param mode: The image mode. See: :ref:`concept-modes`. + :param size: The image size. + :param data: A bytes or other buffer object containing raw + data for the given mode. + :param decoder_name: What decoder to use. + :param args: Additional parameters for the given decoder. For the + default encoder ("raw"), it's recommended that you provide the + full set of parameters:: + + frombuffer(mode, size, data, "raw", mode, 0, 1) + + :returns: An :py:class:`~PIL.Image.Image` object. + + .. versionadded:: 1.1.4 + """ + + _check_size(size) + + # may pass tuple instead of argument list + if len(args) == 1 and isinstance(args[0], tuple): + args = args[0] + + if decoder_name == "raw": + if args == (): + args = mode, 0, 1 + if args[0] in _MAPMODES: + im = new(mode, (0, 0)) + im = im._new(core.map_buffer(data, size, decoder_name, 0, args)) + if mode == "P": + from . import ImagePalette + + im.palette = ImagePalette.ImagePalette("RGB", im.im.getpalette("RGB")) + im.readonly = 1 + return im + + return frombytes(mode, size, data, decoder_name, args) + + +class SupportsArrayInterface(Protocol): + """ + An object that has an ``__array_interface__`` dictionary. + """ + + @property + def __array_interface__(self) -> dict[str, Any]: + raise NotImplementedError() + + +class SupportsArrowArrayInterface(Protocol): + """ + An object that has an ``__arrow_c_array__`` method corresponding to the arrow c + data interface. + """ + + def __arrow_c_array__( + self, requested_schema: "PyCapsule" = None # type: ignore[name-defined] # noqa: F821, UP037 + ) -> tuple["PyCapsule", "PyCapsule"]: # type: ignore[name-defined] # noqa: F821, UP037 + raise NotImplementedError() + + +def fromarray(obj: SupportsArrayInterface, mode: str | None = None) -> Image: + """ + Creates an image memory from an object exporting the array interface + (using the buffer protocol):: + + from PIL import Image + import numpy as np + a = np.zeros((5, 5)) + im = Image.fromarray(a) + + If ``obj`` is not contiguous, then the ``tobytes`` method is called + and :py:func:`~PIL.Image.frombuffer` is used. + + In the case of NumPy, be aware that Pillow modes do not always correspond + to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels, + 32-bit signed integer pixels, and 32-bit floating point pixels. + + Pillow images can also be converted to arrays:: + + from PIL import Image + import numpy as np + im = Image.open("hopper.jpg") + a = np.asarray(im) + + When converting Pillow images to arrays however, only pixel values are + transferred. This means that P and PA mode images will lose their palette. + + :param obj: Object with array interface + :param mode: Optional mode to use when reading ``obj``. Since pixel values do not + contain information about palettes or color spaces, this can be used to place + grayscale L mode data within a P mode image, or read RGB data as YCbCr for + example. + + See: :ref:`concept-modes` for general information about modes. + :returns: An image object. + + .. versionadded:: 1.1.6 + """ + arr = obj.__array_interface__ + shape = arr["shape"] + ndim = len(shape) + strides = arr.get("strides", None) + try: + typekey = (1, 1) + shape[2:], arr["typestr"] + except KeyError as e: + if mode is not None: + typekey = None + color_modes: list[str] = [] + else: + msg = "Cannot handle this data type" + raise TypeError(msg) from e + if typekey is not None: + try: + typemode, rawmode, color_modes = _fromarray_typemap[typekey] + except KeyError as e: + typekey_shape, typestr = typekey + msg = f"Cannot handle this data type: {typekey_shape}, {typestr}" + raise TypeError(msg) from e + if mode is not None: + if mode != typemode and mode not in color_modes: + deprecate("'mode' parameter for changing data types", 13) + rawmode = mode + else: + mode = typemode + if mode in ["1", "L", "I", "P", "F"]: + ndmax = 2 + elif mode == "RGB": + ndmax = 3 + else: + ndmax = 4 + if ndim > ndmax: + msg = f"Too many dimensions: {ndim} > {ndmax}." + raise ValueError(msg) + + size = 1 if ndim == 1 else shape[1], shape[0] + if strides is not None: + if hasattr(obj, "tobytes"): + obj = obj.tobytes() + elif hasattr(obj, "tostring"): + obj = obj.tostring() + else: + msg = "'strides' requires either tobytes() or tostring()" + raise ValueError(msg) + + return frombuffer(mode, size, obj, "raw", rawmode, 0, 1) + + +def fromarrow( + obj: SupportsArrowArrayInterface, mode: str, size: tuple[int, int] +) -> Image: + """Creates an image with zero-copy shared memory from an object exporting + the arrow_c_array interface protocol:: + + from PIL import Image + import pyarrow as pa + arr = pa.array([0]*(5*5*4), type=pa.uint8()) + im = Image.fromarrow(arr, 'RGBA', (5, 5)) + + If the data representation of the ``obj`` is not compatible with + Pillow internal storage, a ValueError is raised. + + Pillow images can also be converted to Arrow objects:: + + from PIL import Image + import pyarrow as pa + im = Image.open('hopper.jpg') + arr = pa.array(im) + + As with array support, when converting Pillow images to arrays, + only pixel values are transferred. This means that P and PA mode + images will lose their palette. + + :param obj: Object with an arrow_c_array interface + :param mode: Image mode. + :param size: Image size. This must match the storage of the arrow object. + :returns: An Image object + + Note that according to the Arrow spec, both the producer and the + consumer should consider the exported array to be immutable, as + unsynchronized updates will potentially cause inconsistent data. + + See: :ref:`arrow-support` for more detailed information + + .. versionadded:: 11.2.1 + + """ + if not hasattr(obj, "__arrow_c_array__"): + msg = "arrow_c_array interface not found" + raise ValueError(msg) + + schema_capsule, array_capsule = obj.__arrow_c_array__() + _im = core.new_arrow(mode, size, schema_capsule, array_capsule) + if _im: + return Image()._new(_im) + + msg = "new_arrow returned None without an exception" + raise ValueError(msg) + + +def fromqimage(im: ImageQt.QImage) -> ImageFile.ImageFile: + """Creates an image instance from a QImage image""" + from . import ImageQt + + if not ImageQt.qt_is_installed: + msg = "Qt bindings are not installed" + raise ImportError(msg) + return ImageQt.fromqimage(im) + + +def fromqpixmap(im: ImageQt.QPixmap) -> ImageFile.ImageFile: + """Creates an image instance from a QPixmap image""" + from . import ImageQt + + if not ImageQt.qt_is_installed: + msg = "Qt bindings are not installed" + raise ImportError(msg) + return ImageQt.fromqpixmap(im) + + +_fromarray_typemap = { + # (shape, typestr) => mode, rawmode, color modes + # first two members of shape are set to one + ((1, 1), "|b1"): ("1", "1;8", []), + ((1, 1), "|u1"): ("L", "L", ["P"]), + ((1, 1), "|i1"): ("I", "I;8", []), + ((1, 1), "u2"): ("I", "I;16B", []), + ((1, 1), "i2"): ("I", "I;16BS", []), + ((1, 1), "u4"): ("I", "I;32B", []), + ((1, 1), "i4"): ("I", "I;32BS", []), + ((1, 1), "f4"): ("F", "F;32BF", []), + ((1, 1), "f8"): ("F", "F;64BF", []), + ((1, 1, 2), "|u1"): ("LA", "LA", ["La", "PA"]), + ((1, 1, 3), "|u1"): ("RGB", "RGB", ["YCbCr", "LAB", "HSV"]), + ((1, 1, 4), "|u1"): ("RGBA", "RGBA", ["RGBa", "RGBX", "CMYK"]), + # shortcuts: + ((1, 1), f"{_ENDIAN}i4"): ("I", "I", []), + ((1, 1), f"{_ENDIAN}f4"): ("F", "F", []), +} + + +def _decompression_bomb_check(size: tuple[int, int]) -> None: + if MAX_IMAGE_PIXELS is None: + return + + pixels = max(1, size[0]) * max(1, size[1]) + + if pixels > 2 * MAX_IMAGE_PIXELS: + msg = ( + f"Image size ({pixels} pixels) exceeds limit of {2 * MAX_IMAGE_PIXELS} " + "pixels, could be decompression bomb DOS attack." + ) + raise DecompressionBombError(msg) + + if pixels > MAX_IMAGE_PIXELS: + warnings.warn( + f"Image size ({pixels} pixels) exceeds limit of {MAX_IMAGE_PIXELS} pixels, " + "could be decompression bomb DOS attack.", + DecompressionBombWarning, + ) + + +def open( + fp: StrOrBytesPath | IO[bytes], + mode: Literal["r"] = "r", + formats: list[str] | tuple[str, ...] | None = None, +) -> ImageFile.ImageFile: + """ + Opens and identifies the given image file. + + This is a lazy operation; this function identifies the file, but + the file remains open and the actual image data is not read from + the file until you try to process the data (or call the + :py:meth:`~PIL.Image.Image.load` method). See + :py:func:`~PIL.Image.new`. See :ref:`file-handling`. + + :param fp: A filename (string), os.PathLike object or a file object. + The file object must implement ``file.read``, + ``file.seek``, and ``file.tell`` methods, + and be opened in binary mode. The file object will also seek to zero + before reading. + :param mode: The mode. If given, this argument must be "r". + :param formats: A list or tuple of formats to attempt to load the file in. + This can be used to restrict the set of formats checked. + Pass ``None`` to try all supported formats. You can print the set of + available formats by running ``python3 -m PIL`` or using + the :py:func:`PIL.features.pilinfo` function. + :returns: An :py:class:`~PIL.Image.Image` object. + :exception FileNotFoundError: If the file cannot be found. + :exception PIL.UnidentifiedImageError: If the image cannot be opened and + identified. + :exception ValueError: If the ``mode`` is not "r", or if a ``StringIO`` + instance is used for ``fp``. + :exception TypeError: If ``formats`` is not ``None``, a list or a tuple. + """ + + if mode != "r": + msg = f"bad mode {repr(mode)}" # type: ignore[unreachable] + raise ValueError(msg) + elif isinstance(fp, io.StringIO): + msg = ( # type: ignore[unreachable] + "StringIO cannot be used to open an image. " + "Binary data must be used instead." + ) + raise ValueError(msg) + + if formats is None: + formats = ID + elif not isinstance(formats, (list, tuple)): + msg = "formats must be a list or tuple" # type: ignore[unreachable] + raise TypeError(msg) + + exclusive_fp = False + filename: str | bytes = "" + if is_path(fp): + filename = os.fspath(fp) + fp = builtins.open(filename, "rb") + exclusive_fp = True + else: + fp = cast(IO[bytes], fp) + + try: + fp.seek(0) + except (AttributeError, io.UnsupportedOperation): + fp = io.BytesIO(fp.read()) + exclusive_fp = True + + prefix = fp.read(16) + + # Try to import just the plugin needed for this file extension + # before falling back to preinit() which imports common plugins + ext = os.path.splitext(filename)[1] if filename else "" + if not _import_plugin_for_extension(ext): + preinit() + + warning_messages: list[str] = [] + + def _open_core( + fp: IO[bytes], + filename: str | bytes, + prefix: bytes, + formats: list[str] | tuple[str, ...], + ) -> ImageFile.ImageFile | None: + for i in formats: + i = i.upper() + if i not in OPEN: + init() + try: + factory, accept = OPEN[i] + result = not accept or accept(prefix) + if isinstance(result, str): + warning_messages.append(result) + elif result: + fp.seek(0) + im = factory(fp, filename) + _decompression_bomb_check(im.size) + return im + except (SyntaxError, IndexError, TypeError, struct.error) as e: + if WARN_POSSIBLE_FORMATS: + warning_messages.append(i + " opening failed. " + str(e)) + except BaseException: + if exclusive_fp: + fp.close() + raise + return None + + im = _open_core(fp, filename, prefix, formats) + + if im is None and formats is ID: + # Try preinit (few common plugins) then init (all plugins) + for loader in (preinit, init): + checked_formats = ID.copy() + loader() + if formats != checked_formats: + im = _open_core( + fp, + filename, + prefix, + tuple(f for f in formats if f not in checked_formats), + ) + if im is not None: + break + + if im: + im._exclusive_fp = exclusive_fp + return im + + if exclusive_fp: + fp.close() + for message in warning_messages: + warnings.warn(message) + msg = "cannot identify image file %r" % (filename if filename else fp) + raise UnidentifiedImageError(msg) + + +# +# Image processing. + + +def alpha_composite(im1: Image, im2: Image) -> Image: + """ + Alpha composite im2 over im1. + + :param im1: The first image. Must have mode RGBA or LA. + :param im2: The second image. Must have the same mode and size as the first image. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + im1.load() + im2.load() + return im1._new(core.alpha_composite(im1.im, im2.im)) + + +def blend(im1: Image, im2: Image, alpha: float) -> Image: + """ + Creates a new image by interpolating between two input images, using + a constant alpha:: + + out = image1 * (1.0 - alpha) + image2 * alpha + + :param im1: The first image. + :param im2: The second image. Must have the same mode and size as + the first image. + :param alpha: The interpolation alpha factor. If alpha is 0.0, a + copy of the first image is returned. If alpha is 1.0, a copy of + the second image is returned. There are no restrictions on the + alpha value. If necessary, the result is clipped to fit into + the allowed output range. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + im1.load() + im2.load() + return im1._new(core.blend(im1.im, im2.im, alpha)) + + +def composite(image1: Image, image2: Image, mask: Image) -> Image: + """ + Create composite image by blending images using a transparency mask. + + :param image1: The first image. + :param image2: The second image. Must have the same mode and + size as the first image. + :param mask: A mask image. This image can have mode + "1", "L", or "RGBA", and must have the same size as the + other two images. + """ + + image = image2.copy() + image.paste(image1, None, mask) + return image + + +def eval(image: Image, *args: Callable[[int], float]) -> Image: + """ + Applies the function (which should take one argument) to each pixel + in the given image. If the image has more than one band, the same + function is applied to each band. Note that the function is + evaluated once for each possible pixel value, so you cannot use + random components or other generators. + + :param image: The input image. + :param function: A function object, taking one integer argument. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + return image.point(args[0]) + + +def merge(mode: str, bands: Sequence[Image]) -> Image: + """ + Merge a set of single band images into a new multiband image. + + :param mode: The mode to use for the output image. See: + :ref:`concept-modes`. + :param bands: A sequence containing one single-band image for + each band in the output image. All bands must have the + same size. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + + if getmodebands(mode) != len(bands) or "*" in mode: + msg = "wrong number of bands" + raise ValueError(msg) + for band in bands[1:]: + if band.mode != getmodetype(mode): + msg = "mode mismatch" + raise ValueError(msg) + if band.size != bands[0].size: + msg = "size mismatch" + raise ValueError(msg) + for band in bands: + band.load() + return bands[0]._new(core.merge(mode, *[b.im for b in bands])) + + +# -------------------------------------------------------------------- +# Plugin registry + + +def register_open( + id: str, + factory: ( + Callable[[IO[bytes], str | bytes], ImageFile.ImageFile] + | type[ImageFile.ImageFile] + ), + accept: Callable[[bytes], bool | str] | None = None, +) -> None: + """ + Register an image file plugin. This function should not be used + in application code. + + :param id: An image format identifier. + :param factory: An image file factory method. + :param accept: An optional function that can be used to quickly + reject images having another format. + """ + id = id.upper() + if id not in ID: + ID.append(id) + OPEN[id] = factory, accept + + +def register_mime(id: str, mimetype: str) -> None: + """ + Registers an image MIME type by populating ``Image.MIME``. This function + should not be used in application code. + + ``Image.MIME`` provides a mapping from image format identifiers to mime + formats, but :py:meth:`~PIL.ImageFile.ImageFile.get_format_mimetype` can + provide a different result for specific images. + + :param id: An image format identifier. + :param mimetype: The image MIME type for this format. + """ + MIME[id.upper()] = mimetype + + +def register_save( + id: str, driver: Callable[[Image, IO[bytes], str | bytes], None] +) -> None: + """ + Registers an image save function. This function should not be + used in application code. + + :param id: An image format identifier. + :param driver: A function to save images in this format. + """ + SAVE[id.upper()] = driver + + +def register_save_all( + id: str, driver: Callable[[Image, IO[bytes], str | bytes], None] +) -> None: + """ + Registers an image function to save all the frames + of a multiframe format. This function should not be + used in application code. + + :param id: An image format identifier. + :param driver: A function to save images in this format. + """ + SAVE_ALL[id.upper()] = driver + + +def register_extension(id: str, extension: str) -> None: + """ + Registers an image extension. This function should not be + used in application code. + + :param id: An image format identifier. + :param extension: An extension used for this format. + """ + EXTENSION[extension.lower()] = id.upper() + + +def register_extensions(id: str, extensions: list[str]) -> None: + """ + Registers image extensions. This function should not be + used in application code. + + :param id: An image format identifier. + :param extensions: A list of extensions used for this format. + """ + for extension in extensions: + register_extension(id, extension) + + +def registered_extensions() -> dict[str, str]: + """ + Returns a dictionary containing all file extensions belonging + to registered plugins + """ + init() + return EXTENSION + + +def register_decoder(name: str, decoder: type[ImageFile.PyDecoder]) -> None: + """ + Registers an image decoder. This function should not be + used in application code. + + :param name: The name of the decoder + :param decoder: An ImageFile.PyDecoder object + + .. versionadded:: 4.1.0 + """ + DECODERS[name] = decoder + + +def register_encoder(name: str, encoder: type[ImageFile.PyEncoder]) -> None: + """ + Registers an image encoder. This function should not be + used in application code. + + :param name: The name of the encoder + :param encoder: An ImageFile.PyEncoder object + + .. versionadded:: 4.1.0 + """ + ENCODERS[name] = encoder + + +# -------------------------------------------------------------------- +# Simple display support. + + +def _show(image: Image, **options: Any) -> None: + from . import ImageShow + + deprecate("Image._show", 13, "ImageShow.show") + ImageShow.show(image, **options) + + +# -------------------------------------------------------------------- +# Effects + + +def effect_mandelbrot( + size: tuple[int, int], extent: tuple[float, float, float, float], quality: int +) -> Image: + """ + Generate a Mandelbrot set covering the given extent. + + :param size: The requested size in pixels, as a 2-tuple: + (width, height). + :param extent: The extent to cover, as a 4-tuple: + (x0, y0, x1, y1). + :param quality: Quality. + """ + return Image()._new(core.effect_mandelbrot(size, extent, quality)) + + +def effect_noise(size: tuple[int, int], sigma: float) -> Image: + """ + Generate Gaussian noise centered around 128. + + :param size: The requested size in pixels, as a 2-tuple: + (width, height). + :param sigma: Standard deviation of noise. + """ + return Image()._new(core.effect_noise(size, sigma)) + + +def linear_gradient(mode: str) -> Image: + """ + Generate 256x256 linear gradient from black to white, top to bottom. + + :param mode: Input mode. + """ + return Image()._new(core.linear_gradient(mode)) + + +def radial_gradient(mode: str) -> Image: + """ + Generate 256x256 radial gradient from black to white, centre to edge. + + :param mode: Input mode. + """ + return Image()._new(core.radial_gradient(mode)) + + +# -------------------------------------------------------------------- +# Resources + + +def _apply_env_variables(env: dict[str, str] | None = None) -> None: + env_dict = env if env is not None else os.environ + + for var_name, setter in [ + ("PILLOW_ALIGNMENT", core.set_alignment), + ("PILLOW_BLOCK_SIZE", core.set_block_size), + ("PILLOW_BLOCKS_MAX", core.set_blocks_max), + ]: + if var_name not in env_dict: + continue + + var = env_dict[var_name].lower() + + units = 1 + for postfix, mul in [("k", 1024), ("m", 1024 * 1024)]: + if var.endswith(postfix): + units = mul + var = var[: -len(postfix)] + + try: + var_int = int(var) * units + except ValueError: + warnings.warn(f"{var_name} is not int") + continue + + try: + setter(var_int) + except ValueError as e: + warnings.warn(f"{var_name}: {e}") + + +_apply_env_variables() +atexit.register(core.clear_cache) + + +if TYPE_CHECKING: + _ExifBase = MutableMapping[int, Any] +else: + _ExifBase = MutableMapping + + +class Exif(_ExifBase): + """ + This class provides read and write access to EXIF image data:: + + from PIL import Image + im = Image.open("exif.png") + exif = im.getexif() # Returns an instance of this class + + Information can be read and written, iterated over or deleted:: + + print(exif[274]) # 1 + exif[274] = 2 + for k, v in exif.items(): + print("Tag", k, "Value", v) # Tag 274 Value 2 + del exif[274] + + To access information beyond IFD0, :py:meth:`~PIL.Image.Exif.get_ifd` + returns a dictionary:: + + from PIL import ExifTags + im = Image.open("exif_gps.jpg") + exif = im.getexif() + gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo) + print(gps_ifd) + + Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``, + ``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``. + + :py:mod:`~PIL.ExifTags` also has enum classes to provide names for data:: + + print(exif[ExifTags.Base.Software]) # PIL + print(gps_ifd[ExifTags.GPS.GPSDateStamp]) # 1999:99:99 99:99:99 + """ + + endian: str | None = None + bigtiff = False + _loaded = False + + def __init__(self) -> None: + self._data: dict[int, Any] = {} + self._hidden_data: dict[int, Any] = {} + self._ifds: dict[int, dict[int, Any]] = {} + self._info: TiffImagePlugin.ImageFileDirectory_v2 | None = None + self._loaded_exif: bytes | None = None + + def _fixup(self, value: Any) -> Any: + try: + if len(value) == 1 and isinstance(value, tuple): + return value[0] + except Exception: + pass + return value + + def _fixup_dict(self, src_dict: dict[int, Any]) -> dict[int, Any]: + # Helper function + # returns a dict with any single item tuples/lists as individual values + return {k: self._fixup(v) for k, v in src_dict.items()} + + def _get_ifd_dict( + self, offset: int, group: int | None = None + ) -> dict[int, Any] | None: + try: + # an offset pointer to the location of the nested embedded IFD. + # It should be a long, but may be corrupted. + self.fp.seek(offset) + except (KeyError, TypeError): + return None + else: + from . import TiffImagePlugin + + info = TiffImagePlugin.ImageFileDirectory_v2(self.head, group=group) + info.load(self.fp) + return self._fixup_dict(dict(info)) + + def _get_head(self) -> bytes: + version = b"\x2b" if self.bigtiff else b"\x2a" + if self.endian == "<": + head = b"II" + version + b"\x00" + o32le(8) + else: + head = b"MM\x00" + version + o32be(8) + if self.bigtiff: + head += o32le(8) if self.endian == "<" else o32be(8) + head += b"\x00\x00\x00\x00" + return head + + def load(self, data: bytes) -> None: + # Extract EXIF information. This is highly experimental, + # and is likely to be replaced with something better in a future + # version. + + # The EXIF record consists of a TIFF file embedded in a JPEG + # application marker (!). + if data == self._loaded_exif: + return + self._loaded_exif = data + self._data.clear() + self._hidden_data.clear() + self._ifds.clear() + while data and data.startswith(b"Exif\x00\x00"): + data = data[6:] + if not data: + self._info = None + return + + self.fp: IO[bytes] = io.BytesIO(data) + self.head = self.fp.read(8) + # process dictionary + from . import TiffImagePlugin + + self._info = TiffImagePlugin.ImageFileDirectory_v2(self.head) + self.endian = self._info._endian + self.fp.seek(self._info.next) + self._info.load(self.fp) + + def load_from_fp(self, fp: IO[bytes], offset: int | None = None) -> None: + self._loaded_exif = None + self._data.clear() + self._hidden_data.clear() + self._ifds.clear() + + # process dictionary + from . import TiffImagePlugin + + self.fp = fp + if offset is not None: + self.head = self._get_head() + else: + self.head = self.fp.read(8) + self._info = TiffImagePlugin.ImageFileDirectory_v2(self.head) + if self.endian is None: + self.endian = self._info._endian + if offset is None: + offset = self._info.next + self.fp.tell() + self.fp.seek(offset) + self._info.load(self.fp) + + def _get_merged_dict(self) -> dict[int, Any]: + merged_dict = dict(self) + + # get EXIF extension + if ExifTags.IFD.Exif in self: + ifd = self._get_ifd_dict(self[ExifTags.IFD.Exif], ExifTags.IFD.Exif) + if ifd: + merged_dict.update(ifd) + + # GPS + if ExifTags.IFD.GPSInfo in self: + merged_dict[ExifTags.IFD.GPSInfo] = self._get_ifd_dict( + self[ExifTags.IFD.GPSInfo], ExifTags.IFD.GPSInfo + ) + + return merged_dict + + def tobytes(self, offset: int = 8) -> bytes: + from . import TiffImagePlugin + + head = self._get_head() + ifd = TiffImagePlugin.ImageFileDirectory_v2(ifh=head) + for tag, ifd_dict in self._ifds.items(): + if tag not in self: + ifd[tag] = ifd_dict + for tag, value in self.items(): + if tag in [ + ExifTags.IFD.Exif, + ExifTags.IFD.GPSInfo, + ] and not isinstance(value, dict): + value = self.get_ifd(tag) + if ( + tag == ExifTags.IFD.Exif + and ExifTags.IFD.Interop in value + and not isinstance(value[ExifTags.IFD.Interop], dict) + ): + value = value.copy() + value[ExifTags.IFD.Interop] = self.get_ifd(ExifTags.IFD.Interop) + ifd[tag] = value + return b"Exif\x00\x00" + head + ifd.tobytes(offset) + + def get_ifd(self, tag: int) -> dict[int, Any]: + if tag not in self._ifds: + if tag == ExifTags.IFD.IFD1: + if self._info is not None and self._info.next != 0: + ifd = self._get_ifd_dict(self._info.next) + if ifd is not None: + self._ifds[tag] = ifd + elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]: + offset = self._hidden_data.get(tag, self.get(tag)) + if offset is not None: + ifd = self._get_ifd_dict(offset, tag) + if ifd is not None: + self._ifds[tag] = ifd + elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.MakerNote]: + if ExifTags.IFD.Exif not in self._ifds: + self.get_ifd(ExifTags.IFD.Exif) + tag_data = self._ifds[ExifTags.IFD.Exif][tag] + if tag == ExifTags.IFD.MakerNote: + from .TiffImagePlugin import ImageFileDirectory_v2 + + try: + if tag_data.startswith(b"FUJIFILM"): + ifd_offset = i32le(tag_data, 8) + ifd_data = tag_data[ifd_offset:] + + makernote = {} + for i in range(struct.unpack(" 4: + (offset,) = struct.unpack("H", tag_data[:2])[0]): + ifd_tag, typ, count, data = struct.unpack( + ">HHL4s", tag_data[i * 12 + 2 : (i + 1) * 12 + 2] + ) + if ifd_tag == 0x1101: + # CameraInfo + (offset,) = struct.unpack(">L", data) + self.fp.seek(offset) + + camerainfo: dict[str, int | bytes] = { + "ModelID": self.fp.read(4) + } + + self.fp.read(4) + # Seconds since 2000 + camerainfo["TimeStamp"] = i32le(self.fp.read(12)) + + self.fp.read(4) + camerainfo["InternalSerialNumber"] = self.fp.read(4) + + self.fp.read(12) + parallax = self.fp.read(4) + handler = ImageFileDirectory_v2._load_dispatch[ + TiffTags.FLOAT + ][1] + camerainfo["Parallax"] = handler( + ImageFileDirectory_v2(), parallax, False + )[0] + + self.fp.read(4) + camerainfo["Category"] = self.fp.read(2) + + makernote = {0x1101: camerainfo} + self._ifds[tag] = makernote + except struct.error: + pass + else: + # Interop + ifd = self._get_ifd_dict(tag_data, tag) + if ifd is not None: + self._ifds[tag] = ifd + ifd = self._ifds.setdefault(tag, {}) + if tag == ExifTags.IFD.Exif and self._hidden_data: + ifd = { + k: v + for (k, v) in ifd.items() + if k not in (ExifTags.IFD.Interop, ExifTags.IFD.MakerNote) + } + return ifd + + def hide_offsets(self) -> None: + for tag in (ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo): + if tag in self: + self._hidden_data[tag] = self[tag] + del self[tag] + + def __str__(self) -> str: + if self._info is not None: + # Load all keys into self._data + for tag in self._info: + self[tag] + + return str(self._data) + + def __len__(self) -> int: + keys = set(self._data) + if self._info is not None: + keys.update(self._info) + return len(keys) + + def __getitem__(self, tag: int) -> Any: + if self._info is not None and tag not in self._data and tag in self._info: + self._data[tag] = self._fixup(self._info[tag]) + del self._info[tag] + return self._data[tag] + + def __contains__(self, tag: object) -> bool: + return tag in self._data or (self._info is not None and tag in self._info) + + def __setitem__(self, tag: int, value: Any) -> None: + if self._info is not None and tag in self._info: + del self._info[tag] + self._data[tag] = value + + def __delitem__(self, tag: int) -> None: + if self._info is not None and tag in self._info: + del self._info[tag] + else: + del self._data[tag] + if tag in self._ifds: + del self._ifds[tag] + + def __iter__(self) -> Iterator[int]: + keys = set(self._data) + if self._info is not None: + keys.update(self._info) + return iter(keys) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageChops.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageChops.py new file mode 100644 index 0000000000000000000000000000000000000000..4ec5fafa8e716f3358d38606a1f775387827b10d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageChops.py @@ -0,0 +1,311 @@ +# +# The Python Imaging Library. +# $Id$ +# +# standard channel operations +# +# History: +# 1996-03-24 fl Created +# 1996-08-13 fl Added logical operations (for "1" images) +# 2000-10-12 fl Added offset method (from Image.py) +# +# Copyright (c) 1997-2000 by Secret Labs AB +# Copyright (c) 1996-2000 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# + +from __future__ import annotations + +from . import Image + + +def constant(image: Image.Image, value: int) -> Image.Image: + """Fill a channel with a given gray level. + + :rtype: :py:class:`~PIL.Image.Image` + """ + + return Image.new("L", image.size, value) + + +def duplicate(image: Image.Image) -> Image.Image: + """Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`. + + :rtype: :py:class:`~PIL.Image.Image` + """ + + return image.copy() + + +def invert(image: Image.Image) -> Image.Image: + """ + Invert an image (channel). :: + + out = MAX - image + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image.load() + return image._new(image.im.chop_invert()) + + +def lighter(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Compares the two images, pixel by pixel, and returns a new image containing + the lighter values. :: + + out = max(image1, image2) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_lighter(image2.im)) + + +def darker(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Compares the two images, pixel by pixel, and returns a new image containing + the darker values. :: + + out = min(image1, image2) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_darker(image2.im)) + + +def difference(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Returns the absolute value of the pixel-by-pixel difference between the two + images. :: + + out = abs(image1 - image2) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_difference(image2.im)) + + +def multiply(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Superimposes two images on top of each other. + + If you multiply an image with a solid black image, the result is black. If + you multiply with a solid white image, the image is unaffected. :: + + out = image1 * image2 / MAX + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_multiply(image2.im)) + + +def screen(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Superimposes two inverted images on top of each other. :: + + out = MAX - ((MAX - image1) * (MAX - image2) / MAX) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_screen(image2.im)) + + +def soft_light(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Superimposes two images on top of each other using the Soft Light algorithm + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_soft_light(image2.im)) + + +def hard_light(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Superimposes two images on top of each other using the Hard Light algorithm + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_hard_light(image2.im)) + + +def overlay(image1: Image.Image, image2: Image.Image) -> Image.Image: + """ + Superimposes two images on top of each other using the Overlay algorithm + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_overlay(image2.im)) + + +def add( + image1: Image.Image, image2: Image.Image, scale: float = 1.0, offset: float = 0 +) -> Image.Image: + """ + Adds two images, dividing the result by scale and adding the + offset. If omitted, scale defaults to 1.0, and offset to 0.0. :: + + out = ((image1 + image2) / scale + offset) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_add(image2.im, scale, offset)) + + +def subtract( + image1: Image.Image, image2: Image.Image, scale: float = 1.0, offset: float = 0 +) -> Image.Image: + """ + Subtracts two images, dividing the result by scale and adding the offset. + If omitted, scale defaults to 1.0, and offset to 0.0. :: + + out = ((image1 - image2) / scale + offset) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_subtract(image2.im, scale, offset)) + + +def add_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image: + """Add two images, without clipping the result. :: + + out = ((image1 + image2) % MAX) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_add_modulo(image2.im)) + + +def subtract_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image: + """Subtract two images, without clipping the result. :: + + out = ((image1 - image2) % MAX) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_subtract_modulo(image2.im)) + + +def logical_and(image1: Image.Image, image2: Image.Image) -> Image.Image: + """Logical AND between two images. + + Both of the images must have mode "1". If you would like to perform a + logical AND on an image with a mode other than "1", try + :py:meth:`~PIL.ImageChops.multiply` instead, using a black-and-white mask + as the second image. :: + + out = ((image1 and image2) % MAX) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_and(image2.im)) + + +def logical_or(image1: Image.Image, image2: Image.Image) -> Image.Image: + """Logical OR between two images. + + Both of the images must have mode "1". :: + + out = ((image1 or image2) % MAX) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_or(image2.im)) + + +def logical_xor(image1: Image.Image, image2: Image.Image) -> Image.Image: + """Logical XOR between two images. + + Both of the images must have mode "1". :: + + out = ((bool(image1) != bool(image2)) % MAX) + + :rtype: :py:class:`~PIL.Image.Image` + """ + + image1.load() + image2.load() + return image1._new(image1.im.chop_xor(image2.im)) + + +def blend(image1: Image.Image, image2: Image.Image, alpha: float) -> Image.Image: + """Blend images using constant transparency weight. Alias for + :py:func:`PIL.Image.blend`. + + :rtype: :py:class:`~PIL.Image.Image` + """ + + return Image.blend(image1, image2, alpha) + + +def composite( + image1: Image.Image, image2: Image.Image, mask: Image.Image +) -> Image.Image: + """Create composite using transparency mask. Alias for + :py:func:`PIL.Image.composite`. + + :rtype: :py:class:`~PIL.Image.Image` + """ + + return Image.composite(image1, image2, mask) + + +def offset(image: Image.Image, xoffset: int, yoffset: int | None = None) -> Image.Image: + """Returns a copy of the image where data has been offset by the given + distances. Data wraps around the edges. If ``yoffset`` is omitted, it + is assumed to be equal to ``xoffset``. + + :param image: Input image. + :param xoffset: The horizontal distance. + :param yoffset: The vertical distance. If omitted, both + distances are set to the same value. + :rtype: :py:class:`~PIL.Image.Image` + """ + + if yoffset is None: + yoffset = xoffset + image.load() + return image._new(image.im.offset(xoffset, yoffset)) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageCms.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageCms.py new file mode 100644 index 0000000000000000000000000000000000000000..d68a2240eb1cd86f883cae54f2ae43d0a2fd86e5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageCms.py @@ -0,0 +1,1076 @@ +# The Python Imaging Library. +# $Id$ + +# Optional color management support, based on Kevin Cazabon's PyCMS +# library. + +# Originally released under LGPL. Graciously donated to PIL in +# March 2009, for distribution under the standard PIL license + +# History: + +# 2009-03-08 fl Added to PIL. + +# Copyright (C) 2002-2003 Kevin Cazabon +# Copyright (c) 2009 by Fredrik Lundh +# Copyright (c) 2013 by Eric Soroos + +# See the README file for information on usage and redistribution. See +# below for the original description. +from __future__ import annotations + +import operator +import sys +from enum import IntEnum, IntFlag +from functools import reduce +from typing import Any, Literal, SupportsFloat, SupportsInt, Union + +from . import Image +from ._deprecate import deprecate +from ._typing import SupportsRead + +try: + from . import _imagingcms as core + + _CmsProfileCompatible = Union[ + str, SupportsRead[bytes], core.CmsProfile, "ImageCmsProfile" + ] +except ImportError as ex: + # Allow error import for doc purposes, but error out when accessing + # anything in core. + from ._util import DeferredError + + core = DeferredError.new(ex) + +_DESCRIPTION = """ +pyCMS + + a Python / PIL interface to the littleCMS ICC Color Management System + Copyright (C) 2002-2003 Kevin Cazabon + kevin@cazabon.com + https://www.cazabon.com + + pyCMS home page: https://www.cazabon.com/pyCMS + littleCMS home page: https://www.littlecms.com + (littleCMS is Copyright (C) 1998-2001 Marti Maria) + + Originally released under LGPL. Graciously donated to PIL in + March 2009, for distribution under the standard PIL license + + The pyCMS.py module provides a "clean" interface between Python/PIL and + pyCMSdll, taking care of some of the more complex handling of the direct + pyCMSdll functions, as well as error-checking and making sure that all + relevant data is kept together. + + While it is possible to call pyCMSdll functions directly, it's not highly + recommended. + + Version History: + + 1.0.0 pil Oct 2013 Port to LCMS 2. + + 0.1.0 pil mod March 10, 2009 + + Renamed display profile to proof profile. The proof + profile is the profile of the device that is being + simulated, not the profile of the device which is + actually used to display/print the final simulation + (that'd be the output profile) - also see LCMSAPI.txt + input colorspace -> using 'renderingIntent' -> proof + colorspace -> using 'proofRenderingIntent' -> output + colorspace + + Added LCMS FLAGS support. + Added FLAGS["SOFTPROOFING"] as default flag for + buildProofTransform (otherwise the proof profile/intent + would be ignored). + + 0.1.0 pil March 2009 - added to PIL, as PIL.ImageCms + + 0.0.2 alpha Jan 6, 2002 + + Added try/except statements around type() checks of + potential CObjects... Python won't let you use type() + on them, and raises a TypeError (stupid, if you ask + me!) + + Added buildProofTransformFromOpenProfiles() function. + Additional fixes in DLL, see DLL code for details. + + 0.0.1 alpha first public release, Dec. 26, 2002 + + Known to-do list with current version (of Python interface, not pyCMSdll): + + none + +""" + +_VERSION = "1.0.0 pil" + + +# --------------------------------------------------------------------. + + +# +# intent/direction values + + +class Intent(IntEnum): + PERCEPTUAL = 0 + RELATIVE_COLORIMETRIC = 1 + SATURATION = 2 + ABSOLUTE_COLORIMETRIC = 3 + + +class Direction(IntEnum): + INPUT = 0 + OUTPUT = 1 + PROOF = 2 + + +# +# flags + + +class Flags(IntFlag): + """Flags and documentation are taken from ``lcms2.h``.""" + + NONE = 0 + NOCACHE = 0x0040 + """Inhibit 1-pixel cache""" + NOOPTIMIZE = 0x0100 + """Inhibit optimizations""" + NULLTRANSFORM = 0x0200 + """Don't transform anyway""" + GAMUTCHECK = 0x1000 + """Out of Gamut alarm""" + SOFTPROOFING = 0x4000 + """Do softproofing""" + BLACKPOINTCOMPENSATION = 0x2000 + NOWHITEONWHITEFIXUP = 0x0004 + """Don't fix scum dot""" + HIGHRESPRECALC = 0x0400 + """Use more memory to give better accuracy""" + LOWRESPRECALC = 0x0800 + """Use less memory to minimize resources""" + # this should be 8BITS_DEVICELINK, but that is not a valid name in Python: + USE_8BITS_DEVICELINK = 0x0008 + """Create 8 bits devicelinks""" + GUESSDEVICECLASS = 0x0020 + """Guess device class (for ``transform2devicelink``)""" + KEEP_SEQUENCE = 0x0080 + """Keep profile sequence for devicelink creation""" + FORCE_CLUT = 0x0002 + """Force CLUT optimization""" + CLUT_POST_LINEARIZATION = 0x0001 + """create postlinearization tables if possible""" + CLUT_PRE_LINEARIZATION = 0x0010 + """create prelinearization tables if possible""" + NONEGATIVES = 0x8000 + """Prevent negative numbers in floating point transforms""" + COPY_ALPHA = 0x04000000 + """Alpha channels are copied on ``cmsDoTransform()``""" + NODEFAULTRESOURCEDEF = 0x01000000 + + _GRIDPOINTS_1 = 1 << 16 + _GRIDPOINTS_2 = 2 << 16 + _GRIDPOINTS_4 = 4 << 16 + _GRIDPOINTS_8 = 8 << 16 + _GRIDPOINTS_16 = 16 << 16 + _GRIDPOINTS_32 = 32 << 16 + _GRIDPOINTS_64 = 64 << 16 + _GRIDPOINTS_128 = 128 << 16 + + @staticmethod + def GRIDPOINTS(n: int) -> Flags: + """ + Fine-tune control over number of gridpoints + + :param n: :py:class:`int` in range ``0 <= n <= 255`` + """ + return Flags.NONE | ((n & 0xFF) << 16) + + +_MAX_FLAG = reduce(operator.or_, Flags) + + +_FLAGS = { + "MATRIXINPUT": 1, + "MATRIXOUTPUT": 2, + "MATRIXONLY": (1 | 2), + "NOWHITEONWHITEFIXUP": 4, # Don't hot fix scum dot + # Don't create prelinearization tables on precalculated transforms + # (internal use): + "NOPRELINEARIZATION": 16, + "GUESSDEVICECLASS": 32, # Guess device class (for transform2devicelink) + "NOTCACHE": 64, # Inhibit 1-pixel cache + "NOTPRECALC": 256, + "NULLTRANSFORM": 512, # Don't transform anyway + "HIGHRESPRECALC": 1024, # Use more memory to give better accuracy + "LOWRESPRECALC": 2048, # Use less memory to minimize resources + "WHITEBLACKCOMPENSATION": 8192, + "BLACKPOINTCOMPENSATION": 8192, + "GAMUTCHECK": 4096, # Out of Gamut alarm + "SOFTPROOFING": 16384, # Do softproofing + "PRESERVEBLACK": 32768, # Black preservation + "NODEFAULTRESOURCEDEF": 16777216, # CRD special + "GRIDPOINTS": lambda n: (n & 0xFF) << 16, # Gridpoints +} + + +# --------------------------------------------------------------------. +# Experimental PIL-level API +# --------------------------------------------------------------------. + +## +# Profile. + + +class ImageCmsProfile: + def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None: + """ + :param profile: Either a string representing a filename, + a file like object containing a profile or a + low-level profile object + + """ + self.filename: str | None = None + + if isinstance(profile, str): + if sys.platform == "win32": + profile_bytes_path = profile.encode() + try: + profile_bytes_path.decode("ascii") + except UnicodeDecodeError: + with open(profile, "rb") as f: + self.profile = core.profile_frombytes(f.read()) + return + self.filename = profile + self.profile = core.profile_open(profile) + elif hasattr(profile, "read"): + self.profile = core.profile_frombytes(profile.read()) + elif isinstance(profile, core.CmsProfile): + self.profile = profile + else: + msg = "Invalid type for Profile" # type: ignore[unreachable] + raise TypeError(msg) + + def __getattr__(self, name: str) -> Any: + if name in ("product_name", "product_info"): + deprecate(f"ImageCms.ImageCmsProfile.{name}", 13) + return None + msg = f"'{self.__class__.__name__}' object has no attribute '{name}'" + raise AttributeError(msg) + + def tobytes(self) -> bytes: + """ + Returns the profile in a format suitable for embedding in + saved images. + + :returns: a bytes object containing the ICC profile. + """ + + return core.profile_tobytes(self.profile) + + +class ImageCmsTransform(Image.ImagePointHandler): + """ + Transform. This can be used with the procedural API, or with the standard + :py:func:`~PIL.Image.Image.point` method. + + Will return the output profile in the ``output.info['icc_profile']``. + """ + + def __init__( + self, + input: ImageCmsProfile, + output: ImageCmsProfile, + input_mode: str, + output_mode: str, + intent: Intent = Intent.PERCEPTUAL, + proof: ImageCmsProfile | None = None, + proof_intent: Intent = Intent.ABSOLUTE_COLORIMETRIC, + flags: Flags = Flags.NONE, + ): + if proof is None: + self.transform = core.buildTransform( + input.profile, output.profile, input_mode, output_mode, intent, flags + ) + else: + self.transform = core.buildProofTransform( + input.profile, + output.profile, + proof.profile, + input_mode, + output_mode, + intent, + proof_intent, + flags, + ) + # Note: inputMode and outputMode are for pyCMS compatibility only + self.input_mode = self.inputMode = input_mode + self.output_mode = self.outputMode = output_mode + + self.output_profile = output + + def point(self, im: Image.Image) -> Image.Image: + return self.apply(im) + + def apply(self, im: Image.Image, imOut: Image.Image | None = None) -> Image.Image: + if imOut is None: + imOut = Image.new(self.output_mode, im.size, None) + self.transform.apply(im.getim(), imOut.getim()) + imOut.info["icc_profile"] = self.output_profile.tobytes() + return imOut + + def apply_in_place(self, im: Image.Image) -> Image.Image: + if im.mode != self.output_mode: + msg = "mode mismatch" + raise ValueError(msg) # wrong output mode + self.transform.apply(im.getim(), im.getim()) + im.info["icc_profile"] = self.output_profile.tobytes() + return im + + +def get_display_profile(handle: SupportsInt | None = None) -> ImageCmsProfile | None: + """ + (experimental) Fetches the profile for the current display device. + + :returns: ``None`` if the profile is not known. + """ + + if sys.platform != "win32": + return None + + from . import ImageWin # type: ignore[unused-ignore, unreachable] + + if isinstance(handle, ImageWin.HDC): + profile = core.get_display_profile_win32(int(handle), 1) + else: + profile = core.get_display_profile_win32(int(handle or 0)) + if profile is None: + return None + return ImageCmsProfile(profile) + + +# --------------------------------------------------------------------. +# pyCMS compatible layer +# --------------------------------------------------------------------. + + +class PyCMSError(Exception): + """(pyCMS) Exception class. + This is used for all errors in the pyCMS API.""" + + pass + + +def profileToProfile( + im: Image.Image, + inputProfile: _CmsProfileCompatible, + outputProfile: _CmsProfileCompatible, + renderingIntent: Intent = Intent.PERCEPTUAL, + outputMode: str | None = None, + inPlace: bool = False, + flags: Flags = Flags.NONE, +) -> Image.Image | None: + """ + (pyCMS) Applies an ICC transformation to a given image, mapping from + ``inputProfile`` to ``outputProfile``. + + If the input or output profiles specified are not valid filenames, a + :exc:`PyCMSError` will be raised. If ``inPlace`` is ``True`` and + ``outputMode != im.mode``, a :exc:`PyCMSError` will be raised. + If an error occurs during application of the profiles, + a :exc:`PyCMSError` will be raised. + If ``outputMode`` is not a mode supported by the ``outputProfile`` (or by pyCMS), + a :exc:`PyCMSError` will be raised. + + This function applies an ICC transformation to im from ``inputProfile``'s + color space to ``outputProfile``'s color space using the specified rendering + intent to decide how to handle out-of-gamut colors. + + ``outputMode`` can be used to specify that a color mode conversion is to + be done using these profiles, but the specified profiles must be able + to handle that mode. I.e., if converting im from RGB to CMYK using + profiles, the input profile must handle RGB data, and the output + profile must handle CMYK data. + + :param im: An open :py:class:`~PIL.Image.Image` object (i.e. Image.new(...) + or Image.open(...), etc.) + :param inputProfile: String, as a valid filename path to the ICC input + profile you wish to use for this image, or a profile object + :param outputProfile: String, as a valid filename path to the ICC output + profile you wish to use for this image, or a profile object + :param renderingIntent: Integer (0-3) specifying the rendering intent you + wish to use for the transform + + ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) + ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 + ImageCms.Intent.SATURATION = 2 + ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 + + see the pyCMS documentation for details on rendering intents and what + they do. + :param outputMode: A valid PIL mode for the output image (i.e. "RGB", + "CMYK", etc.). Note: if rendering the image "inPlace", outputMode + MUST be the same mode as the input, or omitted completely. If + omitted, the outputMode will be the same as the mode of the input + image (im.mode) + :param inPlace: Boolean. If ``True``, the original image is modified in-place, + and ``None`` is returned. If ``False`` (default), a new + :py:class:`~PIL.Image.Image` object is returned with the transform applied. + :param flags: Integer (0-...) specifying additional flags + :returns: Either None or a new :py:class:`~PIL.Image.Image` object, depending on + the value of ``inPlace`` + :exception PyCMSError: + """ + + if outputMode is None: + outputMode = im.mode + + if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3): + msg = "renderingIntent must be an integer between 0 and 3" + raise PyCMSError(msg) + + if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG): + msg = f"flags must be an integer between 0 and {_MAX_FLAG}" + raise PyCMSError(msg) + + try: + if not isinstance(inputProfile, ImageCmsProfile): + inputProfile = ImageCmsProfile(inputProfile) + if not isinstance(outputProfile, ImageCmsProfile): + outputProfile = ImageCmsProfile(outputProfile) + transform = ImageCmsTransform( + inputProfile, + outputProfile, + im.mode, + outputMode, + renderingIntent, + flags=flags, + ) + if inPlace: + transform.apply_in_place(im) + imOut = None + else: + imOut = transform.apply(im) + except (OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + return imOut + + +def getOpenProfile( + profileFilename: str | SupportsRead[bytes] | core.CmsProfile, +) -> ImageCmsProfile: + """ + (pyCMS) Opens an ICC profile file. + + The PyCMSProfile object can be passed back into pyCMS for use in creating + transforms and such (as in ImageCms.buildTransformFromOpenProfiles()). + + If ``profileFilename`` is not a valid filename for an ICC profile, + a :exc:`PyCMSError` will be raised. + + :param profileFilename: String, as a valid filename path to the ICC profile + you wish to open, or a file-like object. + :returns: A CmsProfile class object. + :exception PyCMSError: + """ + + try: + return ImageCmsProfile(profileFilename) + except (OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def buildTransform( + inputProfile: _CmsProfileCompatible, + outputProfile: _CmsProfileCompatible, + inMode: str, + outMode: str, + renderingIntent: Intent = Intent.PERCEPTUAL, + flags: Flags = Flags.NONE, +) -> ImageCmsTransform: + """ + (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the + ``outputProfile``. Use applyTransform to apply the transform to a given + image. + + If the input or output profiles specified are not valid filenames, a + :exc:`PyCMSError` will be raised. If an error occurs during creation + of the transform, a :exc:`PyCMSError` will be raised. + + If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile`` + (or by pyCMS), a :exc:`PyCMSError` will be raised. + + This function builds and returns an ICC transform from the ``inputProfile`` + to the ``outputProfile`` using the ``renderingIntent`` to determine what to do + with out-of-gamut colors. It will ONLY work for converting images that + are in ``inMode`` to images that are in ``outMode`` color format (PIL mode, + i.e. "RGB", "RGBA", "CMYK", etc.). + + Building the transform is a fair part of the overhead in + ImageCms.profileToProfile(), so if you're planning on converting multiple + images using the same input/output settings, this can save you time. + Once you have a transform object, it can be used with + ImageCms.applyProfile() to convert images without the need to re-compute + the lookup table for the transform. + + The reason pyCMS returns a class object rather than a handle directly + to the transform is that it needs to keep track of the PIL input/output + modes that the transform is meant for. These attributes are stored in + the ``inMode`` and ``outMode`` attributes of the object (which can be + manually overridden if you really want to, but I don't know of any + time that would be of use, or would even work). + + :param inputProfile: String, as a valid filename path to the ICC input + profile you wish to use for this transform, or a profile object + :param outputProfile: String, as a valid filename path to the ICC output + profile you wish to use for this transform, or a profile object + :param inMode: String, as a valid PIL mode that the appropriate profile + also supports (i.e. "RGB", "RGBA", "CMYK", etc.) + :param outMode: String, as a valid PIL mode that the appropriate profile + also supports (i.e. "RGB", "RGBA", "CMYK", etc.) + :param renderingIntent: Integer (0-3) specifying the rendering intent you + wish to use for the transform + + ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) + ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 + ImageCms.Intent.SATURATION = 2 + ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 + + see the pyCMS documentation for details on rendering intents and what + they do. + :param flags: Integer (0-...) specifying additional flags + :returns: A CmsTransform class object. + :exception PyCMSError: + """ + + if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3): + msg = "renderingIntent must be an integer between 0 and 3" + raise PyCMSError(msg) + + if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG): + msg = f"flags must be an integer between 0 and {_MAX_FLAG}" + raise PyCMSError(msg) + + try: + if not isinstance(inputProfile, ImageCmsProfile): + inputProfile = ImageCmsProfile(inputProfile) + if not isinstance(outputProfile, ImageCmsProfile): + outputProfile = ImageCmsProfile(outputProfile) + return ImageCmsTransform( + inputProfile, outputProfile, inMode, outMode, renderingIntent, flags=flags + ) + except (OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def buildProofTransform( + inputProfile: _CmsProfileCompatible, + outputProfile: _CmsProfileCompatible, + proofProfile: _CmsProfileCompatible, + inMode: str, + outMode: str, + renderingIntent: Intent = Intent.PERCEPTUAL, + proofRenderingIntent: Intent = Intent.ABSOLUTE_COLORIMETRIC, + flags: Flags = Flags.SOFTPROOFING, +) -> ImageCmsTransform: + """ + (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the + ``outputProfile``, but tries to simulate the result that would be + obtained on the ``proofProfile`` device. + + If the input, output, or proof profiles specified are not valid + filenames, a :exc:`PyCMSError` will be raised. + + If an error occurs during creation of the transform, + a :exc:`PyCMSError` will be raised. + + If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile`` + (or by pyCMS), a :exc:`PyCMSError` will be raised. + + This function builds and returns an ICC transform from the ``inputProfile`` + to the ``outputProfile``, but tries to simulate the result that would be + obtained on the ``proofProfile`` device using ``renderingIntent`` and + ``proofRenderingIntent`` to determine what to do with out-of-gamut + colors. This is known as "soft-proofing". It will ONLY work for + converting images that are in ``inMode`` to images that are in outMode + color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.). + + Usage of the resulting transform object is exactly the same as with + ImageCms.buildTransform(). + + Proof profiling is generally used when using an output device to get a + good idea of what the final printed/displayed image would look like on + the ``proofProfile`` device when it's quicker and easier to use the + output device for judging color. Generally, this means that the + output device is a monitor, or a dye-sub printer (etc.), and the simulated + device is something more expensive, complicated, or time consuming + (making it difficult to make a real print for color judgement purposes). + + Soft-proofing basically functions by adjusting the colors on the + output device to match the colors of the device being simulated. However, + when the simulated device has a much wider gamut than the output + device, you may obtain marginal results. + + :param inputProfile: String, as a valid filename path to the ICC input + profile you wish to use for this transform, or a profile object + :param outputProfile: String, as a valid filename path to the ICC output + (monitor, usually) profile you wish to use for this transform, or a + profile object + :param proofProfile: String, as a valid filename path to the ICC proof + profile you wish to use for this transform, or a profile object + :param inMode: String, as a valid PIL mode that the appropriate profile + also supports (i.e. "RGB", "RGBA", "CMYK", etc.) + :param outMode: String, as a valid PIL mode that the appropriate profile + also supports (i.e. "RGB", "RGBA", "CMYK", etc.) + :param renderingIntent: Integer (0-3) specifying the rendering intent you + wish to use for the input->proof (simulated) transform + + ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) + ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 + ImageCms.Intent.SATURATION = 2 + ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 + + see the pyCMS documentation for details on rendering intents and what + they do. + :param proofRenderingIntent: Integer (0-3) specifying the rendering intent + you wish to use for proof->output transform + + ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) + ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 + ImageCms.Intent.SATURATION = 2 + ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 + + see the pyCMS documentation for details on rendering intents and what + they do. + :param flags: Integer (0-...) specifying additional flags + :returns: A CmsTransform class object. + :exception PyCMSError: + """ + + if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <= 3): + msg = "renderingIntent must be an integer between 0 and 3" + raise PyCMSError(msg) + + if not isinstance(flags, int) or not (0 <= flags <= _MAX_FLAG): + msg = f"flags must be an integer between 0 and {_MAX_FLAG}" + raise PyCMSError(msg) + + try: + if not isinstance(inputProfile, ImageCmsProfile): + inputProfile = ImageCmsProfile(inputProfile) + if not isinstance(outputProfile, ImageCmsProfile): + outputProfile = ImageCmsProfile(outputProfile) + if not isinstance(proofProfile, ImageCmsProfile): + proofProfile = ImageCmsProfile(proofProfile) + return ImageCmsTransform( + inputProfile, + outputProfile, + inMode, + outMode, + renderingIntent, + proofProfile, + proofRenderingIntent, + flags, + ) + except (OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +buildTransformFromOpenProfiles = buildTransform +buildProofTransformFromOpenProfiles = buildProofTransform + + +def applyTransform( + im: Image.Image, transform: ImageCmsTransform, inPlace: bool = False +) -> Image.Image | None: + """ + (pyCMS) Applies a transform to a given image. + + If ``im.mode != transform.input_mode``, a :exc:`PyCMSError` is raised. + + If ``inPlace`` is ``True`` and ``transform.input_mode != transform.output_mode``, a + :exc:`PyCMSError` is raised. + + If ``im.mode``, ``transform.input_mode`` or ``transform.output_mode`` is not + supported by pyCMSdll or the profiles you used for the transform, a + :exc:`PyCMSError` is raised. + + If an error occurs while the transform is being applied, + a :exc:`PyCMSError` is raised. + + This function applies a pre-calculated transform (from + ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles()) + to an image. The transform can be used for multiple images, saving + considerable calculation time if doing the same conversion multiple times. + + If you want to modify im in-place instead of receiving a new image as + the return value, set ``inPlace`` to ``True``. This can only be done if + ``transform.input_mode`` and ``transform.output_mode`` are the same, because we + can't change the mode in-place (the buffer sizes for some modes are + different). The default behavior is to return a new :py:class:`~PIL.Image.Image` + object of the same dimensions in mode ``transform.output_mode``. + + :param im: An :py:class:`~PIL.Image.Image` object, and ``im.mode`` must be the same + as the ``input_mode`` supported by the transform. + :param transform: A valid CmsTransform class object + :param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is + returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the + transform applied is returned (and ``im`` is not changed). The default is + ``False``. + :returns: Either ``None``, or a new :py:class:`~PIL.Image.Image` object, + depending on the value of ``inPlace``. The profile will be returned in + the image's ``info['icc_profile']``. + :exception PyCMSError: + """ + + try: + if inPlace: + transform.apply_in_place(im) + imOut = None + else: + imOut = transform.apply(im) + except (TypeError, ValueError) as v: + raise PyCMSError(v) from v + + return imOut + + +def createProfile( + colorSpace: Literal["LAB", "XYZ", "sRGB"], colorTemp: SupportsFloat = 0 +) -> core.CmsProfile: + """ + (pyCMS) Creates a profile. + + If colorSpace not in ``["LAB", "XYZ", "sRGB"]``, + a :exc:`PyCMSError` is raised. + + If using LAB and ``colorTemp`` is not a positive integer, + a :exc:`PyCMSError` is raised. + + If an error occurs while creating the profile, + a :exc:`PyCMSError` is raised. + + Use this function to create common profiles on-the-fly instead of + having to supply a profile on disk and knowing the path to it. It + returns a normal CmsProfile object that can be passed to + ImageCms.buildTransformFromOpenProfiles() to create a transform to apply + to images. + + :param colorSpace: String, the color space of the profile you wish to + create. + Currently only "LAB", "XYZ", and "sRGB" are supported. + :param colorTemp: Positive number for the white point for the profile, in + degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50 + illuminant if omitted (5000k). colorTemp is ONLY applied to LAB + profiles, and is ignored for XYZ and sRGB. + :returns: A CmsProfile class object + :exception PyCMSError: + """ + + if colorSpace not in ["LAB", "XYZ", "sRGB"]: + msg = ( + f"Color space not supported for on-the-fly profile creation ({colorSpace})" + ) + raise PyCMSError(msg) + + if colorSpace == "LAB": + try: + colorTemp = float(colorTemp) + except (TypeError, ValueError) as e: + msg = f'Color temperature must be numeric, "{colorTemp}" not valid' + raise PyCMSError(msg) from e + + try: + return core.createProfile(colorSpace, colorTemp) + except (TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getProfileName(profile: _CmsProfileCompatible) -> str: + """ + + (pyCMS) Gets the internal product name for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, + a :exc:`PyCMSError` is raised If an error occurs while trying + to obtain the name tag, a :exc:`PyCMSError` is raised. + + Use this function to obtain the INTERNAL name of the profile (stored + in an ICC tag in the profile itself), usually the one used when the + profile was originally created. Sometimes this tag also contains + additional information supplied by the creator. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: A string containing the internal name of the profile as stored + in an ICC tag. + :exception PyCMSError: + """ + + try: + # add an extra newline to preserve pyCMS compatibility + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + # do it in python, not c. + # // name was "%s - %s" (model, manufacturer) || Description , + # // but if the Model and Manufacturer were the same or the model + # // was long, Just the model, in 1.x + model = profile.profile.model + manufacturer = profile.profile.manufacturer + + if not (model or manufacturer): + return (profile.profile.profile_description or "") + "\n" + if not manufacturer or (model and len(model) > 30): + return f"{model}\n" + return f"{model} - {manufacturer}\n" + + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getProfileInfo(profile: _CmsProfileCompatible) -> str: + """ + (pyCMS) Gets the internal product information for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, + a :exc:`PyCMSError` is raised. + + If an error occurs while trying to obtain the info tag, + a :exc:`PyCMSError` is raised. + + Use this function to obtain the information stored in the profile's + info tag. This often contains details about the profile, and how it + was created, as supplied by the creator. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: A string containing the internal profile information stored in + an ICC tag. + :exception PyCMSError: + """ + + try: + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + # add an extra newline to preserve pyCMS compatibility + # Python, not C. the white point bits weren't working well, + # so skipping. + # info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint + description = profile.profile.profile_description + cpright = profile.profile.copyright + elements = [element for element in (description, cpright) if element] + return "\r\n\r\n".join(elements) + "\r\n\r\n" + + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getProfileCopyright(profile: _CmsProfileCompatible) -> str: + """ + (pyCMS) Gets the copyright for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, a + :exc:`PyCMSError` is raised. + + If an error occurs while trying to obtain the copyright tag, + a :exc:`PyCMSError` is raised. + + Use this function to obtain the information stored in the profile's + copyright tag. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: A string containing the internal profile information stored in + an ICC tag. + :exception PyCMSError: + """ + try: + # add an extra newline to preserve pyCMS compatibility + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + return (profile.profile.copyright or "") + "\n" + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getProfileManufacturer(profile: _CmsProfileCompatible) -> str: + """ + (pyCMS) Gets the manufacturer for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, a + :exc:`PyCMSError` is raised. + + If an error occurs while trying to obtain the manufacturer tag, a + :exc:`PyCMSError` is raised. + + Use this function to obtain the information stored in the profile's + manufacturer tag. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: A string containing the internal profile information stored in + an ICC tag. + :exception PyCMSError: + """ + try: + # add an extra newline to preserve pyCMS compatibility + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + return (profile.profile.manufacturer or "") + "\n" + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getProfileModel(profile: _CmsProfileCompatible) -> str: + """ + (pyCMS) Gets the model for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, a + :exc:`PyCMSError` is raised. + + If an error occurs while trying to obtain the model tag, + a :exc:`PyCMSError` is raised. + + Use this function to obtain the information stored in the profile's + model tag. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: A string containing the internal profile information stored in + an ICC tag. + :exception PyCMSError: + """ + + try: + # add an extra newline to preserve pyCMS compatibility + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + return (profile.profile.model or "") + "\n" + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getProfileDescription(profile: _CmsProfileCompatible) -> str: + """ + (pyCMS) Gets the description for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, a + :exc:`PyCMSError` is raised. + + If an error occurs while trying to obtain the description tag, + a :exc:`PyCMSError` is raised. + + Use this function to obtain the information stored in the profile's + description tag. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: A string containing the internal profile information stored in an + ICC tag. + :exception PyCMSError: + """ + + try: + # add an extra newline to preserve pyCMS compatibility + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + return (profile.profile.profile_description or "") + "\n" + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def getDefaultIntent(profile: _CmsProfileCompatible) -> int: + """ + (pyCMS) Gets the default intent name for the given profile. + + If ``profile`` isn't a valid CmsProfile object or filename to a profile, a + :exc:`PyCMSError` is raised. + + If an error occurs while trying to obtain the default intent, a + :exc:`PyCMSError` is raised. + + Use this function to determine the default (and usually best optimized) + rendering intent for this profile. Most profiles support multiple + rendering intents, but are intended mostly for one type of conversion. + If you wish to use a different intent than returned, use + ImageCms.isIntentSupported() to verify it will work first. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :returns: Integer 0-3 specifying the default rendering intent for this + profile. + + ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) + ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 + ImageCms.Intent.SATURATION = 2 + ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 + + see the pyCMS documentation for details on rendering intents and what + they do. + :exception PyCMSError: + """ + + try: + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + return profile.profile.rendering_intent + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v + + +def isIntentSupported( + profile: _CmsProfileCompatible, intent: Intent, direction: Direction +) -> Literal[-1, 1]: + """ + (pyCMS) Checks if a given intent is supported. + + Use this function to verify that you can use your desired + ``intent`` with ``profile``, and that ``profile`` can be used for the + input/output/proof profile as you desire. + + Some profiles are created specifically for one "direction", can cannot + be used for others. Some profiles can only be used for certain + rendering intents, so it's best to either verify this before trying + to create a transform with them (using this function), or catch the + potential :exc:`PyCMSError` that will occur if they don't + support the modes you select. + + :param profile: EITHER a valid CmsProfile object, OR a string of the + filename of an ICC profile. + :param intent: Integer (0-3) specifying the rendering intent you wish to + use with this profile + + ImageCms.Intent.PERCEPTUAL = 0 (DEFAULT) + ImageCms.Intent.RELATIVE_COLORIMETRIC = 1 + ImageCms.Intent.SATURATION = 2 + ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3 + + see the pyCMS documentation for details on rendering intents and what + they do. + :param direction: Integer specifying if the profile is to be used for + input, output, or proof + + INPUT = 0 (or use ImageCms.Direction.INPUT) + OUTPUT = 1 (or use ImageCms.Direction.OUTPUT) + PROOF = 2 (or use ImageCms.Direction.PROOF) + + :returns: 1 if the intent/direction are supported, -1 if they are not. + :exception PyCMSError: + """ + + try: + if not isinstance(profile, ImageCmsProfile): + profile = ImageCmsProfile(profile) + # FIXME: I get different results for the same data w. different + # compilers. Bug in LittleCMS or in the binding? + if profile.profile.is_intent_supported(intent, direction): + return 1 + else: + return -1 + except (AttributeError, OSError, TypeError, ValueError) as v: + raise PyCMSError(v) from v diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageColor.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageColor.py new file mode 100644 index 0000000000000000000000000000000000000000..4dcc33bf19db7dc7fbe5e72a696448d9117c4a8d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageColor.py @@ -0,0 +1,320 @@ +# +# The Python Imaging Library +# $Id$ +# +# map CSS3-style colour description strings to RGB +# +# History: +# 2002-10-24 fl Added support for CSS-style color strings +# 2002-12-15 fl Added RGBA support +# 2004-03-27 fl Fixed remaining int() problems for Python 1.5.2 +# 2004-07-19 fl Fixed gray/grey spelling issues +# 2009-03-05 fl Fixed rounding error in grayscale calculation +# +# Copyright (c) 2002-2004 by Secret Labs AB +# Copyright (c) 2002-2004 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import re +from functools import lru_cache + +from . import Image + + +@lru_cache +def getrgb(color: str) -> tuple[int, int, int] | tuple[int, int, int, int]: + """ + Convert a color string to an RGB or RGBA tuple. If the string cannot be + parsed, this function raises a :py:exc:`ValueError` exception. + + .. versionadded:: 1.1.4 + + :param color: A color string + :return: ``(red, green, blue[, alpha])`` + """ + if len(color) > 100: + msg = "color specifier is too long" + raise ValueError(msg) + color = color.lower() + + rgb = colormap.get(color, None) + if rgb: + if isinstance(rgb, tuple): + return rgb + rgb_tuple = getrgb(rgb) + assert len(rgb_tuple) == 3 + colormap[color] = rgb_tuple + return rgb_tuple + + # check for known string formats + if re.match("#[a-f0-9]{3}$", color): + return int(color[1] * 2, 16), int(color[2] * 2, 16), int(color[3] * 2, 16) + + if re.match("#[a-f0-9]{4}$", color): + return ( + int(color[1] * 2, 16), + int(color[2] * 2, 16), + int(color[3] * 2, 16), + int(color[4] * 2, 16), + ) + + if re.match("#[a-f0-9]{6}$", color): + return int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16) + + if re.match("#[a-f0-9]{8}$", color): + return ( + int(color[1:3], 16), + int(color[3:5], 16), + int(color[5:7], 16), + int(color[7:9], 16), + ) + + m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color) + if m: + return int(m.group(1)), int(m.group(2)), int(m.group(3)) + + m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color) + if m: + return ( + int((int(m.group(1)) * 255) / 100.0 + 0.5), + int((int(m.group(2)) * 255) / 100.0 + 0.5), + int((int(m.group(3)) * 255) / 100.0 + 0.5), + ) + + m = re.match( + r"hsl\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color + ) + if m: + from colorsys import hls_to_rgb + + rgb_floats = hls_to_rgb( + float(m.group(1)) / 360.0, + float(m.group(3)) / 100.0, + float(m.group(2)) / 100.0, + ) + return ( + int(rgb_floats[0] * 255 + 0.5), + int(rgb_floats[1] * 255 + 0.5), + int(rgb_floats[2] * 255 + 0.5), + ) + + m = re.match( + r"hs[bv]\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color + ) + if m: + from colorsys import hsv_to_rgb + + rgb_floats = hsv_to_rgb( + float(m.group(1)) / 360.0, + float(m.group(2)) / 100.0, + float(m.group(3)) / 100.0, + ) + return ( + int(rgb_floats[0] * 255 + 0.5), + int(rgb_floats[1] * 255 + 0.5), + int(rgb_floats[2] * 255 + 0.5), + ) + + m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color) + if m: + return int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4)) + msg = f"unknown color specifier: {repr(color)}" + raise ValueError(msg) + + +@lru_cache +def getcolor(color: str, mode: str) -> int | tuple[int, ...]: + """ + Same as :py:func:`~PIL.ImageColor.getrgb` for most modes. However, if + ``mode`` is HSV, converts the RGB value to a HSV value, or if ``mode`` is + not color or a palette image, converts the RGB value to a grayscale value. + If the string cannot be parsed, this function raises a :py:exc:`ValueError` + exception. + + .. versionadded:: 1.1.4 + + :param color: A color string + :param mode: Convert result to this mode + :return: ``graylevel, (graylevel, alpha) or (red, green, blue[, alpha])`` + """ + # same as getrgb, but converts the result to the given mode + rgb, alpha = getrgb(color), 255 + if len(rgb) == 4: + alpha = rgb[3] + rgb = rgb[:3] + + if mode == "HSV": + from colorsys import rgb_to_hsv + + r, g, b = rgb + h, s, v = rgb_to_hsv(r / 255, g / 255, b / 255) + return int(h * 255), int(s * 255), int(v * 255) + elif Image.getmodebase(mode) == "L": + r, g, b = rgb + # ITU-R Recommendation 601-2 for nonlinear RGB + # scaled to 24 bits to match the convert's implementation. + graylevel = (r * 19595 + g * 38470 + b * 7471 + 0x8000) >> 16 + if mode[-1] == "A": + return graylevel, alpha + return graylevel + elif mode[-1] == "A": + return rgb + (alpha,) + return rgb + + +colormap: dict[str, str | tuple[int, int, int]] = { + # X11 colour table from https://drafts.csswg.org/css-color-4/, with + # gray/grey spelling issues fixed. This is a superset of HTML 4.0 + # colour names used in CSS 1. + "aliceblue": "#f0f8ff", + "antiquewhite": "#faebd7", + "aqua": "#00ffff", + "aquamarine": "#7fffd4", + "azure": "#f0ffff", + "beige": "#f5f5dc", + "bisque": "#ffe4c4", + "black": "#000000", + "blanchedalmond": "#ffebcd", + "blue": "#0000ff", + "blueviolet": "#8a2be2", + "brown": "#a52a2a", + "burlywood": "#deb887", + "cadetblue": "#5f9ea0", + "chartreuse": "#7fff00", + "chocolate": "#d2691e", + "coral": "#ff7f50", + "cornflowerblue": "#6495ed", + "cornsilk": "#fff8dc", + "crimson": "#dc143c", + "cyan": "#00ffff", + "darkblue": "#00008b", + "darkcyan": "#008b8b", + "darkgoldenrod": "#b8860b", + "darkgray": "#a9a9a9", + "darkgrey": "#a9a9a9", + "darkgreen": "#006400", + "darkkhaki": "#bdb76b", + "darkmagenta": "#8b008b", + "darkolivegreen": "#556b2f", + "darkorange": "#ff8c00", + "darkorchid": "#9932cc", + "darkred": "#8b0000", + "darksalmon": "#e9967a", + "darkseagreen": "#8fbc8f", + "darkslateblue": "#483d8b", + "darkslategray": "#2f4f4f", + "darkslategrey": "#2f4f4f", + "darkturquoise": "#00ced1", + "darkviolet": "#9400d3", + "deeppink": "#ff1493", + "deepskyblue": "#00bfff", + "dimgray": "#696969", + "dimgrey": "#696969", + "dodgerblue": "#1e90ff", + "firebrick": "#b22222", + "floralwhite": "#fffaf0", + "forestgreen": "#228b22", + "fuchsia": "#ff00ff", + "gainsboro": "#dcdcdc", + "ghostwhite": "#f8f8ff", + "gold": "#ffd700", + "goldenrod": "#daa520", + "gray": "#808080", + "grey": "#808080", + "green": "#008000", + "greenyellow": "#adff2f", + "honeydew": "#f0fff0", + "hotpink": "#ff69b4", + "indianred": "#cd5c5c", + "indigo": "#4b0082", + "ivory": "#fffff0", + "khaki": "#f0e68c", + "lavender": "#e6e6fa", + "lavenderblush": "#fff0f5", + "lawngreen": "#7cfc00", + "lemonchiffon": "#fffacd", + "lightblue": "#add8e6", + "lightcoral": "#f08080", + "lightcyan": "#e0ffff", + "lightgoldenrodyellow": "#fafad2", + "lightgreen": "#90ee90", + "lightgray": "#d3d3d3", + "lightgrey": "#d3d3d3", + "lightpink": "#ffb6c1", + "lightsalmon": "#ffa07a", + "lightseagreen": "#20b2aa", + "lightskyblue": "#87cefa", + "lightslategray": "#778899", + "lightslategrey": "#778899", + "lightsteelblue": "#b0c4de", + "lightyellow": "#ffffe0", + "lime": "#00ff00", + "limegreen": "#32cd32", + "linen": "#faf0e6", + "magenta": "#ff00ff", + "maroon": "#800000", + "mediumaquamarine": "#66cdaa", + "mediumblue": "#0000cd", + "mediumorchid": "#ba55d3", + "mediumpurple": "#9370db", + "mediumseagreen": "#3cb371", + "mediumslateblue": "#7b68ee", + "mediumspringgreen": "#00fa9a", + "mediumturquoise": "#48d1cc", + "mediumvioletred": "#c71585", + "midnightblue": "#191970", + "mintcream": "#f5fffa", + "mistyrose": "#ffe4e1", + "moccasin": "#ffe4b5", + "navajowhite": "#ffdead", + "navy": "#000080", + "oldlace": "#fdf5e6", + "olive": "#808000", + "olivedrab": "#6b8e23", + "orange": "#ffa500", + "orangered": "#ff4500", + "orchid": "#da70d6", + "palegoldenrod": "#eee8aa", + "palegreen": "#98fb98", + "paleturquoise": "#afeeee", + "palevioletred": "#db7093", + "papayawhip": "#ffefd5", + "peachpuff": "#ffdab9", + "peru": "#cd853f", + "pink": "#ffc0cb", + "plum": "#dda0dd", + "powderblue": "#b0e0e6", + "purple": "#800080", + "rebeccapurple": "#663399", + "red": "#ff0000", + "rosybrown": "#bc8f8f", + "royalblue": "#4169e1", + "saddlebrown": "#8b4513", + "salmon": "#fa8072", + "sandybrown": "#f4a460", + "seagreen": "#2e8b57", + "seashell": "#fff5ee", + "sienna": "#a0522d", + "silver": "#c0c0c0", + "skyblue": "#87ceeb", + "slateblue": "#6a5acd", + "slategray": "#708090", + "slategrey": "#708090", + "snow": "#fffafa", + "springgreen": "#00ff7f", + "steelblue": "#4682b4", + "tan": "#d2b48c", + "teal": "#008080", + "thistle": "#d8bfd8", + "tomato": "#ff6347", + "turquoise": "#40e0d0", + "violet": "#ee82ee", + "wheat": "#f5deb3", + "white": "#ffffff", + "whitesmoke": "#f5f5f5", + "yellow": "#ffff00", + "yellowgreen": "#9acd32", +} diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageDraw.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageDraw.py new file mode 100644 index 0000000000000000000000000000000000000000..b99d42fb5a20a0845294b261638b9b04e22ee182 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageDraw.py @@ -0,0 +1,1035 @@ +# +# The Python Imaging Library +# $Id$ +# +# drawing interface operations +# +# History: +# 1996-04-13 fl Created (experimental) +# 1996-08-07 fl Filled polygons, ellipses. +# 1996-08-13 fl Added text support +# 1998-06-28 fl Handle I and F images +# 1998-12-29 fl Added arc; use arc primitive to draw ellipses +# 1999-01-10 fl Added shape stuff (experimental) +# 1999-02-06 fl Added bitmap support +# 1999-02-11 fl Changed all primitives to take options +# 1999-02-20 fl Fixed backwards compatibility +# 2000-10-12 fl Copy on write, when necessary +# 2001-02-18 fl Use default ink for bitmap/text also in fill mode +# 2002-10-24 fl Added support for CSS-style color strings +# 2002-12-10 fl Added experimental support for RGBA-on-RGB drawing +# 2002-12-11 fl Refactored low-level drawing API (work in progress) +# 2004-08-26 fl Made Draw() a factory function, added getdraw() support +# 2004-09-04 fl Added width support to line primitive +# 2004-09-10 fl Added font mode handling +# 2006-06-19 fl Added font bearing support (getmask2) +# +# Copyright (c) 1997-2006 by Secret Labs AB +# Copyright (c) 1996-2006 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import math +import struct +from collections.abc import Sequence +from typing import cast + +from . import Image, ImageColor, ImageText + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from types import ModuleType + from typing import Any, AnyStr + + from . import ImageDraw2, ImageFont + from ._typing import Coords, _Ink + +# experimental access to the outline API +Outline: Callable[[], Image.core._Outline] = Image.core.outline + +""" +A simple 2D drawing interface for PIL images. +

+Application code should use the Draw factory, instead of +directly. +""" + + +class ImageDraw: + font: ( + ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont | None + ) = None + + def __init__(self, im: Image.Image, mode: str | None = None) -> None: + """ + Create a drawing instance. + + :param im: The image to draw in. + :param mode: Optional mode to use for color values. For RGB + images, this argument can be RGB or RGBA (to blend the + drawing into the image). For all other modes, this argument + must be the same as the image mode. If omitted, the mode + defaults to the mode of the image. + """ + im._ensure_mutable() + blend = 0 + if mode is None: + mode = im.mode + if mode != im.mode: + if mode == "RGBA" and im.mode == "RGB": + blend = 1 + else: + msg = "mode mismatch" + raise ValueError(msg) + if mode == "P": + self.palette = im.palette + else: + self.palette = None + self._image = im + self.im = im.im + self.draw = Image.core.draw(self.im, blend) + self.mode = mode + if mode in ("I", "F"): + self.ink = self.draw.draw_ink(1) + else: + self.ink = self.draw.draw_ink(-1) + if mode in ("1", "P", "I", "F"): + # FIXME: fix Fill2 to properly support matte for I+F images + self.fontmode = "1" + else: + self.fontmode = "L" # aliasing is okay for other modes + self.fill = False + + def getfont( + self, + ) -> ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont: + """ + Get the current default font. + + To set the default font for this ImageDraw instance:: + + from PIL import ImageDraw, ImageFont + draw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf") + + To set the default font for all future ImageDraw instances:: + + from PIL import ImageDraw, ImageFont + ImageDraw.ImageDraw.font = ImageFont.truetype("Tests/fonts/FreeMono.ttf") + + If the current default font is ``None``, + it is initialized with ``ImageFont.load_default()``. + + :returns: An image font.""" + if not self.font: + # FIXME: should add a font repository + from . import ImageFont + + self.font = ImageFont.load_default() + return self.font + + def _getfont( + self, font_size: float | None + ) -> ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont: + if font_size is not None: + from . import ImageFont + + return ImageFont.load_default(font_size) + else: + return self.getfont() + + def _getink( + self, ink: _Ink | None, fill: _Ink | None = None + ) -> tuple[int | None, int | None]: + result_ink = None + result_fill = None + if ink is None and fill is None: + if self.fill: + result_fill = self.ink + else: + result_ink = self.ink + else: + if ink is not None: + if isinstance(ink, str): + ink = ImageColor.getcolor(ink, self.mode) + if self.palette and isinstance(ink, tuple): + ink = self.palette.getcolor(ink, self._image) + result_ink = self.draw.draw_ink(ink) + if fill is not None: + if isinstance(fill, str): + fill = ImageColor.getcolor(fill, self.mode) + if self.palette and isinstance(fill, tuple): + fill = self.palette.getcolor(fill, self._image) + result_fill = self.draw.draw_ink(fill) + return result_ink, result_fill + + def arc( + self, + xy: Coords, + start: float, + end: float, + fill: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw an arc.""" + ink, fill = self._getink(fill) + if ink is not None: + self.draw.draw_arc(xy, start, end, ink, width) + + def bitmap( + self, xy: Sequence[int], bitmap: Image.Image, fill: _Ink | None = None + ) -> None: + """Draw a bitmap.""" + bitmap.load() + ink, fill = self._getink(fill) + if ink is None: + ink = fill + if ink is not None: + self.draw.draw_bitmap(xy, bitmap.im, ink) + + def chord( + self, + xy: Coords, + start: float, + end: float, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw a chord.""" + ink, fill_ink = self._getink(outline, fill) + if fill_ink is not None: + self.draw.draw_chord(xy, start, end, fill_ink, 1) + if ink is not None and ink != fill_ink and width != 0: + self.draw.draw_chord(xy, start, end, ink, 0, width) + + def ellipse( + self, + xy: Coords, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw an ellipse.""" + ink, fill_ink = self._getink(outline, fill) + if fill_ink is not None: + self.draw.draw_ellipse(xy, fill_ink, 1) + if ink is not None and ink != fill_ink and width != 0: + self.draw.draw_ellipse(xy, ink, 0, width) + + def circle( + self, + xy: Sequence[float], + radius: float, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw a circle given center coordinates and a radius.""" + ellipse_xy = (xy[0] - radius, xy[1] - radius, xy[0] + radius, xy[1] + radius) + self.ellipse(ellipse_xy, fill, outline, width) + + def line( + self, + xy: Coords, + fill: _Ink | None = None, + width: int = 0, + joint: str | None = None, + ) -> None: + """Draw a line, or a connected sequence of line segments.""" + ink = self._getink(fill)[0] + if ink is not None: + self.draw.draw_lines(xy, ink, width) + if joint == "curve" and width > 4: + points: Sequence[Sequence[float]] + if isinstance(xy[0], (list, tuple)): + points = cast(Sequence[Sequence[float]], xy) + else: + points = [ + cast(Sequence[float], tuple(xy[i : i + 2])) + for i in range(0, len(xy), 2) + ] + for i in range(1, len(points) - 1): + point = points[i] + angles = [ + math.degrees(math.atan2(end[0] - start[0], start[1] - end[1])) + % 360 + for start, end in ( + (points[i - 1], point), + (point, points[i + 1]), + ) + ] + if angles[0] == angles[1]: + # This is a straight line, so no joint is required + continue + + def coord_at_angle( + coord: Sequence[float], angle: float + ) -> tuple[float, ...]: + x, y = coord + angle -= 90 + distance = width / 2 - 1 + return tuple( + p + (math.floor(p_d) if p_d > 0 else math.ceil(p_d)) + for p, p_d in ( + (x, distance * math.cos(math.radians(angle))), + (y, distance * math.sin(math.radians(angle))), + ) + ) + + flipped = ( + angles[1] > angles[0] and angles[1] - 180 > angles[0] + ) or (angles[1] < angles[0] and angles[1] + 180 > angles[0]) + coords = [ + (point[0] - width / 2 + 1, point[1] - width / 2 + 1), + (point[0] + width / 2 - 1, point[1] + width / 2 - 1), + ] + if flipped: + start, end = (angles[1] + 90, angles[0] + 90) + else: + start, end = (angles[0] - 90, angles[1] - 90) + self.pieslice(coords, start - 90, end - 90, fill) + + if width > 8: + # Cover potential gaps between the line and the joint + if flipped: + gap_coords = [ + coord_at_angle(point, angles[0] + 90), + point, + coord_at_angle(point, angles[1] + 90), + ] + else: + gap_coords = [ + coord_at_angle(point, angles[0] - 90), + point, + coord_at_angle(point, angles[1] - 90), + ] + self.line(gap_coords, fill, width=3) + + def shape( + self, + shape: Image.core._Outline, + fill: _Ink | None = None, + outline: _Ink | None = None, + ) -> None: + """(Experimental) Draw a shape.""" + shape.close() + ink, fill_ink = self._getink(outline, fill) + if fill_ink is not None: + self.draw.draw_outline(shape, fill_ink, 1) + if ink is not None and ink != fill_ink: + self.draw.draw_outline(shape, ink, 0) + + def pieslice( + self, + xy: Coords, + start: float, + end: float, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw a pieslice.""" + ink, fill_ink = self._getink(outline, fill) + if fill_ink is not None: + self.draw.draw_pieslice(xy, start, end, fill_ink, 1) + if ink is not None and ink != fill_ink and width != 0: + self.draw.draw_pieslice(xy, start, end, ink, 0, width) + + def point(self, xy: Coords, fill: _Ink | None = None) -> None: + """Draw one or more individual pixels.""" + ink, fill = self._getink(fill) + if ink is not None: + self.draw.draw_points(xy, ink) + + def polygon( + self, + xy: Coords, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw a polygon.""" + ink, fill_ink = self._getink(outline, fill) + if fill_ink is not None: + self.draw.draw_polygon(xy, fill_ink, 1) + if ink is not None and ink != fill_ink and width != 0: + if width == 1: + self.draw.draw_polygon(xy, ink, 0, width) + elif self.im is not None: + # To avoid expanding the polygon outwards, + # use the fill as a mask + mask = Image.new("1", self.im.size) + mask_ink = self._getink(1)[0] + draw = Draw(mask) + draw.draw.draw_polygon(xy, mask_ink, 1) + + self.draw.draw_polygon(xy, ink, 0, width * 2 - 1, mask.im) + + def regular_polygon( + self, + bounding_circle: Sequence[Sequence[float] | float], + n_sides: int, + rotation: float = 0, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw a regular polygon.""" + xy = _compute_regular_polygon_vertices(bounding_circle, n_sides, rotation) + self.polygon(xy, fill, outline, width) + + def rectangle( + self, + xy: Coords, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + ) -> None: + """Draw a rectangle.""" + ink, fill_ink = self._getink(outline, fill) + if fill_ink is not None: + self.draw.draw_rectangle(xy, fill_ink, 1) + if ink is not None and ink != fill_ink and width != 0: + self.draw.draw_rectangle(xy, ink, 0, width) + + def rounded_rectangle( + self, + xy: Coords, + radius: float = 0, + fill: _Ink | None = None, + outline: _Ink | None = None, + width: int = 1, + *, + corners: tuple[bool, bool, bool, bool] | None = None, + ) -> None: + """Draw a rounded rectangle.""" + if isinstance(xy[0], (list, tuple)): + (x0, y0), (x1, y1) = cast(Sequence[Sequence[float]], xy) + else: + x0, y0, x1, y1 = cast(Sequence[float], xy) + if x1 < x0: + msg = "x1 must be greater than or equal to x0" + raise ValueError(msg) + if y1 < y0: + msg = "y1 must be greater than or equal to y0" + raise ValueError(msg) + if corners is None: + corners = (True, True, True, True) + + d = radius * 2 + + x0 = round(x0) + y0 = round(y0) + x1 = round(x1) + y1 = round(y1) + full_x, full_y = False, False + if all(corners): + full_x = d >= x1 - x0 - 1 + if full_x: + # The two left and two right corners are joined + d = x1 - x0 + full_y = d >= y1 - y0 - 1 + if full_y: + # The two top and two bottom corners are joined + d = y1 - y0 + if full_x and full_y: + # If all corners are joined, that is a circle + return self.ellipse(xy, fill, outline, width) + + if d == 0 or not any(corners): + # If the corners have no curve, + # or there are no corners, + # that is a rectangle + return self.rectangle(xy, fill, outline, width) + + r = int(d // 2) + ink, fill_ink = self._getink(outline, fill) + + def draw_corners(pieslice: bool) -> None: + parts: tuple[tuple[tuple[float, float, float, float], int, int], ...] + if full_x: + # Draw top and bottom halves + parts = ( + ((x0, y0, x0 + d, y0 + d), 180, 360), + ((x0, y1 - d, x0 + d, y1), 0, 180), + ) + elif full_y: + # Draw left and right halves + parts = ( + ((x0, y0, x0 + d, y0 + d), 90, 270), + ((x1 - d, y0, x1, y0 + d), 270, 90), + ) + else: + # Draw four separate corners + parts = tuple( + part + for i, part in enumerate( + ( + ((x0, y0, x0 + d, y0 + d), 180, 270), + ((x1 - d, y0, x1, y0 + d), 270, 360), + ((x1 - d, y1 - d, x1, y1), 0, 90), + ((x0, y1 - d, x0 + d, y1), 90, 180), + ) + ) + if corners[i] + ) + for part in parts: + if pieslice: + self.draw.draw_pieslice(*(part + (fill_ink, 1))) + else: + self.draw.draw_arc(*(part + (ink, width))) + + if fill_ink is not None: + draw_corners(True) + + if full_x: + self.draw.draw_rectangle((x0, y0 + r + 1, x1, y1 - r - 1), fill_ink, 1) + elif x1 - r - 1 >= x0 + r + 1: + self.draw.draw_rectangle((x0 + r + 1, y0, x1 - r - 1, y1), fill_ink, 1) + if not full_x and not full_y: + left = [x0, y0, x0 + r, y1] + if corners[0]: + left[1] += r + 1 + if corners[3]: + left[3] -= r + 1 + self.draw.draw_rectangle(left, fill_ink, 1) + + right = [x1 - r, y0, x1, y1] + if corners[1]: + right[1] += r + 1 + if corners[2]: + right[3] -= r + 1 + self.draw.draw_rectangle(right, fill_ink, 1) + if ink is not None and ink != fill_ink and width != 0: + draw_corners(False) + + if not full_x: + top = [x0, y0, x1, y0 + width - 1] + if corners[0]: + top[0] += r + 1 + if corners[1]: + top[2] -= r + 1 + self.draw.draw_rectangle(top, ink, 1) + + bottom = [x0, y1 - width + 1, x1, y1] + if corners[3]: + bottom[0] += r + 1 + if corners[2]: + bottom[2] -= r + 1 + self.draw.draw_rectangle(bottom, ink, 1) + if not full_y: + left = [x0, y0, x0 + width - 1, y1] + if corners[0]: + left[1] += r + 1 + if corners[3]: + left[3] -= r + 1 + self.draw.draw_rectangle(left, ink, 1) + + right = [x1 - width + 1, y0, x1, y1] + if corners[1]: + right[1] += r + 1 + if corners[2]: + right[3] -= r + 1 + self.draw.draw_rectangle(right, ink, 1) + + def text( + self, + xy: tuple[float, float], + text: AnyStr | ImageText.Text[AnyStr], + fill: _Ink | None = None, + font: ( + ImageFont.ImageFont + | ImageFont.FreeTypeFont + | ImageFont.TransposedFont + | None + ) = None, + anchor: str | None = None, + spacing: float = 4, + align: str = "left", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + stroke_fill: _Ink | None = None, + embedded_color: bool = False, + *args: Any, + **kwargs: Any, + ) -> None: + """Draw text.""" + if isinstance(text, ImageText.Text): + image_text = text + else: + if font is None: + font = self._getfont(kwargs.get("font_size")) + image_text = ImageText.Text( + text, font, self.mode, spacing, direction, features, language + ) + if embedded_color: + image_text.embed_color() + if stroke_width: + image_text.stroke(stroke_width, stroke_fill) + + def getink(fill: _Ink | None) -> int: + ink, fill_ink = self._getink(fill) + if ink is None: + assert fill_ink is not None + return fill_ink + return ink + + ink = getink(fill) + if ink is None: + return + + stroke_ink = None + if image_text.stroke_width: + stroke_ink = ( + getink(image_text.stroke_fill) + if image_text.stroke_fill is not None + else ink + ) + + for line in image_text._split(xy, anchor, align): + + def draw_text(ink: int, stroke_width: float = 0) -> None: + mode = self.fontmode + if stroke_width == 0 and embedded_color: + mode = "RGBA" + x = int(line.x) + y = int(line.y) + start = (math.modf(line.x)[0], math.modf(line.y)[0]) + try: + mask, offset = image_text.font.getmask2( # type: ignore[union-attr,misc] + line.text, + mode, + direction=direction, + features=features, + language=language, + stroke_width=stroke_width, + stroke_filled=True, + anchor=line.anchor, + ink=ink, + start=start, + *args, + **kwargs, + ) + x += offset[0] + y += offset[1] + except AttributeError: + try: + mask = image_text.font.getmask( # type: ignore[misc] + line.text, + mode, + direction, + features, + language, + stroke_width, + line.anchor, + ink, + start=start, + *args, + **kwargs, + ) + except TypeError: + mask = image_text.font.getmask(line.text) + if mode == "RGBA": + # image_text.font.getmask2(mode="RGBA") + # returns color in RGB bands and mask in A + # extract mask and set text alpha + color, mask = mask, mask.getband(3) + ink_alpha = struct.pack("i", ink)[3] + color.fillband(3, ink_alpha) + if self.im is not None: + self.im.paste( + color, (x, y, x + mask.size[0], y + mask.size[1]), mask + ) + else: + self.draw.draw_bitmap((x, y), mask, ink) + + if stroke_ink is not None: + # Draw stroked text + draw_text(stroke_ink, image_text.stroke_width) + + # Draw normal text + if ink != stroke_ink: + draw_text(ink) + else: + # Only draw normal text + draw_text(ink) + + def multiline_text( + self, + xy: tuple[float, float], + text: AnyStr, + fill: _Ink | None = None, + font: ( + ImageFont.ImageFont + | ImageFont.FreeTypeFont + | ImageFont.TransposedFont + | None + ) = None, + anchor: str | None = None, + spacing: float = 4, + align: str = "left", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + stroke_fill: _Ink | None = None, + embedded_color: bool = False, + *, + font_size: float | None = None, + ) -> None: + return self.text( + xy, + text, + fill, + font, + anchor, + spacing, + align, + direction, + features, + language, + stroke_width, + stroke_fill, + embedded_color, + font_size=font_size, + ) + + def textlength( + self, + text: AnyStr, + font: ( + ImageFont.ImageFont + | ImageFont.FreeTypeFont + | ImageFont.TransposedFont + | None + ) = None, + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + embedded_color: bool = False, + *, + font_size: float | None = None, + ) -> float: + """Get the length of a given string, in pixels with 1/64 precision.""" + if font is None: + font = self._getfont(font_size) + image_text = ImageText.Text( + text, + font, + self.mode, + direction=direction, + features=features, + language=language, + ) + if embedded_color: + image_text.embed_color() + return image_text.get_length() + + def textbbox( + self, + xy: tuple[float, float], + text: AnyStr, + font: ( + ImageFont.ImageFont + | ImageFont.FreeTypeFont + | ImageFont.TransposedFont + | None + ) = None, + anchor: str | None = None, + spacing: float = 4, + align: str = "left", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + embedded_color: bool = False, + *, + font_size: float | None = None, + ) -> tuple[float, float, float, float]: + """Get the bounding box of a given string, in pixels.""" + if font is None: + font = self._getfont(font_size) + image_text = ImageText.Text( + text, font, self.mode, spacing, direction, features, language + ) + if embedded_color: + image_text.embed_color() + if stroke_width: + image_text.stroke(stroke_width) + return image_text.get_bbox(xy, anchor, align) + + def multiline_textbbox( + self, + xy: tuple[float, float], + text: AnyStr, + font: ( + ImageFont.ImageFont + | ImageFont.FreeTypeFont + | ImageFont.TransposedFont + | None + ) = None, + anchor: str | None = None, + spacing: float = 4, + align: str = "left", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + embedded_color: bool = False, + *, + font_size: float | None = None, + ) -> tuple[float, float, float, float]: + return self.textbbox( + xy, + text, + font, + anchor, + spacing, + align, + direction, + features, + language, + stroke_width, + embedded_color, + font_size=font_size, + ) + + +def Draw(im: Image.Image, mode: str | None = None) -> ImageDraw: + """ + A simple 2D drawing interface for PIL images. + + :param im: The image to draw in. + :param mode: Optional mode to use for color values. For RGB + images, this argument can be RGB or RGBA (to blend the + drawing into the image). For all other modes, this argument + must be the same as the image mode. If omitted, the mode + defaults to the mode of the image. + """ + try: + return getattr(im, "getdraw")(mode) + except AttributeError: + return ImageDraw(im, mode) + + +def getdraw(im: Image.Image | None = None) -> tuple[ImageDraw2.Draw | None, ModuleType]: + """ + :param im: The image to draw in. + :returns: A (drawing context, drawing resource factory) tuple. + """ + from . import ImageDraw2 + + draw = ImageDraw2.Draw(im) if im is not None else None + return draw, ImageDraw2 + + +def floodfill( + image: Image.Image, + xy: tuple[int, int], + value: float | tuple[int, ...], + border: float | tuple[int, ...] | None = None, + thresh: float = 0, +) -> None: + """ + .. warning:: This method is experimental. + + Fills a bounded region with a given color. + + :param image: Target image. + :param xy: Seed position (a 2-item coordinate tuple). See + :ref:`coordinate-system`. + :param value: Fill color. + :param border: Optional border value. If given, the region consists of + pixels with a color different from the border color. If not given, + the region consists of pixels having the same color as the seed + pixel. + :param thresh: Optional threshold value which specifies a maximum + tolerable difference of a pixel value from the 'background' in + order for it to be replaced. Useful for filling regions of + non-homogeneous, but similar, colors. + """ + # based on an implementation by Eric S. Raymond + # amended by yo1995 @20180806 + pixel = image.load() + assert pixel is not None + x, y = xy + try: + background = pixel[x, y] + if _color_diff(value, background) <= thresh: + return # seed point already has fill color + pixel[x, y] = value + except (ValueError, IndexError): + return # seed point outside image + edge = {(x, y)} + # use a set to keep record of current and previous edge pixels + # to reduce memory consumption + full_edge = set() + while edge: + new_edge = set() + for x, y in edge: # 4 adjacent method + for s, t in ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)): + # If already processed, or if a coordinate is negative, skip + if (s, t) in full_edge or s < 0 or t < 0: + continue + try: + p = pixel[s, t] + except (ValueError, IndexError): + pass + else: + full_edge.add((s, t)) + if border is None: + fill = _color_diff(p, background) <= thresh + else: + fill = p not in (value, border) + if fill: + pixel[s, t] = value + new_edge.add((s, t)) + full_edge = edge # discard pixels processed + edge = new_edge + + +def _compute_regular_polygon_vertices( + bounding_circle: Sequence[Sequence[float] | float], n_sides: int, rotation: float +) -> list[tuple[float, float]]: + """ + Generate a list of vertices for a 2D regular polygon. + + :param bounding_circle: The bounding circle is a sequence defined + by a point and radius. The polygon is inscribed in this circle. + (e.g. ``bounding_circle=(x, y, r)`` or ``((x, y), r)``) + :param n_sides: Number of sides + (e.g. ``n_sides=3`` for a triangle, ``6`` for a hexagon) + :param rotation: Apply an arbitrary rotation to the polygon + (e.g. ``rotation=90``, applies a 90 degree rotation) + :return: List of regular polygon vertices + (e.g. ``[(25, 50), (50, 50), (50, 25), (25, 25)]``) + + How are the vertices computed? + 1. Compute the following variables + - theta: Angle between the apothem & the nearest polygon vertex + - side_length: Length of each polygon edge + - centroid: Center of bounding circle (1st, 2nd elements of bounding_circle) + - polygon_radius: Polygon radius (last element of bounding_circle) + - angles: Location of each polygon vertex in polar grid + (e.g. A square with 0 degree rotation => [225.0, 315.0, 45.0, 135.0]) + + 2. For each angle in angles, get the polygon vertex at that angle + The vertex is computed using the equation below. + X= xcos(φ) + ysin(φ) + Y= −xsin(φ) + ycos(φ) + + Note: + φ = angle in degrees + x = 0 + y = polygon_radius + + The formula above assumes rotation around the origin. + In our case, we are rotating around the centroid. + To account for this, we use the formula below + X = xcos(φ) + ysin(φ) + centroid_x + Y = −xsin(φ) + ycos(φ) + centroid_y + """ + # 1. Error Handling + # 1.1 Check `n_sides` has an appropriate value + if not isinstance(n_sides, int): + msg = "n_sides should be an int" # type: ignore[unreachable] + raise TypeError(msg) + if n_sides < 3: + msg = "n_sides should be an int > 2" + raise ValueError(msg) + + # 1.2 Check `bounding_circle` has an appropriate value + if not isinstance(bounding_circle, (list, tuple)): + msg = "bounding_circle should be a sequence" + raise TypeError(msg) + + if len(bounding_circle) == 3: + if not all(isinstance(i, (int, float)) for i in bounding_circle): + msg = "bounding_circle should only contain numeric data" + raise ValueError(msg) + + *centroid, polygon_radius = cast(list[float], list(bounding_circle)) + elif len(bounding_circle) == 2 and isinstance(bounding_circle[0], (list, tuple)): + if not all( + isinstance(i, (int, float)) for i in bounding_circle[0] + ) or not isinstance(bounding_circle[1], (int, float)): + msg = "bounding_circle should only contain numeric data" + raise ValueError(msg) + + if len(bounding_circle[0]) != 2: + msg = "bounding_circle centre should contain 2D coordinates (e.g. (x, y))" + raise ValueError(msg) + + centroid = cast(list[float], list(bounding_circle[0])) + polygon_radius = cast(float, bounding_circle[1]) + else: + msg = ( + "bounding_circle should contain 2D coordinates " + "and a radius (e.g. (x, y, r) or ((x, y), r) )" + ) + raise ValueError(msg) + + if polygon_radius <= 0: + msg = "bounding_circle radius should be > 0" + raise ValueError(msg) + + # 1.3 Check `rotation` has an appropriate value + if not isinstance(rotation, (int, float)): + msg = "rotation should be an int or float" # type: ignore[unreachable] + raise ValueError(msg) + + # 2. Define Helper Functions + def _apply_rotation(point: list[float], degrees: float) -> tuple[float, float]: + return ( + round( + point[0] * math.cos(math.radians(360 - degrees)) + - point[1] * math.sin(math.radians(360 - degrees)) + + centroid[0], + 2, + ), + round( + point[1] * math.cos(math.radians(360 - degrees)) + + point[0] * math.sin(math.radians(360 - degrees)) + + centroid[1], + 2, + ), + ) + + def _compute_polygon_vertex(angle: float) -> tuple[float, float]: + start_point = [polygon_radius, 0] + return _apply_rotation(start_point, angle) + + def _get_angles(n_sides: int, rotation: float) -> list[float]: + angles = [] + degrees = 360 / n_sides + # Start with the bottom left polygon vertex + current_angle = (270 - 0.5 * degrees) + rotation + for _ in range(n_sides): + angles.append(current_angle) + current_angle += degrees + if current_angle > 360: + current_angle -= 360 + return angles + + # 3. Variable Declarations + angles = _get_angles(n_sides, rotation) + + # 4. Compute Vertices + return [_compute_polygon_vertex(angle) for angle in angles] + + +def _color_diff( + color1: float | tuple[int, ...], color2: float | tuple[int, ...] +) -> float: + """ + Uses 1-norm distance to calculate difference between two values. + """ + first = color1 if isinstance(color1, tuple) else (color1,) + second = color2 if isinstance(color2, tuple) else (color2,) + + return sum(abs(first[i] - second[i]) for i in range(len(second))) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageDraw2.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageDraw2.py new file mode 100644 index 0000000000000000000000000000000000000000..f5dd160edd04816f008baac8a79af9e347676921 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageDraw2.py @@ -0,0 +1,244 @@ +# +# The Python Imaging Library +# $Id$ +# +# WCK-style drawing interface operations +# +# History: +# 2003-12-07 fl created +# 2005-05-15 fl updated; added to PIL as ImageDraw2 +# 2005-05-15 fl added text support +# 2005-05-20 fl added arc/chord/pieslice support +# +# Copyright (c) 2003-2005 by Secret Labs AB +# Copyright (c) 2003-2005 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# + + +""" +(Experimental) WCK-style drawing interface operations + +.. seealso:: :py:mod:`PIL.ImageDraw` +""" + +from __future__ import annotations + +from typing import Any, AnyStr, BinaryIO + +from . import Image, ImageColor, ImageDraw, ImageFont, ImagePath +from ._typing import Coords, StrOrBytesPath + + +class Pen: + """Stores an outline color and width.""" + + def __init__(self, color: str, width: int = 1, opacity: int = 255) -> None: + self.color = ImageColor.getrgb(color) + self.width = width + + +class Brush: + """Stores a fill color""" + + def __init__(self, color: str, opacity: int = 255) -> None: + self.color = ImageColor.getrgb(color) + + +class Font: + """Stores a TrueType font and color""" + + def __init__( + self, color: str, file: StrOrBytesPath | BinaryIO, size: float = 12 + ) -> None: + # FIXME: add support for bitmap fonts + self.color = ImageColor.getrgb(color) + self.font = ImageFont.truetype(file, size) + + +class Draw: + """ + (Experimental) WCK-style drawing interface + """ + + def __init__( + self, + image: Image.Image | str, + size: tuple[int, int] | list[int] | None = None, + color: float | tuple[float, ...] | str | None = None, + ) -> None: + if isinstance(image, str): + if size is None: + msg = "If image argument is mode string, size must be a list or tuple" + raise ValueError(msg) + image = Image.new(image, size, color) + self.draw = ImageDraw.Draw(image) + self.image = image + self.transform: tuple[float, float, float, float, float, float] | None = None + + def flush(self) -> Image.Image: + return self.image + + def render( + self, + op: str, + xy: Coords, + pen: Pen | Brush | None, + brush: Brush | Pen | None = None, + **kwargs: Any, + ) -> None: + # handle color arguments + outline = fill = None + width = 1 + if isinstance(pen, Pen): + outline = pen.color + width = pen.width + elif isinstance(brush, Pen): + outline = brush.color + width = brush.width + if isinstance(brush, Brush): + fill = brush.color + elif isinstance(pen, Brush): + fill = pen.color + # handle transformation + if self.transform: + path = ImagePath.Path(xy) + path.transform(self.transform) + xy = path + # render the item + if op in ("arc", "line"): + kwargs.setdefault("fill", outline) + else: + kwargs.setdefault("fill", fill) + kwargs.setdefault("outline", outline) + if op == "line": + kwargs.setdefault("width", width) + getattr(self.draw, op)(xy, **kwargs) + + def settransform(self, offset: tuple[float, float]) -> None: + """Sets a transformation offset.""" + xoffset, yoffset = offset + self.transform = (1, 0, xoffset, 0, 1, yoffset) + + def arc( + self, + xy: Coords, + pen: Pen | Brush | None, + start: float, + end: float, + *options: Any, + ) -> None: + """ + Draws an arc (a portion of a circle outline) between the start and end + angles, inside the given bounding box. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc` + """ + self.render("arc", xy, pen, *options, start=start, end=end) + + def chord( + self, + xy: Coords, + pen: Pen | Brush | None, + start: float, + end: float, + *options: Any, + ) -> None: + """ + Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points + with a straight line. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord` + """ + self.render("chord", xy, pen, *options, start=start, end=end) + + def ellipse(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: + """ + Draws an ellipse inside the given bounding box. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse` + """ + self.render("ellipse", xy, pen, *options) + + def line(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: + """ + Draws a line between the coordinates in the ``xy`` list. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line` + """ + self.render("line", xy, pen, *options) + + def pieslice( + self, + xy: Coords, + pen: Pen | Brush | None, + start: float, + end: float, + *options: Any, + ) -> None: + """ + Same as arc, but also draws straight lines between the end points and the + center of the bounding box. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice` + """ + self.render("pieslice", xy, pen, *options, start=start, end=end) + + def polygon(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: + """ + Draws a polygon. + + The polygon outline consists of straight lines between the given + coordinates, plus a straight line between the last and the first + coordinate. + + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon` + """ + self.render("polygon", xy, pen, *options) + + def rectangle(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None: + """ + Draws a rectangle. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle` + """ + self.render("rectangle", xy, pen, *options) + + def text(self, xy: tuple[float, float], text: AnyStr, font: Font) -> None: + """ + Draws the string at the given position. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text` + """ + if self.transform: + path = ImagePath.Path(xy) + path.transform(self.transform) + xy = path + self.draw.text(xy, text, font=font.font, fill=font.color) + + def textbbox( + self, xy: tuple[float, float], text: AnyStr, font: Font + ) -> tuple[float, float, float, float]: + """ + Returns bounding box (in pixels) of given text. + + :return: ``(left, top, right, bottom)`` bounding box + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textbbox` + """ + if self.transform: + path = ImagePath.Path(xy) + path.transform(self.transform) + xy = path + return self.draw.textbbox(xy, text, font=font.font) + + def textlength(self, text: AnyStr, font: Font) -> float: + """ + Returns length (in pixels) of given text. + This is the amount by which following text should be offset. + + .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textlength` + """ + return self.draw.textlength(text, font=font.font) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageEnhance.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageEnhance.py new file mode 100644 index 0000000000000000000000000000000000000000..580b358fdf0d874852317cc1ad256ed9de14d120 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageEnhance.py @@ -0,0 +1,113 @@ +# +# The Python Imaging Library. +# $Id$ +# +# image enhancement classes +# +# For a background, see "Image Processing By Interpolation and +# Extrapolation", Paul Haeberli and Douglas Voorhies. Available +# at http://www.graficaobscura.com/interp/index.html +# +# History: +# 1996-03-23 fl Created +# 2009-06-16 fl Fixed mean calculation +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image, ImageFilter, ImageStat + + +class _Enhance: + image: Image.Image + degenerate: Image.Image + + def enhance(self, factor: float) -> Image.Image: + """ + Returns an enhanced image. + + :param factor: A floating point value controlling the enhancement. + Factor 1.0 always returns a copy of the original image, + lower factors mean less color (brightness, contrast, + etc), and higher values more. There are no restrictions + on this value. + :rtype: :py:class:`~PIL.Image.Image` + """ + return Image.blend(self.degenerate, self.image, factor) + + +class Color(_Enhance): + """Adjust image color balance. + + This class can be used to adjust the colour balance of an image, in + a manner similar to the controls on a colour TV set. An enhancement + factor of 0.0 gives a black and white image. A factor of 1.0 gives + the original image. + """ + + def __init__(self, image: Image.Image) -> None: + self.image = image + self.intermediate_mode = "L" + if "A" in image.getbands(): + self.intermediate_mode = "LA" + + if self.intermediate_mode != image.mode: + image = image.convert(self.intermediate_mode).convert(image.mode) + self.degenerate = image + + +class Contrast(_Enhance): + """Adjust image contrast. + + This class can be used to control the contrast of an image, similar + to the contrast control on a TV set. An enhancement factor of 0.0 + gives a solid gray image. A factor of 1.0 gives the original image. + """ + + def __init__(self, image: Image.Image) -> None: + self.image = image + if image.mode != "L": + image = image.convert("L") + mean = int(ImageStat.Stat(image).mean[0] + 0.5) + self.degenerate = Image.new("L", image.size, mean) + if self.degenerate.mode != self.image.mode: + self.degenerate = self.degenerate.convert(self.image.mode) + + if "A" in self.image.getbands(): + self.degenerate.putalpha(self.image.getchannel("A")) + + +class Brightness(_Enhance): + """Adjust image brightness. + + This class can be used to control the brightness of an image. An + enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the + original image. + """ + + def __init__(self, image: Image.Image) -> None: + self.image = image + self.degenerate = Image.new(image.mode, image.size, 0) + + if "A" in image.getbands(): + self.degenerate.putalpha(image.getchannel("A")) + + +class Sharpness(_Enhance): + """Adjust image sharpness. + + This class can be used to adjust the sharpness of an image. An + enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the + original image, and a factor of 2.0 gives a sharpened image. + """ + + def __init__(self, image: Image.Image) -> None: + self.image = image + self.degenerate = image.filter(ImageFilter.SMOOTH) + + if "A" in image.getbands(): + self.degenerate.putalpha(image.getchannel("A")) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFile.py new file mode 100644 index 0000000000000000000000000000000000000000..13940f5b78e16ef857abab66c96035e239eee814 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFile.py @@ -0,0 +1,935 @@ +# +# The Python Imaging Library. +# $Id$ +# +# base class for image file handlers +# +# history: +# 1995-09-09 fl Created +# 1996-03-11 fl Fixed load mechanism. +# 1996-04-15 fl Added pcx/xbm decoders. +# 1996-04-30 fl Added encoders. +# 1996-12-14 fl Added load helpers +# 1997-01-11 fl Use encode_to_file where possible +# 1997-08-27 fl Flush output in _save +# 1998-03-05 fl Use memory mapping for some modes +# 1999-02-04 fl Use memory mapping also for "I;16" and "I;16B" +# 1999-05-31 fl Added image parser +# 2000-10-12 fl Set readonly flag on memory-mapped images +# 2002-03-20 fl Use better messages for common decoder errors +# 2003-04-21 fl Fall back on mmap/map_buffer if map is not available +# 2003-10-30 fl Added StubImageFile class +# 2004-02-25 fl Made incremental parser more robust +# +# Copyright (c) 1997-2004 by Secret Labs AB +# Copyright (c) 1995-2004 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import abc +import io +import itertools +import logging +import os +import struct +from typing import IO, Any, NamedTuple, cast + +from . import ExifTags, Image +from ._util import DeferredError, is_path + +TYPE_CHECKING = False +if TYPE_CHECKING: + from ._typing import StrOrBytesPath + +logger = logging.getLogger(__name__) + +MAXBLOCK = 65536 +""" +By default, Pillow processes image data in blocks. This helps to prevent excessive use +of resources. Codecs may disable this behaviour with ``_pulls_fd`` or ``_pushes_fd``. + +When reading an image, this is the number of bytes to read at once. + +When writing an image, this is the number of bytes to write at once. +If the image width times 4 is greater, then that will be used instead. +Plugins may also set a greater number. + +User code may set this to another number. +""" + +SAFEBLOCK = 1024 * 1024 + +LOAD_TRUNCATED_IMAGES = False +"""Whether or not to load truncated image files. User code may change this.""" + +ERRORS = { + -1: "image buffer overrun error", + -2: "decoding error", + -3: "unknown error", + -8: "bad configuration", + -9: "out of memory error", +} +""" +Dict of known error codes returned from :meth:`.PyDecoder.decode`, +:meth:`.PyEncoder.encode` :meth:`.PyEncoder.encode_to_pyfd` and +:meth:`.PyEncoder.encode_to_file`. +""" + + +# +# -------------------------------------------------------------------- +# Helpers + + +def _get_oserror(error: int, *, encoder: bool) -> OSError: + try: + msg = Image.core.getcodecstatus(error) + except AttributeError: + msg = ERRORS.get(error) + if not msg: + msg = f"{'encoder' if encoder else 'decoder'} error {error}" + msg += f" when {'writing' if encoder else 'reading'} image file" + return OSError(msg) + + +def _tilesort(t: _Tile) -> int: + # sort on offset + return t[2] + + +class _Tile(NamedTuple): + codec_name: str + extents: tuple[int, int, int, int] | None + offset: int = 0 + args: tuple[Any, ...] | str | None = None + + +# +# -------------------------------------------------------------------- +# ImageFile base class + + +class ImageFile(Image.Image): + """Base class for image file format handlers.""" + + def __init__( + self, fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None + ) -> None: + super().__init__() + + self._min_frame = 0 + + self.custom_mimetype: str | None = None + + self.tile: list[_Tile] = [] + """ A list of tile descriptors """ + + self.readonly = 1 # until we know better + + self.decoderconfig: tuple[Any, ...] = () + self.decodermaxblock = MAXBLOCK + + self.fp: IO[bytes] | None + self._fp: IO[bytes] | DeferredError + if is_path(fp): + # filename + self.fp = open(fp, "rb") + self.filename = os.fspath(fp) + self._exclusive_fp = True + else: + # stream + self.fp = cast(IO[bytes], fp) + self.filename = filename if filename is not None else "" + # can be overridden + self._exclusive_fp = False + + try: + try: + self._open() + + if isinstance(self, StubImageFile): + if loader := self._load(): + loader.open(self) + except ( + IndexError, # end of data + TypeError, # end of data (ord) + KeyError, # unsupported mode + EOFError, # got header but not the first frame + struct.error, + ) as v: + raise SyntaxError(v) from v + + if not self.mode or self.size[0] <= 0 or self.size[1] <= 0: + msg = "not identified by this driver" + raise SyntaxError(msg) + except BaseException: + # close the file only if we have opened it this constructor + if self._exclusive_fp: + self.fp.close() + raise + + def _open(self) -> None: + pass + + # Context manager support + def __enter__(self) -> ImageFile: + return self + + def _close_fp(self) -> None: + if getattr(self, "_fp", False) and not isinstance(self._fp, DeferredError): + if self._fp != self.fp: + self._fp.close() + self._fp = DeferredError(ValueError("Operation on closed image")) + if self.fp: + self.fp.close() + + def __exit__(self, *args: object) -> None: + if getattr(self, "_exclusive_fp", False): + self._close_fp() + self.fp = None + + def close(self) -> None: + """ + Closes the file pointer, if possible. + + This operation will destroy the image core and release its memory. + The image data will be unusable afterward. + + This function is required to close images that have multiple frames or + have not had their file read and closed by the + :py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for + more information. + """ + try: + self._close_fp() + self.fp = None + except Exception as msg: + logger.debug("Error closing: %s", msg) + + super().close() + + def get_child_images(self) -> list[ImageFile]: + child_images = [] + exif = self.getexif() + ifds = [] + if ExifTags.Base.SubIFDs in exif: + subifd_offsets = exif[ExifTags.Base.SubIFDs] + if subifd_offsets: + if not isinstance(subifd_offsets, tuple): + subifd_offsets = (subifd_offsets,) + ifds = [ + (exif._get_ifd_dict(subifd_offset), subifd_offset) + for subifd_offset in subifd_offsets + ] + ifd1 = exif.get_ifd(ExifTags.IFD.IFD1) + if ifd1 and ifd1.get(ExifTags.Base.JpegIFOffset): + assert exif._info is not None + ifds.append((ifd1, exif._info.next)) + + offset = None + for ifd, ifd_offset in ifds: + assert self.fp is not None + current_offset = self.fp.tell() + if offset is None: + offset = current_offset + + fp = self.fp + if ifd is not None: + thumbnail_offset = ifd.get(ExifTags.Base.JpegIFOffset) + if thumbnail_offset is not None: + thumbnail_offset += getattr(self, "_exif_offset", 0) + self.fp.seek(thumbnail_offset) + + length = ifd.get(ExifTags.Base.JpegIFByteCount) + assert isinstance(length, int) + data = self.fp.read(length) + fp = io.BytesIO(data) + + with Image.open(fp) as im: + from . import TiffImagePlugin + + if thumbnail_offset is None and isinstance( + im, TiffImagePlugin.TiffImageFile + ): + im._frame_pos = [ifd_offset] + im._seek(0) + im.load() + child_images.append(im) + + if offset is not None: + assert self.fp is not None + self.fp.seek(offset) + return child_images + + def get_format_mimetype(self) -> str | None: + if self.custom_mimetype: + return self.custom_mimetype + if self.format is not None: + return Image.MIME.get(self.format.upper()) + return None + + def __getstate__(self) -> list[Any]: + return super().__getstate__() + [self.filename] + + def __setstate__(self, state: list[Any]) -> None: + self.tile = [] + if len(state) > 5: + self.filename = state[5] + super().__setstate__(state) + + def verify(self) -> None: + """Check file integrity""" + + # raise exception if something's wrong. must be called + # directly after open, and closes file when finished. + if self._exclusive_fp and self.fp: + self.fp.close() + self.fp = None + + def load(self) -> Image.core.PixelAccess | None: + """Load image data based on tile list""" + + if not self.tile and self._im is None: + msg = "cannot load this image" + raise OSError(msg) + + pixel = Image.Image.load(self) + if not self.tile: + return pixel + + self.map: mmap.mmap | None = None + use_mmap = self.filename and len(self.tile) == 1 + + assert self.fp is not None + readonly = 0 + + # look for read/seek overrides + if hasattr(self, "load_read"): + read = self.load_read + # don't use mmap if there are custom read/seek functions + use_mmap = False + else: + read = self.fp.read + + if hasattr(self, "load_seek"): + seek = self.load_seek + use_mmap = False + else: + seek = self.fp.seek + + if use_mmap: + # try memory mapping + decoder_name, extents, offset, args = self.tile[0] + if isinstance(args, str): + args = (args, 0, 1) + if ( + decoder_name == "raw" + and isinstance(args, tuple) + and len(args) >= 3 + and args[0] == self.mode + and args[0] in Image._MAPMODES + ): + if offset < 0: + msg = "Tile offset cannot be negative" + raise ValueError(msg) + try: + # use mmap, if possible + import mmap + + with open(self.filename) as fp: + self.map = mmap.mmap(fp.fileno(), 0, access=mmap.ACCESS_READ) + if offset + self.size[1] * args[1] > self.map.size(): + msg = "buffer is not large enough" + raise OSError(msg) + self.im = Image.core.map_buffer( + self.map, self.size, decoder_name, offset, args + ) + readonly = 1 + # After trashing self.im, + # we might need to reload the palette data. + if self.palette: + self.palette.dirty = 1 + except (AttributeError, OSError, ImportError): + self.map = None + + self.load_prepare() + err_code = -3 # initialize to unknown error + if not self.map: + # sort tiles in file order + self.tile.sort(key=_tilesort) + + # FIXME: This is a hack to handle TIFF's JpegTables tag. + prefix = getattr(self, "tile_prefix", b"") + + # Remove consecutive duplicates that only differ by their offset + self.tile = [ + list(tiles)[-1] + for _, tiles in itertools.groupby( + self.tile, lambda tile: (tile[0], tile[1], tile[3]) + ) + ] + for i, (decoder_name, extents, offset, args) in enumerate(self.tile): + seek(offset) + decoder = Image._getdecoder( + self.mode, decoder_name, args, self.decoderconfig + ) + try: + decoder.setimage(self.im, extents) + if decoder.pulls_fd: + decoder.setfd(self.fp) + err_code = decoder.decode(b"")[1] + else: + b = prefix + while True: + read_bytes = self.decodermaxblock + if i + 1 < len(self.tile): + next_offset = self.tile[i + 1].offset + if next_offset > offset: + read_bytes = next_offset - offset + try: + s = read(read_bytes) + except (IndexError, struct.error) as e: + # truncated png/gif + if LOAD_TRUNCATED_IMAGES: + break + else: + msg = "image file is truncated" + raise OSError(msg) from e + + if not s: # truncated jpeg + if LOAD_TRUNCATED_IMAGES: + break + else: + msg = ( + "image file is truncated " + f"({len(b)} bytes not processed)" + ) + raise OSError(msg) + + b = b + s + n, err_code = decoder.decode(b) + if n < 0: + break + b = b[n:] + finally: + # Need to cleanup here to prevent leaks + decoder.cleanup() + + self.tile = [] + self.readonly = readonly + + self.load_end() + + if self._exclusive_fp and self._close_exclusive_fp_after_loading: + self.fp.close() + self.fp = None + + if not self.map and not LOAD_TRUNCATED_IMAGES and err_code < 0: + # still raised if decoder fails to return anything + raise _get_oserror(err_code, encoder=False) + + return Image.Image.load(self) + + def load_prepare(self) -> None: + # create image memory if necessary + if self._im is None: + self.im = Image.core.new(self.mode, self.size) + # create palette (optional) + if self.mode == "P": + Image.Image.load(self) + + def load_end(self) -> None: + # may be overridden + pass + + # may be defined for contained formats + # def load_seek(self, pos: int) -> None: + # pass + + # may be defined for blocked formats (e.g. PNG) + # def load_read(self, read_bytes: int) -> bytes: + # pass + + def _seek_check(self, frame: int) -> bool: + if ( + frame < self._min_frame + # Only check upper limit on frames if additional seek operations + # are not required to do so + or ( + not (hasattr(self, "_n_frames") and self._n_frames is None) + and frame >= getattr(self, "n_frames") + self._min_frame + ) + ): + msg = "attempt to seek outside sequence" + raise EOFError(msg) + + return self.tell() != frame + + +class StubHandler(abc.ABC): + def open(self, im: StubImageFile) -> None: + pass + + @abc.abstractmethod + def load(self, im: StubImageFile) -> Image.Image: + pass + + +class StubImageFile(ImageFile, metaclass=abc.ABCMeta): + """ + Base class for stub image loaders. + + A stub loader is an image loader that can identify files of a + certain format, but relies on external code to load the file. + """ + + @abc.abstractmethod + def _open(self) -> None: + pass + + def load(self) -> Image.core.PixelAccess | None: + loader = self._load() + if loader is None: + msg = f"cannot find loader for this {self.format} file" + raise OSError(msg) + image = loader.load(self) + assert image is not None + # become the other object (!) + self.__class__ = image.__class__ # type: ignore[assignment] + self.__dict__ = image.__dict__ + return image.load() + + @abc.abstractmethod + def _load(self) -> StubHandler | None: + """(Hook) Find actual image loader.""" + pass + + +class Parser: + """ + Incremental image parser. This class implements the standard + feed/close consumer interface. + """ + + incremental = None + image: Image.Image | None = None + data: bytes | None = None + decoder: Image.core.ImagingDecoder | PyDecoder | None = None + offset = 0 + finished = 0 + + def reset(self) -> None: + """ + (Consumer) Reset the parser. Note that you can only call this + method immediately after you've created a parser; parser + instances cannot be reused. + """ + assert self.data is None, "cannot reuse parsers" + + def feed(self, data: bytes) -> None: + """ + (Consumer) Feed data to the parser. + + :param data: A string buffer. + :exception OSError: If the parser failed to parse the image file. + """ + # collect data + + if self.finished: + return + + if self.data is None: + self.data = data + else: + self.data = self.data + data + + # parse what we have + if self.decoder: + if self.offset > 0: + # skip header + skip = min(len(self.data), self.offset) + self.data = self.data[skip:] + self.offset = self.offset - skip + if self.offset > 0 or not self.data: + return + + n, e = self.decoder.decode(self.data) + + if n < 0: + # end of stream + self.data = None + self.finished = 1 + if e < 0: + # decoding error + self.image = None + raise _get_oserror(e, encoder=False) + else: + # end of image + return + self.data = self.data[n:] + + elif self.image: + # if we end up here with no decoder, this file cannot + # be incrementally parsed. wait until we've gotten all + # available data + pass + + else: + # attempt to open this file + try: + with io.BytesIO(self.data) as fp: + im = Image.open(fp) + except OSError: + pass # not enough data + else: + flag = hasattr(im, "load_seek") or hasattr(im, "load_read") + if not flag and len(im.tile) == 1: + # initialize decoder + im.load_prepare() + d, e, o, a = im.tile[0] + im.tile = [] + self.decoder = Image._getdecoder(im.mode, d, a, im.decoderconfig) + self.decoder.setimage(im.im, e) + + # calculate decoder offset + self.offset = o + if self.offset <= len(self.data): + self.data = self.data[self.offset :] + self.offset = 0 + + self.image = im + + def __enter__(self) -> Parser: + return self + + def __exit__(self, *args: object) -> None: + self.close() + + def close(self) -> Image.Image: + """ + (Consumer) Close the stream. + + :returns: An image object. + :exception OSError: If the parser failed to parse the image file either + because it cannot be identified or cannot be + decoded. + """ + # finish decoding + if self.decoder: + # get rid of what's left in the buffers + self.feed(b"") + self.data = self.decoder = None + if not self.finished: + msg = "image was incomplete" + raise OSError(msg) + if not self.image: + msg = "cannot parse this image" + raise OSError(msg) + if self.data: + # incremental parsing not possible; reopen the file + # not that we have all data + with io.BytesIO(self.data) as fp: + try: + self.image = Image.open(fp) + finally: + self.image.load() + return self.image + + +# -------------------------------------------------------------------- + + +def _save(im: Image.Image, fp: IO[bytes], tile: list[_Tile], bufsize: int = 0) -> None: + """Helper to save image based on tile list + + :param im: Image object. + :param fp: File object. + :param tile: Tile list. + :param bufsize: Optional buffer size + """ + + im.load() + if not hasattr(im, "encoderconfig"): + im.encoderconfig = () + tile.sort(key=_tilesort) + # FIXME: make MAXBLOCK a configuration parameter + # It would be great if we could have the encoder specify what it needs + # But, it would need at least the image size in most cases. RawEncode is + # a tricky case. + bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4) # see RawEncode.c + try: + fh = fp.fileno() + fp.flush() + _encode_tile(im, fp, tile, bufsize, fh) + except (AttributeError, io.UnsupportedOperation) as exc: + _encode_tile(im, fp, tile, bufsize, None, exc) + if hasattr(fp, "flush"): + fp.flush() + + +def _encode_tile( + im: Image.Image, + fp: IO[bytes], + tile: list[_Tile], + bufsize: int, + fh: int | None, + exc: BaseException | None = None, +) -> None: + for encoder_name, extents, offset, args in tile: + if offset > 0: + fp.seek(offset) + encoder = Image._getencoder(im.mode, encoder_name, args, im.encoderconfig) + try: + encoder.setimage(im.im, extents) + if encoder.pushes_fd: + encoder.setfd(fp) + errcode = encoder.encode_to_pyfd()[1] + else: + if exc: + # compress to Python file-compatible object + while True: + errcode, data = encoder.encode(bufsize)[1:] + fp.write(data) + if errcode: + break + else: + # slight speedup: compress to real file object + assert fh is not None + errcode = encoder.encode_to_file(fh, bufsize) + if errcode < 0: + raise _get_oserror(errcode, encoder=True) from exc + finally: + encoder.cleanup() + + +def _safe_read(fp: IO[bytes], size: int) -> bytes: + """ + Reads large blocks in a safe way. Unlike fp.read(n), this function + doesn't trust the user. If the requested size is larger than + SAFEBLOCK, the file is read block by block. + + :param fp: File handle. Must implement a read method. + :param size: Number of bytes to read. + :returns: A string containing size bytes of data. + + Raises an OSError if the file is truncated and the read cannot be completed + + """ + if size <= 0: + return b"" + if size <= SAFEBLOCK: + data = fp.read(size) + if len(data) < size: + msg = "Truncated File Read" + raise OSError(msg) + return data + blocks: list[bytes] = [] + remaining_size = size + while remaining_size > 0: + block = fp.read(min(remaining_size, SAFEBLOCK)) + if not block: + break + blocks.append(block) + remaining_size -= len(block) + if sum(len(block) for block in blocks) < size: + msg = "Truncated File Read" + raise OSError(msg) + return b"".join(blocks) + + +class PyCodecState: + def __init__(self) -> None: + self.xsize = 0 + self.ysize = 0 + self.xoff = 0 + self.yoff = 0 + + def extents(self) -> tuple[int, int, int, int]: + return self.xoff, self.yoff, self.xoff + self.xsize, self.yoff + self.ysize + + +class PyCodec: + fd: IO[bytes] | None + + def __init__(self, mode: str, *args: Any) -> None: + self.im: Image.core.ImagingCore | None = None + self.state = PyCodecState() + self.fd = None + self.mode = mode + self.init(args) + + def init(self, args: tuple[Any, ...]) -> None: + """ + Override to perform codec specific initialization + + :param args: Tuple of arg items from the tile entry + :returns: None + """ + self.args = args + + def cleanup(self) -> None: + """ + Override to perform codec specific cleanup + + :returns: None + """ + pass + + def setfd(self, fd: IO[bytes]) -> None: + """ + Called from ImageFile to set the Python file-like object + + :param fd: A Python file-like object + :returns: None + """ + self.fd = fd + + def setimage( + self, + im: Image.core.ImagingCore, + extents: tuple[int, int, int, int] | None = None, + ) -> None: + """ + Called from ImageFile to set the core output image for the codec + + :param im: A core image object + :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle + for this tile + :returns: None + """ + + # following c code + self.im = im + + if extents: + x0, y0, x1, y1 = extents + + if x0 < 0 or y0 < 0 or x1 > self.im.size[0] or y1 > self.im.size[1]: + msg = "Tile cannot extend outside image" + raise ValueError(msg) + + self.state.xoff = x0 + self.state.yoff = y0 + self.state.xsize = x1 - x0 + self.state.ysize = y1 - y0 + else: + self.state.xsize, self.state.ysize = self.im.size + + if self.state.xsize <= 0 or self.state.ysize <= 0: + msg = "Size must be positive" + raise ValueError(msg) + + +class PyDecoder(PyCodec): + """ + Python implementation of a format decoder. Override this class and + add the decoding logic in the :meth:`decode` method. + + See :ref:`Writing Your Own File Codec in Python` + """ + + _pulls_fd = False + + @property + def pulls_fd(self) -> bool: + return self._pulls_fd + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + """ + Override to perform the decoding process. + + :param buffer: A bytes object with the data to be decoded. + :returns: A tuple of ``(bytes consumed, errcode)``. + If finished with decoding return -1 for the bytes consumed. + Err codes are from :data:`.ImageFile.ERRORS`. + """ + msg = "unavailable in base decoder" + raise NotImplementedError(msg) + + def set_as_raw( + self, data: bytes, rawmode: str | None = None, extra: tuple[Any, ...] = () + ) -> None: + """ + Convenience method to set the internal image from a stream of raw data + + :param data: Bytes to be set + :param rawmode: The rawmode to be used for the decoder. + If not specified, it will default to the mode of the image + :param extra: Extra arguments for the decoder. + :returns: None + """ + + if not rawmode: + rawmode = self.mode + d = Image._getdecoder(self.mode, "raw", rawmode, extra) + assert self.im is not None + d.setimage(self.im, self.state.extents()) + s = d.decode(data) + + if s[0] >= 0: + msg = "not enough image data" + raise ValueError(msg) + if s[1] != 0: + msg = "cannot decode image data" + raise ValueError(msg) + + +class PyEncoder(PyCodec): + """ + Python implementation of a format encoder. Override this class and + add the decoding logic in the :meth:`encode` method. + + See :ref:`Writing Your Own File Codec in Python` + """ + + _pushes_fd = False + + @property + def pushes_fd(self) -> bool: + return self._pushes_fd + + def encode(self, bufsize: int) -> tuple[int, int, bytes]: + """ + Override to perform the encoding process. + + :param bufsize: Buffer size. + :returns: A tuple of ``(bytes encoded, errcode, bytes)``. + If finished with encoding return 1 for the error code. + Err codes are from :data:`.ImageFile.ERRORS`. + """ + msg = "unavailable in base encoder" + raise NotImplementedError(msg) + + def encode_to_pyfd(self) -> tuple[int, int]: + """ + If ``pushes_fd`` is ``True``, then this method will be used, + and ``encode()`` will only be called once. + + :returns: A tuple of ``(bytes consumed, errcode)``. + Err codes are from :data:`.ImageFile.ERRORS`. + """ + if not self.pushes_fd: + return 0, -8 # bad configuration + bytes_consumed, errcode, data = self.encode(0) + if data: + assert self.fd is not None + self.fd.write(data) + return bytes_consumed, errcode + + def encode_to_file(self, fh: int, bufsize: int) -> int: + """ + :param fh: File handle. + :param bufsize: Buffer size. + + :returns: If finished successfully, return 0. + Otherwise, return an error code. Err codes are from + :data:`.ImageFile.ERRORS`. + """ + errcode = 0 + while errcode == 0: + status, errcode, buf = self.encode(bufsize) + if status > 0: + os.write(fh, buf[status:]) + return errcode diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFilter.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFilter.py new file mode 100644 index 0000000000000000000000000000000000000000..6186ca861e08ee374a888341fecfa231f180a4d0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFilter.py @@ -0,0 +1,607 @@ +# +# The Python Imaging Library. +# $Id$ +# +# standard filters +# +# History: +# 1995-11-27 fl Created +# 2002-06-08 fl Added rank and mode filters +# 2003-09-15 fl Fixed rank calculation in rank filter; added expand call +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1995-2002 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import abc +import functools +from collections.abc import Sequence +from typing import cast + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from types import ModuleType + from typing import Any + + from . import _imaging + from ._typing import NumpyArray + + +class Filter(abc.ABC): + @abc.abstractmethod + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + pass + + +class MultibandFilter(Filter): + pass + + +class BuiltinFilter(MultibandFilter): + filterargs: tuple[Any, ...] + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + if image.mode == "P": + msg = "cannot filter palette images" + raise ValueError(msg) + return image.filter(*self.filterargs) + + +class Kernel(BuiltinFilter): + """ + Create a convolution kernel. This only supports 3x3 and 5x5 integer and floating + point kernels. + + Kernels can only be applied to "L" and "RGB" images. + + :param size: Kernel size, given as (width, height). This must be (3,3) or (5,5). + :param kernel: A sequence containing kernel weights. The kernel will be flipped + vertically before being applied to the image. + :param scale: Scale factor. If given, the result for each pixel is divided by this + value. The default is the sum of the kernel weights. + :param offset: Offset. If given, this value is added to the result, after it has + been divided by the scale factor. + """ + + name = "Kernel" + + def __init__( + self, + size: tuple[int, int], + kernel: Sequence[float], + scale: float | None = None, + offset: float = 0, + ) -> None: + if scale is None: + # default scale is sum of kernel + scale = functools.reduce(lambda a, b: a + b, kernel) + if size[0] * size[1] != len(kernel): + msg = "not enough coefficients in kernel" + raise ValueError(msg) + self.filterargs = size, scale, offset, kernel + + +class RankFilter(Filter): + """ + Create a rank filter. The rank filter sorts all pixels in + a window of the given size, and returns the ``rank``'th value. + + :param size: The kernel size, in pixels. + :param rank: What pixel value to pick. Use 0 for a min filter, + ``size * size / 2`` for a median filter, ``size * size - 1`` + for a max filter, etc. + """ + + name = "Rank" + + def __init__(self, size: int, rank: int) -> None: + self.size = size + self.rank = rank + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + if image.mode == "P": + msg = "cannot filter palette images" + raise ValueError(msg) + image = image.expand(self.size // 2, self.size // 2) + return image.rankfilter(self.size, self.rank) + + +class MedianFilter(RankFilter): + """ + Create a median filter. Picks the median pixel value in a window with the + given size. + + :param size: The kernel size, in pixels. + """ + + name = "Median" + + def __init__(self, size: int = 3) -> None: + self.size = size + self.rank = size * size // 2 + + +class MinFilter(RankFilter): + """ + Create a min filter. Picks the lowest pixel value in a window with the + given size. + + :param size: The kernel size, in pixels. + """ + + name = "Min" + + def __init__(self, size: int = 3) -> None: + self.size = size + self.rank = 0 + + +class MaxFilter(RankFilter): + """ + Create a max filter. Picks the largest pixel value in a window with the + given size. + + :param size: The kernel size, in pixels. + """ + + name = "Max" + + def __init__(self, size: int = 3) -> None: + self.size = size + self.rank = size * size - 1 + + +class ModeFilter(Filter): + """ + Create a mode filter. Picks the most frequent pixel value in a box with the + given size. Pixel values that occur only once or twice are ignored; if no + pixel value occurs more than twice, the original pixel value is preserved. + + :param size: The kernel size, in pixels. + """ + + name = "Mode" + + def __init__(self, size: int = 3) -> None: + self.size = size + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + return image.modefilter(self.size) + + +class GaussianBlur(MultibandFilter): + """Blurs the image with a sequence of extended box filters, which + approximates a Gaussian kernel. For details on accuracy see + + + :param radius: Standard deviation of the Gaussian kernel. Either a sequence of two + numbers for x and y, or a single number for both. + """ + + name = "GaussianBlur" + + def __init__(self, radius: float | Sequence[float] = 2) -> None: + self.radius = radius + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + xy = self.radius + if isinstance(xy, (int, float)): + xy = (xy, xy) + if xy == (0, 0): + return image.copy() + return image.gaussian_blur(xy) + + +class BoxBlur(MultibandFilter): + """Blurs the image by setting each pixel to the average value of the pixels + in a square box extending radius pixels in each direction. + Supports float radius of arbitrary size. Uses an optimized implementation + which runs in linear time relative to the size of the image + for any radius value. + + :param radius: Size of the box in a direction. Either a sequence of two numbers for + x and y, or a single number for both. + + Radius 0 does not blur, returns an identical image. + Radius 1 takes 1 pixel in each direction, i.e. 9 pixels in total. + """ + + name = "BoxBlur" + + def __init__(self, radius: float | Sequence[float]) -> None: + xy = radius if isinstance(radius, (tuple, list)) else (radius, radius) + if xy[0] < 0 or xy[1] < 0: + msg = "radius must be >= 0" + raise ValueError(msg) + self.radius = radius + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + xy = self.radius + if isinstance(xy, (int, float)): + xy = (xy, xy) + if xy == (0, 0): + return image.copy() + return image.box_blur(xy) + + +class UnsharpMask(MultibandFilter): + """Unsharp mask filter. + + See Wikipedia's entry on `digital unsharp masking`_ for an explanation of + the parameters. + + :param radius: Blur Radius + :param percent: Unsharp strength, in percent + :param threshold: Threshold controls the minimum brightness change that + will be sharpened + + .. _digital unsharp masking: https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking + + """ + + name = "UnsharpMask" + + def __init__( + self, radius: float = 2, percent: int = 150, threshold: int = 3 + ) -> None: + self.radius = radius + self.percent = percent + self.threshold = threshold + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + return image.unsharp_mask(self.radius, self.percent, self.threshold) + + +class BLUR(BuiltinFilter): + name = "Blur" + # fmt: off + filterargs = (5, 5), 16, 0, ( + 1, 1, 1, 1, 1, + 1, 0, 0, 0, 1, + 1, 0, 0, 0, 1, + 1, 0, 0, 0, 1, + 1, 1, 1, 1, 1, + ) + # fmt: on + + +class CONTOUR(BuiltinFilter): + name = "Contour" + # fmt: off + filterargs = (3, 3), 1, 255, ( + -1, -1, -1, + -1, 8, -1, + -1, -1, -1, + ) + # fmt: on + + +class DETAIL(BuiltinFilter): + name = "Detail" + # fmt: off + filterargs = (3, 3), 6, 0, ( + 0, -1, 0, + -1, 10, -1, + 0, -1, 0, + ) + # fmt: on + + +class EDGE_ENHANCE(BuiltinFilter): + name = "Edge-enhance" + # fmt: off + filterargs = (3, 3), 2, 0, ( + -1, -1, -1, + -1, 10, -1, + -1, -1, -1, + ) + # fmt: on + + +class EDGE_ENHANCE_MORE(BuiltinFilter): + name = "Edge-enhance More" + # fmt: off + filterargs = (3, 3), 1, 0, ( + -1, -1, -1, + -1, 9, -1, + -1, -1, -1, + ) + # fmt: on + + +class EMBOSS(BuiltinFilter): + name = "Emboss" + # fmt: off + filterargs = (3, 3), 1, 128, ( + -1, 0, 0, + 0, 1, 0, + 0, 0, 0, + ) + # fmt: on + + +class FIND_EDGES(BuiltinFilter): + name = "Find Edges" + # fmt: off + filterargs = (3, 3), 1, 0, ( + -1, -1, -1, + -1, 8, -1, + -1, -1, -1, + ) + # fmt: on + + +class SHARPEN(BuiltinFilter): + name = "Sharpen" + # fmt: off + filterargs = (3, 3), 16, 0, ( + -2, -2, -2, + -2, 32, -2, + -2, -2, -2, + ) + # fmt: on + + +class SMOOTH(BuiltinFilter): + name = "Smooth" + # fmt: off + filterargs = (3, 3), 13, 0, ( + 1, 1, 1, + 1, 5, 1, + 1, 1, 1, + ) + # fmt: on + + +class SMOOTH_MORE(BuiltinFilter): + name = "Smooth More" + # fmt: off + filterargs = (5, 5), 100, 0, ( + 1, 1, 1, 1, 1, + 1, 5, 5, 5, 1, + 1, 5, 44, 5, 1, + 1, 5, 5, 5, 1, + 1, 1, 1, 1, 1, + ) + # fmt: on + + +class Color3DLUT(MultibandFilter): + """Three-dimensional color lookup table. + + Transforms 3-channel pixels using the values of the channels as coordinates + in the 3D lookup table and interpolating the nearest elements. + + This method allows you to apply almost any color transformation + in constant time by using pre-calculated decimated tables. + + .. versionadded:: 5.2.0 + + :param size: Size of the table. One int or tuple of (int, int, int). + Minimal size in any dimension is 2, maximum is 65. + :param table: Flat lookup table. A list of ``channels * size**3`` + float elements or a list of ``size**3`` channels-sized + tuples with floats. Channels are changed first, + then first dimension, then second, then third. + Value 0.0 corresponds lowest value of output, 1.0 highest. + :param channels: Number of channels in the table. Could be 3 or 4. + Default is 3. + :param target_mode: A mode for the result image. Should have not less + than ``channels`` channels. Default is ``None``, + which means that mode wouldn't be changed. + """ + + name = "Color 3D LUT" + + def __init__( + self, + size: int | tuple[int, int, int], + table: Sequence[float] | Sequence[Sequence[int]] | NumpyArray, + channels: int = 3, + target_mode: str | None = None, + **kwargs: bool, + ) -> None: + if channels not in (3, 4): + msg = "Only 3 or 4 output channels are supported" + raise ValueError(msg) + self.size = size = self._check_size(size) + self.channels = channels + self.mode = target_mode + + # Hidden flag `_copy_table=False` could be used to avoid extra copying + # of the table if the table is specially made for the constructor. + copy_table = kwargs.get("_copy_table", True) + items = size[0] * size[1] * size[2] + wrong_size = False + + numpy: ModuleType | None = None + if hasattr(table, "shape"): + try: + import numpy + except ImportError: + pass + + if numpy and isinstance(table, numpy.ndarray): + numpy_table: NumpyArray = table + if copy_table: + numpy_table = numpy_table.copy() + + if numpy_table.shape in [ + (items * channels,), + (items, channels), + (size[2], size[1], size[0], channels), + ]: + table = numpy_table.reshape(items * channels) + else: + wrong_size = True + + else: + if copy_table: + table = list(table) + + # Convert to a flat list + if table and isinstance(table[0], (list, tuple)): + raw_table = cast(Sequence[Sequence[int]], table) + flat_table: list[int] = [] + for pixel in raw_table: + if len(pixel) != channels: + msg = ( + "The elements of the table should " + f"have a length of {channels}." + ) + raise ValueError(msg) + flat_table.extend(pixel) + table = flat_table + + if wrong_size or len(table) != items * channels: + msg = ( + "The table should have either channels * size**3 float items " + "or size**3 items of channels-sized tuples with floats. " + f"Table should be: {channels}x{size[0]}x{size[1]}x{size[2]}. " + f"Actual length: {len(table)}" + ) + raise ValueError(msg) + self.table = table + + @staticmethod + def _check_size(size: Any) -> tuple[int, int, int]: + try: + _, _, _ = size + except ValueError as e: + msg = "Size should be either an integer or a tuple of three integers." + raise ValueError(msg) from e + except TypeError: + size = (size, size, size) + size = tuple(int(x) for x in size) + for size_1d in size: + if not 2 <= size_1d <= 65: + msg = "Size should be in [2, 65] range." + raise ValueError(msg) + return size + + @classmethod + def generate( + cls, + size: int | tuple[int, int, int], + callback: Callable[[float, float, float], tuple[float, ...]], + channels: int = 3, + target_mode: str | None = None, + ) -> Color3DLUT: + """Generates new LUT using provided callback. + + :param size: Size of the table. Passed to the constructor. + :param callback: Function with three parameters which correspond + three color channels. Will be called ``size**3`` + times with values from 0.0 to 1.0 and should return + a tuple with ``channels`` elements. + :param channels: The number of channels which should return callback. + :param target_mode: Passed to the constructor of the resulting + lookup table. + """ + size_1d, size_2d, size_3d = cls._check_size(size) + if channels not in (3, 4): + msg = "Only 3 or 4 output channels are supported" + raise ValueError(msg) + + table: list[float] = [0] * (size_1d * size_2d * size_3d * channels) + idx_out = 0 + for b in range(size_3d): + for g in range(size_2d): + for r in range(size_1d): + table[idx_out : idx_out + channels] = callback( + r / (size_1d - 1), g / (size_2d - 1), b / (size_3d - 1) + ) + idx_out += channels + + return cls( + (size_1d, size_2d, size_3d), + table, + channels=channels, + target_mode=target_mode, + _copy_table=False, + ) + + def transform( + self, + callback: Callable[..., tuple[float, ...]], + with_normals: bool = False, + channels: int | None = None, + target_mode: str | None = None, + ) -> Color3DLUT: + """Transforms the table values using provided callback and returns + a new LUT with altered values. + + :param callback: A function which takes old lookup table values + and returns a new set of values. The number + of arguments which function should take is + ``self.channels`` or ``3 + self.channels`` + if ``with_normals`` flag is set. + Should return a tuple of ``self.channels`` or + ``channels`` elements if it is set. + :param with_normals: If true, ``callback`` will be called with + coordinates in the color cube as the first + three arguments. Otherwise, ``callback`` + will be called only with actual color values. + :param channels: The number of channels in the resulting lookup table. + :param target_mode: Passed to the constructor of the resulting + lookup table. + """ + if channels not in (None, 3, 4): + msg = "Only 3 or 4 output channels are supported" + raise ValueError(msg) + ch_in = self.channels + ch_out = channels or ch_in + size_1d, size_2d, size_3d = self.size + + table: list[float] = [0] * (size_1d * size_2d * size_3d * ch_out) + idx_in = 0 + idx_out = 0 + for b in range(size_3d): + for g in range(size_2d): + for r in range(size_1d): + values = self.table[idx_in : idx_in + ch_in] + if with_normals: + values = callback( + r / (size_1d - 1), + g / (size_2d - 1), + b / (size_3d - 1), + *values, + ) + else: + values = callback(*values) + table[idx_out : idx_out + ch_out] = values + idx_in += ch_in + idx_out += ch_out + + return type(self)( + self.size, + table, + channels=ch_out, + target_mode=target_mode or self.mode, + _copy_table=False, + ) + + def __repr__(self) -> str: + r = [ + f"{self.__class__.__name__} from {self.table.__class__.__name__}", + "size={:d}x{:d}x{:d}".format(*self.size), + f"channels={self.channels:d}", + ] + if self.mode: + r.append(f"target_mode={self.mode}") + return "<{}>".format(" ".join(r)) + + def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore: + from . import Image + + return image.color_lut_3d( + self.mode or image.mode, + Image.Resampling.BILINEAR, + self.channels, + self.size, + self.table, + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFont.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFont.py new file mode 100644 index 0000000000000000000000000000000000000000..c9dbc3c6fcfefe19cd7b512b483504f8ac444298 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageFont.py @@ -0,0 +1,1309 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PIL raster font management +# +# History: +# 1996-08-07 fl created (experimental) +# 1997-08-25 fl minor adjustments to handle fonts from pilfont 0.3 +# 1999-02-06 fl rewrote most font management stuff in C +# 1999-03-17 fl take pth files into account in load_path (from Richard Jones) +# 2001-02-17 fl added freetype support +# 2001-05-09 fl added TransposedFont wrapper class +# 2002-03-04 fl make sure we have a "L" or "1" font +# 2002-12-04 fl skip non-directory entries in the system path +# 2003-04-29 fl add embedded default font +# 2003-09-27 fl added support for truetype charmap encodings +# +# Todo: +# Adapt to PILFONT2 format (16-bit fonts, compressed, single file) +# +# Copyright (c) 1997-2003 by Secret Labs AB +# Copyright (c) 1996-2003 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# + +from __future__ import annotations + +import base64 +import os +import sys +import warnings +from enum import IntEnum +from io import BytesIO +from types import ModuleType +from typing import IO, Any, BinaryIO, TypedDict, cast + +from . import Image +from ._typing import StrOrBytesPath +from ._util import DeferredError, is_path + +TYPE_CHECKING = False +if TYPE_CHECKING: + from . import ImageFile + from ._imaging import ImagingFont + from ._imagingft import Font + + +class Axis(TypedDict): + minimum: int | None + default: int | None + maximum: int | None + name: bytes | None + + +class Layout(IntEnum): + BASIC = 0 + RAQM = 1 + + +MAX_STRING_LENGTH = 1_000_000 + + +core: ModuleType | DeferredError +try: + from . import _imagingft as core +except ImportError as ex: + core = DeferredError.new(ex) + + +def _string_length_check(text: str | bytes | bytearray) -> None: + if MAX_STRING_LENGTH is not None and len(text) > MAX_STRING_LENGTH: + msg = "too many characters in string" + raise ValueError(msg) + + +# FIXME: add support for pilfont2 format (see FontFile.py) + +# -------------------------------------------------------------------- +# Font metrics format: +# "PILfont" LF +# fontdescriptor LF +# (optional) key=value... LF +# "DATA" LF +# binary data: 256*10*2 bytes (dx, dy, dstbox, srcbox) +# +# To place a character, cut out srcbox and paste at dstbox, +# relative to the character position. Then move the character +# position according to dx, dy. +# -------------------------------------------------------------------- + + +class ImageFont: + """PIL font wrapper""" + + font: ImagingFont + + def _load_pilfont(self, filename: str) -> None: + with open(filename, "rb") as fp: + image: ImageFile.ImageFile | None = None + root = os.path.splitext(filename)[0] + + for ext in (".png", ".gif", ".pbm"): + if image: + image.close() + try: + fullname = root + ext + image = Image.open(fullname) + except Exception: + pass + else: + if image.mode in ("1", "L"): + break + else: + if image: + image.close() + + msg = f"cannot find glyph data file {root}.{{gif|pbm|png}}" + raise OSError(msg) + + self.file = fullname + + self._load_pilfont_data(fp, image) + image.close() + + def _load_pilfont_data(self, file: IO[bytes], image: Image.Image) -> None: + # check image + if image.mode not in ("1", "L"): + image.close() + + msg = "invalid font image mode" + raise TypeError(msg) + + # read PILfont header + if file.read(8) != b"PILfont\n": + image.close() + + msg = "Not a PILfont file" + raise SyntaxError(msg) + file.readline() + self.info = [] # FIXME: should be a dictionary + while True: + s = file.readline() + if not s or s == b"DATA\n": + break + self.info.append(s) + + # read PILfont metrics + data = file.read(256 * 20) + + self._load(image, data) + + def _load(self, image: Image.Image, data: bytes) -> None: + image.load() + + self.font = Image.core.font(image.im, data) + + def getmask( + self, text: str | bytes, mode: str = "", *args: Any, **kwargs: Any + ) -> Image.core.ImagingCore: + """ + Create a bitmap for the text. + + If the font uses antialiasing, the bitmap should have mode ``L`` and use a + maximum value of 255. Otherwise, it should have mode ``1``. + + :param text: Text to render. + :param mode: Used by some graphics drivers to indicate what mode the + driver prefers; if empty, the renderer may return either + mode. Note that the mode is always a string, to simplify + C-level implementations. + + .. versionadded:: 1.1.5 + + :return: An internal PIL storage memory instance as defined by the + :py:mod:`PIL.Image.core` interface module. + """ + _string_length_check(text) + Image._decompression_bomb_check(self.font.getsize(text)) + return self.font.getmask(text, mode) + + def getbbox( + self, text: str | bytes | bytearray, *args: Any, **kwargs: Any + ) -> tuple[int, int, int, int]: + """ + Returns bounding box (in pixels) of given text. + + .. versionadded:: 9.2.0 + + :param text: Text to render. + + :return: ``(left, top, right, bottom)`` bounding box + """ + _string_length_check(text) + width, height = self.font.getsize(text) + return 0, 0, width, height + + def getlength( + self, text: str | bytes | bytearray, *args: Any, **kwargs: Any + ) -> int: + """ + Returns length (in pixels) of given text. + This is the amount by which following text should be offset. + + .. versionadded:: 9.2.0 + """ + _string_length_check(text) + width, height = self.font.getsize(text) + return width + + +## +# Wrapper for FreeType fonts. Application code should use the +# truetype factory function to create font objects. + + +class FreeTypeFont: + """FreeType font wrapper (requires _imagingft service)""" + + font: Font + font_bytes: bytes + + def __init__( + self, + font: StrOrBytesPath | BinaryIO, + size: float = 10, + index: int = 0, + encoding: str = "", + layout_engine: Layout | None = None, + ) -> None: + # FIXME: use service provider instead + + if isinstance(core, DeferredError): + raise core.ex + + if size <= 0: + msg = f"font size must be greater than 0, not {size}" + raise ValueError(msg) + + self.path = font + self.size = size + self.index = index + self.encoding = encoding + + if layout_engine not in (Layout.BASIC, Layout.RAQM): + layout_engine = Layout.BASIC + if core.HAVE_RAQM: + layout_engine = Layout.RAQM + elif layout_engine == Layout.RAQM and not core.HAVE_RAQM: + warnings.warn( + "Raqm layout was requested, but Raqm is not available. " + "Falling back to basic layout." + ) + layout_engine = Layout.BASIC + + self.layout_engine = layout_engine + + def load_from_bytes(f: IO[bytes]) -> None: + self.font_bytes = f.read() + self.font = core.getfont( + "", size, index, encoding, self.font_bytes, layout_engine + ) + + if is_path(font): + font = os.fspath(font) + if sys.platform == "win32": + font_bytes_path = font if isinstance(font, bytes) else font.encode() + try: + font_bytes_path.decode("ascii") + except UnicodeDecodeError: + # FreeType cannot load fonts with non-ASCII characters on Windows + # So load it into memory first + with open(font, "rb") as f: + load_from_bytes(f) + return + self.font = core.getfont( + font, size, index, encoding, layout_engine=layout_engine + ) + else: + load_from_bytes(cast(IO[bytes], font)) + + def __getstate__(self) -> list[Any]: + return [self.path, self.size, self.index, self.encoding, self.layout_engine] + + def __setstate__(self, state: list[Any]) -> None: + path, size, index, encoding, layout_engine = state + FreeTypeFont.__init__(self, path, size, index, encoding, layout_engine) + + def getname(self) -> tuple[str | None, str | None]: + """ + :return: A tuple of the font family (e.g. Helvetica) and the font style + (e.g. Bold) + """ + return self.font.family, self.font.style + + def getmetrics(self) -> tuple[int, int]: + """ + :return: A tuple of the font ascent (the distance from the baseline to + the highest outline point) and descent (the distance from the + baseline to the lowest outline point, a negative value) + """ + return self.font.ascent, self.font.descent + + def getlength( + self, + text: str | bytes, + mode: str = "", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + ) -> float: + """ + Returns length (in pixels with 1/64 precision) of given text when rendered + in font with provided direction, features, and language. + + This is the amount by which following text should be offset. + Text bounding box may extend past the length in some fonts, + e.g. when using italics or accents. + + The result is returned as a float; it is a whole number if using basic layout. + + Note that the sum of two lengths may not equal the length of a concatenated + string due to kerning. If you need to adjust for kerning, include the following + character and subtract its length. + + For example, instead of :: + + hello = font.getlength("Hello") + world = font.getlength("World") + hello_world = hello + world # not adjusted for kerning + assert hello_world == font.getlength("HelloWorld") # may fail + + use :: + + hello = font.getlength("HelloW") - font.getlength("W") # adjusted for kerning + world = font.getlength("World") + hello_world = hello + world # adjusted for kerning + assert hello_world == font.getlength("HelloWorld") # True + + or disable kerning with (requires libraqm) :: + + hello = draw.textlength("Hello", font, features=["-kern"]) + world = draw.textlength("World", font, features=["-kern"]) + hello_world = hello + world # kerning is disabled, no need to adjust + assert hello_world == draw.textlength("HelloWorld", font, features=["-kern"]) + + .. versionadded:: 8.0.0 + + :param text: Text to measure. + :param mode: Used by some graphics drivers to indicate what mode the + driver prefers; if empty, the renderer may return either + mode. Note that the mode is always a string, to simplify + C-level implementations. + + :param direction: Direction of the text. It can be 'rtl' (right to + left), 'ltr' (left to right) or 'ttb' (top to bottom). + Requires libraqm. + + :param features: A list of OpenType font features to be used during text + layout. This is usually used to turn on optional + font features that are not enabled by default, + for example 'dlig' or 'ss01', but can be also + used to turn off default font features for + example '-liga' to disable ligatures or '-kern' + to disable kerning. To get all supported + features, see + https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist + Requires libraqm. + + :param language: Language of the text. Different languages may use + different glyph shapes or ligatures. This parameter tells + the font which language the text is in, and to apply the + correct substitutions as appropriate, if available. + It should be a `BCP 47 language code + `_ + Requires libraqm. + + :return: Either width for horizontal text, or height for vertical text. + """ + _string_length_check(text) + return self.font.getlength(text, mode, direction, features, language) / 64 + + def getbbox( + self, + text: str | bytes, + mode: str = "", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + anchor: str | None = None, + ) -> tuple[float, float, float, float]: + """ + Returns bounding box (in pixels) of given text relative to given anchor + when rendered in font with provided direction, features, and language. + + Use :py:meth:`getlength()` to get the offset of following text with + 1/64 pixel precision. The bounding box includes extra margins for + some fonts, e.g. italics or accents. + + .. versionadded:: 8.0.0 + + :param text: Text to render. + :param mode: Used by some graphics drivers to indicate what mode the + driver prefers; if empty, the renderer may return either + mode. Note that the mode is always a string, to simplify + C-level implementations. + + :param direction: Direction of the text. It can be 'rtl' (right to + left), 'ltr' (left to right) or 'ttb' (top to bottom). + Requires libraqm. + + :param features: A list of OpenType font features to be used during text + layout. This is usually used to turn on optional + font features that are not enabled by default, + for example 'dlig' or 'ss01', but can be also + used to turn off default font features for + example '-liga' to disable ligatures or '-kern' + to disable kerning. To get all supported + features, see + https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist + Requires libraqm. + + :param language: Language of the text. Different languages may use + different glyph shapes or ligatures. This parameter tells + the font which language the text is in, and to apply the + correct substitutions as appropriate, if available. + It should be a `BCP 47 language code + `_ + Requires libraqm. + + :param stroke_width: The width of the text stroke. + + :param anchor: The text anchor alignment. Determines the relative location of + the anchor to the text. The default alignment is top left, + specifically ``la`` for horizontal text and ``lt`` for + vertical text. See :ref:`text-anchors` for details. + + :return: ``(left, top, right, bottom)`` bounding box + """ + _string_length_check(text) + size, offset = self.font.getsize( + text, mode, direction, features, language, anchor + ) + left, top = offset[0] - stroke_width, offset[1] - stroke_width + width, height = size[0] + 2 * stroke_width, size[1] + 2 * stroke_width + return left, top, left + width, top + height + + def getmask( + self, + text: str | bytes, + mode: str = "", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + anchor: str | None = None, + ink: int = 0, + start: tuple[float, float] | None = None, + ) -> Image.core.ImagingCore: + """ + Create a bitmap for the text. + + If the font uses antialiasing, the bitmap should have mode ``L`` and use a + maximum value of 255. If the font has embedded color data, the bitmap + should have mode ``RGBA``. Otherwise, it should have mode ``1``. + + :param text: Text to render. + :param mode: Used by some graphics drivers to indicate what mode the + driver prefers; if empty, the renderer may return either + mode. Note that the mode is always a string, to simplify + C-level implementations. + + .. versionadded:: 1.1.5 + + :param direction: Direction of the text. It can be 'rtl' (right to + left), 'ltr' (left to right) or 'ttb' (top to bottom). + Requires libraqm. + + .. versionadded:: 4.2.0 + + :param features: A list of OpenType font features to be used during text + layout. This is usually used to turn on optional + font features that are not enabled by default, + for example 'dlig' or 'ss01', but can be also + used to turn off default font features for + example '-liga' to disable ligatures or '-kern' + to disable kerning. To get all supported + features, see + https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist + Requires libraqm. + + .. versionadded:: 4.2.0 + + :param language: Language of the text. Different languages may use + different glyph shapes or ligatures. This parameter tells + the font which language the text is in, and to apply the + correct substitutions as appropriate, if available. + It should be a `BCP 47 language code + `_ + Requires libraqm. + + .. versionadded:: 6.0.0 + + :param stroke_width: The width of the text stroke. + + .. versionadded:: 6.2.0 + + :param anchor: The text anchor alignment. Determines the relative location of + the anchor to the text. The default alignment is top left, + specifically ``la`` for horizontal text and ``lt`` for + vertical text. See :ref:`text-anchors` for details. + + .. versionadded:: 8.0.0 + + :param ink: Foreground ink for rendering in RGBA mode. + + .. versionadded:: 8.0.0 + + :param start: Tuple of horizontal and vertical offset, as text may render + differently when starting at fractional coordinates. + + .. versionadded:: 9.4.0 + + :return: An internal PIL storage memory instance as defined by the + :py:mod:`PIL.Image.core` interface module. + """ + return self.getmask2( + text, + mode, + direction=direction, + features=features, + language=language, + stroke_width=stroke_width, + anchor=anchor, + ink=ink, + start=start, + )[0] + + def getmask2( + self, + text: str | bytes, + mode: str = "", + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + stroke_width: float = 0, + anchor: str | None = None, + ink: int = 0, + start: tuple[float, float] | None = None, + *args: Any, + **kwargs: Any, + ) -> tuple[Image.core.ImagingCore, tuple[int, int]]: + """ + Create a bitmap for the text. + + If the font uses antialiasing, the bitmap should have mode ``L`` and use a + maximum value of 255. If the font has embedded color data, the bitmap + should have mode ``RGBA``. Otherwise, it should have mode ``1``. + + :param text: Text to render. + :param mode: Used by some graphics drivers to indicate what mode the + driver prefers; if empty, the renderer may return either + mode. Note that the mode is always a string, to simplify + C-level implementations. + + .. versionadded:: 1.1.5 + + :param direction: Direction of the text. It can be 'rtl' (right to + left), 'ltr' (left to right) or 'ttb' (top to bottom). + Requires libraqm. + + .. versionadded:: 4.2.0 + + :param features: A list of OpenType font features to be used during text + layout. This is usually used to turn on optional + font features that are not enabled by default, + for example 'dlig' or 'ss01', but can be also + used to turn off default font features for + example '-liga' to disable ligatures or '-kern' + to disable kerning. To get all supported + features, see + https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist + Requires libraqm. + + .. versionadded:: 4.2.0 + + :param language: Language of the text. Different languages may use + different glyph shapes or ligatures. This parameter tells + the font which language the text is in, and to apply the + correct substitutions as appropriate, if available. + It should be a `BCP 47 language code + `_ + Requires libraqm. + + .. versionadded:: 6.0.0 + + :param stroke_width: The width of the text stroke. + + .. versionadded:: 6.2.0 + + :param anchor: The text anchor alignment. Determines the relative location of + the anchor to the text. The default alignment is top left, + specifically ``la`` for horizontal text and ``lt`` for + vertical text. See :ref:`text-anchors` for details. + + .. versionadded:: 8.0.0 + + :param ink: Foreground ink for rendering in RGBA mode. + + .. versionadded:: 8.0.0 + + :param start: Tuple of horizontal and vertical offset, as text may render + differently when starting at fractional coordinates. + + .. versionadded:: 9.4.0 + + :return: A tuple of an internal PIL storage memory instance as defined by the + :py:mod:`PIL.Image.core` interface module, and the text offset, the + gap between the starting coordinate and the first marking + """ + _string_length_check(text) + if start is None: + start = (0, 0) + + def fill(width: int, height: int) -> Image.core.ImagingCore: + size = (width, height) + Image._decompression_bomb_check(size) + return Image.core.fill("RGBA" if mode == "RGBA" else "L", size) + + return self.font.render( + text, + fill, + mode, + direction, + features, + language, + stroke_width, + kwargs.get("stroke_filled", False), + anchor, + ink, + start, + ) + + def font_variant( + self, + font: StrOrBytesPath | BinaryIO | None = None, + size: float | None = None, + index: int | None = None, + encoding: str | None = None, + layout_engine: Layout | None = None, + ) -> FreeTypeFont: + """ + Create a copy of this FreeTypeFont object, + using any specified arguments to override the settings. + + Parameters are identical to the parameters used to initialize this + object. + + :return: A FreeTypeFont object. + """ + if font is None: + try: + font = BytesIO(self.font_bytes) + except AttributeError: + font = self.path + return FreeTypeFont( + font=font, + size=self.size if size is None else size, + index=self.index if index is None else index, + encoding=self.encoding if encoding is None else encoding, + layout_engine=layout_engine or self.layout_engine, + ) + + def get_variation_names(self) -> list[bytes]: + """ + :returns: A list of the named styles in a variation font. + :exception OSError: If the font is not a variation font. + """ + names = [] + for name in self.font.getvarnames(): + name = name.replace(b"\x00", b"") + if name not in names: + names.append(name) + return names + + def set_variation_by_name(self, name: str | bytes) -> None: + """ + :param name: The name of the style. + :exception OSError: If the font is not a variation font. + """ + names = self.get_variation_names() + if not isinstance(name, bytes): + name = name.encode() + index = names.index(name) + 1 + + if index == getattr(self, "_last_variation_index", None): + # When the same name is set twice in a row, + # there is an 'unknown freetype error' + # https://savannah.nongnu.org/bugs/?56186 + return + self._last_variation_index = index + + self.font.setvarname(index) + + def get_variation_axes(self) -> list[Axis]: + """ + :returns: A list of the axes in a variation font. + :exception OSError: If the font is not a variation font. + """ + axes = self.font.getvaraxes() + for axis in axes: + if axis["name"]: + axis["name"] = axis["name"].replace(b"\x00", b"") + return axes + + def set_variation_by_axes(self, axes: list[float]) -> None: + """ + :param axes: A list of values for each axis. + :exception OSError: If the font is not a variation font. + """ + self.font.setvaraxes(axes) + + +class TransposedFont: + """Wrapper for writing rotated or mirrored text""" + + def __init__( + self, font: ImageFont | FreeTypeFont, orientation: Image.Transpose | None = None + ): + """ + Wrapper that creates a transposed font from any existing font + object. + + :param font: A font object. + :param orientation: An optional orientation. If given, this should + be one of Image.Transpose.FLIP_LEFT_RIGHT, Image.Transpose.FLIP_TOP_BOTTOM, + Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_180, or + Image.Transpose.ROTATE_270. + """ + self.font = font + self.orientation = orientation # any 'transpose' argument, or None + + def getmask( + self, text: str | bytes, mode: str = "", *args: Any, **kwargs: Any + ) -> Image.core.ImagingCore: + im = self.font.getmask(text, mode, *args, **kwargs) + if self.orientation is not None: + return im.transpose(self.orientation) + return im + + def getbbox( + self, text: str | bytes, *args: Any, **kwargs: Any + ) -> tuple[int, int, float, float]: + # TransposedFont doesn't support getmask2, move top-left point to (0, 0) + # this has no effect on ImageFont and simulates anchor="lt" for FreeTypeFont + left, top, right, bottom = self.font.getbbox(text, *args, **kwargs) + width = right - left + height = bottom - top + if self.orientation in (Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_270): + return 0, 0, height, width + return 0, 0, width, height + + def getlength(self, text: str | bytes, *args: Any, **kwargs: Any) -> float: + if self.orientation in (Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_270): + msg = "text length is undefined for text rotated by 90 or 270 degrees" + raise ValueError(msg) + return self.font.getlength(text, *args, **kwargs) + + +def load(filename: str) -> ImageFont: + """ + Load a font file. This function loads a font object from the given + bitmap font file, and returns the corresponding font object. For loading TrueType + or OpenType fonts instead, see :py:func:`~PIL.ImageFont.truetype`. + + :param filename: Name of font file. + :return: A font object. + :exception OSError: If the file could not be read. + """ + f = ImageFont() + f._load_pilfont(filename) + return f + + +def truetype( + font: StrOrBytesPath | BinaryIO, + size: float = 10, + index: int = 0, + encoding: str = "", + layout_engine: Layout | None = None, +) -> FreeTypeFont: + """ + Load a TrueType or OpenType font from a file or file-like object, + and create a font object. This function loads a font object from the given + file or file-like object, and creates a font object for a font of the given + size. For loading bitmap fonts instead, see :py:func:`~PIL.ImageFont.load` + and :py:func:`~PIL.ImageFont.load_path`. + + Pillow uses FreeType to open font files. On Windows, be aware that FreeType + will keep the file open as long as the FreeTypeFont object exists. Windows + limits the number of files that can be open in C at once to 512, so if many + fonts are opened simultaneously and that limit is approached, an + ``OSError`` may be thrown, reporting that FreeType "cannot open resource". + A workaround would be to copy the file(s) into memory, and open that instead. + + This function requires the _imagingft service. + + :param font: A filename or file-like object containing a TrueType font. + If the file is not found in this filename, the loader may also + search in other directories, such as: + + * The :file:`fonts/` directory on Windows, + * :file:`/Library/Fonts/`, :file:`/System/Library/Fonts/` + and :file:`~/Library/Fonts/` on macOS. + * :file:`~/.local/share/fonts`, :file:`/usr/local/share/fonts`, + and :file:`/usr/share/fonts` on Linux; or those specified by + the ``XDG_DATA_HOME`` and ``XDG_DATA_DIRS`` environment variables + for user-installed and system-wide fonts, respectively. + + :param size: The requested size, in pixels. + :param index: Which font face to load (default is first available face). + :param encoding: Which font encoding to use (default is Unicode). Possible + encodings include (see the FreeType documentation for more + information): + + * "unic" (Unicode) + * "symb" (Microsoft Symbol) + * "ADOB" (Adobe Standard) + * "ADBE" (Adobe Expert) + * "ADBC" (Adobe Custom) + * "armn" (Apple Roman) + * "sjis" (Shift JIS) + * "gb " (PRC) + * "big5" + * "wans" (Extended Wansung) + * "joha" (Johab) + * "lat1" (Latin-1) + + This specifies the character set to use. It does not alter the + encoding of any text provided in subsequent operations. + :param layout_engine: Which layout engine to use, if available: + :attr:`.ImageFont.Layout.BASIC` or :attr:`.ImageFont.Layout.RAQM`. + If it is available, Raqm layout will be used by default. + Otherwise, basic layout will be used. + + Raqm layout is recommended for all non-English text. If Raqm layout + is not required, basic layout will have better performance. + + You can check support for Raqm layout using + :py:func:`PIL.features.check_feature` with ``feature="raqm"``. + + .. versionadded:: 4.2.0 + :return: A font object. + :exception OSError: If the file could not be read. + :exception ValueError: If the font size is not greater than zero. + """ + + def freetype(font: StrOrBytesPath | BinaryIO) -> FreeTypeFont: + return FreeTypeFont(font, size, index, encoding, layout_engine) + + try: + return freetype(font) + except OSError: + if not is_path(font): + raise + ttf_filename = os.path.basename(font) + + dirs = [] + if sys.platform == "win32": + # check the windows font repository + # NOTE: must use uppercase WINDIR, to work around bugs in + # 1.5.2's os.environ.get() + windir = os.environ.get("WINDIR") + if windir: + dirs.append(os.path.join(windir, "fonts")) + elif sys.platform in ("linux", "linux2"): + data_home = os.environ.get("XDG_DATA_HOME") + if not data_home: + # The freedesktop spec defines the following default directory for + # when XDG_DATA_HOME is unset or empty. This user-level directory + # takes precedence over system-level directories. + data_home = os.path.expanduser("~/.local/share") + xdg_dirs = [data_home] + + data_dirs = os.environ.get("XDG_DATA_DIRS") + if not data_dirs: + # Similarly, defaults are defined for the system-level directories + data_dirs = "/usr/local/share:/usr/share" + xdg_dirs += data_dirs.split(":") + + dirs += [os.path.join(xdg_dir, "fonts") for xdg_dir in xdg_dirs] + elif sys.platform == "darwin": + dirs += [ + "/Library/Fonts", + "/System/Library/Fonts", + os.path.expanduser("~/Library/Fonts"), + ] + + ext = os.path.splitext(ttf_filename)[1] + first_font_with_a_different_extension = None + for directory in dirs: + for walkroot, walkdir, walkfilenames in os.walk(directory): + for walkfilename in walkfilenames: + if ext and walkfilename == ttf_filename: + return freetype(os.path.join(walkroot, walkfilename)) + elif not ext and os.path.splitext(walkfilename)[0] == ttf_filename: + fontpath = os.path.join(walkroot, walkfilename) + if os.path.splitext(fontpath)[1] == ".ttf": + return freetype(fontpath) + if not ext and first_font_with_a_different_extension is None: + first_font_with_a_different_extension = fontpath + if first_font_with_a_different_extension: + return freetype(first_font_with_a_different_extension) + raise + + +def load_path(filename: str | bytes) -> ImageFont: + """ + Load font file. Same as :py:func:`~PIL.ImageFont.load`, but searches for a + bitmap font along the Python path. + + :param filename: Name of font file. + :return: A font object. + :exception OSError: If the file could not be read. + """ + if not isinstance(filename, str): + filename = filename.decode("utf-8") + for directory in sys.path: + try: + return load(os.path.join(directory, filename)) + except OSError: # noqa: PERF203 + pass + msg = f'cannot find font file "{filename}" in sys.path' + if os.path.exists(filename): + msg += f', did you mean ImageFont.load("{filename}") instead?' + + raise OSError(msg) + + +def load_default_imagefont() -> ImageFont: + f = ImageFont() + f._load_pilfont_data( + # courB08 + BytesIO(base64.b64decode(b""" +UElMZm9udAo7Ozs7OzsxMDsKREFUQQoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAA//8AAQAAAAAAAAABAAEA +BgAAAAH/+gADAAAAAQAAAAMABgAGAAAAAf/6AAT//QADAAAABgADAAYAAAAA//kABQABAAYAAAAL +AAgABgAAAAD/+AAFAAEACwAAABAACQAGAAAAAP/5AAUAAAAQAAAAFQAHAAYAAP////oABQAAABUA +AAAbAAYABgAAAAH/+QAE//wAGwAAAB4AAwAGAAAAAf/5AAQAAQAeAAAAIQAIAAYAAAAB//kABAAB +ACEAAAAkAAgABgAAAAD/+QAE//0AJAAAACgABAAGAAAAAP/6AAX//wAoAAAALQAFAAYAAAAB//8A +BAACAC0AAAAwAAMABgAAAAD//AAF//0AMAAAADUAAQAGAAAAAf//AAMAAAA1AAAANwABAAYAAAAB +//kABQABADcAAAA7AAgABgAAAAD/+QAFAAAAOwAAAEAABwAGAAAAAP/5AAYAAABAAAAARgAHAAYA +AAAA//kABQAAAEYAAABLAAcABgAAAAD/+QAFAAAASwAAAFAABwAGAAAAAP/5AAYAAABQAAAAVgAH +AAYAAAAA//kABQAAAFYAAABbAAcABgAAAAD/+QAFAAAAWwAAAGAABwAGAAAAAP/5AAUAAABgAAAA +ZQAHAAYAAAAA//kABQAAAGUAAABqAAcABgAAAAD/+QAFAAAAagAAAG8ABwAGAAAAAf/8AAMAAABv +AAAAcQAEAAYAAAAA//wAAwACAHEAAAB0AAYABgAAAAD/+gAE//8AdAAAAHgABQAGAAAAAP/7AAT/ +/gB4AAAAfAADAAYAAAAB//oABf//AHwAAACAAAUABgAAAAD/+gAFAAAAgAAAAIUABgAGAAAAAP/5 +AAYAAQCFAAAAiwAIAAYAAP////oABgAAAIsAAACSAAYABgAA////+gAFAAAAkgAAAJgABgAGAAAA +AP/6AAUAAACYAAAAnQAGAAYAAP////oABQAAAJ0AAACjAAYABgAA////+gAFAAAAowAAAKkABgAG +AAD////6AAUAAACpAAAArwAGAAYAAAAA//oABQAAAK8AAAC0AAYABgAA////+gAGAAAAtAAAALsA +BgAGAAAAAP/6AAQAAAC7AAAAvwAGAAYAAP////oABQAAAL8AAADFAAYABgAA////+gAGAAAAxQAA +AMwABgAGAAD////6AAUAAADMAAAA0gAGAAYAAP////oABQAAANIAAADYAAYABgAA////+gAGAAAA +2AAAAN8ABgAGAAAAAP/6AAUAAADfAAAA5AAGAAYAAP////oABQAAAOQAAADqAAYABgAAAAD/+gAF +AAEA6gAAAO8ABwAGAAD////6AAYAAADvAAAA9gAGAAYAAAAA//oABQAAAPYAAAD7AAYABgAA//// ++gAFAAAA+wAAAQEABgAGAAD////6AAYAAAEBAAABCAAGAAYAAP////oABgAAAQgAAAEPAAYABgAA +////+gAGAAABDwAAARYABgAGAAAAAP/6AAYAAAEWAAABHAAGAAYAAP////oABgAAARwAAAEjAAYA +BgAAAAD/+gAFAAABIwAAASgABgAGAAAAAf/5AAQAAQEoAAABKwAIAAYAAAAA//kABAABASsAAAEv +AAgABgAAAAH/+QAEAAEBLwAAATIACAAGAAAAAP/5AAX//AEyAAABNwADAAYAAAAAAAEABgACATcA +AAE9AAEABgAAAAH/+QAE//wBPQAAAUAAAwAGAAAAAP/7AAYAAAFAAAABRgAFAAYAAP////kABQAA +AUYAAAFMAAcABgAAAAD/+wAFAAABTAAAAVEABQAGAAAAAP/5AAYAAAFRAAABVwAHAAYAAAAA//sA +BQAAAVcAAAFcAAUABgAAAAD/+QAFAAABXAAAAWEABwAGAAAAAP/7AAYAAgFhAAABZwAHAAYAAP// +//kABQAAAWcAAAFtAAcABgAAAAD/+QAGAAABbQAAAXMABwAGAAAAAP/5AAQAAgFzAAABdwAJAAYA +AP////kABgAAAXcAAAF+AAcABgAAAAD/+QAGAAABfgAAAYQABwAGAAD////7AAUAAAGEAAABigAF +AAYAAP////sABQAAAYoAAAGQAAUABgAAAAD/+wAFAAABkAAAAZUABQAGAAD////7AAUAAgGVAAAB +mwAHAAYAAAAA//sABgACAZsAAAGhAAcABgAAAAD/+wAGAAABoQAAAacABQAGAAAAAP/7AAYAAAGn +AAABrQAFAAYAAAAA//kABgAAAa0AAAGzAAcABgAA////+wAGAAABswAAAboABQAGAAD////7AAUA +AAG6AAABwAAFAAYAAP////sABgAAAcAAAAHHAAUABgAAAAD/+wAGAAABxwAAAc0ABQAGAAD////7 +AAYAAgHNAAAB1AAHAAYAAAAA//sABQAAAdQAAAHZAAUABgAAAAH/+QAFAAEB2QAAAd0ACAAGAAAA +Av/6AAMAAQHdAAAB3gAHAAYAAAAA//kABAABAd4AAAHiAAgABgAAAAD/+wAF//0B4gAAAecAAgAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAB +//sAAwACAecAAAHpAAcABgAAAAD/+QAFAAEB6QAAAe4ACAAGAAAAAP/5AAYAAAHuAAAB9AAHAAYA +AAAA//oABf//AfQAAAH5AAUABgAAAAD/+QAGAAAB+QAAAf8ABwAGAAAAAv/5AAMAAgH/AAACAAAJ +AAYAAAAA//kABQABAgAAAAIFAAgABgAAAAH/+gAE//sCBQAAAggAAQAGAAAAAP/5AAYAAAIIAAAC +DgAHAAYAAAAB//kABf/+Ag4AAAISAAUABgAA////+wAGAAACEgAAAhkABQAGAAAAAP/7AAX//gIZ +AAACHgADAAYAAAAA//wABf/9Ah4AAAIjAAEABgAAAAD/+QAHAAACIwAAAioABwAGAAAAAP/6AAT/ ++wIqAAACLgABAAYAAAAA//kABP/8Ai4AAAIyAAMABgAAAAD/+gAFAAACMgAAAjcABgAGAAAAAf/5 +AAT//QI3AAACOgAEAAYAAAAB//kABP/9AjoAAAI9AAQABgAAAAL/+QAE//sCPQAAAj8AAgAGAAD/ +///7AAYAAgI/AAACRgAHAAYAAAAA//kABgABAkYAAAJMAAgABgAAAAH//AAD//0CTAAAAk4AAQAG +AAAAAf//AAQAAgJOAAACUQADAAYAAAAB//kABP/9AlEAAAJUAAQABgAAAAH/+QAF//4CVAAAAlgA +BQAGAAD////7AAYAAAJYAAACXwAFAAYAAP////kABgAAAl8AAAJmAAcABgAA////+QAGAAACZgAA +Am0ABwAGAAD////5AAYAAAJtAAACdAAHAAYAAAAA//sABQACAnQAAAJ5AAcABgAA////9wAGAAAC +eQAAAoAACQAGAAD////3AAYAAAKAAAAChwAJAAYAAP////cABgAAAocAAAKOAAkABgAA////9wAG +AAACjgAAApUACQAGAAD////4AAYAAAKVAAACnAAIAAYAAP////cABgAAApwAAAKjAAkABgAA//// ++gAGAAACowAAAqoABgAGAAAAAP/6AAUAAgKqAAACrwAIAAYAAP////cABQAAAq8AAAK1AAkABgAA +////9wAFAAACtQAAArsACQAGAAD////3AAUAAAK7AAACwQAJAAYAAP////gABQAAAsEAAALHAAgA +BgAAAAD/9wAEAAACxwAAAssACQAGAAAAAP/3AAQAAALLAAACzwAJAAYAAAAA//cABAAAAs8AAALT +AAkABgAAAAD/+AAEAAAC0wAAAtcACAAGAAD////6AAUAAALXAAAC3QAGAAYAAP////cABgAAAt0A +AALkAAkABgAAAAD/9wAFAAAC5AAAAukACQAGAAAAAP/3AAUAAALpAAAC7gAJAAYAAAAA//cABQAA +Au4AAALzAAkABgAAAAD/9wAFAAAC8wAAAvgACQAGAAAAAP/4AAUAAAL4AAAC/QAIAAYAAAAA//oA +Bf//Av0AAAMCAAUABgAA////+gAGAAADAgAAAwkABgAGAAD////3AAYAAAMJAAADEAAJAAYAAP// +//cABgAAAxAAAAMXAAkABgAA////9wAGAAADFwAAAx4ACQAGAAD////4AAYAAAAAAAoABwASAAYA +AP////cABgAAAAcACgAOABMABgAA////+gAFAAAADgAKABQAEAAGAAD////6AAYAAAAUAAoAGwAQ +AAYAAAAA//gABgAAABsACgAhABIABgAAAAD/+AAGAAAAIQAKACcAEgAGAAAAAP/4AAYAAAAnAAoA +LQASAAYAAAAA//gABgAAAC0ACgAzABIABgAAAAD/+QAGAAAAMwAKADkAEQAGAAAAAP/3AAYAAAA5 +AAoAPwATAAYAAP////sABQAAAD8ACgBFAA8ABgAAAAD/+wAFAAIARQAKAEoAEQAGAAAAAP/4AAUA +AABKAAoATwASAAYAAAAA//gABQAAAE8ACgBUABIABgAAAAD/+AAFAAAAVAAKAFkAEgAGAAAAAP/5 +AAUAAABZAAoAXgARAAYAAAAA//gABgAAAF4ACgBkABIABgAAAAD/+AAGAAAAZAAKAGoAEgAGAAAA +AP/4AAYAAABqAAoAcAASAAYAAAAA//kABgAAAHAACgB2ABEABgAAAAD/+AAFAAAAdgAKAHsAEgAG +AAD////4AAYAAAB7AAoAggASAAYAAAAA//gABQAAAIIACgCHABIABgAAAAD/+AAFAAAAhwAKAIwA +EgAGAAAAAP/4AAUAAACMAAoAkQASAAYAAAAA//gABQAAAJEACgCWABIABgAAAAD/+QAFAAAAlgAK +AJsAEQAGAAAAAP/6AAX//wCbAAoAoAAPAAYAAAAA//oABQABAKAACgClABEABgAA////+AAGAAAA +pQAKAKwAEgAGAAD////4AAYAAACsAAoAswASAAYAAP////gABgAAALMACgC6ABIABgAA////+QAG +AAAAugAKAMEAEQAGAAD////4AAYAAgDBAAoAyAAUAAYAAP////kABQACAMgACgDOABMABgAA//// ++QAGAAIAzgAKANUAEw== +""")), + Image.open(BytesIO(base64.b64decode(b""" +iVBORw0KGgoAAAANSUhEUgAAAx4AAAAUAQAAAAArMtZoAAAEwElEQVR4nABlAJr/AHVE4czCI/4u +Mc4b7vuds/xzjz5/3/7u/n9vMe7vnfH/9++vPn/xyf5zhxzjt8GHw8+2d83u8x27199/nxuQ6Od9 +M43/5z2I+9n9ZtmDBwMQECDRQw/eQIQohJXxpBCNVE6QCCAAAAD//wBlAJr/AgALyj1t/wINwq0g +LeNZUworuN1cjTPIzrTX6ofHWeo3v336qPzfEwRmBnHTtf95/fglZK5N0PDgfRTslpGBvz7LFc4F +IUXBWQGjQ5MGCx34EDFPwXiY4YbYxavpnhHFrk14CDAAAAD//wBlAJr/AgKqRooH2gAgPeggvUAA +Bu2WfgPoAwzRAABAAAAAAACQgLz/3Uv4Gv+gX7BJgDeeGP6AAAD1NMDzKHD7ANWr3loYbxsAD791 +NAADfcoIDyP44K/jv4Y63/Z+t98Ovt+ub4T48LAAAAD//wBlAJr/AuplMlADJAAAAGuAphWpqhMx +in0A/fRvAYBABPgBwBUgABBQ/sYAyv9g0bCHgOLoGAAAAAAAREAAwI7nr0ArYpow7aX8//9LaP/9 +SjdavWA8ePHeBIKB//81/83ndznOaXx379wAAAD//wBlAJr/AqDxW+D3AABAAbUh/QMnbQag/gAY +AYDAAACgtgD/gOqAAAB5IA/8AAAk+n9w0AAA8AAAmFRJuPo27ciC0cD5oeW4E7KA/wD3ECMAn2tt +y8PgwH8AfAxFzC0JzeAMtratAsC/ffwAAAD//wBlAJr/BGKAyCAA4AAAAvgeYTAwHd1kmQF5chkG +ABoMIHcL5xVpTfQbUqzlAAAErwAQBgAAEOClA5D9il08AEh/tUzdCBsXkbgACED+woQg8Si9VeqY +lODCn7lmF6NhnAEYgAAA/NMIAAAAAAD//2JgjLZgVGBg5Pv/Tvpc8hwGBjYGJADjHDrAwPzAjv/H +/Wf3PzCwtzcwHmBgYGcwbZz8wHaCAQMDOwMDQ8MCBgYOC3W7mp+f0w+wHOYxO3OG+e376hsMZjk3 +AAAAAP//YmCMY2A4wMAIN5e5gQETPD6AZisDAwMDgzSDAAPjByiHcQMDAwMDg1nOze1lByRu5/47 +c4859311AYNZzg0AAAAA//9iYGDBYihOIIMuwIjGL39/fwffA8b//xv/P2BPtzzHwCBjUQAAAAD/ +/yLFBrIBAAAA//9i1HhcwdhizX7u8NZNzyLbvT97bfrMf/QHI8evOwcSqGUJAAAA//9iYBB81iSw +pEE170Qrg5MIYydHqwdDQRMrAwcVrQAAAAD//2J4x7j9AAMDn8Q/BgYLBoaiAwwMjPdvMDBYM1Tv +oJodAAAAAP//Yqo/83+dxePWlxl3npsel9lvLfPcqlE9725C+acfVLMEAAAA//9i+s9gwCoaaGMR +evta/58PTEWzr21hufPjA8N+qlnBwAAAAAD//2JiWLci5v1+HmFXDqcnULE/MxgYGBj+f6CaJQAA +AAD//2Ji2FrkY3iYpYC5qDeGgeEMAwPDvwQBBoYvcTwOVLMEAAAA//9isDBgkP///0EOg9z35v// +Gc/eeW7BwPj5+QGZhANUswMAAAD//2JgqGBgYGBgqEMXlvhMPUsAAAAA//8iYDd1AAAAAP//AwDR +w7IkEbzhVQAAAABJRU5ErkJggg== +"""))), + ) + return f + + +def load_default(size: float | None = None) -> FreeTypeFont | ImageFont: + """If FreeType support is available, load a version of Aileron Regular, + https://dotcolon.net/fonts/aileron, with a more limited character set. + + Otherwise, load a "better than nothing" font. + + .. versionadded:: 1.1.4 + + :param size: The font size of Aileron Regular. + + .. versionadded:: 10.1.0 + + :return: A font object. + """ + if isinstance(core, ModuleType) or size is not None: + return truetype( + BytesIO(base64.b64decode(b""" +AAEAAAAPAIAAAwBwRkZUTYwDlUAAADFoAAAAHEdERUYAqADnAAAo8AAAACRHUE9ThhmITwAAKfgAA +AduR1NVQnHxefoAACkUAAAA4k9TLzJovoHLAAABeAAAAGBjbWFw5lFQMQAAA6gAAAGqZ2FzcP//AA +MAACjoAAAACGdseWYmRXoPAAAGQAAAHfhoZWFkE18ayQAAAPwAAAA2aGhlYQboArEAAAE0AAAAJGh +tdHjjERZ8AAAB2AAAAdBsb2NhuOexrgAABVQAAADqbWF4cAC7AEYAAAFYAAAAIG5hbWUr+h5lAAAk +OAAAA6Jwb3N0D3oPTQAAJ9wAAAEKAAEAAAABGhxJDqIhXw889QALA+gAAAAA0Bqf2QAAAADhCh2h/ +2r/LgOxAyAAAAAIAAIAAAAAAAAAAQAAA8r/GgAAA7j/av9qA7EAAQAAAAAAAAAAAAAAAAAAAHQAAQ +AAAHQAQwAFAAAAAAACAAAAAQABAAAAQAAAAAAAAAADAfoBkAAFAAgCigJYAAAASwKKAlgAAAFeADI +BPgAAAAAFAAAAAAAAAAAAAAcAAAAAAAAAAAAAAABVS1dOAEAAIPsCAwL/GgDIA8oA5iAAAJMAAAAA +AhICsgAAACAAAwH0AAAAAAAAAU0AAADYAAAA8gA5AVMAVgJEAEYCRAA1AuQAKQKOAEAAsAArATsAZ +AE7AB4CMABVAkQAUADc/+EBEgAgANwAJQEv//sCRAApAkQAggJEADwCRAAtAkQAIQJEADkCRAArAk +QAMgJEACwCRAAxANwAJQDc/+ECRABnAkQAUAJEAEQB8wAjA1QANgJ/AB0CcwBkArsALwLFAGQCSwB +kAjcAZALGAC8C2gBkAQgAZAIgADcCYQBkAj8AZANiAGQCzgBkAuEALwJWAGQC3QAvAmsAZAJJADQC +ZAAiAqoAXgJuACADuAAaAnEAGQJFABMCTwAuATMAYgEv//sBJwAiAkQAUAH0ADIBLAApAhMAJAJjA +EoCEQAeAmcAHgIlAB4BIgAVAmcAHgJRAEoA7gA+AOn/8wIKAEoA9wBGA1cASgJRAEoCSgAeAmMASg +JnAB4BSgBKAcsAGAE5ABQCUABCAgIAAQMRAAEB4v/6AgEAAQHOABQBLwBAAPoAYAEvACECRABNA0Y +AJAItAHgBKgAcAkQAUAEsAHQAygAgAi0AOQD3ADYA9wAWAaEANgGhABYCbAAlAYMAeAGDADkA6/9q +AhsAFAIKABUB/QAVAAAAAwAAAAMAAAAcAAEAAAAAAKQAAwABAAAAHAAEAIgAAAAeABAAAwAOAH4Aq +QCrALEAtAC3ALsgGSAdICYgOiBEISL7Av//AAAAIACpAKsAsAC0ALcAuyAYIBwgJiA5IEQhIvsB// +//4/+5/7j/tP+y/7D/reBR4E/gR+A14CzfTwVxAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAEGAAABAAAAAAAAAAECAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAMEBQYHCAkKCwwNDg8QERIT +FBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMT +U5PUFFSU1RVVldYWVpbXF1eX2BhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGQAAA +AAAAAAYnFmAAAAAABlAAAAAAAAAAAAAAAAAAAAAAAAAAAAY2htAAAAAAAAAABrbGlqAAAAAHAAbm9 +ycwBnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmACYAJgAmAD4AUgCCAMoBCgFO +AVwBcgGIAaYBvAHKAdYB6AH2AgwCIAJKAogCpgLWAw4DIgNkA5wDugPUA+gD/AQQBEYEogS8BPoFJ +gVSBWoFgAWwBcoF1gX6BhQGJAZMBmgGiga0BuIHGgdUB2YHkAeiB8AH3AfyCAoIHAgqCDoITghcCG +oIogjSCPoJKglYCXwJwgnqCgIKKApACl4Klgq8CtwLDAs8C1YLjAuyC9oL7gwMDCYMSAxgDKAMrAz +qDQoNTA1mDYQNoA2uDcAN2g3oDfYODA4iDkoOXA5sDnoOnA7EDvwAAAAFAAAAAAH0ArwAAwAGAAkA +DAAPAAAxESERAxMhExcRASELARETAfT6qv6syKr+jgFUqsiqArz9RAGLAP/+1P8B/v3VAP8BLP4CA +P8AAgA5//IAuQKyAAMACwAANyMDMwIyFhQGIiY0oE4MZk84JCQ4JLQB/v3AJDgkJDgAAgBWAeUBPA +LfAAMABwAAEyMnMxcjJzOmRgpagkYKWgHl+vr6AAAAAAIARgAAAf4CsgAbAB8AAAEHMxUjByM3Iwc +jNyM1MzcjNTM3MwczNzMHMxUrAQczAZgdZXEvOi9bLzovWmYdZXEvOi9bLzovWp9bHlsBn4w429vb +2ziMONvb29s4jAAAAAMANf+mAg4DDAAfACYALAAAJRQGBxUjNS4BJzMeARcRLgE0Njc1MxUeARcjJ +icVHgEBFBYXNQ4BExU+ATU0Ag5xWDpgcgRcBz41Xl9oVTpVYwpcC1ttXP6cLTQuM5szOrVRZwlOTQ +ZqVzZECAEAGlukZAlOTQdrUG8O7iNlAQgxNhDlCDj+8/YGOjReAAAAAAUAKf/yArsCvAAHAAsAFQA +dACcAABIyFhQGIiY0EyMBMwQiBhUUFjI2NTQSMhYUBiImNDYiBhUUFjI2NTR5iFBQiFCVVwHAV/5c +OiMjOiPmiFBQiFCxOiMjOiMCvFaSVlaS/ZoCsjIzMC80NC8w/uNWklZWkhozMC80NC8wAAAAAgBA/ +/ICbgLAACIALgAAARUjEQYjIiY1NDY3LgE1NDYzMhcVJiMiBhUUFhcWOwE1MxUFFBYzMjc1IyIHDg +ECbmBcYYOOVkg7R4hsQjY4Q0RNRD4SLDxW/pJUXzksPCkUUk0BgUb+zBVUZ0BkDw5RO1huCkULQzp +COAMBcHDHRz0J/AIHRQAAAAEAKwHlAIUC3wADAAATIycze0YKWgHl+gAAAAABAGT/sAEXAwwACQAA +EzMGEBcjLgE0Nt06dXU6OUBAAwzG/jDGVePs4wAAAAEAHv+wANEDDAAJAAATMx4BFAYHIzYQHjo5Q +EA5OnUDDFXj7ONVxgHQAAAAAQBVAFIB2wHbAA4AAAE3FwcXBycHJzcnNxcnMwEtmxOfcTJjYzJxnx +ObCj4BKD07KYolmZkliik7PbMAAQBQAFUB9AIlAAsAAAEjFSM1IzUzNTMVMwH0tTq1tTq1AR/Kyjj +OzgAAAAAB/+H/iACMAGQABAAANwcjNzOMWlFOXVrS3AAAAQAgAP8A8gE3AAMAABMjNTPy0tIA/zgA +AQAl//IApQByAAcAADYyFhQGIiY0STgkJDgkciQ4JCQ4AAAAAf/7/+IBNALQAAMAABcjEzM5Pvs+H +gLuAAAAAAIAKf/yAhsCwAADAAcAABIgECA2IBAgKQHy/g5gATL+zgLA/TJEAkYAAAAAAQCCAAABlg +KyAAgAAAERIxEHNTc2MwGWVr6SIygCsv1OAldxW1sWAAEAPAAAAg4CwAAZAAA3IRUhNRM+ATU0JiM +iDwEjNz4BMzIWFRQGB7kBUv4x+kI2QTt+EAFWAQp8aGVtSl5GRjEA/0RVLzlLmAoKa3FsUkNxXQAA +AAEALf/yAhYCwAAqAAABHgEVFAYjIi8BMxceATMyNjU0KwE1MzI2NTQmIyIGDwEjNz4BMzIWFRQGA +YxBSZJo2RUBVgEHV0JBUaQREUBUQzc5TQcBVgEKfGhfcEMBbxJbQl1x0AoKRkZHPn9GSD80QUVCCg +pfbGBPOlgAAAACACEAAAIkArIACgAPAAAlIxUjNSE1ATMRMyMRBg8BAiRXVv6qAVZWV60dHLCurq4 +rAdn+QgFLMibzAAABADn/8gIZArIAHQAAATIWFRQGIyIvATMXFjMyNjU0JiMiByMTIRUhBzc2ATNv +d5Fl1RQBVgIad0VSTkVhL1IwAYj+vh8rMAHHgGdtgcUKCoFXTU5bYgGRRvAuHQAAAAACACv/8gITA +sAAFwAjAAABMhYVFAYjIhE0NjMyFh8BIycmIyIDNzYTMjY1NCYjIgYVFBYBLmp7imr0l3RZdAgBXA +IYZ5wKJzU6QVNJSz5SUAHSgWltiQFGxcNlVQoKdv7sPiz+ZF1LTmJbU0lhAAAAAQAyAAACGgKyAAY +AAAEVASMBITUCGv6oXAFL/oECsij9dgJsRgAAAAMALP/xAhgCwAAWACAALAAAAR4BFRQGIyImNTQ2 +Ny4BNTQ2MhYVFAYmIgYVFBYyNjU0AzI2NTQmIyIGFRQWAZQ5S5BmbIpPOjA7ecp5P2F8Q0J8RIVJS +0pLTEtOAW0TXTxpZ2ZqPF0SE1A3VWVlVTdQ/UU0N0RENzT9/ko+Ok1NOj1LAAIAMf/yAhkCwAAXAC +MAAAEyERQGIyImLwEzFxYzMhMHBiMiJjU0NhMyNjU0JiMiBhUUFgEl9Jd0WXQIAVwCGGecCic1SWp +7imo+UlBAQVNJAsD+usXDZVUKCnYBFD4sgWltif5kW1NJYV1LTmIAAAACACX/8gClAiAABwAPAAAS +MhYUBiImNBIyFhQGIiY0STgkJDgkJDgkJDgkAiAkOCQkOP52JDgkJDgAAAAC/+H/iAClAiAABwAMA +AASMhYUBiImNBMHIzczSTgkJDgkaFpSTl4CICQ4JCQ4/mba5gAAAQBnAB4B+AH0AAYAAAENARUlNS +UB+P6qAVb+bwGRAbCmpkbJRMkAAAIAUAC7AfQBuwADAAcAAAEhNSERITUhAfT+XAGk/lwBpAGDOP8 +AOAABAEQAHgHVAfQABgAAARUFNS0BNQHV/m8BVv6qAStEyUSmpkYAAAAAAgAj//IB1ALAABgAIAAA +ATIWFRQHDgEHIz4BNz4BNTQmIyIGByM+ARIyFhQGIiY0AQRibmktIAJWBSEqNig+NTlHBFoDezQ4J +CQ4JALAZ1BjaS03JS1DMD5LLDQ/SUVgcv2yJDgkJDgAAAAAAgA2/5gDFgKYADYAQgAAAQMGFRQzMj +Y1NCYjIg4CFRQWMzI2NxcGIyImNTQ+AjMyFhUUBiMiJwcGIyImNTQ2MzIfATcHNzYmIyIGFRQzMjY +Cej8EJjJJlnBAfGQ+oHtAhjUYg5OPx0h2k06Os3xRWQsVLjY5VHtdPBwJETcJDyUoOkZEJz8B0f74 +EQ8kZl6EkTFZjVOLlyknMVm1pmCiaTq4lX6CSCknTVRmmR8wPdYnQzxuSWVGAAIAHQAAAncCsgAHA +AoAACUjByMTMxMjATMDAcj+UVz4dO5d/sjPZPT0ArL9TgE6ATQAAAADAGQAAAJMArIAEAAbACcAAA +EeARUUBgcGKwERMzIXFhUUJRUzMjc2NTQnJiMTPgE1NCcmKwEVMzIBvkdHZkwiNt7LOSGq/oeFHBt +hahIlSTM+cB8Yj5UWAW8QT0VYYgwFArIEF5Fv1eMED2NfDAL93AU+N24PBP0AAAAAAQAv//ICjwLA +ABsAAAEyFh8BIycmIyIGFRQWMzI/ATMHDgEjIiY1NDYBdX+PCwFWAiKiaHx5ZaIiAlYBCpWBk6a0A +sCAagoKpqN/gaOmCgplhcicn8sAAAIAZAAAAp8CsgAMABkAAAEeARUUBgcGKwERMzITPgE1NCYnJi +sBETMyAY59lJp8IzXN0jUVWmdjWRs5d3I4Aq4QqJWUug8EArL9mQ+PeHGHDgX92gAAAAABAGQAAAI +vArIACwAAJRUhESEVIRUhFSEVAi/+NQHB/pUBTf6zRkYCskbwRvAAAAABAGQAAAIlArIACQAAExUh +FSERIxEhFboBQ/69VgHBAmzwRv7KArJGAAAAAAEAL//yAo8CwAAfAAABMxEjNQcGIyImNTQ2MzIWH +wEjJyYjIgYVFBYzMjY1IwGP90wfPnWTprSSf48LAVYCIqJofHllVG+hAU3+s3hARsicn8uAagoKpq +N/gaN1XAAAAAEAZAAAAowCsgALAAABESMRIREjETMRIRECjFb+hFZWAXwCsv1OAS7+0gKy/sQBPAA +AAAABAGQAAAC6ArIAAwAAMyMRM7pWVgKyAAABADf/8gHoArIAEwAAAREUBw4BIyImLwEzFxYzMjc2 +NREB6AIFcGpgbQIBVgIHfXQKAQKy/lYxIltob2EpKYyEFD0BpwAAAAABAGQAAAJ0ArIACwAACQEjA +wcVIxEzEQEzATsBJ3ntQlZWAVVlAWH+nwEnR+ACsv6RAW8AAQBkAAACLwKyAAUAACUVIREzEQIv/j +VWRkYCsv2UAAABAGQAAAMUArIAFAAAAREjETQ3BgcDIwMmJxYVESMRMxsBAxRWAiMxemx8NxsCVo7 +MywKy/U4BY7ZLco7+nAFmoFxLtP6dArL9lwJpAAAAAAEAZAAAAoACsgANAAAhIwEWFREjETMBJjUR +MwKAhP67A1aEAUUDVAJeeov+pwKy/aJ5jAFZAAAAAgAv//ICuwLAAAkAEwAAEiAWFRQGICY1NBIyN +jU0JiIGFRTbATSsrP7MrNrYenrYegLAxaKhxsahov47nIeIm5uIhwACAGQAAAJHArIADgAYAAABHg +EVFAYHBisBESMRMzITNjQnJisBETMyAZRUX2VOHzuAVtY7GlxcGDWIiDUCrgtnVlVpCgT+5gKy/rU +V1BUF/vgAAAACAC//zAK9AsAAEgAcAAAlFhcHJiMiBwYjIiY1NDYgFhUUJRQWMjY1NCYiBgI9PUMx +UDcfKh8omqysATSs/dR62Hp62HpICTg7NgkHxqGixcWitbWHnJyHiJubAAIAZAAAAlgCsgAXACMAA +CUWFyMmJyYnJisBESMRMzIXHgEVFAYHFiUzMjc+ATU0JyYrAQIqDCJfGQwNWhAhglbiOx9QXEY1Tv +6bhDATMj1lGSyMtYgtOXR0BwH+1wKyBApbU0BSESRAAgVAOGoQBAABADT/8gIoAsAAJQAAATIWFyM +uASMiBhUUFhceARUUBiMiJiczHgEzMjY1NCYnLgE1NDYBOmd2ClwGS0E6SUNRdW+HZnKKC1wPWkQ9 +Uk1cZGuEAsBwXUJHNjQ3OhIbZVZZbm5kREo+NT5DFRdYUFdrAAAAAAEAIgAAAmQCsgAHAAABIxEjE +SM1IQJk9lb2AkICbP2UAmxGAAEAXv/yAmQCsgAXAAABERQHDgEiJicmNREzERQXHgEyNjc2NRECZA +IIgfCBCAJWAgZYmlgGAgKy/k0qFFxzc1wUKgGz/lUrEkRQUEQSKwGrAAAAAAEAIAAAAnoCsgAGAAA +hIwMzGwEzAYJ07l3N1FwCsv2PAnEAAAEAGgAAA7ECsgAMAAABAyMLASMDMxsBMxsBA7HAcZyicrZi +kaB0nJkCsv1OAlP9rQKy/ZsCW/2kAmYAAAEAGQAAAm8CsgALAAAhCwEjEwMzGwEzAxMCCsrEY/bkY +re+Y/D6AST+3AFcAVb+5gEa/q3+oQAAAQATAAACUQKyAAgAAAERIxEDMxsBMwFdVvRjwLphARD+8A +EQAaL+sQFPAAABAC4AAAI5ArIACQAAJRUhNQEhNSEVAQI5/fUBof57Aen+YUZGQgIqRkX92QAAAAA +BAGL/sAEFAwwABwAAARUjETMVIxEBBWlpowMMOP0UOANcAAAB//v/4gE0AtAAAwAABSMDMwE0Pvs+ +HgLuAAAAAQAi/7AAxQMMAAcAABcjNTMRIzUzxaNpaaNQOALsOAABAFAA1wH0AmgABgAAJQsBIxMzE +wGwjY1GsESw1wFZ/qcBkf5vAAAAAQAy/6oBwv/iAAMAAAUhNSEBwv5wAZBWOAAAAAEAKQJEALYCsg +ADAAATIycztjhVUAJEbgAAAAACACT/8gHQAiAAHQAlAAAhJwcGIyImNTQ2OwE1NCcmIyIHIz4BMzI +XFh0BFBcnMjY9ASYVFAF6CR0wVUtgkJoiAgdgaQlaBm1Zrg4DCuQ9R+5MOSFQR1tbDiwUUXBUXowf +J8c9SjRORzYSgVwAAAAAAgBK//ICRQLfABEAHgAAATIWFRQGIyImLwEVIxEzETc2EzI2NTQmIyIGH +QEUFgFUcYCVbiNJEyNWVigySElcU01JXmECIJd4i5QTEDRJAt/+3jkq/hRuZV55ZWsdX14AAQAe// +IB9wIgABgAAAEyFhcjJiMiBhUUFjMyNjczDgEjIiY1NDYBF152DFocbEJXU0A1Rw1aE3pbaoKQAiB +oWH5qZm1tPDlaXYuLgZcAAAACAB7/8gIZAt8AEQAeAAABESM1BwYjIiY1NDYzMhYfAREDMjY9ATQm +IyIGFRQWAhlWKDJacYCVbiNJEyOnSV5hQUlcUwLf/SFVOSqXeIuUExA0ARb9VWVrHV9ebmVeeQACA +B7/8gH9AiAAFQAbAAABFAchHgEzMjY3Mw4BIyImNTQ2MzIWJyIGByEmAf0C/oAGUkA1SwlaD4FXbI +WObmt45UBVBwEqDQEYFhNjWD84W16Oh3+akU9aU60AAAEAFQAAARoC8gAWAAATBh0BMxUjESMRIzU +zNTQ3PgEzMhcVJqcDbW1WOTkDB0k8Hx5oAngVITRC/jQBzEIsJRs5PwVHEwAAAAIAHv8uAhkCIAAi +AC8AAAERFAcOASMiLwEzFx4BMzI2NzY9AQcGIyImNTQ2MzIWHwE1AzI2PQE0JiMiBhUUFgIZAQSEd +NwRAVcBBU5DTlUDASgyWnGAlW4jSRMjp0leYUFJXFMCEv5wSh1zeq8KCTI8VU0ZIQk5Kpd4i5QTED +RJ/iJlax1fXm5lXnkAAQBKAAACCgLkABcAAAEWFREjETQnLgEHDgEdASMRMxE3NjMyFgIIAlYCBDs +6RVRWViE5UVViAYUbQP7WASQxGzI7AQJyf+kC5P7TPSxUAAACAD4AAACsAsAABwALAAASMhYUBiIm +NBMjETNeLiAgLiBiVlYCwCAuICAu/WACEgAC//P/LgCnAsAABwAVAAASMhYUBiImNBcRFAcGIyInN +RY3NjURWS4gIC4gYgMLcRwNSgYCAsAgLiAgLo79wCUbZAJGBzMOHgJEAAAAAQBKAAACCALfAAsAAC +EnBxUjETMREzMHEwGTwTJWVvdu9/rgN6kC3/4oAQv6/ugAAQBG//wA3gLfAA8AABMRFBceATcVBiM +iJicmNRGcAQIcIxkkKi4CAQLf/bkhERoSBD4EJC8SNAJKAAAAAQBKAAADEAIgACQAAAEWFREjETQn +JiMiFREjETQnJiMiFREjETMVNzYzMhYXNzYzMhYDCwVWBAxedFYEDF50VlYiJko7ThAvJkpEVAGfI +jn+vAEcQyRZ1v76ARxDJFnW/voCEk08HzYtRB9HAAAAAAEASgAAAgoCIAAWAAABFhURIxE0JyYjIg +YdASMRMxU3NjMyFgIIAlYCCXBEVVZWITlRVWIBhRtA/tYBJDEbbHR/6QISWz0sVAAAAAACAB7/8gI +sAiAABwARAAASIBYUBiAmNBIyNjU0JiIGFRSlAQCHh/8Ah7ieWlqeWgIgn/Cfn/D+s3ZfYHV1YF8A +AgBK/zwCRQIgABEAHgAAATIWFRQGIyImLwERIxEzFTc2EzI2NTQmIyIGHQEUFgFUcYCVbiNJEyNWV +igySElcU01JXmECIJd4i5QTEDT+8wLWVTkq/hRuZV55ZWsdX14AAgAe/zwCGQIgABEAHgAAAREjEQ +cGIyImNTQ2MzIWHwE1AzI2PQE0JiMiBhUUFgIZVigyWnGAlW4jSRMjp0leYUFJXFMCEv0qARk5Kpd +4i5QTEDRJ/iJlax1fXm5lXnkAAQBKAAABPgIeAA0AAAEyFxUmBhURIxEzFTc2ARoWDkdXVlYwIwIe +B0EFVlf+0gISU0cYAAEAGP/yAa0CIAAjAAATMhYXIyYjIgYVFBYXHgEVFAYjIiYnMxYzMjY1NCYnL +gE1NDbkV2MJWhNdKy04PF1XbVhWbgxaE2ktOjlEUllkAiBaS2MrJCUoEBlPQkhOVFZoKCUmLhIWSE +BIUwAAAAEAFP/4ARQCiQAXAAATERQXHgE3FQYjIiYnJjURIzUzNTMVMxWxAQMmMx8qMjMEAUdHVmM +BzP7PGw4mFgY/BSwxDjQBNUJ7e0IAAAABAEL/8gICAhIAFwAAAREjNQcGIyImJyY1ETMRFBceATMy +Nj0BAgJWITlRT2EKBVYEBkA1RFECEv3uWj4qTToiOQE+/tIlJC43c4DpAAAAAAEAAQAAAfwCEgAGA +AABAyMDMxsBAfzJaclfop8CEv3uAhL+LQHTAAABAAEAAAMLAhIADAAAAQMjCwEjAzMbATMbAQMLqW +Z2dmapY3t0a3Z7AhL97gG+/kICEv5AAcD+QwG9AAAB//oAAAHWAhIACwAAARMjJwcjEwMzFzczARq +8ZIuKY763ZoWFYwEO/vLV1QEMAQbNzQAAAQAB/y4B+wISABEAAAEDDgEjIic1FjMyNj8BAzMbAQH7 +2iFZQB8NDRIpNhQH02GenQIS/cFVUAJGASozEwIt/i4B0gABABQAAAGxAg4ACQAAJRUhNQEhNSEVA +QGx/mMBNP7iAYL+zkREQgGIREX+ewAAAAABAED/sAEOAwwALAAAASMiBhUUFxYVFAYHHgEVFAcGFR +QWOwEVIyImNTQ3NjU0JzU2NTQnJjU0NjsBAQ4MKiMLDS4pKS4NCyMqDAtERAwLUlILDERECwLUGBk +WTlsgKzUFBTcrIFtOFhkYOC87GFVMIkUIOAhFIkxVGDsvAAAAAAEAYP84AJoDIAADAAAXIxEzmjo6 +yAPoAAEAIf+wAO8DDAAsAAATFQYVFBcWFRQGKwE1MzI2NTQnJjU0NjcuATU0NzY1NCYrATUzMhYVF +AcGFRTvUgsMREQLDCojCw0uKSkuDQsjKgwLREQMCwF6OAhFIkxVGDsvOBgZFk5bICs1BQU3KyBbTh +YZGDgvOxhVTCJFAAABAE0A3wH2AWQAEwAAATMUIyImJyYjIhUjNDMyFhcWMzIBvjhuGywtQR0xOG4 +bLC1BHTEBZIURGCNMhREYIwAAAwAk/94DIgLoAAcAEQApAAAAIBYQBiAmECQgBhUUFiA2NTQlMhYX +IyYjIgYUFjMyNjczDgEjIiY1NDYBAQFE3d3+vN0CB/7wubkBELn+xVBnD1wSWDo+QTcqOQZcEmZWX +HN2Aujg/rbg4AFKpr+Mjb6+jYxbWEldV5ZZNShLVn5na34AAgB4AFIB9AGeAAUACwAAAQcXIyc3Mw +cXIyc3AUqJiUmJifOJiUmJiQGepqampqampqYAAAIAHAHSAQ4CwAAHAA8AABIyFhQGIiY0NiIGFBY +yNjRgakREakSTNCEhNCECwEJqQkJqCiM4IyM4AAAAAAIAUAAAAfQCCwALAA8AAAEzFSMVIzUjNTM1 +MxMhNSEBP7W1OrW1OrX+XAGkAVs4tLQ4sP31OAAAAQB0AkQBAQKyAAMAABMjNzOsOD1QAkRuAAAAA +AEAIADsAKoBdgAHAAASMhYUBiImNEg6KCg6KAF2KDooKDoAAAIAOQBSAbUBngAFAAsAACUHIzcnMw +UHIzcnMwELiUmJiUkBM4lJiYlJ+KampqampqYAAAABADYB5QDhAt8ABAAAEzczByM2Xk1OXQHv8Po +AAQAWAeUAwQLfAAQAABMHIzczwV5NTl0C1fD6AAIANgHlAYsC3wAEAAkAABM3MwcjPwEzByM2Xk1O +XapeTU5dAe/w+grw+gAAAgAWAeUBawLfAAQACQAAEwcjNzMXByM3M8FeTU5dql5NTl0C1fD6CvD6A +AADACX/8gI1AHIABwAPABcAADYyFhQGIiY0NjIWFAYiJjQ2MhYUBiImNEk4JCQ4JOw4JCQ4JOw4JC +Q4JHIkOCQkOCQkOCQkOCQkOCQkOAAAAAEAeABSAUoBngAFAAABBxcjJzcBSomJSYmJAZ6mpqamAAA +AAAEAOQBSAQsBngAFAAAlByM3JzMBC4lJiYlJ+KampgAAAf9qAAABgQKyAAMAACsBATM/VwHAVwKy +AAAAAAIAFAHIAdwClAAHABQAABMVIxUjNSM1BRUjNwcjJxcjNTMXN9pKMkoByDICKzQqATJLKysCl +CmjoykBy46KiY3Lm5sAAQAVAAABvALyABgAAAERIxEjESMRIzUzNTQ3NjMyFxUmBgcGHQEBvFbCVj +k5AxHHHx5iVgcDAg798gHM/jQBzEIOJRuWBUcIJDAVIRYAAAABABX//AHkAvIAJQAAJR4BNxUGIyI +mJyY1ESYjIgcGHQEzFSMRIxEjNTM1NDc2MzIXERQBowIcIxkkKi4CAR4nXgwDbW1WLy8DEbNdOmYa +EQQ/BCQvEjQCFQZWFSEWQv40AcxCDiUblhP9uSEAAAAAAAAWAQ4AAQAAAAAAAAATACgAAQAAAAAAA +QAHAEwAAQAAAAAAAgAHAGQAAQAAAAAAAwAaAKIAAQAAAAAABAAHAM0AAQAAAAAABQA8AU8AAQAAAA +AABgAPAawAAQAAAAAACAALAdQAAQAAAAAACQALAfgAAQAAAAAACwAXAjQAAQAAAAAADAAXAnwAAwA +BBAkAAAAmAAAAAwABBAkAAQAOADwAAwABBAkAAgAOAFQAAwABBAkAAwA0AGwAAwABBAkABAAOAL0A +AwABBAkABQB4ANUAAwABBAkABgAeAYwAAwABBAkACAAWAbwAAwABBAkACQAWAeAAAwABBAkACwAuA +gQAAwABBAkADAAuAkwATgBvACAAUgBpAGcAaAB0AHMAIABSAGUAcwBlAHIAdgBlAGQALgAATm8gUm +lnaHRzIFJlc2VydmVkLgAAQQBpAGwAZQByAG8AbgAAQWlsZXJvbgAAUgBlAGcAdQBsAGEAcgAAUmV +ndWxhcgAAMQAuADEAMAAyADsAVQBLAFcATgA7AEEAaQBsAGUAcgBvAG4ALQBSAGUAZwB1AGwAYQBy +AAAxLjEwMjtVS1dOO0FpbGVyb24tUmVndWxhcgAAQQBpAGwAZQByAG8AbgAAQWlsZXJvbgAAVgBlA +HIAcwBpAG8AbgAgADEALgAxADAAMgA7AFAAUwAgADAAMAAxAC4AMQAwADIAOwBoAG8AdABjAG8Abg +B2ACAAMQAuADAALgA3ADAAOwBtAGEAawBlAG8AdABmAC4AbABpAGIAMgAuADUALgA1ADgAMwAyADk +AAFZlcnNpb24gMS4xMDI7UFMgMDAxLjEwMjtob3Rjb252IDEuMC43MDttYWtlb3RmLmxpYjIuNS41 +ODMyOQAAQQBpAGwAZQByAG8AbgAtAFIAZQBnAHUAbABhAHIAAEFpbGVyb24tUmVndWxhcgAAUwBvA +HIAYQAgAFMAYQBnAGEAbgBvAABTb3JhIFNhZ2FubwAAUwBvAHIAYQAgAFMAYQBnAGEAbgBvAABTb3 +JhIFNhZ2FubwAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGQAbwB0AGMAbwBsAG8AbgAuAG4AZQB0AAB +odHRwOi8vd3d3LmRvdGNvbG9uLm5ldAAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGQAbwB0AGMAbwBs +AG8AbgAuAG4AZQB0AABodHRwOi8vd3d3LmRvdGNvbG9uLm5ldAAAAAACAAAAAAAA/4MAMgAAAAAAA +AAAAAAAAAAAAAAAAAAAAHQAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATAB +QAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAA +xADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0A +TgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYABhAIsAqQCDAJMAjQDDAKoAtgC3A +LQAtQCrAL4AvwC8AIwAwADBAAAAAAAB//8AAgABAAAADAAAABwAAAACAAIAAwBxAAEAcgBzAAIABA +AAAAIAAAABAAAACgBMAGYAAkRGTFQADmxhdG4AGgAEAAAAAP//AAEAAAAWAANDQVQgAB5NT0wgABZ +ST00gABYAAP//AAEAAAAA//8AAgAAAAEAAmxpZ2EADmxvY2wAFAAAAAEAAQAAAAEAAAACAAYAEAAG +AAAAAgASADQABAAAAAEATAADAAAAAgAQABYAAQAcAAAAAQABAE8AAQABAGcAAQABAE8AAwAAAAIAE +AAWAAEAHAAAAAEAAQAvAAEAAQBnAAEAAQAvAAEAGgABAAgAAgAGAAwAcwACAE8AcgACAEwAAQABAE +kAAAABAAAACgBGAGAAAkRGTFQADmxhdG4AHAAEAAAAAP//AAIAAAABABYAA0NBVCAAFk1PTCAAFlJ +PTSAAFgAA//8AAgAAAAEAAmNwc3AADmtlcm4AFAAAAAEAAAAAAAEAAQACAAYADgABAAAAAQASAAIA +AAACAB4ANgABAAoABQAFAAoAAgABACQAPQAAAAEAEgAEAAAAAQAMAAEAOP/nAAEAAQAkAAIGigAEA +AAFJAXKABoAGQAA//gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAD/sv+4/+z/7v/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAD/xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/9T/6AAAAAD/8QAA +ABD/vQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/7gAAAAAAAAAAAAAAAAAA//MAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAP/5AAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/gAAD/4AAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//L/9AAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAA/+gAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/zAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/mAAAAAAAAAAAAAAAAAAD +/4gAA//AAAAAA//YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+AAAAAAAAP/OAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/zv/qAAAAAP/0AAAACAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/ZAAD/egAA/1kAAAAA/5D/rgAAAAAAAAAAAA +AAAAAAAAAAAAAAAAD/9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAD/8AAA/7b/8P+wAAD/8P/E/98AAAAA/8P/+P/0//oAAAAAAAAAAAAA//gA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+AAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/w//C/9MAAP/SAAD/9wAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAD/yAAA/+kAAAAA//QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/9wAAAAD//QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAP/2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAP/cAAAAAAAAAAAAAAAA/7YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAP/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/6AAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAkAFAAEAAAAAQACwAAABcA +BgAAAAAAAAAIAA4AAAAAAAsAEgAAAAAAAAATABkAAwANAAAAAQAJAAAAAAAAAAAAAAAAAAAAGAAAA +AAABwAAAAAAAAAAAAAAFQAFAAAAAAAYABgAAAAUAAAACgAAAAwAAgAPABEAFgAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAEAEQBdAAYAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAcAAAAAAAAABwAAAAAACAAAAAAAAAAAAAcAAAAHAAAAEwAJ +ABUADgAPAAAACwAQAAAAAAAAAAAAAAAAAAUAGAACAAIAAgAAAAIAGAAXAAAAGAAAABYAFgACABYAA +gAWAAAAEQADAAoAFAAMAA0ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAEgAGAAEAHgAkAC +YAJwApACoALQAuAC8AMgAzADcAOAA5ADoAPAA9AEUASABOAE8AUgBTAFUAVwBZAFoAWwBcAF0AcwA +AAAAAAQAAAADa3tfFAAAAANAan9kAAAAA4QodoQ== +""")), + 10 if size is None else size, + layout_engine=Layout.BASIC, + ) + return load_default_imagefont() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageGrab.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageGrab.py new file mode 100644 index 0000000000000000000000000000000000000000..eb0724abc530524136f9d1d0f34759bfebe781b5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageGrab.py @@ -0,0 +1,231 @@ +# +# The Python Imaging Library +# $Id$ +# +# screen grabber +# +# History: +# 2001-04-26 fl created +# 2001-09-17 fl use builtin driver, if present +# 2002-11-19 fl added grabclipboard support +# +# Copyright (c) 2001-2002 by Secret Labs AB +# Copyright (c) 2001-2002 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +import os +import shutil +import subprocess +import sys +import tempfile + +from . import Image + +TYPE_CHECKING = False +if TYPE_CHECKING: + from . import ImageWin + + +def grab( + bbox: tuple[int, int, int, int] | None = None, + include_layered_windows: bool = False, + all_screens: bool = False, + xdisplay: str | None = None, + window: int | ImageWin.HWND | None = None, +) -> Image.Image: + im: Image.Image + if xdisplay is None: + if sys.platform == "darwin": + fh, filepath = tempfile.mkstemp(".png") + os.close(fh) + args = ["screencapture"] + if window is not None: + args += ["-l", str(window)] + elif bbox: + left, top, right, bottom = bbox + args += ["-R", f"{left},{top},{right-left},{bottom-top}"] + args += ["-x", filepath] + retcode = subprocess.call(args) + if retcode: + raise subprocess.CalledProcessError(retcode, args) + im = Image.open(filepath) + im.load() + os.unlink(filepath) + if bbox: + if window is not None: + # Determine if the window was in Retina mode or not + # by capturing it without the shadow, + # and checking how different the width is + fh, filepath = tempfile.mkstemp(".png") + os.close(fh) + args = ["screencapture", "-l", str(window), "-o", "-x", filepath] + retcode = subprocess.call(args) + if retcode: + raise subprocess.CalledProcessError(retcode, args) + with Image.open(filepath) as im_no_shadow: + retina = im.width - im_no_shadow.width > 100 + os.unlink(filepath) + + # Since screencapture's -R does not work with -l, + # crop the image manually + if retina: + left, top, right, bottom = bbox + im_cropped = im.resize( + (right - left, bottom - top), + box=tuple(coord * 2 for coord in bbox), + ) + else: + im_cropped = im.crop(bbox) + im.close() + return im_cropped + else: + im_resized = im.resize((right - left, bottom - top)) + im.close() + return im_resized + return im + elif sys.platform == "win32": + if window is not None: + all_screens = -1 + offset, size, data = Image.core.grabscreen_win32( + include_layered_windows, + all_screens, + int(window) if window is not None else 0, + ) + im = Image.frombytes( + "RGB", + size, + data, + # RGB, 32-bit line padding, origin lower left corner + "raw", + "BGR", + (size[0] * 3 + 3) & -4, + -1, + ) + if bbox: + x0, y0 = offset + left, top, right, bottom = bbox + im = im.crop((left - x0, top - y0, right - x0, bottom - y0)) + return im + # Cast to Optional[str] needed for Windows and macOS. + display_name: str | None = xdisplay + try: + if not Image.core.HAVE_XCB: + msg = "Pillow was built without XCB support" + raise OSError(msg) + size, data = Image.core.grabscreen_x11(display_name) + except OSError: + if display_name is None and sys.platform not in ("darwin", "win32"): + if shutil.which("gnome-screenshot"): + args = ["gnome-screenshot", "-f"] + elif shutil.which("grim"): + args = ["grim"] + elif shutil.which("spectacle"): + args = ["spectacle", "-n", "-b", "-f", "-o"] + else: + raise + fh, filepath = tempfile.mkstemp(".png") + os.close(fh) + args.append(filepath) + retcode = subprocess.call(args) + if retcode: + raise subprocess.CalledProcessError(retcode, args) + im = Image.open(filepath) + im.load() + os.unlink(filepath) + if bbox: + im_cropped = im.crop(bbox) + im.close() + return im_cropped + return im + else: + raise + else: + im = Image.frombytes("RGB", size, data, "raw", "BGRX", size[0] * 4, 1) + if bbox: + im = im.crop(bbox) + return im + + +def grabclipboard() -> Image.Image | list[str] | None: + if sys.platform == "darwin": + p = subprocess.run( + ["osascript", "-e", "get the clipboard as «class PNGf»"], + capture_output=True, + ) + if p.returncode != 0: + return None + + import binascii + + data = io.BytesIO(binascii.unhexlify(p.stdout[11:-3])) + return Image.open(data) + elif sys.platform == "win32": + fmt, data = Image.core.grabclipboard_win32() + if fmt == "file": # CF_HDROP + import struct + + o = struct.unpack_from("I", data)[0] + if data[16] == 0: + files = data[o:].decode("mbcs").split("\0") + else: + files = data[o:].decode("utf-16le").split("\0") + return files[: files.index("")] + if isinstance(data, bytes): + data = io.BytesIO(data) + if fmt == "png": + from . import PngImagePlugin + + return PngImagePlugin.PngImageFile(data) + elif fmt == "DIB": + from . import BmpImagePlugin + + return BmpImagePlugin.DibImageFile(data) + return None + else: + if os.getenv("WAYLAND_DISPLAY"): + session_type = "wayland" + elif os.getenv("DISPLAY"): + session_type = "x11" + else: # Session type check failed + session_type = None + + if shutil.which("wl-paste") and session_type in ("wayland", None): + args = ["wl-paste", "-t", "image"] + elif shutil.which("xclip") and session_type in ("x11", None): + args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"] + else: + msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux" + raise NotImplementedError(msg) + + p = subprocess.run(args, capture_output=True) + if p.returncode != 0: + err = p.stderr + for silent_error in [ + # wl-paste, when the clipboard is empty + b"Nothing is copied", + # Ubuntu/Debian wl-paste, when the clipboard is empty + b"No selection", + # Ubuntu/Debian wl-paste, when an image isn't available + b"No suitable type of content copied", + # wl-paste or Ubuntu/Debian xclip, when an image isn't available + b" not available", + # xclip, when an image isn't available + b"cannot convert ", + # xclip, when the clipboard isn't initialized + b"xclip: Error: There is no owner for the ", + ]: + if silent_error in err: + return None + msg = f"{args[0]} error" + if err: + msg += f": {err.strip().decode()}" + raise ChildProcessError(msg) + + data = io.BytesIO(p.stdout) + im = Image.open(data) + im.load() + return im diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageMath.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageMath.py new file mode 100644 index 0000000000000000000000000000000000000000..7deee74d74ff1e55469e08b8b439487ba1bd135b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageMath.py @@ -0,0 +1,314 @@ +# +# The Python Imaging Library +# $Id$ +# +# a simple math add-on for the Python Imaging Library +# +# History: +# 1999-02-15 fl Original PIL Plus release +# 2005-05-05 fl Simplified and cleaned up for PIL 1.1.6 +# 2005-09-12 fl Fixed int() and float() for Python 2.4.1 +# +# Copyright (c) 1999-2005 by Secret Labs AB +# Copyright (c) 2005 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import builtins + +from . import Image, _imagingmath + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from types import CodeType + from typing import Any + + +class _Operand: + """Wraps an image operand, providing standard operators""" + + def __init__(self, im: Image.Image): + self.im = im + + def __fixup(self, im1: _Operand | float) -> Image.Image: + # convert image to suitable mode + if isinstance(im1, _Operand): + # argument was an image. + if im1.im.mode in ("1", "L"): + return im1.im.convert("I") + elif im1.im.mode in ("I", "F"): + return im1.im + else: + msg = f"unsupported mode: {im1.im.mode}" + raise ValueError(msg) + else: + # argument was a constant + if isinstance(im1, (int, float)) and self.im.mode in ("1", "L", "I"): + return Image.new("I", self.im.size, im1) + else: + return Image.new("F", self.im.size, im1) + + def apply( + self, + op: str, + im1: _Operand | float, + im2: _Operand | float | None = None, + mode: str | None = None, + ) -> _Operand: + im_1 = self.__fixup(im1) + if im2 is None: + # unary operation + out = Image.new(mode or im_1.mode, im_1.size, None) + try: + op = getattr(_imagingmath, f"{op}_{im_1.mode}") + except AttributeError as e: + msg = f"bad operand type for '{op}'" + raise TypeError(msg) from e + _imagingmath.unop(op, out.getim(), im_1.getim()) + else: + # binary operation + im_2 = self.__fixup(im2) + if im_1.mode != im_2.mode: + # convert both arguments to floating point + if im_1.mode != "F": + im_1 = im_1.convert("F") + if im_2.mode != "F": + im_2 = im_2.convert("F") + if im_1.size != im_2.size: + # crop both arguments to a common size + size = ( + min(im_1.size[0], im_2.size[0]), + min(im_1.size[1], im_2.size[1]), + ) + if im_1.size != size: + im_1 = im_1.crop((0, 0) + size) + if im_2.size != size: + im_2 = im_2.crop((0, 0) + size) + out = Image.new(mode or im_1.mode, im_1.size, None) + try: + op = getattr(_imagingmath, f"{op}_{im_1.mode}") + except AttributeError as e: + msg = f"bad operand type for '{op}'" + raise TypeError(msg) from e + _imagingmath.binop(op, out.getim(), im_1.getim(), im_2.getim()) + return _Operand(out) + + # unary operators + def __bool__(self) -> bool: + # an image is "true" if it contains at least one non-zero pixel + return self.im.getbbox() is not None + + def __abs__(self) -> _Operand: + return self.apply("abs", self) + + def __pos__(self) -> _Operand: + return self + + def __neg__(self) -> _Operand: + return self.apply("neg", self) + + # binary operators + def __add__(self, other: _Operand | float) -> _Operand: + return self.apply("add", self, other) + + def __radd__(self, other: _Operand | float) -> _Operand: + return self.apply("add", other, self) + + def __sub__(self, other: _Operand | float) -> _Operand: + return self.apply("sub", self, other) + + def __rsub__(self, other: _Operand | float) -> _Operand: + return self.apply("sub", other, self) + + def __mul__(self, other: _Operand | float) -> _Operand: + return self.apply("mul", self, other) + + def __rmul__(self, other: _Operand | float) -> _Operand: + return self.apply("mul", other, self) + + def __truediv__(self, other: _Operand | float) -> _Operand: + return self.apply("div", self, other) + + def __rtruediv__(self, other: _Operand | float) -> _Operand: + return self.apply("div", other, self) + + def __mod__(self, other: _Operand | float) -> _Operand: + return self.apply("mod", self, other) + + def __rmod__(self, other: _Operand | float) -> _Operand: + return self.apply("mod", other, self) + + def __pow__(self, other: _Operand | float) -> _Operand: + return self.apply("pow", self, other) + + def __rpow__(self, other: _Operand | float) -> _Operand: + return self.apply("pow", other, self) + + # bitwise + def __invert__(self) -> _Operand: + return self.apply("invert", self) + + def __and__(self, other: _Operand | float) -> _Operand: + return self.apply("and", self, other) + + def __rand__(self, other: _Operand | float) -> _Operand: + return self.apply("and", other, self) + + def __or__(self, other: _Operand | float) -> _Operand: + return self.apply("or", self, other) + + def __ror__(self, other: _Operand | float) -> _Operand: + return self.apply("or", other, self) + + def __xor__(self, other: _Operand | float) -> _Operand: + return self.apply("xor", self, other) + + def __rxor__(self, other: _Operand | float) -> _Operand: + return self.apply("xor", other, self) + + def __lshift__(self, other: _Operand | float) -> _Operand: + return self.apply("lshift", self, other) + + def __rshift__(self, other: _Operand | float) -> _Operand: + return self.apply("rshift", self, other) + + # logical + def __eq__(self, other: _Operand | float) -> _Operand: # type: ignore[override] + return self.apply("eq", self, other) + + def __ne__(self, other: _Operand | float) -> _Operand: # type: ignore[override] + return self.apply("ne", self, other) + + def __lt__(self, other: _Operand | float) -> _Operand: + return self.apply("lt", self, other) + + def __le__(self, other: _Operand | float) -> _Operand: + return self.apply("le", self, other) + + def __gt__(self, other: _Operand | float) -> _Operand: + return self.apply("gt", self, other) + + def __ge__(self, other: _Operand | float) -> _Operand: + return self.apply("ge", self, other) + + +# conversions +def imagemath_int(self: _Operand) -> _Operand: + return _Operand(self.im.convert("I")) + + +def imagemath_float(self: _Operand) -> _Operand: + return _Operand(self.im.convert("F")) + + +# logical +def imagemath_equal(self: _Operand, other: _Operand | float | None) -> _Operand: + return self.apply("eq", self, other, mode="I") + + +def imagemath_notequal(self: _Operand, other: _Operand | float | None) -> _Operand: + return self.apply("ne", self, other, mode="I") + + +def imagemath_min(self: _Operand, other: _Operand | float | None) -> _Operand: + return self.apply("min", self, other) + + +def imagemath_max(self: _Operand, other: _Operand | float | None) -> _Operand: + return self.apply("max", self, other) + + +def imagemath_convert(self: _Operand, mode: str) -> _Operand: + return _Operand(self.im.convert(mode)) + + +ops = { + "int": imagemath_int, + "float": imagemath_float, + "equal": imagemath_equal, + "notequal": imagemath_notequal, + "min": imagemath_min, + "max": imagemath_max, + "convert": imagemath_convert, +} + + +def lambda_eval(expression: Callable[[dict[str, Any]], Any], **kw: Any) -> Any: + """ + Returns the result of an image function. + + :py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band + images, use the :py:meth:`~PIL.Image.Image.split` method or + :py:func:`~PIL.Image.merge` function. + + :param expression: A function that receives a dictionary. + :param **kw: Values to add to the function's dictionary. + :return: The expression result. This is usually an image object, but can + also be an integer, a floating point value, or a pixel tuple, + depending on the expression. + """ + + args: dict[str, Any] = ops.copy() + args.update(kw) + for k, v in args.items(): + if isinstance(v, Image.Image): + args[k] = _Operand(v) + + out = expression(args) + try: + return out.im + except AttributeError: + return out + + +def unsafe_eval(expression: str, **kw: Any) -> Any: + """ + Evaluates an image expression. This uses Python's ``eval()`` function to process + the expression string, and carries the security risks of doing so. It is not + recommended to process expressions without considering this. + :py:meth:`~lambda_eval` is a more secure alternative. + + :py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band + images, use the :py:meth:`~PIL.Image.Image.split` method or + :py:func:`~PIL.Image.merge` function. + + :param expression: A string containing a Python-style expression. + :param **kw: Values to add to the evaluation context. + :return: The evaluated expression. This is usually an image object, but can + also be an integer, a floating point value, or a pixel tuple, + depending on the expression. + """ + + # build execution namespace + args: dict[str, Any] = ops.copy() + for k in kw: + if "__" in k or hasattr(builtins, k): + msg = f"'{k}' not allowed" + raise ValueError(msg) + + args.update(kw) + for k, v in args.items(): + if isinstance(v, Image.Image): + args[k] = _Operand(v) + + compiled_code = compile(expression, "", "eval") + + def scan(code: CodeType) -> None: + for const in code.co_consts: + if type(const) is type(compiled_code): + scan(const) + + for name in code.co_names: + if name not in args and name != "abs": + msg = f"'{name}' not allowed" + raise ValueError(msg) + + scan(compiled_code) + out = builtins.eval(expression, {"__builtins": {"abs": abs}}, args) + try: + return out.im + except AttributeError: + return out diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageMode.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageMode.py new file mode 100644 index 0000000000000000000000000000000000000000..90e6ffe160c96f55004d3d87944b56c2b2b80619 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageMode.py @@ -0,0 +1,85 @@ +# +# The Python Imaging Library. +# $Id$ +# +# standard mode descriptors +# +# History: +# 2006-03-20 fl Added +# +# Copyright (c) 2006 by Secret Labs AB. +# Copyright (c) 2006 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import sys +from functools import lru_cache +from typing import NamedTuple + + +class ModeDescriptor(NamedTuple): + """Wrapper for mode strings.""" + + mode: str + bands: tuple[str, ...] + basemode: str + basetype: str + typestr: str + + def __str__(self) -> str: + return self.mode + + +@lru_cache +def getmode(mode: str) -> ModeDescriptor: + """Gets a mode descriptor for the given mode.""" + endian = "<" if sys.byteorder == "little" else ">" + + modes = { + # core modes + # Bits need to be extended to bytes + "1": ("L", "L", ("1",), "|b1"), + "L": ("L", "L", ("L",), "|u1"), + "I": ("L", "I", ("I",), f"{endian}i4"), + "F": ("L", "F", ("F",), f"{endian}f4"), + "P": ("P", "L", ("P",), "|u1"), + "RGB": ("RGB", "L", ("R", "G", "B"), "|u1"), + "RGBX": ("RGB", "L", ("R", "G", "B", "X"), "|u1"), + "RGBA": ("RGB", "L", ("R", "G", "B", "A"), "|u1"), + "CMYK": ("RGB", "L", ("C", "M", "Y", "K"), "|u1"), + "YCbCr": ("RGB", "L", ("Y", "Cb", "Cr"), "|u1"), + # UNDONE - unsigned |u1i1i1 + "LAB": ("RGB", "L", ("L", "A", "B"), "|u1"), + "HSV": ("RGB", "L", ("H", "S", "V"), "|u1"), + # extra experimental modes + "RGBa": ("RGB", "L", ("R", "G", "B", "a"), "|u1"), + "LA": ("L", "L", ("L", "A"), "|u1"), + "La": ("L", "L", ("L", "a"), "|u1"), + "PA": ("RGB", "L", ("P", "A"), "|u1"), + } + if mode in modes: + base_mode, base_type, bands, type_str = modes[mode] + return ModeDescriptor(mode, bands, base_mode, base_type, type_str) + + mapping_modes = { + # I;16 == I;16L, and I;32 == I;32L + "I;16": "u2", + "I;16BS": ">i2", + "I;16N": f"{endian}u2", + "I;16NS": f"{endian}i2", + "I;32": "u4", + "I;32L": "i4", + "I;32LS": " +from __future__ import annotations + +import re + +from . import Image, _imagingmorph + +LUT_SIZE = 1 << 9 + +# fmt: off +ROTATION_MATRIX = [ + 6, 3, 0, + 7, 4, 1, + 8, 5, 2, +] +MIRROR_MATRIX = [ + 2, 1, 0, + 5, 4, 3, + 8, 7, 6, +] +# fmt: on + + +class LutBuilder: + """A class for building a MorphLut from a descriptive language + + The input patterns is a list of a strings sequences like these:: + + 4:(... + .1. + 111)->1 + + (whitespaces including linebreaks are ignored). The option 4 + describes a series of symmetry operations (in this case a + 4-rotation), the pattern is described by: + + - . or X - Ignore + - 1 - Pixel is on + - 0 - Pixel is off + + The result of the operation is described after "->" string. + + The default is to return the current pixel value, which is + returned if no other match is found. + + Operations: + + - 4 - 4 way rotation + - N - Negate + - 1 - Dummy op for no other operation (an op must always be given) + - M - Mirroring + + Example:: + + lb = LutBuilder(patterns = ["4:(... .1. 111)->1"]) + lut = lb.build_lut() + + """ + + def __init__( + self, patterns: list[str] | None = None, op_name: str | None = None + ) -> None: + """ + :param patterns: A list of input patterns, or None. + :param op_name: The name of a known pattern. One of "corner", "dilation4", + "dilation8", "erosion4", "erosion8" or "edge". + :exception Exception: If the op_name is not recognized. + """ + self.lut: bytearray | None = None + if op_name is not None: + known_patterns = { + "corner": ["1:(... ... ...)->0", "4:(00. 01. ...)->1"], + "dilation4": ["4:(... .0. .1.)->1"], + "dilation8": ["4:(... .0. .1.)->1", "4:(... .0. ..1)->1"], + "erosion4": ["4:(... .1. .0.)->0"], + "erosion8": ["4:(... .1. .0.)->0", "4:(... .1. ..0)->0"], + "edge": [ + "1:(... ... ...)->0", + "4:(.0. .1. ...)->1", + "4:(01. .1. ...)->1", + ], + } + if op_name not in known_patterns: + msg = f"Unknown pattern {op_name}!" + raise Exception(msg) + + self.patterns = known_patterns[op_name] + elif patterns is not None: + self.patterns = patterns + else: + self.patterns = [] + + def add_patterns(self, patterns: list[str]) -> None: + """ + Append to list of patterns. + + :param patterns: Additional patterns. + """ + self.patterns += patterns + + def build_default_lut(self) -> bytearray: + """ + Set the current LUT, and return it. + + This is the default LUT that patterns will be applied against when building. + """ + symbols = [0, 1] + m = 1 << 4 # pos of current pixel + self.lut = bytearray(symbols[(i & m) > 0] for i in range(LUT_SIZE)) + return self.lut + + def get_lut(self) -> bytearray | None: + """ + Returns the current LUT + """ + return self.lut + + def _string_permute(self, pattern: str, permutation: list[int]) -> str: + """Takes a pattern and a permutation and returns the + string permuted according to the permutation list. + """ + assert len(permutation) == 9 + return "".join(pattern[p] for p in permutation) + + def _pattern_permute( + self, basic_pattern: str, options: str, basic_result: int + ) -> list[tuple[str, int]]: + """Takes a basic pattern and its result and clones + the pattern according to the modifications described in the $options + parameter. It returns a list of all cloned patterns.""" + patterns = [(basic_pattern, basic_result)] + + # rotations + if "4" in options: + res = patterns[-1][1] + for i in range(4): + patterns.append( + (self._string_permute(patterns[-1][0], ROTATION_MATRIX), res) + ) + # mirror + if "M" in options: + n = len(patterns) + for pattern, res in patterns[:n]: + patterns.append((self._string_permute(pattern, MIRROR_MATRIX), res)) + + # negate + if "N" in options: + n = len(patterns) + for pattern, res in patterns[:n]: + # Swap 0 and 1 + pattern = pattern.replace("0", "Z").replace("1", "0").replace("Z", "1") + res = 1 - int(res) + patterns.append((pattern, res)) + + return patterns + + def build_lut(self) -> bytearray: + """Compile all patterns into a morphology LUT, and return it. + + This is the data to be passed into MorphOp.""" + self.build_default_lut() + assert self.lut is not None + patterns = [] + + # Parse and create symmetries of the patterns strings + for p in self.patterns: + m = re.search(r"(\w):?\s*\((.+?)\)\s*->\s*(\d)", p.replace("\n", "")) + if not m: + msg = 'Syntax error in pattern "' + p + '"' + raise Exception(msg) + options = m.group(1) + pattern = m.group(2) + result = int(m.group(3)) + + # Get rid of spaces + pattern = pattern.replace(" ", "").replace("\n", "") + + patterns += self._pattern_permute(pattern, options, result) + + # Compile the patterns into regular expressions for speed + compiled_patterns = [] + for pattern in patterns: + p = pattern[0].replace(".", "X").replace("X", "[01]") + compiled_patterns.append((re.compile(p), pattern[1])) + + # Step through table and find patterns that match. + # Note that all the patterns are searched. The last one found takes priority + for i in range(LUT_SIZE): + # Build the bit pattern + bitpattern = bin(i)[2:] + bitpattern = ("0" * (9 - len(bitpattern)) + bitpattern)[::-1] + + for pattern, r in compiled_patterns: + if pattern.match(bitpattern): + self.lut[i] = [0, 1][r] + + return self.lut + + +class MorphOp: + """A class for binary morphological operators""" + + def __init__( + self, + lut: bytearray | None = None, + op_name: str | None = None, + patterns: list[str] | None = None, + ) -> None: + """Create a binary morphological operator. + + If the LUT is not provided, then it is built using LutBuilder from the op_name + or the patterns. + + :param lut: The LUT data. + :param patterns: A list of input patterns, or None. + :param op_name: The name of a known pattern. One of "corner", "dilation4", + "dilation8", "erosion4", "erosion8", "edge". + :exception Exception: If the op_name is not recognized. + """ + if patterns is None and op_name is None: + self.lut = lut + else: + self.lut = LutBuilder(patterns, op_name).build_lut() + + def apply(self, image: Image.Image) -> tuple[int, Image.Image]: + """Run a single morphological operation on an image. + + Returns a tuple of the number of changed pixels and the + morphed image. + + :param image: A 1-mode or L-mode image. + :exception Exception: If the current operator is None. + :exception ValueError: If the image is not 1 or L mode.""" + if self.lut is None: + msg = "No operator loaded" + raise Exception(msg) + + if image.mode not in ("1", "L"): + msg = "Image mode must be 1 or L" + raise ValueError(msg) + outimage = Image.new(image.mode, image.size) + count = _imagingmorph.apply(bytes(self.lut), image.getim(), outimage.getim()) + return count, outimage + + def match(self, image: Image.Image) -> list[tuple[int, int]]: + """Get a list of coordinates matching the morphological operation on + an image. + + Returns a list of tuples of (x,y) coordinates of all matching pixels. See + :ref:`coordinate-system`. + + :param image: A 1-mode or L-mode image. + :exception Exception: If the current operator is None. + :exception ValueError: If the image is not 1 or L mode.""" + if self.lut is None: + msg = "No operator loaded" + raise Exception(msg) + + if image.mode not in ("1", "L"): + msg = "Image mode must be 1 or L" + raise ValueError(msg) + return _imagingmorph.match(bytes(self.lut), image.getim()) + + def get_on_pixels(self, image: Image.Image) -> list[tuple[int, int]]: + """Get a list of all turned on pixels in a 1 or L mode image. + + Returns a list of tuples of (x,y) coordinates of all non-empty pixels. See + :ref:`coordinate-system`. + + :param image: A 1-mode or L-mode image. + :exception ValueError: If the image is not 1 or L mode.""" + + if image.mode not in ("1", "L"): + msg = "Image mode must be 1 or L" + raise ValueError(msg) + return _imagingmorph.get_on_pixels(image.getim()) + + def load_lut(self, filename: str) -> None: + """ + Load an operator from an mrl file + + :param filename: The file to read from. + :exception Exception: If the length of the file data is not 512. + """ + with open(filename, "rb") as f: + self.lut = bytearray(f.read()) + + if len(self.lut) != LUT_SIZE: + self.lut = None + msg = "Wrong size operator file!" + raise Exception(msg) + + def save_lut(self, filename: str) -> None: + """ + Save an operator to an mrl file. + + :param filename: The destination file. + :exception Exception: If the current operator is None. + """ + if self.lut is None: + msg = "No operator loaded" + raise Exception(msg) + with open(filename, "wb") as f: + f.write(self.lut) + + def set_lut(self, lut: bytearray | None) -> None: + """ + Set the LUT from an external source + + :param lut: A new LUT. + """ + self.lut = lut diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageOps.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageOps.py new file mode 100644 index 0000000000000000000000000000000000000000..78f754ebeb0e2b0789a7b5f2a0a77f86852322f0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageOps.py @@ -0,0 +1,746 @@ +# +# The Python Imaging Library. +# $Id$ +# +# standard image operations +# +# History: +# 2001-10-20 fl Created +# 2001-10-23 fl Added autocontrast operator +# 2001-12-18 fl Added Kevin's fit operator +# 2004-03-14 fl Fixed potential division by zero in equalize +# 2005-05-05 fl Fixed equalize for low number of values +# +# Copyright (c) 2001-2004 by Secret Labs AB +# Copyright (c) 2001-2004 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import functools +import operator +import re +from collections.abc import Sequence +from typing import Literal, Protocol, cast, overload + +from . import ExifTags, Image, ImagePalette + +# +# helpers + + +def _border(border: int | tuple[int, ...]) -> tuple[int, int, int, int]: + if isinstance(border, tuple): + if len(border) == 2: + left, top = right, bottom = border + elif len(border) == 4: + left, top, right, bottom = border + else: + left = top = right = bottom = border + return left, top, right, bottom + + +def _color(color: str | int | tuple[int, ...], mode: str) -> int | tuple[int, ...]: + if isinstance(color, str): + from . import ImageColor + + color = ImageColor.getcolor(color, mode) + return color + + +def _lut(image: Image.Image, lut: list[int]) -> Image.Image: + if image.mode == "P": + # FIXME: apply to lookup table, not image data + msg = "mode P support coming soon" + raise NotImplementedError(msg) + elif image.mode in ("L", "RGB"): + if image.mode == "RGB" and len(lut) == 256: + lut = lut + lut + lut + return image.point(lut) + else: + msg = f"not supported for mode {image.mode}" + raise OSError(msg) + + +# +# actions + + +def autocontrast( + image: Image.Image, + cutoff: float | tuple[float, float] = 0, + ignore: int | Sequence[int] | None = None, + mask: Image.Image | None = None, + preserve_tone: bool = False, +) -> Image.Image: + """ + Maximize (normalize) image contrast. This function calculates a + histogram of the input image (or mask region), removes ``cutoff`` percent of the + lightest and darkest pixels from the histogram, and remaps the image + so that the darkest pixel becomes black (0), and the lightest + becomes white (255). + + :param image: The image to process. + :param cutoff: The percent to cut off from the histogram on the low and + high ends. Either a tuple of (low, high), or a single + number for both. + :param ignore: The background pixel value (use None for no background). + :param mask: Histogram used in contrast operation is computed using pixels + within the mask. If no mask is given the entire image is used + for histogram computation. + :param preserve_tone: Preserve image tone in Photoshop-like style autocontrast. + + .. versionadded:: 8.2.0 + + :return: An image. + """ + if preserve_tone: + histogram = image.convert("L").histogram(mask) + else: + histogram = image.histogram(mask) + + lut = [] + for layer in range(0, len(histogram), 256): + h = histogram[layer : layer + 256] + if ignore is not None: + # get rid of outliers + if isinstance(ignore, int): + h[ignore] = 0 + else: + for ix in ignore: + h[ix] = 0 + if cutoff: + # cut off pixels from both ends of the histogram + if not isinstance(cutoff, tuple): + cutoff = (cutoff, cutoff) + # get number of pixels + n = 0 + for ix in range(256): + n = n + h[ix] + # remove cutoff% pixels from the low end + cut = int(n * cutoff[0] // 100) + for lo in range(256): + if cut > h[lo]: + cut = cut - h[lo] + h[lo] = 0 + else: + h[lo] -= cut + cut = 0 + if cut <= 0: + break + # remove cutoff% samples from the high end + cut = int(n * cutoff[1] // 100) + for hi in range(255, -1, -1): + if cut > h[hi]: + cut = cut - h[hi] + h[hi] = 0 + else: + h[hi] -= cut + cut = 0 + if cut <= 0: + break + # find lowest/highest samples after preprocessing + for lo in range(256): + if h[lo]: + break + for hi in range(255, -1, -1): + if h[hi]: + break + if hi <= lo: + # don't bother + lut.extend(list(range(256))) + else: + scale = 255.0 / (hi - lo) + offset = -lo * scale + for ix in range(256): + ix = int(ix * scale + offset) + if ix < 0: + ix = 0 + elif ix > 255: + ix = 255 + lut.append(ix) + return _lut(image, lut) + + +def colorize( + image: Image.Image, + black: str | tuple[int, ...], + white: str | tuple[int, ...], + mid: str | int | tuple[int, ...] | None = None, + blackpoint: int = 0, + whitepoint: int = 255, + midpoint: int = 127, +) -> Image.Image: + """ + Colorize grayscale image. + This function calculates a color wedge which maps all black pixels in + the source image to the first color and all white pixels to the + second color. If ``mid`` is specified, it uses three-color mapping. + The ``black`` and ``white`` arguments should be RGB tuples or color names; + optionally you can use three-color mapping by also specifying ``mid``. + Mapping positions for any of the colors can be specified + (e.g. ``blackpoint``), where these parameters are the integer + value corresponding to where the corresponding color should be mapped. + These parameters must have logical order, such that + ``blackpoint <= midpoint <= whitepoint`` (if ``mid`` is specified). + + :param image: The image to colorize. + :param black: The color to use for black input pixels. + :param white: The color to use for white input pixels. + :param mid: The color to use for midtone input pixels. + :param blackpoint: an int value [0, 255] for the black mapping. + :param whitepoint: an int value [0, 255] for the white mapping. + :param midpoint: an int value [0, 255] for the midtone mapping. + :return: An image. + """ + + # Initial asserts + assert image.mode == "L" + if mid is None: + assert 0 <= blackpoint <= whitepoint <= 255 + else: + assert 0 <= blackpoint <= midpoint <= whitepoint <= 255 + + # Define colors from arguments + rgb_black = cast(Sequence[int], _color(black, "RGB")) + rgb_white = cast(Sequence[int], _color(white, "RGB")) + rgb_mid = cast(Sequence[int], _color(mid, "RGB")) if mid is not None else None + + # Empty lists for the mapping + red = [] + green = [] + blue = [] + + # Create the low-end values + for i in range(blackpoint): + red.append(rgb_black[0]) + green.append(rgb_black[1]) + blue.append(rgb_black[2]) + + # Create the mapping (2-color) + if rgb_mid is None: + range_map = range(whitepoint - blackpoint) + + for i in range_map: + red.append( + rgb_black[0] + i * (rgb_white[0] - rgb_black[0]) // len(range_map) + ) + green.append( + rgb_black[1] + i * (rgb_white[1] - rgb_black[1]) // len(range_map) + ) + blue.append( + rgb_black[2] + i * (rgb_white[2] - rgb_black[2]) // len(range_map) + ) + + # Create the mapping (3-color) + else: + range_map1 = range(midpoint - blackpoint) + range_map2 = range(whitepoint - midpoint) + + for i in range_map1: + red.append( + rgb_black[0] + i * (rgb_mid[0] - rgb_black[0]) // len(range_map1) + ) + green.append( + rgb_black[1] + i * (rgb_mid[1] - rgb_black[1]) // len(range_map1) + ) + blue.append( + rgb_black[2] + i * (rgb_mid[2] - rgb_black[2]) // len(range_map1) + ) + for i in range_map2: + red.append(rgb_mid[0] + i * (rgb_white[0] - rgb_mid[0]) // len(range_map2)) + green.append( + rgb_mid[1] + i * (rgb_white[1] - rgb_mid[1]) // len(range_map2) + ) + blue.append(rgb_mid[2] + i * (rgb_white[2] - rgb_mid[2]) // len(range_map2)) + + # Create the high-end values + for i in range(256 - whitepoint): + red.append(rgb_white[0]) + green.append(rgb_white[1]) + blue.append(rgb_white[2]) + + # Return converted image + image = image.convert("RGB") + return _lut(image, red + green + blue) + + +def contain( + image: Image.Image, size: tuple[int, int], method: int = Image.Resampling.BICUBIC +) -> Image.Image: + """ + Returns a resized version of the image, set to the maximum width and height + within the requested size, while maintaining the original aspect ratio. + + :param image: The image to resize. + :param size: The requested output size in pixels, given as a + (width, height) tuple. + :param method: Resampling method to use. Default is + :py:attr:`~PIL.Image.Resampling.BICUBIC`. + See :ref:`concept-filters`. + :return: An image. + """ + + im_ratio = image.width / image.height + dest_ratio = size[0] / size[1] + + if im_ratio != dest_ratio: + if im_ratio > dest_ratio: + new_height = round(image.height / image.width * size[0]) + if new_height != size[1]: + size = (size[0], new_height) + else: + new_width = round(image.width / image.height * size[1]) + if new_width != size[0]: + size = (new_width, size[1]) + return image.resize(size, resample=method) + + +def cover( + image: Image.Image, size: tuple[int, int], method: int = Image.Resampling.BICUBIC +) -> Image.Image: + """ + Returns a resized version of the image, so that the requested size is + covered, while maintaining the original aspect ratio. + + :param image: The image to resize. + :param size: The requested output size in pixels, given as a + (width, height) tuple. + :param method: Resampling method to use. Default is + :py:attr:`~PIL.Image.Resampling.BICUBIC`. + See :ref:`concept-filters`. + :return: An image. + """ + + im_ratio = image.width / image.height + dest_ratio = size[0] / size[1] + + if im_ratio != dest_ratio: + if im_ratio < dest_ratio: + new_height = round(image.height / image.width * size[0]) + if new_height != size[1]: + size = (size[0], new_height) + else: + new_width = round(image.width / image.height * size[1]) + if new_width != size[0]: + size = (new_width, size[1]) + return image.resize(size, resample=method) + + +def pad( + image: Image.Image, + size: tuple[int, int], + method: int = Image.Resampling.BICUBIC, + color: str | int | tuple[int, ...] | None = None, + centering: tuple[float, float] = (0.5, 0.5), +) -> Image.Image: + """ + Returns a resized and padded version of the image, expanded to fill the + requested aspect ratio and size. + + :param image: The image to resize and crop. + :param size: The requested output size in pixels, given as a + (width, height) tuple. + :param method: Resampling method to use. Default is + :py:attr:`~PIL.Image.Resampling.BICUBIC`. + See :ref:`concept-filters`. + :param color: The background color of the padded image. + :param centering: Control the position of the original image within the + padded version. + + (0.5, 0.5) will keep the image centered + (0, 0) will keep the image aligned to the top left + (1, 1) will keep the image aligned to the bottom + right + :return: An image. + """ + + resized = contain(image, size, method) + if resized.size == size: + out = resized + else: + out = Image.new(image.mode, size, color) + if resized.palette: + palette = resized.getpalette() + if palette is not None: + out.putpalette(palette) + if resized.width != size[0]: + x = round((size[0] - resized.width) * max(0, min(centering[0], 1))) + out.paste(resized, (x, 0)) + else: + y = round((size[1] - resized.height) * max(0, min(centering[1], 1))) + out.paste(resized, (0, y)) + return out + + +def crop(image: Image.Image, border: int = 0) -> Image.Image: + """ + Remove border from image. The same amount of pixels are removed + from all four sides. This function works on all image modes. + + .. seealso:: :py:meth:`~PIL.Image.Image.crop` + + :param image: The image to crop. + :param border: The number of pixels to remove. + :return: An image. + """ + left, top, right, bottom = _border(border) + return image.crop((left, top, image.size[0] - right, image.size[1] - bottom)) + + +def scale( + image: Image.Image, factor: float, resample: int = Image.Resampling.BICUBIC +) -> Image.Image: + """ + Returns a rescaled image by a specific factor given in parameter. + A factor greater than 1 expands the image, between 0 and 1 contracts the + image. + + :param image: The image to rescale. + :param factor: The expansion factor, as a float. + :param resample: Resampling method to use. Default is + :py:attr:`~PIL.Image.Resampling.BICUBIC`. + See :ref:`concept-filters`. + :returns: An :py:class:`~PIL.Image.Image` object. + """ + if factor == 1: + return image.copy() + elif factor <= 0: + msg = "the factor must be greater than 0" + raise ValueError(msg) + else: + size = (round(factor * image.width), round(factor * image.height)) + return image.resize(size, resample) + + +class SupportsGetMesh(Protocol): + """ + An object that supports the ``getmesh`` method, taking an image as an + argument, and returning a list of tuples. Each tuple contains two tuples, + the source box as a tuple of 4 integers, and a tuple of 8 integers for the + final quadrilateral, in order of top left, bottom left, bottom right, top + right. + """ + + def getmesh( + self, image: Image.Image + ) -> list[ + tuple[tuple[int, int, int, int], tuple[int, int, int, int, int, int, int, int]] + ]: ... + + +def deform( + image: Image.Image, + deformer: SupportsGetMesh, + resample: int = Image.Resampling.BILINEAR, +) -> Image.Image: + """ + Deform the image. + + :param image: The image to deform. + :param deformer: A deformer object. Any object that implements a + ``getmesh`` method can be used. + :param resample: An optional resampling filter. Same values possible as + in the PIL.Image.transform function. + :return: An image. + """ + return image.transform( + image.size, Image.Transform.MESH, deformer.getmesh(image), resample + ) + + +def equalize(image: Image.Image, mask: Image.Image | None = None) -> Image.Image: + """ + Equalize the image histogram. This function applies a non-linear + mapping to the input image, in order to create a uniform + distribution of grayscale values in the output image. + + :param image: The image to equalize. + :param mask: An optional mask. If given, only the pixels selected by + the mask are included in the analysis. + :return: An image. + """ + if image.mode == "P": + image = image.convert("RGB") + h = image.histogram(mask) + lut = [] + for b in range(0, len(h), 256): + histo = [_f for _f in h[b : b + 256] if _f] + if len(histo) <= 1: + lut.extend(list(range(256))) + else: + step = (functools.reduce(operator.add, histo) - histo[-1]) // 255 + if not step: + lut.extend(list(range(256))) + else: + n = step // 2 + for i in range(256): + lut.append(n // step) + n = n + h[i + b] + return _lut(image, lut) + + +def expand( + image: Image.Image, + border: int | tuple[int, ...] = 0, + fill: str | int | tuple[int, ...] = 0, +) -> Image.Image: + """ + Add border to the image + + :param image: The image to expand. + :param border: Border width, in pixels. + :param fill: Pixel fill value (a color value). Default is 0 (black). + :return: An image. + """ + left, top, right, bottom = _border(border) + width = left + image.size[0] + right + height = top + image.size[1] + bottom + color = _color(fill, image.mode) + if image.palette: + mode = image.palette.mode + palette = ImagePalette.ImagePalette(mode, image.getpalette(mode)) + if isinstance(color, tuple) and (len(color) == 3 or len(color) == 4): + color = palette.getcolor(color) + else: + palette = None + out = Image.new(image.mode, (width, height), color) + if palette: + out.putpalette(palette.palette, mode) + out.paste(image, (left, top)) + return out + + +def fit( + image: Image.Image, + size: tuple[int, int], + method: int = Image.Resampling.BICUBIC, + bleed: float = 0.0, + centering: tuple[float, float] = (0.5, 0.5), +) -> Image.Image: + """ + Returns a resized and cropped version of the image, cropped to the + requested aspect ratio and size. + + This function was contributed by Kevin Cazabon. + + :param image: The image to resize and crop. + :param size: The requested output size in pixels, given as a + (width, height) tuple. + :param method: Resampling method to use. Default is + :py:attr:`~PIL.Image.Resampling.BICUBIC`. + See :ref:`concept-filters`. + :param bleed: Remove a border around the outside of the image from all + four edges. The value is a decimal percentage (use 0.01 for + one percent). The default value is 0 (no border). + Cannot be greater than or equal to 0.5. + :param centering: Control the cropping position. Use (0.5, 0.5) for + center cropping (e.g. if cropping the width, take 50% off + of the left side, and therefore 50% off the right side). + (0.0, 0.0) will crop from the top left corner (i.e. if + cropping the width, take all of the crop off of the right + side, and if cropping the height, take all of it off the + bottom). (1.0, 0.0) will crop from the bottom left + corner, etc. (i.e. if cropping the width, take all of the + crop off the left side, and if cropping the height take + none from the top, and therefore all off the bottom). + :return: An image. + """ + + # by Kevin Cazabon, Feb 17/2000 + # kevin@cazabon.com + # https://www.cazabon.com + + centering_x, centering_y = centering + + if not 0.0 <= centering_x <= 1.0: + centering_x = 0.5 + if not 0.0 <= centering_y <= 1.0: + centering_y = 0.5 + + if not 0.0 <= bleed < 0.5: + bleed = 0.0 + + # calculate the area to use for resizing and cropping, subtracting + # the 'bleed' around the edges + + # number of pixels to trim off on Top and Bottom, Left and Right + bleed_pixels = (bleed * image.size[0], bleed * image.size[1]) + + live_size = ( + image.size[0] - bleed_pixels[0] * 2, + image.size[1] - bleed_pixels[1] * 2, + ) + + # calculate the aspect ratio of the live_size + live_size_ratio = live_size[0] / live_size[1] + + # calculate the aspect ratio of the output image + output_ratio = size[0] / size[1] + + # figure out if the sides or top/bottom will be cropped off + if live_size_ratio == output_ratio: + # live_size is already the needed ratio + crop_width = live_size[0] + crop_height = live_size[1] + elif live_size_ratio >= output_ratio: + # live_size is wider than what's needed, crop the sides + crop_width = output_ratio * live_size[1] + crop_height = live_size[1] + else: + # live_size is taller than what's needed, crop the top and bottom + crop_width = live_size[0] + crop_height = live_size[0] / output_ratio + + # make the crop + crop_left = bleed_pixels[0] + (live_size[0] - crop_width) * centering_x + crop_top = bleed_pixels[1] + (live_size[1] - crop_height) * centering_y + + crop = (crop_left, crop_top, crop_left + crop_width, crop_top + crop_height) + + # resize the image and return it + return image.resize(size, method, box=crop) + + +def flip(image: Image.Image) -> Image.Image: + """ + Flip the image vertically (top to bottom). + + :param image: The image to flip. + :return: An image. + """ + return image.transpose(Image.Transpose.FLIP_TOP_BOTTOM) + + +def grayscale(image: Image.Image) -> Image.Image: + """ + Convert the image to grayscale. + + :param image: The image to convert. + :return: An image. + """ + return image.convert("L") + + +def invert(image: Image.Image) -> Image.Image: + """ + Invert (negate) the image. + + :param image: The image to invert. + :return: An image. + """ + lut = list(range(255, -1, -1)) + return image.point(lut) if image.mode == "1" else _lut(image, lut) + + +def mirror(image: Image.Image) -> Image.Image: + """ + Flip image horizontally (left to right). + + :param image: The image to mirror. + :return: An image. + """ + return image.transpose(Image.Transpose.FLIP_LEFT_RIGHT) + + +def posterize(image: Image.Image, bits: int) -> Image.Image: + """ + Reduce the number of bits for each color channel. + + :param image: The image to posterize. + :param bits: The number of bits to keep for each channel (1-8). + :return: An image. + """ + mask = ~(2 ** (8 - bits) - 1) + lut = [i & mask for i in range(256)] + return _lut(image, lut) + + +def solarize(image: Image.Image, threshold: int = 128) -> Image.Image: + """ + Invert all pixel values above a threshold. + + :param image: The image to solarize. + :param threshold: All pixels above this grayscale level are inverted. + :return: An image. + """ + lut = [] + for i in range(256): + if i < threshold: + lut.append(i) + else: + lut.append(255 - i) + return _lut(image, lut) + + +@overload +def exif_transpose(image: Image.Image, *, in_place: Literal[True]) -> None: ... + + +@overload +def exif_transpose( + image: Image.Image, *, in_place: Literal[False] = False +) -> Image.Image: ... + + +def exif_transpose(image: Image.Image, *, in_place: bool = False) -> Image.Image | None: + """ + If an image has an EXIF Orientation tag, other than 1, transpose the image + accordingly, and remove the orientation data. + + :param image: The image to transpose. + :param in_place: Boolean. Keyword-only argument. + If ``True``, the original image is modified in-place, and ``None`` is returned. + If ``False`` (default), a new :py:class:`~PIL.Image.Image` object is returned + with the transposition applied. If there is no transposition, a copy of the + image will be returned. + """ + image.load() + image_exif = image.getexif() + orientation = image_exif.get(ExifTags.Base.Orientation, 1) + method = { + 2: Image.Transpose.FLIP_LEFT_RIGHT, + 3: Image.Transpose.ROTATE_180, + 4: Image.Transpose.FLIP_TOP_BOTTOM, + 5: Image.Transpose.TRANSPOSE, + 6: Image.Transpose.ROTATE_270, + 7: Image.Transpose.TRANSVERSE, + 8: Image.Transpose.ROTATE_90, + }.get(orientation) + if method is not None: + if in_place: + image.im = image.im.transpose(method) + image._size = image.im.size + else: + transposed_image = image.transpose(method) + exif_image = image if in_place else transposed_image + + exif = exif_image.getexif() + if ExifTags.Base.Orientation in exif: + del exif[ExifTags.Base.Orientation] + if "exif" in exif_image.info: + exif_image.info["exif"] = exif.tobytes() + elif "Raw profile type exif" in exif_image.info: + exif_image.info["Raw profile type exif"] = exif.tobytes().hex() + for key in ("XML:com.adobe.xmp", "xmp"): + if key in exif_image.info: + for pattern in ( + r'tiff:Orientation="([0-9])"', + r"([0-9])", + ): + value = exif_image.info[key] + if isinstance(value, str): + value = re.sub(pattern, "", value) + elif isinstance(value, tuple): + value = tuple( + re.sub(pattern.encode(), b"", v) for v in value + ) + else: + value = re.sub(pattern.encode(), b"", value) + exif_image.info[key] = value + if not in_place: + return transposed_image + elif not in_place: + return image.copy() + return None diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImagePalette.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImagePalette.py new file mode 100644 index 0000000000000000000000000000000000000000..fb7aa9c119d04507ea44850b68f27ecae3401a72 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImagePalette.py @@ -0,0 +1,290 @@ +# +# The Python Imaging Library. +# $Id$ +# +# image palette object +# +# History: +# 1996-03-11 fl Rewritten. +# 1997-01-03 fl Up and running. +# 1997-08-23 fl Added load hack +# 2001-04-16 fl Fixed randint shadow bug in random() +# +# Copyright (c) 1997-2001 by Secret Labs AB +# Copyright (c) 1996-1997 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import array +from collections.abc import Sequence +from typing import IO + +from . import GimpGradientFile, GimpPaletteFile, ImageColor, PaletteFile + +TYPE_CHECKING = False +if TYPE_CHECKING: + from . import Image + + +class ImagePalette: + """ + Color palette for palette mapped images + + :param mode: The mode to use for the palette. See: + :ref:`concept-modes`. Defaults to "RGB" + :param palette: An optional palette. If given, it must be a bytearray, + an array or a list of ints between 0-255. The list must consist of + all channels for one color followed by the next color (e.g. RGBRGBRGB). + Defaults to an empty palette. + """ + + def __init__( + self, + mode: str = "RGB", + palette: Sequence[int] | bytes | bytearray | None = None, + ) -> None: + self.mode = mode + self.rawmode: str | None = None # if set, palette contains raw data + self.palette = palette or bytearray() + self.dirty: int | None = None + + @property + def palette(self) -> Sequence[int] | bytes | bytearray: + return self._palette + + @palette.setter + def palette(self, palette: Sequence[int] | bytes | bytearray) -> None: + self._colors: dict[tuple[int, ...], int] | None = None + self._palette = palette + + @property + def colors(self) -> dict[tuple[int, ...], int]: + if self._colors is None: + mode_len = len(self.mode) + self._colors = {} + for i in range(0, len(self.palette), mode_len): + color = tuple(self.palette[i : i + mode_len]) + if color in self._colors: + continue + self._colors[color] = i // mode_len + return self._colors + + @colors.setter + def colors(self, colors: dict[tuple[int, ...], int]) -> None: + self._colors = colors + + def copy(self) -> ImagePalette: + new = ImagePalette() + + new.mode = self.mode + new.rawmode = self.rawmode + if self.palette is not None: + new.palette = self.palette[:] + new.dirty = self.dirty + + return new + + def getdata(self) -> tuple[str, Sequence[int] | bytes | bytearray]: + """ + Get palette contents in format suitable for the low-level + ``im.putpalette`` primitive. + + .. warning:: This method is experimental. + """ + if self.rawmode: + return self.rawmode, self.palette + return self.mode, self.tobytes() + + def tobytes(self) -> bytes: + """Convert palette to bytes. + + .. warning:: This method is experimental. + """ + if self.rawmode: + msg = "palette contains raw palette data" + raise ValueError(msg) + if isinstance(self.palette, bytes): + return self.palette + arr = array.array("B", self.palette) + return arr.tobytes() + + # Declare tostring as an alias for tobytes + tostring = tobytes + + def _new_color_index( + self, image: Image.Image | None = None, e: Exception | None = None + ) -> int: + if not isinstance(self.palette, bytearray): + self._palette = bytearray(self.palette) + index = len(self.palette) // len(self.mode) + special_colors: tuple[int | tuple[int, ...] | None, ...] = () + if image: + special_colors = ( + image.info.get("background"), + image.info.get("transparency"), + ) + while index in special_colors: + index += 1 + if index >= 256: + if image: + # Search for an unused index + for i, count in reversed(list(enumerate(image.histogram()))): + if count == 0 and i not in special_colors: + index = i + break + if index >= 256: + msg = "cannot allocate more than 256 colors" + raise ValueError(msg) from e + return index + + def getcolor( + self, + color: tuple[int, ...], + image: Image.Image | None = None, + ) -> int: + """Given an rgb tuple, allocate palette entry. + + .. warning:: This method is experimental. + """ + if self.rawmode: + msg = "palette contains raw palette data" + raise ValueError(msg) + if isinstance(color, tuple): + if self.mode == "RGB": + if len(color) == 4: + if color[3] != 255: + msg = "cannot add non-opaque RGBA color to RGB palette" + raise ValueError(msg) + color = color[:3] + elif self.mode == "RGBA": + if len(color) == 3: + color += (255,) + try: + return self.colors[color] + except KeyError as e: + # allocate new color slot + index = self._new_color_index(image, e) + assert isinstance(self._palette, bytearray) + self.colors[color] = index + mode_len = len(self.mode) + if index * mode_len < len(self.palette): + self._palette = ( + self._palette[: index * mode_len] + + bytes(color) + + self._palette[index * mode_len + mode_len :] + ) + else: + self._palette += bytes(color) + self.dirty = 1 + return index + else: + msg = f"unknown color specifier: {repr(color)}" # type: ignore[unreachable] + raise ValueError(msg) + + def save(self, fp: str | IO[str]) -> None: + """Save palette to text file. + + .. warning:: This method is experimental. + """ + if self.rawmode: + msg = "palette contains raw palette data" + raise ValueError(msg) + open_fp = False + if isinstance(fp, str): + fp = open(fp, "w") + open_fp = True + try: + fp.write("# Palette\n") + fp.write(f"# Mode: {self.mode}\n") + palette_len = len(self.palette) + for i in range(256): + fp.write(f"{i}") + for j in range(i * len(self.mode), (i + 1) * len(self.mode)): + fp.write(f" {self.palette[j] if j < palette_len else 0}") + fp.write("\n") + finally: + if open_fp: + fp.close() + + +# -------------------------------------------------------------------- +# Internal + + +def raw(rawmode: str, data: Sequence[int] | bytes | bytearray) -> ImagePalette: + palette = ImagePalette() + palette.rawmode = rawmode + palette.palette = data + palette.dirty = 1 + return palette + + +# -------------------------------------------------------------------- +# Factories + + +def make_linear_lut(black: int, white: float) -> list[int]: + if black == 0: + return [int(white * i // 255) for i in range(256)] + + msg = "unavailable when black is non-zero" + raise NotImplementedError(msg) # FIXME + + +def make_gamma_lut(exp: float) -> list[int]: + return [int(((i / 255.0) ** exp) * 255.0 + 0.5) for i in range(256)] + + +def negative(mode: str = "RGB") -> ImagePalette: + palette = list(range(256 * len(mode))) + palette.reverse() + return ImagePalette(mode, [i // len(mode) for i in palette]) + + +def random(mode: str = "RGB") -> ImagePalette: + from random import randint + + palette = [randint(0, 255) for _ in range(256 * len(mode))] + return ImagePalette(mode, palette) + + +def sepia(white: str = "#fff0c0") -> ImagePalette: + bands = [make_linear_lut(0, band) for band in ImageColor.getrgb(white)] + return ImagePalette("RGB", [bands[i % 3][i // 3] for i in range(256 * 3)]) + + +def wedge(mode: str = "RGB") -> ImagePalette: + palette = list(range(256 * len(mode))) + return ImagePalette(mode, [i // len(mode) for i in palette]) + + +def load(filename: str) -> tuple[bytes, str]: + # FIXME: supports GIMP gradients only + + with open(filename, "rb") as fp: + paletteHandlers: list[ + type[ + GimpPaletteFile.GimpPaletteFile + | GimpGradientFile.GimpGradientFile + | PaletteFile.PaletteFile + ] + ] = [ + GimpPaletteFile.GimpPaletteFile, + GimpGradientFile.GimpGradientFile, + PaletteFile.PaletteFile, + ] + for paletteHandler in paletteHandlers: + try: + fp.seek(0) + lut = paletteHandler(fp).getpalette() + if lut: + break + except (SyntaxError, ValueError): + pass + else: + msg = "cannot load palette" + raise OSError(msg) + + return lut # data, rawmode diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImagePath.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImagePath.py new file mode 100644 index 0000000000000000000000000000000000000000..c986e909506c8b4ef538a433e9107682be9e67bc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImagePath.py @@ -0,0 +1,20 @@ +# +# The Python Imaging Library +# $Id$ +# +# path interface +# +# History: +# 1996-11-04 fl Created +# 2002-04-14 fl Added documentation stub class +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image + +Path = Image.core.path diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageQt.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageQt.py new file mode 100644 index 0000000000000000000000000000000000000000..dc439b1c9a4cebda58feb28be6a43511b11f8df5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageQt.py @@ -0,0 +1,219 @@ +# +# The Python Imaging Library. +# $Id$ +# +# a simple Qt image interface. +# +# history: +# 2006-06-03 fl: created +# 2006-06-04 fl: inherit from QImage instead of wrapping it +# 2006-06-05 fl: removed toimage helper; move string support to ImageQt +# 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com) +# +# Copyright (c) 2006 by Secret Labs AB +# Copyright (c) 2006 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import sys +from io import BytesIO + +from . import Image +from ._util import is_path + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from typing import Any + + from . import ImageFile + + QBuffer: type + +qt_version: str | None +qt_versions = [ + ["6", "PyQt6"], + ["side6", "PySide6"], +] + +# If a version has already been imported, attempt it first +qt_versions.sort(key=lambda version: version[1] in sys.modules, reverse=True) +for version, qt_module in qt_versions: + try: + qRgba: Callable[[int, int, int, int], int] + if qt_module == "PyQt6": + from PyQt6.QtCore import QBuffer, QByteArray, QIODevice + from PyQt6.QtGui import QImage, QPixmap, qRgba + elif qt_module == "PySide6": + from PySide6.QtCore import ( # type: ignore[assignment] + QBuffer, + QByteArray, + QIODevice, + ) + from PySide6.QtGui import QImage, QPixmap, qRgba # type: ignore[assignment] + except (ImportError, RuntimeError): + continue + qt_is_installed = True + qt_version = version + break +else: + qt_is_installed = False + qt_version = None + + +def rgb(r: int, g: int, b: int, a: int = 255) -> int: + """(Internal) Turns an RGB color into a Qt compatible color integer.""" + # use qRgb to pack the colors, and then turn the resulting long + # into a negative integer with the same bitpattern. + return qRgba(r, g, b, a) & 0xFFFFFFFF + + +def fromqimage(im: QImage | QPixmap) -> ImageFile.ImageFile: + """ + :param im: QImage or PIL ImageQt object + """ + buffer = QBuffer() + qt_openmode: object + if qt_version == "6": + try: + qt_openmode = getattr(QIODevice, "OpenModeFlag") + except AttributeError: + qt_openmode = getattr(QIODevice, "OpenMode") + else: + qt_openmode = QIODevice + buffer.open(getattr(qt_openmode, "ReadWrite")) + # preserve alpha channel with png + # otherwise ppm is more friendly with Image.open + if im.hasAlphaChannel(): + im.save(buffer, "png") + else: + im.save(buffer, "ppm") + + b = BytesIO() + b.write(buffer.data()) + buffer.close() + b.seek(0) + + return Image.open(b) + + +def fromqpixmap(im: QPixmap) -> ImageFile.ImageFile: + return fromqimage(im) + + +def align8to32(bytes: bytes, width: int, mode: str) -> bytes: + """ + converts each scanline of data from 8 bit to 32 bit aligned + """ + + bits_per_pixel = {"1": 1, "L": 8, "P": 8, "I;16": 16}[mode] + + # calculate bytes per line and the extra padding if needed + bits_per_line = bits_per_pixel * width + full_bytes_per_line, remaining_bits_per_line = divmod(bits_per_line, 8) + bytes_per_line = full_bytes_per_line + (1 if remaining_bits_per_line else 0) + + extra_padding = -bytes_per_line % 4 + + # already 32 bit aligned by luck + if not extra_padding: + return bytes + + new_data = [ + bytes[i * bytes_per_line : (i + 1) * bytes_per_line] + b"\x00" * extra_padding + for i in range(len(bytes) // bytes_per_line) + ] + + return b"".join(new_data) + + +def _toqclass_helper(im: Image.Image | str | QByteArray) -> dict[str, Any]: + data = None + colortable = None + exclusive_fp = False + + # handle filename, if given instead of image name + if hasattr(im, "toUtf8"): + # FIXME - is this really the best way to do this? + im = str(im.toUtf8(), "utf-8") + if is_path(im): + im = Image.open(im) + exclusive_fp = True + assert isinstance(im, Image.Image) + + qt_format = getattr(QImage, "Format") if qt_version == "6" else QImage + if im.mode == "1": + format = getattr(qt_format, "Format_Mono") + elif im.mode == "L": + format = getattr(qt_format, "Format_Indexed8") + colortable = [rgb(i, i, i) for i in range(256)] + elif im.mode == "P": + format = getattr(qt_format, "Format_Indexed8") + palette = im.getpalette() + assert palette is not None + colortable = [rgb(*palette[i : i + 3]) for i in range(0, len(palette), 3)] + elif im.mode == "RGB": + # Populate the 4th channel with 255 + im = im.convert("RGBA") + + data = im.tobytes("raw", "BGRA") + format = getattr(qt_format, "Format_RGB32") + elif im.mode == "RGBA": + data = im.tobytes("raw", "BGRA") + format = getattr(qt_format, "Format_ARGB32") + elif im.mode == "I;16": + im = im.point(lambda i: i * 256) + + format = getattr(qt_format, "Format_Grayscale16") + else: + if exclusive_fp: + im.close() + msg = f"unsupported image mode {repr(im.mode)}" + raise ValueError(msg) + + size = im.size + __data = data or align8to32(im.tobytes(), size[0], im.mode) + if exclusive_fp: + im.close() + return {"data": __data, "size": size, "format": format, "colortable": colortable} + + +if qt_is_installed: + + class ImageQt(QImage): + def __init__(self, im: Image.Image | str | QByteArray) -> None: + """ + An PIL image wrapper for Qt. This is a subclass of PyQt's QImage + class. + + :param im: A PIL Image object, or a file name (given either as + Python string or a PyQt string object). + """ + im_data = _toqclass_helper(im) + # must keep a reference, or Qt will crash! + # All QImage constructors that take data operate on an existing + # buffer, so this buffer has to hang on for the life of the image. + # Fixes https://github.com/python-pillow/Pillow/issues/1370 + self.__data = im_data["data"] + super().__init__( + self.__data, + im_data["size"][0], + im_data["size"][1], + im_data["format"], + ) + if im_data["colortable"]: + self.setColorTable(im_data["colortable"]) + + +def toqimage(im: Image.Image | str | QByteArray) -> ImageQt: + return ImageQt(im) + + +def toqpixmap(im: Image.Image | str | QByteArray) -> QPixmap: + qimage = toqimage(im) + pixmap = getattr(QPixmap, "fromImage")(qimage) + if qt_version == "6": + pixmap.detach() + return pixmap diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageSequence.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageSequence.py new file mode 100644 index 0000000000000000000000000000000000000000..0b93f1ea5ff6346aefc6073f0a33bcf384b0e069 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageSequence.py @@ -0,0 +1,88 @@ +# +# The Python Imaging Library. +# $Id$ +# +# sequence support classes +# +# history: +# 1997-02-20 fl Created +# +# Copyright (c) 1997 by Secret Labs AB. +# Copyright (c) 1997 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# + +## +from __future__ import annotations + +from . import Image + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + + +class Iterator: + """ + This class implements an iterator object that can be used to loop + over an image sequence. + + You can use the ``[]`` operator to access elements by index. This operator + will raise an :py:exc:`IndexError` if you try to access a nonexistent + frame. + + :param im: An image object. + """ + + def __init__(self, im: Image.Image) -> None: + if not hasattr(im, "seek"): + msg = "im must have seek method" + raise AttributeError(msg) + self.im = im + self.position = getattr(self.im, "_min_frame", 0) + + def __getitem__(self, ix: int) -> Image.Image: + try: + self.im.seek(ix) + return self.im + except EOFError as e: + msg = "end of sequence" + raise IndexError(msg) from e + + def __iter__(self) -> Iterator: + return self + + def __next__(self) -> Image.Image: + try: + self.im.seek(self.position) + self.position += 1 + return self.im + except EOFError as e: + msg = "end of sequence" + raise StopIteration(msg) from e + + +def all_frames( + im: Image.Image | list[Image.Image], + func: Callable[[Image.Image], Image.Image] | None = None, +) -> list[Image.Image]: + """ + Applies a given function to all frames in an image or a list of images. + The frames are returned as a list of separate images. + + :param im: An image, or a list of images. + :param func: The function to apply to all of the image frames. + :returns: A list of images. + """ + if not isinstance(im, list): + im = [im] + + ims = [] + for imSequence in im: + current = imSequence.tell() + + ims += [im_frame.copy() for im_frame in Iterator(imSequence)] + + imSequence.seek(current) + return [func(im) for im in ims] if func else ims diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageShow.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageShow.py new file mode 100644 index 0000000000000000000000000000000000000000..3b3a5080b20dbdbce9a4e64a1367919acfc93dc0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageShow.py @@ -0,0 +1,362 @@ +# +# The Python Imaging Library. +# $Id$ +# +# im.show() drivers +# +# History: +# 2008-04-06 fl Created +# +# Copyright (c) Secret Labs AB 2008. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import abc +import os +import shutil +import subprocess +import sys +from shlex import quote +from typing import Any + +from . import Image + +_viewers = [] + + +def register(viewer: type[Viewer] | Viewer, order: int = 1) -> None: + """ + The :py:func:`register` function is used to register additional viewers:: + + from PIL import ImageShow + ImageShow.register(MyViewer()) # MyViewer will be used as a last resort + ImageShow.register(MySecondViewer(), 0) # MySecondViewer will be prioritised + ImageShow.register(ImageShow.XVViewer(), 0) # XVViewer will be prioritised + + :param viewer: The viewer to be registered. + :param order: + Zero or a negative integer to prepend this viewer to the list, + a positive integer to append it. + """ + if isinstance(viewer, type) and issubclass(viewer, Viewer): + viewer = viewer() + if order > 0: + _viewers.append(viewer) + else: + _viewers.insert(0, viewer) + + +def show(image: Image.Image, title: str | None = None, **options: Any) -> bool: + r""" + Display a given image. + + :param image: An image object. + :param title: Optional title. Not all viewers can display the title. + :param \**options: Additional viewer options. + :returns: ``True`` if a suitable viewer was found, ``False`` otherwise. + """ + for viewer in _viewers: + if viewer.show(image, title=title, **options): + return True + return False + + +class Viewer: + """Base class for viewers.""" + + # main api + + def show(self, image: Image.Image, **options: Any) -> int: + """ + The main function for displaying an image. + Converts the given image to the target format and displays it. + """ + + if not ( + image.mode in ("1", "RGBA") + or (self.format == "PNG" and image.mode in ("I;16", "LA")) + ): + base = Image.getmodebase(image.mode) + if image.mode != base: + image = image.convert(base) + + return self.show_image(image, **options) + + # hook methods + + format: str | None = None + """The format to convert the image into.""" + options: dict[str, Any] = {} + """Additional options used to convert the image.""" + + def get_format(self, image: Image.Image) -> str | None: + """Return format name, or ``None`` to save as PGM/PPM.""" + return self.format + + def get_command(self, file: str, **options: Any) -> str: + """ + Returns the command used to display the file. + Not implemented in the base class. + """ + msg = "unavailable in base viewer" + raise NotImplementedError(msg) + + def save_image(self, image: Image.Image) -> str: + """Save to temporary file and return filename.""" + return image._dump(format=self.get_format(image), **self.options) + + def show_image(self, image: Image.Image, **options: Any) -> int: + """Display the given image.""" + return self.show_file(self.save_image(image), **options) + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + os.system(self.get_command(path, **options)) # nosec + return 1 + + +# -------------------------------------------------------------------- + + +class WindowsViewer(Viewer): + """The default viewer on Windows is the default system application for PNG files.""" + + format = "PNG" + options = {"compress_level": 1, "save_all": True} + + def get_command(self, file: str, **options: Any) -> str: + return ( + f'start "Pillow" /WAIT "{file}" ' + "&& ping -n 4 127.0.0.1 >NUL " + f'&& del /f "{file}"' + ) + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + subprocess.Popen( + self.get_command(path, **options), + shell=True, + creationflags=getattr(subprocess, "CREATE_NO_WINDOW"), + ) # nosec + return 1 + + +if sys.platform == "win32": + register(WindowsViewer) + + +class MacViewer(Viewer): + """The default viewer on macOS using ``Preview.app``.""" + + format = "PNG" + options = {"compress_level": 1, "save_all": True} + + def get_command(self, file: str, **options: Any) -> str: + # on darwin open returns immediately resulting in the temp + # file removal while app is opening + command = "open -a Preview.app" + command = f"({command} {quote(file)}; sleep 20; rm -f {quote(file)})&" + return command + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + subprocess.call(["open", "-a", "Preview.app", path]) + + pyinstaller = getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS") + executable = (not pyinstaller and sys.executable) or shutil.which("python3") + if executable: + subprocess.Popen( + [ + executable, + "-c", + "import os, sys, time; time.sleep(20); os.remove(sys.argv[1])", + path, + ] + ) + return 1 + + +if sys.platform == "darwin": + register(MacViewer) + + +class UnixViewer(abc.ABC, Viewer): + format = "PNG" + options = {"compress_level": 1, "save_all": True} + + @abc.abstractmethod + def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: + pass + + def get_command(self, file: str, **options: Any) -> str: + command = self.get_command_ex(file, **options)[0] + return f"{command} {quote(file)}" + + +class XDGViewer(UnixViewer): + """ + The freedesktop.org ``xdg-open`` command. + """ + + def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: + command = executable = "xdg-open" + return command, executable + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + subprocess.Popen(["xdg-open", path]) + return 1 + + +class DisplayViewer(UnixViewer): + """ + The ImageMagick ``display`` command. + This viewer supports the ``title`` parameter. + """ + + def get_command_ex( + self, file: str, title: str | None = None, **options: Any + ) -> tuple[str, str]: + command = executable = "display" + if title: + command += f" -title {quote(title)}" + return command, executable + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + args = ["display"] + title = options.get("title") + if title: + args += ["-title", title] + args.append(path) + + subprocess.Popen(args) + return 1 + + +class GmDisplayViewer(UnixViewer): + """The GraphicsMagick ``gm display`` command.""" + + def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: + executable = "gm" + command = "gm display" + return command, executable + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + subprocess.Popen(["gm", "display", path]) + return 1 + + +class EogViewer(UnixViewer): + """The GNOME Image Viewer ``eog`` command.""" + + def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: + executable = "eog" + command = "eog -n" + return command, executable + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + subprocess.Popen(["eog", "-n", path]) + return 1 + + +class XVViewer(UnixViewer): + """ + The X Viewer ``xv`` command. + This viewer supports the ``title`` parameter. + """ + + def get_command_ex( + self, file: str, title: str | None = None, **options: Any + ) -> tuple[str, str]: + # note: xv is pretty outdated. most modern systems have + # imagemagick's display command instead. + command = executable = "xv" + if title: + command += f" -name {quote(title)}" + return command, executable + + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + if not os.path.exists(path): + raise FileNotFoundError + args = ["xv"] + title = options.get("title") + if title: + args += ["-name", title] + args.append(path) + + subprocess.Popen(args) + return 1 + + +if sys.platform not in ("win32", "darwin"): # unixoids + if shutil.which("xdg-open"): + register(XDGViewer) + if shutil.which("display"): + register(DisplayViewer) + if shutil.which("gm"): + register(GmDisplayViewer) + if shutil.which("eog"): + register(EogViewer) + if shutil.which("xv"): + register(XVViewer) + + +class IPythonViewer(Viewer): + """The viewer for IPython frontends.""" + + def show_image(self, image: Image.Image, **options: Any) -> int: + ipython_display(image) + return 1 + + +try: + from IPython.display import display as ipython_display +except ImportError: + pass +else: + register(IPythonViewer) + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Syntax: python3 ImageShow.py imagefile [title]") + sys.exit() + + with Image.open(sys.argv[1]) as im: + print(show(im, *sys.argv[2:])) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageStat.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageStat.py new file mode 100644 index 0000000000000000000000000000000000000000..8f8e3026f0212c87b83fc6b538a5c07ceb01d258 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageStat.py @@ -0,0 +1,167 @@ +# +# The Python Imaging Library. +# $Id$ +# +# global image statistics +# +# History: +# 1996-04-05 fl Created +# 1997-05-21 fl Added mask; added rms, var, stddev attributes +# 1997-08-05 fl Added median +# 1998-07-05 hk Fixed integer overflow error +# +# Notes: +# This class shows how to implement delayed evaluation of attributes. +# To get a certain value, simply access the corresponding attribute. +# The __getattr__ dispatcher takes care of the rest. +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996-97. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import math +from functools import cached_property + +from . import Image + + +class Stat: + def __init__( + self, image_or_list: Image.Image | list[int], mask: Image.Image | None = None + ) -> None: + """ + Calculate statistics for the given image. If a mask is included, + only the regions covered by that mask are included in the + statistics. You can also pass in a previously calculated histogram. + + :param image: A PIL image, or a precalculated histogram. + + .. note:: + + For a PIL image, calculations rely on the + :py:meth:`~PIL.Image.Image.histogram` method. The pixel counts are + grouped into 256 bins, even if the image has more than 8 bits per + channel. So ``I`` and ``F`` mode images have a maximum ``mean``, + ``median`` and ``rms`` of 255, and cannot have an ``extrema`` maximum + of more than 255. + + :param mask: An optional mask. + """ + if isinstance(image_or_list, Image.Image): + self.h = image_or_list.histogram(mask) + elif isinstance(image_or_list, list): + self.h = image_or_list + else: + msg = "first argument must be image or list" # type: ignore[unreachable] + raise TypeError(msg) + self.bands = list(range(len(self.h) // 256)) + + @cached_property + def extrema(self) -> list[tuple[int, int]]: + """ + Min/max values for each band in the image. + + .. note:: + This relies on the :py:meth:`~PIL.Image.Image.histogram` method, and + simply returns the low and high bins used. This is correct for + images with 8 bits per channel, but fails for other modes such as + ``I`` or ``F``. Instead, use :py:meth:`~PIL.Image.Image.getextrema` to + return per-band extrema for the image. This is more correct and + efficient because, for non-8-bit modes, the histogram method uses + :py:meth:`~PIL.Image.Image.getextrema` to determine the bins used. + """ + + def minmax(histogram: list[int]) -> tuple[int, int]: + res_min, res_max = 255, 0 + for i in range(256): + if histogram[i]: + res_min = i + break + for i in range(255, -1, -1): + if histogram[i]: + res_max = i + break + return res_min, res_max + + return [minmax(self.h[i:]) for i in range(0, len(self.h), 256)] + + @cached_property + def count(self) -> list[int]: + """Total number of pixels for each band in the image.""" + return [sum(self.h[i : i + 256]) for i in range(0, len(self.h), 256)] + + @cached_property + def sum(self) -> list[float]: + """Sum of all pixels for each band in the image.""" + + v = [] + for i in range(0, len(self.h), 256): + layer_sum = 0.0 + for j in range(256): + layer_sum += j * self.h[i + j] + v.append(layer_sum) + return v + + @cached_property + def sum2(self) -> list[float]: + """Squared sum of all pixels for each band in the image.""" + + v = [] + for i in range(0, len(self.h), 256): + sum2 = 0.0 + for j in range(256): + sum2 += (j**2) * float(self.h[i + j]) + v.append(sum2) + return v + + @cached_property + def mean(self) -> list[float]: + """Average (arithmetic mean) pixel level for each band in the image.""" + return [self.sum[i] / self.count[i] if self.count[i] else 0 for i in self.bands] + + @cached_property + def median(self) -> list[int]: + """Median pixel level for each band in the image.""" + + v = [] + for i in self.bands: + s = 0 + half = self.count[i] // 2 + b = i * 256 + for j in range(256): + s = s + self.h[b + j] + if s > half: + break + v.append(j) + return v + + @cached_property + def rms(self) -> list[float]: + """RMS (root-mean-square) for each band in the image.""" + return [ + math.sqrt(self.sum2[i] / self.count[i]) if self.count[i] else 0 + for i in self.bands + ] + + @cached_property + def var(self) -> list[float]: + """Variance for each band in the image.""" + return [ + ( + (self.sum2[i] - (self.sum[i] ** 2.0) / self.count[i]) / self.count[i] + if self.count[i] + else 0 + ) + for i in self.bands + ] + + @cached_property + def stddev(self) -> list[float]: + """Standard deviation for each band in the image.""" + return [math.sqrt(self.var[i]) for i in self.bands] + + +Global = Stat # compatibility diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageText.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageText.py new file mode 100644 index 0000000000000000000000000000000000000000..f775bd0b617e50fe830008243deb434952c3d6be --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageText.py @@ -0,0 +1,508 @@ +from __future__ import annotations + +import math +import re +from typing import AnyStr, Generic, NamedTuple + +from . import ImageFont +from ._typing import _Ink + +Font = ImageFont.ImageFont | ImageFont.FreeTypeFont | ImageFont.TransposedFont + + +class _Line(NamedTuple): + x: float + y: float + anchor: str + text: str | bytes + + +class _Wrap(Generic[AnyStr]): + lines: list[AnyStr] = [] + position = 0 + offset = 0 + + def __init__( + self, + text: Text[AnyStr], + width: int, + height: int | None = None, + font: Font | None = None, + ) -> None: + self.text: Text[AnyStr] = text + self.width = width + self.height = height + self.font = font + + input_text = self.text.text + emptystring = "" if isinstance(input_text, str) else b"" + line = emptystring + + for word in re.findall( + r"\s*\S+" if isinstance(input_text, str) else rb"\s*\S+", input_text + ): + newlines = re.findall( + r"[^\S\n]*\n" if isinstance(input_text, str) else rb"[^\S\n]*\n", word + ) + if newlines: + if not self.add_line(line): + break + for i, line in enumerate(newlines): + if i != 0 and not self.add_line(emptystring): + break + self.position += len(line) + word = word[len(line) :] + line = emptystring + + new_line = line + word + if self.text._get_bbox(new_line, self.font)[2] <= width: + # This word fits on the line + line = new_line + continue + + # This word does not fit on the line + if line and not self.add_line(line): + break + + original_length = len(word) + word = word.lstrip() + self.offset = original_length - len(word) + + if self.text._get_bbox(word, self.font)[2] > width: + if font is None: + msg = "Word does not fit within line" + raise ValueError(msg) + break + line = word + else: + if line: + self.add_line(line) + self.remaining_text: AnyStr = input_text[self.position :] + + def add_line(self, line: AnyStr) -> bool: + lines = self.lines + [line] + if self.height is not None: + last_line_y = self.text._split(lines=lines)[-1].y + last_line_height = self.text._get_bbox(line, self.font)[3] + if last_line_y + last_line_height > self.height: + return False + + self.lines = lines + self.position += len(line) + self.offset + self.offset = 0 + return True + + +class Text(Generic[AnyStr]): + def __init__( + self, + text: AnyStr, + font: Font | None = None, + mode: str = "RGB", + spacing: float = 4, + direction: str | None = None, + features: list[str] | None = None, + language: str | None = None, + ) -> None: + """ + :param text: String to be drawn. + :param font: Either an :py:class:`~PIL.ImageFont.ImageFont` instance, + :py:class:`~PIL.ImageFont.FreeTypeFont` instance, + :py:class:`~PIL.ImageFont.TransposedFont` instance or ``None``. If + ``None``, the default font from :py:meth:`.ImageFont.load_default` + will be used. + :param mode: The image mode this will be used with. + :param spacing: The number of pixels between lines. + :param direction: Direction of the text. It can be ``"rtl"`` (right to left), + ``"ltr"`` (left to right) or ``"ttb"`` (top to bottom). + Requires libraqm. + :param features: A list of OpenType font features to be used during text + layout. This is usually used to turn on optional font features + that are not enabled by default, for example ``"dlig"`` or + ``"ss01"``, but can be also used to turn off default font + features, for example ``"-liga"`` to disable ligatures or + ``"-kern"`` to disable kerning. To get all supported + features, see `OpenType docs`_. + Requires libraqm. + :param language: Language of the text. Different languages may use + different glyph shapes or ligatures. This parameter tells + the font which language the text is in, and to apply the + correct substitutions as appropriate, if available. + It should be a `BCP 47 language code`_. + Requires libraqm. + """ + self.text: AnyStr = text + self.font = font or ImageFont.load_default() + + self.mode = mode + self.spacing = spacing + self.direction = direction + self.features = features + self.language = language + + self.embedded_color = False + + self.stroke_width: float = 0 + self.stroke_fill: _Ink | None = None + + def embed_color(self) -> None: + """ + Use embedded color glyphs (COLR, CBDT, SBIX). + """ + if self.mode not in ("RGB", "RGBA"): + msg = "Embedded color supported only in RGB and RGBA modes" + raise ValueError(msg) + self.embedded_color = True + + def stroke(self, width: float = 0, fill: _Ink | None = None) -> None: + """ + :param width: The width of the text stroke. + :param fill: Color to use for the text stroke when drawing. If not given, will + default to the ``fill`` parameter from + :py:meth:`.ImageDraw.ImageDraw.text`. + """ + self.stroke_width = width + self.stroke_fill = fill + + def _get_fontmode(self) -> str: + if self.mode in ("1", "P", "I", "F"): + return "1" + elif self.embedded_color: + return "RGBA" + else: + return "L" + + def wrap( + self, + width: int, + height: int | None = None, + scaling: str | tuple[str, int] | None = None, + ) -> Text[AnyStr] | None: + """ + Wrap text to fit within a given width. + + :param width: The width to fit within. + :param height: An optional height limit. Any text that does not fit within this + will be returned as a new :py:class:`.Text` object. + :param scaling: An optional directive to scale the text, either "grow" as much + as possible within the given dimensions, or "shrink" until it + fits. It can also be a tuple of (direction, limit), with an + integer limit to stop scaling at. + + :returns: An :py:class:`.Text` object, or None. + """ + if isinstance(self.font, ImageFont.TransposedFont): + msg = "TransposedFont not supported" + raise ValueError(msg) + if self.direction not in (None, "ltr"): + msg = "Only ltr direction supported" + raise ValueError(msg) + + if scaling is None: + wrap = _Wrap(self, width, height) + else: + if not isinstance(self.font, ImageFont.FreeTypeFont): + msg = "'scaling' only supports FreeTypeFont" + raise ValueError(msg) + if height is None: + msg = "'scaling' requires 'height'" + raise ValueError(msg) + + if isinstance(scaling, str): + limit = 1 + else: + scaling, limit = scaling + + font = self.font + wrap = _Wrap(self, width, height, font) + if scaling == "shrink": + if not wrap.remaining_text: + return None + + size = math.ceil(font.size) + while wrap.remaining_text: + if size == max(limit, 1): + msg = "Text could not be scaled" + raise ValueError(msg) + size -= 1 + font = self.font.font_variant(size=size) + wrap = _Wrap(self, width, height, font) + self.font = font + else: + if wrap.remaining_text: + msg = "Text could not be scaled" + raise ValueError(msg) + + size = math.floor(font.size) + while not wrap.remaining_text: + if size == limit: + msg = "Text could not be scaled" + raise ValueError(msg) + size += 1 + font = self.font.font_variant(size=size) + last_wrap = wrap + wrap = _Wrap(self, width, height, font) + size -= 1 + if size != self.font.size: + self.font = self.font.font_variant(size=size) + wrap = last_wrap + + if wrap.remaining_text: + text = Text( + text=wrap.remaining_text, + font=self.font, + mode=self.mode, + spacing=self.spacing, + direction=self.direction, + features=self.features, + language=self.language, + ) + text.embedded_color = self.embedded_color + text.stroke_width = self.stroke_width + text.stroke_fill = self.stroke_fill + else: + text = None + + newline = "\n" if isinstance(self.text, str) else b"\n" + self.text = newline.join(wrap.lines) + return text + + def get_length(self) -> float: + """ + Returns length (in pixels with 1/64 precision) of text. + + This is the amount by which following text should be offset. + Text bounding box may extend past the length in some fonts, + e.g. when using italics or accents. + + The result is returned as a float; it is a whole number if using basic layout. + + Note that the sum of two lengths may not equal the length of a concatenated + string due to kerning. If you need to adjust for kerning, include the following + character and subtract its length. + + For example, instead of:: + + hello = ImageText.Text("Hello", font).get_length() + world = ImageText.Text("World", font).get_length() + helloworld = ImageText.Text("HelloWorld", font).get_length() + assert hello + world == helloworld + + use:: + + hello = ( + ImageText.Text("HelloW", font).get_length() - + ImageText.Text("W", font).get_length() + ) # adjusted for kerning + world = ImageText.Text("World", font).get_length() + helloworld = ImageText.Text("HelloWorld", font).get_length() + assert hello + world == helloworld + + or disable kerning with (requires libraqm):: + + hello = ImageText.Text("Hello", font, features=["-kern"]).get_length() + world = ImageText.Text("World", font, features=["-kern"]).get_length() + helloworld = ImageText.Text( + "HelloWorld", font, features=["-kern"] + ).get_length() + assert hello + world == helloworld + + :return: Either width for horizontal text, or height for vertical text. + """ + if isinstance(self.text, str): + multiline = "\n" in self.text + else: + multiline = b"\n" in self.text + if multiline: + msg = "can't measure length of multiline text" + raise ValueError(msg) + return self.font.getlength( + self.text, + self._get_fontmode(), + self.direction, + self.features, + self.language, + ) + + def _split( + self, + xy: tuple[float, float] = (0, 0), + anchor: str | None = None, + align: str = "left", + lines: list[str] | list[bytes] | None = None, + ) -> list[_Line]: + if anchor is None: + anchor = "lt" if self.direction == "ttb" else "la" + elif len(anchor) != 2: + msg = "anchor must be a 2 character string" + raise ValueError(msg) + + if lines is None: + lines = ( + self.text.split("\n") + if isinstance(self.text, str) + else self.text.split(b"\n") + ) + if len(lines) == 1: + return [_Line(xy[0], xy[1], anchor, lines[0])] + + if anchor[1] in "tb" and self.direction != "ttb": + msg = "anchor not supported for multiline text" + raise ValueError(msg) + + fontmode = self._get_fontmode() + line_spacing = ( + self.font.getbbox( + "A", + fontmode, + None, + self.features, + self.language, + self.stroke_width, + )[3] + + self.stroke_width + + self.spacing + ) + + top = xy[1] + parts = [] + if self.direction == "ttb": + left = xy[0] + for line in lines: + parts.append(_Line(left, top, anchor, line)) + left += line_spacing + else: + widths = [] + max_width: float = 0 + for line in lines: + line_width = self.font.getlength( + line, fontmode, self.direction, self.features, self.language + ) + widths.append(line_width) + max_width = max(max_width, line_width) + + if anchor[1] == "m": + top -= (len(lines) - 1) * line_spacing / 2.0 + elif anchor[1] == "d": + top -= (len(lines) - 1) * line_spacing + + idx = -1 + for line in lines: + left = xy[0] + idx += 1 + width_difference = max_width - widths[idx] + + # align by align parameter + if align in ("left", "justify"): + pass + elif align == "center": + left += width_difference / 2.0 + elif align == "right": + left += width_difference + else: + msg = 'align must be "left", "center", "right" or "justify"' + raise ValueError(msg) + + if ( + align == "justify" + and width_difference != 0 + and idx != len(lines) - 1 + ): + words = ( + line.split(" ") if isinstance(line, str) else line.split(b" ") + ) + if len(words) > 1: + # align left by anchor + if anchor[0] == "m": + left -= max_width / 2.0 + elif anchor[0] == "r": + left -= max_width + + word_widths = [ + self.font.getlength( + word, + fontmode, + self.direction, + self.features, + self.language, + ) + for word in words + ] + word_anchor = "l" + anchor[1] + width_difference = max_width - sum(word_widths) + i = 0 + for word in words: + parts.append(_Line(left, top, word_anchor, word)) + left += word_widths[i] + width_difference / (len(words) - 1) + i += 1 + top += line_spacing + continue + + # align left by anchor + if anchor[0] == "m": + left -= width_difference / 2.0 + elif anchor[0] == "r": + left -= width_difference + parts.append(_Line(left, top, anchor, line)) + top += line_spacing + + return parts + + def _get_bbox( + self, text: str | bytes, font: Font | None = None, anchor: str | None = None + ) -> tuple[float, float, float, float]: + return (font or self.font).getbbox( + text, + self._get_fontmode(), + self.direction, + self.features, + self.language, + self.stroke_width, + anchor, + ) + + def get_bbox( + self, + xy: tuple[float, float] = (0, 0), + anchor: str | None = None, + align: str = "left", + ) -> tuple[float, float, float, float]: + """ + Returns bounding box (in pixels) of text. + + Use :py:meth:`get_length` to get the offset of following text with 1/64 pixel + precision. The bounding box includes extra margins for some fonts, e.g. italics + or accents. + + :param xy: The anchor coordinates of the text. + :param anchor: The text anchor alignment. Determines the relative location of + the anchor to the text. The default alignment is top left, + specifically ``la`` for horizontal text and ``lt`` for + vertical text. See :ref:`text-anchors` for details. + :param align: For multiline text, ``"left"``, ``"center"``, ``"right"`` or + ``"justify"`` determines the relative alignment of lines. Use the + ``anchor`` parameter to specify the alignment to ``xy``. + + :return: ``(left, top, right, bottom)`` bounding box + """ + bbox: tuple[float, float, float, float] | None = None + for x, y, anchor, text in self._split(xy, anchor, align): + bbox_line = self._get_bbox(text, anchor=anchor) + bbox_line = ( + bbox_line[0] + x, + bbox_line[1] + y, + bbox_line[2] + x, + bbox_line[3] + y, + ) + if bbox is None: + bbox = bbox_line + else: + bbox = ( + min(bbox[0], bbox_line[0]), + min(bbox[1], bbox_line[1]), + max(bbox[2], bbox_line[2]), + max(bbox[3], bbox_line[3]), + ) + + assert bbox is not None + return bbox diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageTk.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageTk.py new file mode 100644 index 0000000000000000000000000000000000000000..0400e0057e721b55867ad0831bf46cd06808c4dc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageTk.py @@ -0,0 +1,266 @@ +# +# The Python Imaging Library. +# $Id$ +# +# a Tk display interface +# +# History: +# 96-04-08 fl Created +# 96-09-06 fl Added getimage method +# 96-11-01 fl Rewritten, removed image attribute and crop method +# 97-05-09 fl Use PyImagingPaste method instead of image type +# 97-05-12 fl Minor tweaks to match the IFUNC95 interface +# 97-05-17 fl Support the "pilbitmap" booster patch +# 97-06-05 fl Added file= and data= argument to image constructors +# 98-03-09 fl Added width and height methods to Image classes +# 98-07-02 fl Use default mode for "P" images without palette attribute +# 98-07-02 fl Explicitly destroy Tkinter image objects +# 99-07-24 fl Support multiple Tk interpreters (from Greg Couch) +# 99-07-26 fl Automatically hook into Tkinter (if possible) +# 99-08-15 fl Hook uses _imagingtk instead of _imaging +# +# Copyright (c) 1997-1999 by Secret Labs AB +# Copyright (c) 1996-1997 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import tkinter +from io import BytesIO +from typing import Any + +from . import Image, ImageFile + +TYPE_CHECKING = False +if TYPE_CHECKING: + from ._typing import CapsuleType + +# -------------------------------------------------------------------- +# Check for Tkinter interface hooks + + +def _get_image_from_kw(kw: dict[str, Any]) -> ImageFile.ImageFile | None: + source = None + if "file" in kw: + source = kw.pop("file") + elif "data" in kw: + source = BytesIO(kw.pop("data")) + if not source: + return None + return Image.open(source) + + +def _pyimagingtkcall( + command: str, photo: PhotoImage | tkinter.PhotoImage, ptr: CapsuleType +) -> None: + tk = photo.tk + try: + tk.call(command, photo, repr(ptr)) + except tkinter.TclError: + # activate Tkinter hook + # may raise an error if it cannot attach to Tkinter + from . import _imagingtk + + _imagingtk.tkinit(tk.interpaddr()) + tk.call(command, photo, repr(ptr)) + + +# -------------------------------------------------------------------- +# PhotoImage + + +class PhotoImage: + """ + A Tkinter-compatible photo image. This can be used + everywhere Tkinter expects an image object. If the image is an RGBA + image, pixels having alpha 0 are treated as transparent. + + The constructor takes either a PIL image, or a mode and a size. + Alternatively, you can use the ``file`` or ``data`` options to initialize + the photo image object. + + :param image: Either a PIL image, or a mode string. If a mode string is + used, a size must also be given. + :param size: If the first argument is a mode string, this defines the size + of the image. + :keyword file: A filename to load the image from (using + ``Image.open(file)``). + :keyword data: An 8-bit string containing image data (as loaded from an + image file). + """ + + def __init__( + self, + image: Image.Image | str | None = None, + size: tuple[int, int] | None = None, + **kw: Any, + ) -> None: + # Tk compatibility: file or data + if image is None: + image = _get_image_from_kw(kw) + + if image is None: + msg = "Image is required" + raise ValueError(msg) + elif isinstance(image, str): + mode = image + image = None + + if size is None: + msg = "If first argument is mode, size is required" + raise ValueError(msg) + else: + # got an image instead of a mode + mode = image.mode + if mode == "P": + # palette mapped data + image.apply_transparency() + image.load() + mode = image.palette.mode if image.palette else "RGB" + size = image.size + kw["width"], kw["height"] = size + + if mode not in ["1", "L", "RGB", "RGBA"]: + mode = Image.getmodebase(mode) + + self.__mode = mode + self.__size = size + self.__photo = tkinter.PhotoImage(**kw) + self.tk = self.__photo.tk + if image: + self.paste(image) + + def __del__(self) -> None: + try: + name = self.__photo.name + except AttributeError: + return + self.__photo.name = None + try: + self.__photo.tk.call("image", "delete", name) + except Exception: + pass # ignore internal errors + + def __str__(self) -> str: + """ + Get the Tkinter photo image identifier. This method is automatically + called by Tkinter whenever a PhotoImage object is passed to a Tkinter + method. + + :return: A Tkinter photo image identifier (a string). + """ + return str(self.__photo) + + def width(self) -> int: + """ + Get the width of the image. + + :return: The width, in pixels. + """ + return self.__size[0] + + def height(self) -> int: + """ + Get the height of the image. + + :return: The height, in pixels. + """ + return self.__size[1] + + def paste(self, im: Image.Image) -> None: + """ + Paste a PIL image into the photo image. Note that this can + be very slow if the photo image is displayed. + + :param im: A PIL image. The size must match the target region. If the + mode does not match, the image is converted to the mode of + the bitmap image. + """ + # convert to blittable + ptr = im.getim() + image = im.im + if not image.isblock() or im.mode != self.__mode: + block = Image.core.new_block(self.__mode, im.size) + image.convert2(block, image) # convert directly between buffers + ptr = block.ptr + + _pyimagingtkcall("PyImagingPhoto", self.__photo, ptr) + + +# -------------------------------------------------------------------- +# BitmapImage + + +class BitmapImage: + """ + A Tkinter-compatible bitmap image. This can be used everywhere Tkinter + expects an image object. + + The given image must have mode "1". Pixels having value 0 are treated as + transparent. Options, if any, are passed on to Tkinter. The most commonly + used option is ``foreground``, which is used to specify the color for the + non-transparent parts. See the Tkinter documentation for information on + how to specify colours. + + :param image: A PIL image. + """ + + def __init__(self, image: Image.Image | None = None, **kw: Any) -> None: + # Tk compatibility: file or data + if image is None: + image = _get_image_from_kw(kw) + + if image is None: + msg = "Image is required" + raise ValueError(msg) + self.__mode = image.mode + self.__size = image.size + + self.__photo = tkinter.BitmapImage(data=image.tobitmap(), **kw) + + def __del__(self) -> None: + try: + name = self.__photo.name + except AttributeError: + return + self.__photo.name = None + try: + self.__photo.tk.call("image", "delete", name) + except Exception: + pass # ignore internal errors + + def width(self) -> int: + """ + Get the width of the image. + + :return: The width, in pixels. + """ + return self.__size[0] + + def height(self) -> int: + """ + Get the height of the image. + + :return: The height, in pixels. + """ + return self.__size[1] + + def __str__(self) -> str: + """ + Get the Tkinter bitmap image identifier. This method is automatically + called by Tkinter whenever a BitmapImage object is passed to a Tkinter + method. + + :return: A Tkinter bitmap image identifier (a string). + """ + return str(self.__photo) + + +def getimage(photo: PhotoImage) -> Image.Image: + """Copies the contents of a PhotoImage to a PIL image memory.""" + im = Image.new("RGBA", (photo.width(), photo.height())) + + _pyimagingtkcall("PyImagingPhotoGet", photo, im.getim()) + + return im diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageTransform.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageTransform.py new file mode 100644 index 0000000000000000000000000000000000000000..752232b4e090b6f2b56b92ea7a01acff936ff288 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageTransform.py @@ -0,0 +1,136 @@ +# +# The Python Imaging Library. +# $Id$ +# +# transform wrappers +# +# History: +# 2002-04-08 fl Created +# +# Copyright (c) 2002 by Secret Labs AB +# Copyright (c) 2002 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from collections.abc import Sequence +from typing import Any + +from . import Image + + +class Transform(Image.ImageTransformHandler): + """Base class for other transforms defined in :py:mod:`~PIL.ImageTransform`.""" + + method: Image.Transform + + def __init__(self, data: Sequence[Any]) -> None: + self.data = data + + def getdata(self) -> tuple[Image.Transform, Sequence[int]]: + return self.method, self.data + + def transform( + self, + size: tuple[int, int], + image: Image.Image, + **options: Any, + ) -> Image.Image: + """Perform the transform. Called from :py:meth:`.Image.transform`.""" + # can be overridden + method, data = self.getdata() + return image.transform(size, method, data, **options) + + +class AffineTransform(Transform): + """ + Define an affine image transform. + + This function takes a 6-tuple (a, b, c, d, e, f) which contain the first + two rows from the inverse of an affine transform matrix. For each pixel + (x, y) in the output image, the new value is taken from a position (a x + + b y + c, d x + e y + f) in the input image, rounded to nearest pixel. + + This function can be used to scale, translate, rotate, and shear the + original image. + + See :py:meth:`.Image.transform` + + :param matrix: A 6-tuple (a, b, c, d, e, f) containing the first two rows + from the inverse of an affine transform matrix. + """ + + method = Image.Transform.AFFINE + + +class PerspectiveTransform(Transform): + """ + Define a perspective image transform. + + This function takes an 8-tuple (a, b, c, d, e, f, g, h). For each pixel + (x, y) in the output image, the new value is taken from a position + ((a x + b y + c) / (g x + h y + 1), (d x + e y + f) / (g x + h y + 1)) in + the input image, rounded to nearest pixel. + + This function can be used to scale, translate, rotate, and shear the + original image. + + See :py:meth:`.Image.transform` + + :param matrix: An 8-tuple (a, b, c, d, e, f, g, h). + """ + + method = Image.Transform.PERSPECTIVE + + +class ExtentTransform(Transform): + """ + Define a transform to extract a subregion from an image. + + Maps a rectangle (defined by two corners) from the image to a rectangle of + the given size. The resulting image will contain data sampled from between + the corners, such that (x0, y0) in the input image will end up at (0,0) in + the output image, and (x1, y1) at size. + + This method can be used to crop, stretch, shrink, or mirror an arbitrary + rectangle in the current image. It is slightly slower than crop, but about + as fast as a corresponding resize operation. + + See :py:meth:`.Image.transform` + + :param bbox: A 4-tuple (x0, y0, x1, y1) which specifies two points in the + input image's coordinate system. See :ref:`coordinate-system`. + """ + + method = Image.Transform.EXTENT + + +class QuadTransform(Transform): + """ + Define a quad image transform. + + Maps a quadrilateral (a region defined by four corners) from the image to a + rectangle of the given size. + + See :py:meth:`.Image.transform` + + :param xy: An 8-tuple (x0, y0, x1, y1, x2, y2, x3, y3) which contain the + upper left, lower left, lower right, and upper right corner of the + source quadrilateral. + """ + + method = Image.Transform.QUAD + + +class MeshTransform(Transform): + """ + Define a mesh image transform. A mesh transform consists of one or more + individual quad transforms. + + See :py:meth:`.Image.transform` + + :param data: A list of (bbox, quad) tuples. + """ + + method = Image.Transform.MESH diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageWin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageWin.py new file mode 100644 index 0000000000000000000000000000000000000000..383a6e8f59150246b66b47847d9a1b3b4f8a1077 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImageWin.py @@ -0,0 +1,247 @@ +# +# The Python Imaging Library. +# $Id$ +# +# a Windows DIB display interface +# +# History: +# 1996-05-20 fl Created +# 1996-09-20 fl Fixed subregion exposure +# 1997-09-21 fl Added draw primitive (for tzPrint) +# 2003-05-21 fl Added experimental Window/ImageWindow classes +# 2003-09-05 fl Added fromstring/tostring methods +# +# Copyright (c) Secret Labs AB 1997-2003. +# Copyright (c) Fredrik Lundh 1996-2003. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image + + +class HDC: + """ + Wraps an HDC integer. The resulting object can be passed to the + :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose` + methods. + """ + + def __init__(self, dc: int) -> None: + self.dc = dc + + def __int__(self) -> int: + return self.dc + + +class HWND: + """ + Wraps an HWND integer. The resulting object can be passed to the + :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose` + methods, instead of a DC. + """ + + def __init__(self, wnd: int) -> None: + self.wnd = wnd + + def __int__(self) -> int: + return self.wnd + + +class Dib: + """ + A Windows bitmap with the given mode and size. The mode can be one of "1", + "L", "P", or "RGB". + + If the display requires a palette, this constructor creates a suitable + palette and associates it with the image. For an "L" image, 128 graylevels + are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together + with 20 graylevels. + + To make sure that palettes work properly under Windows, you must call the + ``palette`` method upon certain events from Windows. + + :param image: Either a PIL image, or a mode string. If a mode string is + used, a size must also be given. The mode can be one of "1", + "L", "P", or "RGB". + :param size: If the first argument is a mode string, this + defines the size of the image. + """ + + def __init__( + self, image: Image.Image | str, size: tuple[int, int] | None = None + ) -> None: + if isinstance(image, str): + mode = image + image = "" + if size is None: + msg = "If first argument is mode, size is required" + raise ValueError(msg) + else: + mode = image.mode + size = image.size + if mode not in ["1", "L", "P", "RGB"]: + mode = Image.getmodebase(mode) + self.image = Image.core.display(mode, size) + self.mode = mode + self.size = size + if image: + assert not isinstance(image, str) + self.paste(image) + + def expose(self, handle: int | HDC | HWND) -> None: + """ + Copy the bitmap contents to a device context. + + :param handle: Device context (HDC), cast to a Python integer, or an + HDC or HWND instance. In PythonWin, you can use + ``CDC.GetHandleAttrib()`` to get a suitable handle. + """ + handle_int = int(handle) + if isinstance(handle, HWND): + dc = self.image.getdc(handle_int) + try: + self.image.expose(dc) + finally: + self.image.releasedc(handle_int, dc) + else: + self.image.expose(handle_int) + + def draw( + self, + handle: int | HDC | HWND, + dst: tuple[int, int, int, int], + src: tuple[int, int, int, int] | None = None, + ) -> None: + """ + Same as expose, but allows you to specify where to draw the image, and + what part of it to draw. + + The destination and source areas are given as 4-tuple rectangles. If + the source is omitted, the entire image is copied. If the source and + the destination have different sizes, the image is resized as + necessary. + """ + if src is None: + src = (0, 0) + self.size + handle_int = int(handle) + if isinstance(handle, HWND): + dc = self.image.getdc(handle_int) + try: + self.image.draw(dc, dst, src) + finally: + self.image.releasedc(handle_int, dc) + else: + self.image.draw(handle_int, dst, src) + + def query_palette(self, handle: int | HDC | HWND) -> int: + """ + Installs the palette associated with the image in the given device + context. + + This method should be called upon **QUERYNEWPALETTE** and + **PALETTECHANGED** events from Windows. If this method returns a + non-zero value, one or more display palette entries were changed, and + the image should be redrawn. + + :param handle: Device context (HDC), cast to a Python integer, or an + HDC or HWND instance. + :return: The number of entries that were changed (if one or more entries, + this indicates that the image should be redrawn). + """ + handle_int = int(handle) + if isinstance(handle, HWND): + handle = self.image.getdc(handle_int) + try: + result = self.image.query_palette(handle) + finally: + self.image.releasedc(handle, handle) + else: + result = self.image.query_palette(handle_int) + return result + + def paste( + self, im: Image.Image, box: tuple[int, int, int, int] | None = None + ) -> None: + """ + Paste a PIL image into the bitmap image. + + :param im: A PIL image. The size must match the target region. + If the mode does not match, the image is converted to the + mode of the bitmap image. + :param box: A 4-tuple defining the left, upper, right, and + lower pixel coordinate. See :ref:`coordinate-system`. If + None is given instead of a tuple, all of the image is + assumed. + """ + im.load() + if self.mode != im.mode: + im = im.convert(self.mode) + if box: + self.image.paste(im.im, box) + else: + self.image.paste(im.im) + + def frombytes(self, buffer: bytes) -> None: + """ + Load display memory contents from byte data. + + :param buffer: A buffer containing display data (usually + data returned from :py:func:`~PIL.ImageWin.Dib.tobytes`) + """ + self.image.frombytes(buffer) + + def tobytes(self) -> bytes: + """ + Copy display memory contents to bytes object. + + :return: A bytes object containing display data. + """ + return self.image.tobytes() + + +class Window: + """Create a Window with the given title size.""" + + def __init__( + self, title: str = "PIL", width: int | None = None, height: int | None = None + ) -> None: + self.hwnd = Image.core.createwindow( + title, self.__dispatcher, width or 0, height or 0 + ) + + def __dispatcher(self, action: str, *args: int) -> None: + getattr(self, f"ui_handle_{action}")(*args) + + def ui_handle_clear(self, dc: int, x0: int, y0: int, x1: int, y1: int) -> None: + pass + + def ui_handle_damage(self, x0: int, y0: int, x1: int, y1: int) -> None: + pass + + def ui_handle_destroy(self) -> None: + pass + + def ui_handle_repair(self, dc: int, x0: int, y0: int, x1: int, y1: int) -> None: + pass + + def ui_handle_resize(self, width: int, height: int) -> None: + pass + + def mainloop(self) -> None: + Image.core.eventloop() + + +class ImageWindow(Window): + """Create an image window which displays the given image.""" + + def __init__(self, image: Image.Image | Dib, title: str = "PIL") -> None: + if not isinstance(image, Dib): + image = Dib(image) + self.image = image + width, height = image.size + super().__init__(title, width=width, height=height) + + def ui_handle_repair(self, dc: int, x0: int, y0: int, x1: int, y1: int) -> None: + self.image.draw(dc, (x0, y0, x1, y1)) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImtImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImtImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..151bb4ea1df87f3daecfcd7004728755cb6d84f7 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/ImtImagePlugin.py @@ -0,0 +1,103 @@ +# +# The Python Imaging Library. +# $Id$ +# +# IM Tools support for PIL +# +# history: +# 1996-05-27 fl Created (read 8-bit images only) +# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.2) +# +# Copyright (c) Secret Labs AB 1997-2001. +# Copyright (c) Fredrik Lundh 1996-2001. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import re + +from . import Image, ImageFile + +# +# -------------------------------------------------------------------- + +field = re.compile(rb"([a-z]*) ([^ \r\n]*)") + + +## +# Image plugin for IM Tools images. + + +class ImtImageFile(ImageFile.ImageFile): + format = "IMT" + format_description = "IM Tools" + + def _open(self) -> None: + # Quick rejection: if there's not a LF among the first + # 100 bytes, this is (probably) not a text header. + + assert self.fp is not None + + buffer = self.fp.read(100) + if b"\n" not in buffer: + msg = "not an IM file" + raise SyntaxError(msg) + + xsize = ysize = 0 + + while True: + if buffer: + s = buffer[:1] + buffer = buffer[1:] + else: + s = self.fp.read(1) + if not s: + break + + if s == b"\x0c": + # image data begins + self.tile = [ + ImageFile._Tile( + "raw", + (0, 0) + self.size, + self.fp.tell() - len(buffer), + self.mode, + ) + ] + + break + + else: + # read key/value pair + if b"\n" not in buffer: + buffer += self.fp.read(100) + lines = buffer.split(b"\n") + s += lines.pop(0) + buffer = b"\n".join(lines) + if len(s) == 1 or len(s) > 100: + break + if s[0] == ord(b"*"): + continue # comment + + m = field.match(s) + if not m: + break + k, v = m.group(1, 2) + if k == b"width": + xsize = int(v) + self._size = xsize, ysize + elif k == b"height": + ysize = int(v) + self._size = xsize, ysize + elif k == b"pixel" and v == b"n8": + self._mode = "L" + + +# +# -------------------------------------------------------------------- + +Image.register_open(ImtImageFile.format, ImtImageFile) + +# +# no extension registered (".im" is simply too common) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IptcImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IptcImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..f5698277d04742d0ffe22e814bec9fd01352e5bb --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/IptcImagePlugin.py @@ -0,0 +1,226 @@ +# +# The Python Imaging Library. +# $Id$ +# +# IPTC/NAA file handling +# +# history: +# 1995-10-01 fl Created +# 1998-03-09 fl Cleaned up and added to PIL +# 2002-06-18 fl Added getiptcinfo helper +# +# Copyright (c) Secret Labs AB 1997-2002. +# Copyright (c) Fredrik Lundh 1995. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from io import BytesIO +from typing import cast + +from . import Image, ImageFile +from ._binary import i16be as i16 +from ._binary import i32be as i32 + +COMPRESSION = {1: "raw", 5: "jpeg"} + + +# +# Helpers + + +def _i(c: bytes) -> int: + return i32((b"\0\0\0\0" + c)[-4:]) + + +## +# Image plugin for IPTC/NAA datastreams. To read IPTC/NAA fields +# from TIFF and JPEG files, use the getiptcinfo function. + + +class IptcImageFile(ImageFile.ImageFile): + format = "IPTC" + format_description = "IPTC/NAA" + + def getint(self, key: tuple[int, int]) -> int: + return _i(self.info[key]) + + def field(self) -> tuple[tuple[int, int] | None, int]: + # + # get a IPTC field header + assert self.fp is not None + s = self.fp.read(5) + if not s.strip(b"\x00"): + return None, 0 + + tag = s[1], s[2] + + # syntax + if s[0] != 0x1C or tag[0] not in [1, 2, 3, 4, 5, 6, 7, 8, 9, 240]: + msg = "invalid IPTC/NAA file" + raise SyntaxError(msg) + + # field size + size = s[3] + if size > 132: + msg = "illegal field length in IPTC/NAA file" + raise OSError(msg) + elif size == 128: + size = 0 + elif size > 128: + size = _i(self.fp.read(size - 128)) + else: + size = i16(s, 3) + + return tag, size + + def _open(self) -> None: + # load descriptive fields + assert self.fp is not None + while True: + offset = self.fp.tell() + tag, size = self.field() + if not tag or tag == (8, 10): + break + if size: + tagdata = self.fp.read(size) + else: + tagdata = None + if tag in self.info: + if isinstance(self.info[tag], list): + self.info[tag].append(tagdata) + else: + self.info[tag] = [self.info[tag], tagdata] + else: + self.info[tag] = tagdata + + # mode + layers = self.info[(3, 60)][0] + component = self.info[(3, 60)][1] + if layers == 1 and not component: + self._mode = "L" + band = None + else: + if layers == 3 and component: + self._mode = "RGB" + elif layers == 4 and component: + self._mode = "CMYK" + if (3, 65) in self.info: + band = self.info[(3, 65)][0] - 1 + else: + band = 0 + + # size + self._size = self.getint((3, 20)), self.getint((3, 30)) + + # compression + try: + compression = COMPRESSION[self.getint((3, 120))] + except KeyError as e: + msg = "Unknown IPTC image compression" + raise OSError(msg) from e + + # tile + if tag == (8, 10): + self.tile = [ + ImageFile._Tile("iptc", (0, 0) + self.size, offset, (compression, band)) + ] + + def load(self) -> Image.core.PixelAccess | None: + if self.tile: + args = self.tile[0].args + assert isinstance(args, tuple) + compression, band = args + + assert self.fp is not None + self.fp.seek(self.tile[0].offset) + + # Copy image data to temporary file + o = BytesIO() + if compression == "raw": + # To simplify access to the extracted file, + # prepend a PPM header + o.write(b"P5\n%d %d\n255\n" % self.size) + while True: + type, size = self.field() + if type != (8, 10): + break + while size > 0: + s = self.fp.read(min(size, 8192)) + if not s: + break + o.write(s) + size -= len(s) + + with Image.open(o) as _im: + if band is not None: + bands = [Image.new("L", _im.size)] * Image.getmodebands(self.mode) + bands[band] = _im + im = Image.merge(self.mode, bands) + else: + im = _im + im.load() + self.im = im.im + self.tile = [] + return ImageFile.ImageFile.load(self) + + +Image.register_open(IptcImageFile.format, IptcImageFile) + +Image.register_extension(IptcImageFile.format, ".iim") + + +def getiptcinfo( + im: ImageFile.ImageFile, +) -> dict[tuple[int, int], bytes | list[bytes]] | None: + """ + Get IPTC information from TIFF, JPEG, or IPTC file. + + :param im: An image containing IPTC data. + :returns: A dictionary containing IPTC information, or None if + no IPTC information block was found. + """ + from . import JpegImagePlugin, TiffImagePlugin + + data = None + + if isinstance(im, IptcImageFile): + # return info dictionary right away + return {k: v for k, v in im.info.items() if isinstance(k, tuple)} + + elif isinstance(im, JpegImagePlugin.JpegImageFile): + # extract the IPTC/NAA resource + photoshop = im.info.get("photoshop") + if photoshop: + data = photoshop.get(0x0404) + + elif isinstance(im, TiffImagePlugin.TiffImageFile): + # get raw data from the IPTC/NAA tag (PhotoShop tags the data + # as 4-byte integers, so we cannot use the get method...) + try: + data = im.tag_v2._tagdata[TiffImagePlugin.IPTC_NAA_CHUNK] + except KeyError: + pass + + if data is None: + return None # no properties + + # create an IptcImagePlugin object without initializing it + class FakeImage: + pass + + fake_im = FakeImage() + fake_im.__class__ = IptcImageFile # type: ignore[assignment] + iptc_im = cast(IptcImageFile, fake_im) + + # parse the IPTC information chunk + iptc_im.info = {} + iptc_im.fp = BytesIO(data) + + try: + iptc_im._open() + except (IndexError, KeyError): + pass # expected failure + + return {k: v for k, v in iptc_im.info.items() if isinstance(k, tuple)} diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Jpeg2KImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Jpeg2KImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..6db5d4acde6aebbe5c96ec1b37d6eb999fce914c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/Jpeg2KImagePlugin.py @@ -0,0 +1,460 @@ +# +# The Python Imaging Library +# $Id$ +# +# JPEG2000 file handling +# +# History: +# 2014-03-12 ajh Created +# 2021-06-30 rogermb Extract dpi information from the 'resc' header box +# +# Copyright (c) 2014 Coriolis Systems Limited +# Copyright (c) 2014 Alastair Houghton +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +import os +import struct +from typing import cast + +from . import Image, ImageFile, ImagePalette, _binary + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from typing import IO + + +class BoxReader: + """ + A small helper class to read fields stored in JPEG2000 header boxes + and to easily step into and read sub-boxes. + """ + + def __init__(self, fp: IO[bytes], length: int = -1) -> None: + self.fp = fp + self.has_length = length >= 0 + self.length = length + self.remaining_in_box = -1 + + def _can_read(self, num_bytes: int) -> bool: + if self.has_length and self.fp.tell() + num_bytes > self.length: + # Outside box: ensure we don't read past the known file length + return False + if self.remaining_in_box >= 0: + # Inside box contents: ensure read does not go past box boundaries + return num_bytes <= self.remaining_in_box + else: + return True # No length known, just read + + def _read_bytes(self, num_bytes: int) -> bytes: + if not self._can_read(num_bytes): + msg = "Not enough data in header" + raise SyntaxError(msg) + + data = self.fp.read(num_bytes) + if len(data) < num_bytes: + msg = f"Expected to read {num_bytes} bytes but only got {len(data)}." + raise OSError(msg) + + if self.remaining_in_box > 0: + self.remaining_in_box -= num_bytes + return data + + def read_fields(self, field_format: str) -> tuple[int | bytes, ...]: + size = struct.calcsize(field_format) + data = self._read_bytes(size) + return struct.unpack(field_format, data) + + def read_boxes(self) -> BoxReader: + size = self.remaining_in_box + data = self._read_bytes(size) + return BoxReader(io.BytesIO(data), size) + + def has_next_box(self) -> bool: + if self.has_length: + return self.fp.tell() + self.remaining_in_box < self.length + else: + return True + + def next_box_type(self) -> bytes: + # Skip the rest of the box if it has not been read + if self.remaining_in_box > 0: + self.fp.seek(self.remaining_in_box, os.SEEK_CUR) + self.remaining_in_box = -1 + + # Read the length and type of the next box + lbox, tbox = cast(tuple[int, bytes], self.read_fields(">I4s")) + if lbox == 1: + lbox = cast(int, self.read_fields(">Q")[0]) + hlen = 16 + else: + hlen = 8 + + if lbox < hlen or not self._can_read(lbox - hlen): + msg = "Invalid header length" + raise SyntaxError(msg) + + self.remaining_in_box = lbox - hlen + return tbox + + +def _parse_codestream(fp: IO[bytes]) -> tuple[tuple[int, int], str]: + """Parse the JPEG 2000 codestream to extract the size and component + count from the SIZ marker segment, returning a PIL (size, mode) tuple.""" + + hdr = fp.read(2) + lsiz = _binary.i16be(hdr) + siz = hdr + fp.read(lsiz - 2) + lsiz, rsiz, xsiz, ysiz, xosiz, yosiz, _, _, _, _, csiz = struct.unpack_from( + ">HHIIIIIIIIH", siz + ) + + size = (xsiz - xosiz, ysiz - yosiz) + if csiz == 1: + ssiz = struct.unpack_from(">B", siz, 38) + if (ssiz[0] & 0x7F) + 1 > 8: + mode = "I;16" + else: + mode = "L" + elif csiz == 2: + mode = "LA" + elif csiz == 3: + mode = "RGB" + elif csiz == 4: + mode = "RGBA" + else: + msg = "unable to determine J2K image mode" + raise SyntaxError(msg) + + return size, mode + + +def _res_to_dpi(num: int, denom: int, exp: int) -> float | None: + """Convert JPEG2000's (numerator, denominator, exponent-base-10) resolution, + calculated as (num / denom) * 10^exp and stored in dots per meter, + to floating-point dots per inch.""" + if denom == 0: + return None + return (254 * num * (10**exp)) / (10000 * denom) + + +def _parse_jp2_header( + fp: IO[bytes], +) -> tuple[ + tuple[int, int], + str, + str | None, + tuple[float, float] | None, + ImagePalette.ImagePalette | None, +]: + """Parse the JP2 header box to extract size, component count, + color space information, and optionally DPI information, + returning a (size, mode, mimetype, dpi) tuple.""" + + # Find the JP2 header box + reader = BoxReader(fp) + header = None + mimetype = None + while reader.has_next_box(): + tbox = reader.next_box_type() + + if tbox == b"jp2h": + header = reader.read_boxes() + break + elif tbox == b"ftyp": + if reader.read_fields(">4s")[0] == b"jpx ": + mimetype = "image/jpx" + assert header is not None + + size = None + mode = None + bpc = None + nc = None + dpi = None # 2-tuple of DPI info, or None + palette = None + colr = None + + while header.has_next_box(): + tbox = header.next_box_type() + + if tbox == b"ihdr": + height, width, nc, bpc = header.read_fields(">IIHB") + assert isinstance(height, int) + assert isinstance(width, int) + assert isinstance(bpc, int) + size = (width, height) + if nc == 1 and (bpc & 0x7F) > 8: + mode = "I;16" + elif nc == 1: + mode = "L" + elif nc == 2: + mode = "LA" + elif nc == 3: + mode = "RGB" + elif nc == 4: + mode = "RGBA" + elif tbox == b"colr": + meth, _, _, enumcs = header.read_fields(">BBBI") + if meth == 1: + if enumcs in (0, 15): + colr = "1" + elif enumcs == 12: + colr = "CMYK" + if nc == 4: + mode = "CMYK" + elif enumcs == 17: + colr = "L" + elif tbox == b"pclr" and mode in ("L", "LA") and colr not in ("1", "L"): + ne, npc = header.read_fields(">HB") + assert isinstance(ne, int) + assert isinstance(npc, int) + max_bitdepth = 0 + for bitdepth in header.read_fields(">" + ("B" * npc)): + assert isinstance(bitdepth, int) + if bitdepth > max_bitdepth: + max_bitdepth = bitdepth + if max_bitdepth <= 8: + if npc == 4: + palette_mode = "CMYK" if colr == "CMYK" else "RGBA" + else: + palette_mode = "RGB" + palette = ImagePalette.ImagePalette(palette_mode) + for i in range(ne): + color: list[int] = [] + for value in header.read_fields(">" + ("B" * npc)): + assert isinstance(value, int) + color.append(value) + palette.getcolor(tuple(color)) + mode = "P" if mode == "L" else "PA" + elif tbox == b"res ": + res = header.read_boxes() + while res.has_next_box(): + tres = res.next_box_type() + if tres == b"resc": + vrcn, vrcd, hrcn, hrcd, vrce, hrce = res.read_fields(">HHHHBB") + assert isinstance(vrcn, int) + assert isinstance(vrcd, int) + assert isinstance(hrcn, int) + assert isinstance(hrcd, int) + assert isinstance(vrce, int) + assert isinstance(hrce, int) + hres = _res_to_dpi(hrcn, hrcd, hrce) + vres = _res_to_dpi(vrcn, vrcd, vrce) + if hres is not None and vres is not None: + dpi = (hres, vres) + break + + if size is None or mode is None: + msg = "Malformed JP2 header" + raise SyntaxError(msg) + + return size, mode, mimetype, dpi, palette + + +## +# Image plugin for JPEG2000 images. + + +class Jpeg2KImageFile(ImageFile.ImageFile): + format = "JPEG2000" + format_description = "JPEG 2000 (ISO 15444)" + + def _open(self) -> None: + assert self.fp is not None + sig = self.fp.read(4) + if sig == b"\xff\x4f\xff\x51": + self.codec = "j2k" + self._size, self._mode = _parse_codestream(self.fp) + self._parse_comment() + else: + sig = sig + self.fp.read(8) + + if sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a": + self.codec = "jp2" + header = _parse_jp2_header(self.fp) + self._size, self._mode, self.custom_mimetype, dpi, self.palette = header + if dpi is not None: + self.info["dpi"] = dpi + if self.fp.read(12).endswith(b"jp2c\xff\x4f\xff\x51"): + hdr = self.fp.read(2) + length = _binary.i16be(hdr) + self.fp.seek(length - 2, os.SEEK_CUR) + self._parse_comment() + else: + msg = "not a JPEG 2000 file" + raise SyntaxError(msg) + + self._reduce = 0 + self.layers = 0 + + fd = -1 + length = -1 + + try: + fd = self.fp.fileno() + length = os.fstat(fd).st_size + except Exception: + fd = -1 + try: + pos = self.fp.tell() + self.fp.seek(0, io.SEEK_END) + length = self.fp.tell() + self.fp.seek(pos) + except Exception: + length = -1 + + self.tile = [ + ImageFile._Tile( + "jpeg2k", + (0, 0) + self.size, + 0, + (self.codec, self._reduce, self.layers, fd, length), + ) + ] + + def _parse_comment(self) -> None: + assert self.fp is not None + while True: + marker = self.fp.read(2) + if not marker: + break + typ = marker[1] + if typ in (0x90, 0xD9): + # Start of tile or end of codestream + break + hdr = self.fp.read(2) + length = _binary.i16be(hdr) + if typ == 0x64: + # Comment + self.info["comment"] = self.fp.read(length - 2)[2:] + break + else: + self.fp.seek(length - 2, os.SEEK_CUR) + + @property # type: ignore[override] + def reduce( + self, + ) -> ( + Callable[[int | tuple[int, int], tuple[int, int, int, int] | None], Image.Image] + | int + ): + # https://github.com/python-pillow/Pillow/issues/4343 found that the + # new Image 'reduce' method was shadowed by this plugin's 'reduce' + # property. This attempts to allow for both scenarios + return self._reduce or super().reduce + + @reduce.setter + def reduce(self, value: int) -> None: + self._reduce = value + + def load(self) -> Image.core.PixelAccess | None: + if self.tile and self._reduce: + power = 1 << self._reduce + adjust = power >> 1 + self._size = ( + int((self.size[0] + adjust) / power), + int((self.size[1] + adjust) / power), + ) + + # Update the reduce and layers settings + t = self.tile[0] + assert isinstance(t[3], tuple) + t3 = (t[3][0], self._reduce, self.layers, t[3][3], t[3][4]) + self.tile = [ImageFile._Tile(t[0], (0, 0) + self.size, t[2], t3)] + + return ImageFile.ImageFile.load(self) + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith( + (b"\xff\x4f\xff\x51", b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a") + ) + + +# ------------------------------------------------------------ +# Save support + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + # Get the keyword arguments + info = im.encoderinfo + + if isinstance(filename, str): + filename = filename.encode() + if filename.endswith(b".j2k") or info.get("no_jp2", False): + kind = "j2k" + else: + kind = "jp2" + + offset = info.get("offset", None) + tile_offset = info.get("tile_offset", None) + tile_size = info.get("tile_size", None) + quality_mode = info.get("quality_mode", "rates") + quality_layers = info.get("quality_layers", None) + if quality_layers is not None and not ( + isinstance(quality_layers, (list, tuple)) + and all( + isinstance(quality_layer, (int, float)) for quality_layer in quality_layers + ) + ): + msg = "quality_layers must be a sequence of numbers" + raise ValueError(msg) + + num_resolutions = info.get("num_resolutions", 0) + cblk_size = info.get("codeblock_size", None) + precinct_size = info.get("precinct_size", None) + irreversible = info.get("irreversible", False) + progression = info.get("progression", "LRCP") + cinema_mode = info.get("cinema_mode", "no") + mct = info.get("mct", 0) + signed = info.get("signed", False) + comment = info.get("comment") + if isinstance(comment, str): + comment = comment.encode() + plt = info.get("plt", False) + + fd = -1 + if hasattr(fp, "fileno"): + try: + fd = fp.fileno() + except Exception: + fd = -1 + + im.encoderconfig = ( + offset, + tile_offset, + tile_size, + quality_mode, + quality_layers, + num_resolutions, + cblk_size, + precinct_size, + irreversible, + progression, + cinema_mode, + mct, + signed, + fd, + comment, + plt, + ) + + ImageFile._save(im, fp, [ImageFile._Tile("jpeg2k", (0, 0) + im.size, 0, kind)]) + + +# ------------------------------------------------------------ +# Registry stuff + + +Image.register_open(Jpeg2KImageFile.format, Jpeg2KImageFile, _accept) +Image.register_save(Jpeg2KImageFile.format, _save) + +Image.register_extensions( + Jpeg2KImageFile.format, [".jp2", ".j2k", ".jpc", ".jpf", ".jpx", ".j2c"] +) + +Image.register_mime(Jpeg2KImageFile.format, "image/jp2") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/JpegImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/JpegImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..e071f9e71ea82a5cd134d2875bbcdbecd82ca896 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/JpegImagePlugin.py @@ -0,0 +1,889 @@ +# +# The Python Imaging Library. +# $Id$ +# +# JPEG (JFIF) file handling +# +# See "Digital Compression and Coding of Continuous-Tone Still Images, +# Part 1, Requirements and Guidelines" (CCITT T.81 / ISO 10918-1) +# +# History: +# 1995-09-09 fl Created +# 1995-09-13 fl Added full parser +# 1996-03-25 fl Added hack to use the IJG command line utilities +# 1996-05-05 fl Workaround Photoshop 2.5 CMYK polarity bug +# 1996-05-28 fl Added draft support, JFIF version (0.1) +# 1996-12-30 fl Added encoder options, added progression property (0.2) +# 1997-08-27 fl Save mode 1 images as BW (0.3) +# 1998-07-12 fl Added YCbCr to draft and save methods (0.4) +# 1998-10-19 fl Don't hang on files using 16-bit DQT's (0.4.1) +# 2001-04-16 fl Extract DPI settings from JFIF files (0.4.2) +# 2002-07-01 fl Skip pad bytes before markers; identify Exif files (0.4.3) +# 2003-04-25 fl Added experimental EXIF decoder (0.5) +# 2003-06-06 fl Added experimental EXIF GPSinfo decoder +# 2003-09-13 fl Extract COM markers +# 2009-09-06 fl Added icc_profile support (from Florian Hoech) +# 2009-03-06 fl Changed CMYK handling; always use Adobe polarity (0.6) +# 2009-03-08 fl Added subsampling support (from Justin Huff). +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1995-1996 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import array +import io +import math +import os +import struct +import subprocess +import sys +import tempfile +import warnings + +from . import Image, ImageFile +from ._binary import i16be as i16 +from ._binary import i32be as i32 +from ._binary import o8 +from ._binary import o16be as o16 +from .JpegPresets import presets + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import IO, Any + + from .MpoImagePlugin import MpoImageFile + +# +# Parser + + +def Skip(self: JpegImageFile, marker: int) -> None: + assert self.fp is not None + n = i16(self.fp.read(2)) - 2 + ImageFile._safe_read(self.fp, n) + + +def APP(self: JpegImageFile, marker: int) -> None: + # + # Application marker. Store these in the APP dictionary. + # Also look for well-known application markers. + + assert self.fp is not None + n = i16(self.fp.read(2)) - 2 + s = ImageFile._safe_read(self.fp, n) + + app = f"APP{marker & 15}" + + self.app[app] = s # compatibility + self.applist.append((app, s)) + + if marker == 0xFFE0 and s.startswith(b"JFIF"): + # extract JFIF information + self.info["jfif"] = version = i16(s, 5) # version + self.info["jfif_version"] = divmod(version, 256) + # extract JFIF properties + try: + jfif_unit = s[7] + jfif_density = i16(s, 8), i16(s, 10) + except Exception: + pass + else: + if jfif_unit == 1: + self.info["dpi"] = jfif_density + elif jfif_unit == 2: # cm + # 1 dpcm = 2.54 dpi + self.info["dpi"] = tuple(d * 2.54 for d in jfif_density) + self.info["jfif_unit"] = jfif_unit + self.info["jfif_density"] = jfif_density + elif marker == 0xFFE1 and s.startswith(b"Exif\0\0"): + # extract EXIF information + if "exif" in self.info: + self.info["exif"] += s[6:] + else: + self.info["exif"] = s + self._exif_offset = self.fp.tell() - n + 6 + elif marker == 0xFFE1 and s.startswith(b"http://ns.adobe.com/xap/1.0/\x00"): + self.info["xmp"] = s.split(b"\x00", 1)[1] + elif marker == 0xFFE2 and s.startswith(b"FPXR\0"): + # extract FlashPix information (incomplete) + self.info["flashpix"] = s # FIXME: value will change + elif marker == 0xFFE2 and s.startswith(b"ICC_PROFILE\0"): + # Since an ICC profile can be larger than the maximum size of + # a JPEG marker (64K), we need provisions to split it into + # multiple markers. The format defined by the ICC specifies + # one or more APP2 markers containing the following data: + # Identifying string ASCII "ICC_PROFILE\0" (12 bytes) + # Marker sequence number 1, 2, etc (1 byte) + # Number of markers Total of APP2's used (1 byte) + # Profile data (remainder of APP2 data) + # Decoders should use the marker sequence numbers to + # reassemble the profile, rather than assuming that the APP2 + # markers appear in the correct sequence. + self.icclist.append(s) + elif marker == 0xFFED and s.startswith(b"Photoshop 3.0\x00"): + # parse the image resource block + offset = 14 + photoshop = self.info.setdefault("photoshop", {}) + try: + while s[offset : offset + 4] == b"8BIM": + offset += 4 + # resource code + code = i16(s, offset) + offset += 2 + # resource name (usually empty) + name_len = s[offset] + # name = s[offset+1:offset+1+name_len] + offset += 1 + name_len + offset += offset & 1 # align + # resource data block + size = i32(s, offset) + offset += 4 + data = s[offset : offset + size] + if code == 0x03ED: # ResolutionInfo + photoshop[code] = { + "XResolution": i32(data, 0) / 65536, + "DisplayedUnitsX": i16(data, 4), + "YResolution": i32(data, 8) / 65536, + "DisplayedUnitsY": i16(data, 12), + } + else: + photoshop[code] = data + offset += size + offset += offset & 1 # align + except struct.error: + pass # insufficient data + + elif marker == 0xFFEE and s.startswith(b"Adobe"): + self.info["adobe"] = i16(s, 5) + # extract Adobe custom properties + try: + adobe_transform = s[11] + except IndexError: + pass + else: + self.info["adobe_transform"] = adobe_transform + elif marker == 0xFFE2 and s.startswith(b"MPF\0"): + # extract MPO information + self.info["mp"] = s[4:] + # offset is current location minus buffer size + # plus constant header size + self.info["mpoffset"] = self.fp.tell() - n + 4 + + +def COM(self: JpegImageFile, marker: int) -> None: + # + # Comment marker. Store these in the APP dictionary. + assert self.fp is not None + n = i16(self.fp.read(2)) - 2 + s = ImageFile._safe_read(self.fp, n) + + self.info["comment"] = s + self.app["COM"] = s # compatibility + self.applist.append(("COM", s)) + + +def SOF(self: JpegImageFile, marker: int) -> None: + # + # Start of frame marker. Defines the size and mode of the + # image. JPEG is colour blind, so we use some simple + # heuristics to map the number of layers to an appropriate + # mode. Note that this could be made a bit brighter, by + # looking for JFIF and Adobe APP markers. + + assert self.fp is not None + n = i16(self.fp.read(2)) - 2 + s = ImageFile._safe_read(self.fp, n) + self._size = i16(s, 3), i16(s, 1) + if self._im is not None and self.size != self.im.size: + self._im = None + + self.bits = s[0] + if self.bits != 8: + msg = f"cannot handle {self.bits}-bit layers" + raise SyntaxError(msg) + + self.layers = s[5] + if self.layers == 1: + self._mode = "L" + elif self.layers == 3: + self._mode = "RGB" + elif self.layers == 4: + self._mode = "CMYK" + else: + msg = f"cannot handle {self.layers}-layer images" + raise SyntaxError(msg) + + if marker in [0xFFC2, 0xFFC6, 0xFFCA, 0xFFCE]: + self.info["progressive"] = self.info["progression"] = 1 + + if self.icclist: + # fixup icc profile + self.icclist.sort() # sort by sequence number + if self.icclist[0][13] == len(self.icclist): + profile = [p[14:] for p in self.icclist] + icc_profile = b"".join(profile) + else: + icc_profile = None # wrong number of fragments + self.info["icc_profile"] = icc_profile + self.icclist = [] + + for i in range(6, len(s), 3): + t = s[i : i + 3] + # 4-tuples: id, vsamp, hsamp, qtable + self.layer.append((t[0], t[1] // 16, t[1] & 15, t[2])) + + +def DQT(self: JpegImageFile, marker: int) -> None: + # + # Define quantization table. Note that there might be more + # than one table in each marker. + + # FIXME: The quantization tables can be used to estimate the + # compression quality. + + assert self.fp is not None + n = i16(self.fp.read(2)) - 2 + s = ImageFile._safe_read(self.fp, n) + while len(s): + v = s[0] + precision = 1 if (v // 16 == 0) else 2 # in bytes + qt_length = 1 + precision * 64 + if len(s) < qt_length: + msg = "bad quantization table marker" + raise SyntaxError(msg) + data = array.array("B" if precision == 1 else "H", s[1:qt_length]) + if sys.byteorder == "little" and precision > 1: + data.byteswap() # the values are always big-endian + self.quantization[v & 15] = [data[i] for i in zigzag_index] + s = s[qt_length:] + + +# +# JPEG marker table + +MARKER = { + 0xFFC0: ("SOF0", "Baseline DCT", SOF), + 0xFFC1: ("SOF1", "Extended Sequential DCT", SOF), + 0xFFC2: ("SOF2", "Progressive DCT", SOF), + 0xFFC3: ("SOF3", "Spatial lossless", SOF), + 0xFFC4: ("DHT", "Define Huffman table", Skip), + 0xFFC5: ("SOF5", "Differential sequential DCT", SOF), + 0xFFC6: ("SOF6", "Differential progressive DCT", SOF), + 0xFFC7: ("SOF7", "Differential spatial", SOF), + 0xFFC8: ("JPG", "Extension", None), + 0xFFC9: ("SOF9", "Extended sequential DCT (AC)", SOF), + 0xFFCA: ("SOF10", "Progressive DCT (AC)", SOF), + 0xFFCB: ("SOF11", "Spatial lossless DCT (AC)", SOF), + 0xFFCC: ("DAC", "Define arithmetic coding conditioning", Skip), + 0xFFCD: ("SOF13", "Differential sequential DCT (AC)", SOF), + 0xFFCE: ("SOF14", "Differential progressive DCT (AC)", SOF), + 0xFFCF: ("SOF15", "Differential spatial (AC)", SOF), + 0xFFD0: ("RST0", "Restart 0", None), + 0xFFD1: ("RST1", "Restart 1", None), + 0xFFD2: ("RST2", "Restart 2", None), + 0xFFD3: ("RST3", "Restart 3", None), + 0xFFD4: ("RST4", "Restart 4", None), + 0xFFD5: ("RST5", "Restart 5", None), + 0xFFD6: ("RST6", "Restart 6", None), + 0xFFD7: ("RST7", "Restart 7", None), + 0xFFD8: ("SOI", "Start of image", None), + 0xFFD9: ("EOI", "End of image", None), + 0xFFDA: ("SOS", "Start of scan", Skip), + 0xFFDB: ("DQT", "Define quantization table", DQT), + 0xFFDC: ("DNL", "Define number of lines", Skip), + 0xFFDD: ("DRI", "Define restart interval", Skip), + 0xFFDE: ("DHP", "Define hierarchical progression", SOF), + 0xFFDF: ("EXP", "Expand reference component", Skip), + 0xFFE0: ("APP0", "Application segment 0", APP), + 0xFFE1: ("APP1", "Application segment 1", APP), + 0xFFE2: ("APP2", "Application segment 2", APP), + 0xFFE3: ("APP3", "Application segment 3", APP), + 0xFFE4: ("APP4", "Application segment 4", APP), + 0xFFE5: ("APP5", "Application segment 5", APP), + 0xFFE6: ("APP6", "Application segment 6", APP), + 0xFFE7: ("APP7", "Application segment 7", APP), + 0xFFE8: ("APP8", "Application segment 8", APP), + 0xFFE9: ("APP9", "Application segment 9", APP), + 0xFFEA: ("APP10", "Application segment 10", APP), + 0xFFEB: ("APP11", "Application segment 11", APP), + 0xFFEC: ("APP12", "Application segment 12", APP), + 0xFFED: ("APP13", "Application segment 13", APP), + 0xFFEE: ("APP14", "Application segment 14", APP), + 0xFFEF: ("APP15", "Application segment 15", APP), + 0xFFF0: ("JPG0", "Extension 0", None), + 0xFFF1: ("JPG1", "Extension 1", None), + 0xFFF2: ("JPG2", "Extension 2", None), + 0xFFF3: ("JPG3", "Extension 3", None), + 0xFFF4: ("JPG4", "Extension 4", None), + 0xFFF5: ("JPG5", "Extension 5", None), + 0xFFF6: ("JPG6", "Extension 6", None), + 0xFFF7: ("JPG7", "Extension 7", None), + 0xFFF8: ("JPG8", "Extension 8", None), + 0xFFF9: ("JPG9", "Extension 9", None), + 0xFFFA: ("JPG10", "Extension 10", None), + 0xFFFB: ("JPG11", "Extension 11", None), + 0xFFFC: ("JPG12", "Extension 12", None), + 0xFFFD: ("JPG13", "Extension 13", None), + 0xFFFE: ("COM", "Comment", COM), +} + + +def _accept(prefix: bytes) -> bool: + # Magic number was taken from https://en.wikipedia.org/wiki/JPEG + return prefix.startswith(b"\xff\xd8\xff") + + +## +# Image plugin for JPEG and JFIF images. + + +class JpegImageFile(ImageFile.ImageFile): + format = "JPEG" + format_description = "JPEG (ISO 10918)" + + def _open(self) -> None: + assert self.fp is not None + s = self.fp.read(3) + + if not _accept(s): + msg = "not a JPEG file" + raise SyntaxError(msg) + s = b"\xff" + + # Create attributes + self.bits = self.layers = 0 + self._exif_offset = 0 + + # JPEG specifics (internal) + self.layer: list[tuple[int, int, int, int]] = [] + self._huffman_dc: dict[Any, Any] = {} + self._huffman_ac: dict[Any, Any] = {} + self.quantization: dict[int, list[int]] = {} + self.app: dict[str, bytes] = {} # compatibility + self.applist: list[tuple[str, bytes]] = [] + self.icclist: list[bytes] = [] + + while True: + i = s[0] + if i == 0xFF: + s = s + self.fp.read(1) + i = i16(s) + else: + # Skip non-0xFF junk + s = self.fp.read(1) + continue + + if i in MARKER: + name, description, handler = MARKER[i] + if handler is not None: + handler(self, i) + if i == 0xFFDA: # start of scan + rawmode = self.mode + if self.mode == "CMYK": + rawmode = "CMYK;I" # assume adobe conventions + self.tile = [ + ImageFile._Tile("jpeg", (0, 0) + self.size, 0, (rawmode, "")) + ] + # self.__offset = self.fp.tell() + break + s = self.fp.read(1) + elif i in {0, 0xFFFF}: + # padded marker or junk; move on + s = b"\xff" + elif i == 0xFF00: # Skip extraneous data (escaped 0xFF) + s = self.fp.read(1) + else: + msg = "no marker found" + raise SyntaxError(msg) + + self._read_dpi_from_exif() + + def __getstate__(self) -> list[Any]: + return super().__getstate__() + [self.layers, self.layer] + + def __setstate__(self, state: list[Any]) -> None: + self.layers, self.layer = state[6:] + super().__setstate__(state) + + def load_read(self, read_bytes: int) -> bytes: + """ + internal: read more image data + For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker + so libjpeg can finish decoding + """ + assert self.fp is not None + s = self.fp.read(read_bytes) + + if not s and ImageFile.LOAD_TRUNCATED_IMAGES and not hasattr(self, "_ended"): + # Premature EOF. + # Pretend file is finished adding EOI marker + self._ended = True + return b"\xff\xd9" + + return s + + def draft( + self, mode: str | None, size: tuple[int, int] | None + ) -> tuple[str, tuple[int, int, float, float]] | None: + if len(self.tile) != 1: + return None + + # Protect from second call + if self.decoderconfig: + return None + + d, e, o, a = self.tile[0] + scale = 1 + original_size = self.size + + assert isinstance(a, tuple) + if a[0] == "RGB" and mode in ["L", "YCbCr"]: + self._mode = mode + a = mode, "" + + if size: + scale = min(self.size[0] // size[0], self.size[1] // size[1]) + for s in [8, 4, 2, 1]: + if scale >= s: + break + assert e is not None + e = ( + e[0], + e[1], + (e[2] - e[0] + s - 1) // s + e[0], + (e[3] - e[1] + s - 1) // s + e[1], + ) + self._size = ((self.size[0] + s - 1) // s, (self.size[1] + s - 1) // s) + scale = s + + self.tile = [ImageFile._Tile(d, e, o, a)] + self.decoderconfig = (scale, 0) + + box = (0, 0, original_size[0] / scale, original_size[1] / scale) + return self.mode, box + + def load_djpeg(self) -> None: + # ALTERNATIVE: handle JPEGs via the IJG command line utilities + + f, path = tempfile.mkstemp() + os.close(f) + if os.path.exists(self.filename): + subprocess.check_call(["djpeg", "-outfile", path, self.filename]) + else: + try: + os.unlink(path) + except OSError: + pass + + msg = "Invalid Filename" + raise ValueError(msg) + + try: + with Image.open(path) as _im: + _im.load() + self.im = _im.im + finally: + try: + os.unlink(path) + except OSError: + pass + + self._mode = self.im.mode + self._size = self.im.size + + self.tile = [] + + def _getexif(self) -> dict[int, Any] | None: + return _getexif(self) + + def _read_dpi_from_exif(self) -> None: + # If DPI isn't in JPEG header, fetch from EXIF + if "dpi" in self.info or "exif" not in self.info: + return + try: + exif = self.getexif() + resolution_unit = exif[0x0128] + x_resolution = exif[0x011A] + try: + dpi = float(x_resolution[0]) / x_resolution[1] + except TypeError: + dpi = x_resolution + if math.isnan(dpi): + msg = "DPI is not a number" + raise ValueError(msg) + if resolution_unit == 3: # cm + # 1 dpcm = 2.54 dpi + dpi *= 2.54 + self.info["dpi"] = dpi, dpi + except ( + struct.error, # truncated EXIF + KeyError, # dpi not included + SyntaxError, # invalid/unreadable EXIF + TypeError, # dpi is an invalid float + ValueError, # dpi is an invalid float + ZeroDivisionError, # invalid dpi rational value + ): + self.info["dpi"] = 72, 72 + + def _getmp(self) -> dict[int, Any] | None: + return _getmp(self) + + +def _getexif(self: JpegImageFile) -> dict[int, Any] | None: + if "exif" not in self.info: + return None + return self.getexif()._get_merged_dict() + + +def _getmp(self: JpegImageFile) -> dict[int, Any] | None: + # Extract MP information. This method was inspired by the "highly + # experimental" _getexif version that's been in use for years now, + # itself based on the ImageFileDirectory class in the TIFF plugin. + + # The MP record essentially consists of a TIFF file embedded in a JPEG + # application marker. + try: + data = self.info["mp"] + except KeyError: + return None + file_contents = io.BytesIO(data) + head = file_contents.read(8) + endianness = ">" if head.startswith(b"\x4d\x4d\x00\x2a") else "<" + # process dictionary + from . import TiffImagePlugin + + try: + info = TiffImagePlugin.ImageFileDirectory_v2(head) + file_contents.seek(info.next) + info.load(file_contents) + mp = dict(info) + except Exception as e: + msg = "malformed MP Index (unreadable directory)" + raise SyntaxError(msg) from e + # it's an error not to have a number of images + try: + quant = mp[0xB001] + except KeyError as e: + msg = "malformed MP Index (no number of images)" + raise SyntaxError(msg) from e + # get MP entries + mpentries = [] + try: + rawmpentries = mp[0xB002] + for entrynum in range(quant): + unpackedentry = struct.unpack_from( + f"{endianness}LLLHH", rawmpentries, entrynum * 16 + ) + labels = ("Attribute", "Size", "DataOffset", "EntryNo1", "EntryNo2") + mpentry = dict(zip(labels, unpackedentry)) + mpentryattr = { + "DependentParentImageFlag": bool(mpentry["Attribute"] & (1 << 31)), + "DependentChildImageFlag": bool(mpentry["Attribute"] & (1 << 30)), + "RepresentativeImageFlag": bool(mpentry["Attribute"] & (1 << 29)), + "Reserved": (mpentry["Attribute"] & (3 << 27)) >> 27, + "ImageDataFormat": (mpentry["Attribute"] & (7 << 24)) >> 24, + "MPType": mpentry["Attribute"] & 0x00FFFFFF, + } + if mpentryattr["ImageDataFormat"] == 0: + mpentryattr["ImageDataFormat"] = "JPEG" + else: + msg = "unsupported picture format in MPO" + raise SyntaxError(msg) + mptypemap = { + 0x000000: "Undefined", + 0x010001: "Large Thumbnail (VGA Equivalent)", + 0x010002: "Large Thumbnail (Full HD Equivalent)", + 0x020001: "Multi-Frame Image (Panorama)", + 0x020002: "Multi-Frame Image: (Disparity)", + 0x020003: "Multi-Frame Image: (Multi-Angle)", + 0x030000: "Baseline MP Primary Image", + } + mpentryattr["MPType"] = mptypemap.get(mpentryattr["MPType"], "Unknown") + mpentry["Attribute"] = mpentryattr + mpentries.append(mpentry) + mp[0xB002] = mpentries + except KeyError as e: + msg = "malformed MP Index (bad MP Entry)" + raise SyntaxError(msg) from e + # Next we should try and parse the individual image unique ID list; + # we don't because I've never seen this actually used in a real MPO + # file and so can't test it. + return mp + + +# -------------------------------------------------------------------- +# stuff to save JPEG files + +RAWMODE = { + "1": "L", + "L": "L", + "RGB": "RGB", + "RGBX": "RGB", + "CMYK": "CMYK;I", # assume adobe conventions + "YCbCr": "YCbCr", +} + +# fmt: off +zigzag_index = ( + 0, 1, 5, 6, 14, 15, 27, 28, + 2, 4, 7, 13, 16, 26, 29, 42, + 3, 8, 12, 17, 25, 30, 41, 43, + 9, 11, 18, 24, 31, 40, 44, 53, + 10, 19, 23, 32, 39, 45, 52, 54, + 20, 22, 33, 38, 46, 51, 55, 60, + 21, 34, 37, 47, 50, 56, 59, 61, + 35, 36, 48, 49, 57, 58, 62, 63, +) + +samplings = { + (1, 1, 1, 1, 1, 1): 0, + (2, 1, 1, 1, 1, 1): 1, + (2, 2, 1, 1, 1, 1): 2, +} +# fmt: on + + +def get_sampling(im: Image.Image) -> int: + # There's no subsampling when images have only 1 layer + # (grayscale images) or when they are CMYK (4 layers), + # so set subsampling to the default value. + # + # NOTE: currently Pillow can't encode JPEG to YCCK format. + # If YCCK support is added in the future, subsampling code will have + # to be updated (here and in JpegEncode.c) to deal with 4 layers. + if not isinstance(im, JpegImageFile) or im.layers in (1, 4): + return -1 + sampling = im.layer[0][1:3] + im.layer[1][1:3] + im.layer[2][1:3] + return samplings.get(sampling, -1) + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + try: + rawmode = RAWMODE[im.mode] + except KeyError as e: + msg = f"cannot write mode {im.mode} as JPEG" + raise OSError(msg) from e + + info = im.encoderinfo + + dpi = [round(x) for x in info.get("dpi", (0, 0))] + + quality = info.get("quality", -1) + subsampling = info.get("subsampling", -1) + qtables = info.get("qtables") + + if quality == "keep": + quality = -1 + subsampling = "keep" + qtables = "keep" + elif quality in presets: + preset = presets[quality] + quality = -1 + subsampling = preset.get("subsampling", -1) + qtables = preset.get("quantization") + elif not isinstance(quality, int): + msg = "Invalid quality setting" + raise ValueError(msg) + else: + if subsampling in presets: + subsampling = presets[subsampling].get("subsampling", -1) + if isinstance(qtables, str) and qtables in presets: + qtables = presets[qtables].get("quantization") + + if subsampling == "4:4:4": + subsampling = 0 + elif subsampling == "4:2:2": + subsampling = 1 + elif subsampling == "4:2:0": + subsampling = 2 + elif subsampling == "4:1:1": + # For compatibility. Before Pillow 4.3, 4:1:1 actually meant 4:2:0. + # Set 4:2:0 if someone is still using that value. + subsampling = 2 + elif subsampling == "keep": + if im.format != "JPEG": + msg = "Cannot use 'keep' when original image is not a JPEG" + raise ValueError(msg) + subsampling = get_sampling(im) + + def validate_qtables( + qtables: ( + str | tuple[list[int], ...] | list[list[int]] | dict[int, list[int]] | None + ), + ) -> list[list[int]] | None: + if qtables is None: + return qtables + if isinstance(qtables, str): + try: + lines = [ + int(num) + for line in qtables.splitlines() + for num in line.split("#", 1)[0].split() + ] + except ValueError as e: + msg = "Invalid quantization table" + raise ValueError(msg) from e + else: + qtables = [lines[s : s + 64] for s in range(0, len(lines), 64)] + if isinstance(qtables, (tuple, list, dict)): + if isinstance(qtables, dict): + qtables = [ + qtables[key] for key in range(len(qtables)) if key in qtables + ] + elif isinstance(qtables, tuple): + qtables = list(qtables) + if not (0 < len(qtables) < 5): + msg = "None or too many quantization tables" + raise ValueError(msg) + try: + for idx, table in enumerate(qtables): + if len(table) != 64: + msg = "Invalid quantization table" + raise TypeError(msg) + qtables[idx] = list(array.array("H", table)) + except TypeError as e: + msg = "Invalid quantization table" + raise ValueError(msg) from e + return qtables + + if qtables == "keep": + if im.format != "JPEG": + msg = "Cannot use 'keep' when original image is not a JPEG" + raise ValueError(msg) + qtables = getattr(im, "quantization", None) + qtables = validate_qtables(qtables) + + extra = info.get("extra", b"") + + MAX_BYTES_IN_MARKER = 65533 + if xmp := info.get("xmp"): + overhead_len = 29 # b"http://ns.adobe.com/xap/1.0/\x00" + max_data_bytes_in_marker = MAX_BYTES_IN_MARKER - overhead_len + if len(xmp) > max_data_bytes_in_marker: + msg = "XMP data is too long" + raise ValueError(msg) + size = o16(2 + overhead_len + len(xmp)) + extra += b"\xff\xe1" + size + b"http://ns.adobe.com/xap/1.0/\x00" + xmp + + if icc_profile := info.get("icc_profile"): + overhead_len = 14 # b"ICC_PROFILE\0" + o8(i) + o8(len(markers)) + max_data_bytes_in_marker = MAX_BYTES_IN_MARKER - overhead_len + markers = [] + while icc_profile: + markers.append(icc_profile[:max_data_bytes_in_marker]) + icc_profile = icc_profile[max_data_bytes_in_marker:] + i = 1 + for marker in markers: + size = o16(2 + overhead_len + len(marker)) + extra += ( + b"\xff\xe2" + + size + + b"ICC_PROFILE\0" + + o8(i) + + o8(len(markers)) + + marker + ) + i += 1 + + comment = info.get("comment", im.info.get("comment")) + + # "progressive" is the official name, but older documentation + # says "progression" + # FIXME: issue a warning if the wrong form is used (post-1.1.7) + progressive = info.get("progressive", False) or info.get("progression", False) + + optimize = info.get("optimize", False) + + exif = info.get("exif", b"") + if isinstance(exif, Image.Exif): + exif = exif.tobytes() + if len(exif) > MAX_BYTES_IN_MARKER: + msg = "EXIF data is too long" + raise ValueError(msg) + + # get keyword arguments + im.encoderconfig = ( + quality, + progressive, + info.get("smooth", 0), + optimize, + info.get("keep_rgb", False), + info.get("streamtype", 0), + dpi, + subsampling, + info.get("restart_marker_blocks", 0), + info.get("restart_marker_rows", 0), + qtables, + comment, + extra, + exif, + ) + + # if we optimize, libjpeg needs a buffer big enough to hold the whole image + # in a shot. Guessing on the size, at im.size bytes. (raw pixel size is + # channels*size, this is a value that's been used in a django patch. + # https://github.com/matthewwithanm/django-imagekit/issues/50 + if optimize or progressive: + # CMYK can be bigger + if im.mode == "CMYK": + bufsize = 4 * im.size[0] * im.size[1] + # keep sets quality to -1, but the actual value may be high. + elif quality >= 95 or quality == -1: + bufsize = 2 * im.size[0] * im.size[1] + else: + bufsize = im.size[0] * im.size[1] + if exif: + bufsize += len(exif) + 5 + if extra: + bufsize += len(extra) + 1 + else: + # The EXIF info needs to be written as one block, + APP1, + one spare byte. + # Ensure that our buffer is big enough. Same with the icc_profile block. + bufsize = max(len(exif) + 5, len(extra) + 1) + + ImageFile._save( + im, fp, [ImageFile._Tile("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize + ) + + +## +# Factory for making JPEG and MPO instances +def jpeg_factory( + fp: IO[bytes], filename: str | bytes | None = None +) -> JpegImageFile | MpoImageFile: + im = JpegImageFile(fp, filename) + try: + mpheader = im._getmp() + if mpheader is not None and mpheader[45057] > 1: + for segment, content in im.applist: + if segment == "APP1" and b' hdrgm:Version="' in content: + # Ultra HDR images are not yet supported + return im + # It's actually an MPO + from .MpoImagePlugin import MpoImageFile + + # Don't reload everything, just convert it. + im = MpoImageFile.adopt(im, mpheader) + except (TypeError, IndexError): + # It is really a JPEG + pass + except SyntaxError: + warnings.warn( + "Image appears to be a malformed MPO file, it will be " + "interpreted as a base JPEG file" + ) + return im + + +# --------------------------------------------------------------------- +# Registry stuff + +Image.register_open(JpegImageFile.format, jpeg_factory, _accept) +Image.register_save(JpegImageFile.format, _save) + +Image.register_extensions(JpegImageFile.format, [".jfif", ".jpe", ".jpg", ".jpeg"]) + +Image.register_mime(JpegImageFile.format, "image/jpeg") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/JpegPresets.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/JpegPresets.py new file mode 100644 index 0000000000000000000000000000000000000000..eb9b7b2317d5b96b676471d5c704c2bbe33ab541 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/JpegPresets.py @@ -0,0 +1,242 @@ +""" +JPEG quality settings equivalent to the Photoshop settings. +Can be used when saving JPEG files. + +The following presets are available by default: +``web_low``, ``web_medium``, ``web_high``, ``web_very_high``, ``web_maximum``, +``low``, ``medium``, ``high``, ``maximum``. +More presets can be added to the :py:data:`presets` dict if needed. + +To apply the preset, specify:: + + quality="preset_name" + +To apply only the quantization table:: + + qtables="preset_name" + +To apply only the subsampling setting:: + + subsampling="preset_name" + +Example:: + + im.save("image_name.jpg", quality="web_high") + +Subsampling +----------- + +Subsampling is the practice of encoding images by implementing less resolution +for chroma information than for luma information. +(ref.: https://en.wikipedia.org/wiki/Chroma_subsampling) + +Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and +4:2:0. + +You can get the subsampling of a JPEG with the +:func:`.JpegImagePlugin.get_sampling` function. + +In JPEG compressed data a JPEG marker is used instead of an EXIF tag. +(ref.: https://exiv2.org/tags.html) + + +Quantization tables +------------------- + +They are values use by the DCT (Discrete cosine transform) to remove +*unnecessary* information from the image (the lossy part of the compression). +(ref.: https://en.wikipedia.org/wiki/Quantization_matrix#Quantization_matrices, +https://en.wikipedia.org/wiki/JPEG#Quantization) + +You can get the quantization tables of a JPEG with:: + + im.quantization + +This will return a dict with a number of lists. You can pass this dict +directly as the qtables argument when saving a JPEG. + +The quantization table format in presets is a list with sublists. These formats +are interchangeable. + +Libjpeg ref.: +https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html + +""" + +from __future__ import annotations + +# fmt: off +presets = { + 'web_low': {'subsampling': 2, # "4:2:0" + 'quantization': [ + [20, 16, 25, 39, 50, 46, 62, 68, + 16, 18, 23, 38, 38, 53, 65, 68, + 25, 23, 31, 38, 53, 65, 68, 68, + 39, 38, 38, 53, 65, 68, 68, 68, + 50, 38, 53, 65, 68, 68, 68, 68, + 46, 53, 65, 68, 68, 68, 68, 68, + 62, 65, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68], + [21, 25, 32, 38, 54, 68, 68, 68, + 25, 28, 24, 38, 54, 68, 68, 68, + 32, 24, 32, 43, 66, 68, 68, 68, + 38, 38, 43, 53, 68, 68, 68, 68, + 54, 54, 66, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68] + ]}, + 'web_medium': {'subsampling': 2, # "4:2:0" + 'quantization': [ + [16, 11, 11, 16, 23, 27, 31, 30, + 11, 12, 12, 15, 20, 23, 23, 30, + 11, 12, 13, 16, 23, 26, 35, 47, + 16, 15, 16, 23, 26, 37, 47, 64, + 23, 20, 23, 26, 39, 51, 64, 64, + 27, 23, 26, 37, 51, 64, 64, 64, + 31, 23, 35, 47, 64, 64, 64, 64, + 30, 30, 47, 64, 64, 64, 64, 64], + [17, 15, 17, 21, 20, 26, 38, 48, + 15, 19, 18, 17, 20, 26, 35, 43, + 17, 18, 20, 22, 26, 30, 46, 53, + 21, 17, 22, 28, 30, 39, 53, 64, + 20, 20, 26, 30, 39, 48, 64, 64, + 26, 26, 30, 39, 48, 63, 64, 64, + 38, 35, 46, 53, 64, 64, 64, 64, + 48, 43, 53, 64, 64, 64, 64, 64] + ]}, + 'web_high': {'subsampling': 0, # "4:4:4" + 'quantization': [ + [6, 4, 4, 6, 9, 11, 12, 16, + 4, 5, 5, 6, 8, 10, 12, 12, + 4, 5, 5, 6, 10, 12, 14, 19, + 6, 6, 6, 11, 12, 15, 19, 28, + 9, 8, 10, 12, 16, 20, 27, 31, + 11, 10, 12, 15, 20, 27, 31, 31, + 12, 12, 14, 19, 27, 31, 31, 31, + 16, 12, 19, 28, 31, 31, 31, 31], + [7, 7, 13, 24, 26, 31, 31, 31, + 7, 12, 16, 21, 31, 31, 31, 31, + 13, 16, 17, 31, 31, 31, 31, 31, + 24, 21, 31, 31, 31, 31, 31, 31, + 26, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31] + ]}, + 'web_very_high': {'subsampling': 0, # "4:4:4" + 'quantization': [ + [2, 2, 2, 2, 3, 4, 5, 6, + 2, 2, 2, 2, 3, 4, 5, 6, + 2, 2, 2, 2, 4, 5, 7, 9, + 2, 2, 2, 4, 5, 7, 9, 12, + 3, 3, 4, 5, 8, 10, 12, 12, + 4, 4, 5, 7, 10, 12, 12, 12, + 5, 5, 7, 9, 12, 12, 12, 12, + 6, 6, 9, 12, 12, 12, 12, 12], + [3, 3, 5, 9, 13, 15, 15, 15, + 3, 4, 6, 11, 14, 12, 12, 12, + 5, 6, 9, 14, 12, 12, 12, 12, + 9, 11, 14, 12, 12, 12, 12, 12, + 13, 14, 12, 12, 12, 12, 12, 12, + 15, 12, 12, 12, 12, 12, 12, 12, + 15, 12, 12, 12, 12, 12, 12, 12, + 15, 12, 12, 12, 12, 12, 12, 12] + ]}, + 'web_maximum': {'subsampling': 0, # "4:4:4" + 'quantization': [ + [1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 2, 2, + 1, 1, 1, 1, 1, 2, 2, 3, + 1, 1, 1, 1, 2, 2, 3, 3, + 1, 1, 1, 2, 2, 3, 3, 3, + 1, 1, 2, 2, 3, 3, 3, 3], + [1, 1, 1, 2, 2, 3, 3, 3, + 1, 1, 1, 2, 3, 3, 3, 3, + 1, 1, 1, 3, 3, 3, 3, 3, + 2, 2, 3, 3, 3, 3, 3, 3, + 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3] + ]}, + 'low': {'subsampling': 2, # "4:2:0" + 'quantization': [ + [18, 14, 14, 21, 30, 35, 34, 17, + 14, 16, 16, 19, 26, 23, 12, 12, + 14, 16, 17, 21, 23, 12, 12, 12, + 21, 19, 21, 23, 12, 12, 12, 12, + 30, 26, 23, 12, 12, 12, 12, 12, + 35, 23, 12, 12, 12, 12, 12, 12, + 34, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12], + [20, 19, 22, 27, 20, 20, 17, 17, + 19, 25, 23, 14, 14, 12, 12, 12, + 22, 23, 14, 14, 12, 12, 12, 12, + 27, 14, 14, 12, 12, 12, 12, 12, + 20, 14, 12, 12, 12, 12, 12, 12, + 20, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12] + ]}, + 'medium': {'subsampling': 2, # "4:2:0" + 'quantization': [ + [12, 8, 8, 12, 17, 21, 24, 17, + 8, 9, 9, 11, 15, 19, 12, 12, + 8, 9, 10, 12, 19, 12, 12, 12, + 12, 11, 12, 21, 12, 12, 12, 12, + 17, 15, 19, 12, 12, 12, 12, 12, + 21, 19, 12, 12, 12, 12, 12, 12, + 24, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12], + [13, 11, 13, 16, 20, 20, 17, 17, + 11, 14, 14, 14, 14, 12, 12, 12, + 13, 14, 14, 14, 12, 12, 12, 12, + 16, 14, 14, 12, 12, 12, 12, 12, + 20, 14, 12, 12, 12, 12, 12, 12, + 20, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12] + ]}, + 'high': {'subsampling': 0, # "4:4:4" + 'quantization': [ + [6, 4, 4, 6, 9, 11, 12, 16, + 4, 5, 5, 6, 8, 10, 12, 12, + 4, 5, 5, 6, 10, 12, 12, 12, + 6, 6, 6, 11, 12, 12, 12, 12, + 9, 8, 10, 12, 12, 12, 12, 12, + 11, 10, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, + 16, 12, 12, 12, 12, 12, 12, 12], + [7, 7, 13, 24, 20, 20, 17, 17, + 7, 12, 16, 14, 14, 12, 12, 12, + 13, 16, 14, 14, 12, 12, 12, 12, + 24, 14, 14, 12, 12, 12, 12, 12, + 20, 14, 12, 12, 12, 12, 12, 12, + 20, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12, + 17, 12, 12, 12, 12, 12, 12, 12] + ]}, + 'maximum': {'subsampling': 0, # "4:4:4" + 'quantization': [ + [2, 2, 2, 2, 3, 4, 5, 6, + 2, 2, 2, 2, 3, 4, 5, 6, + 2, 2, 2, 2, 4, 5, 7, 9, + 2, 2, 2, 4, 5, 7, 9, 12, + 3, 3, 4, 5, 8, 10, 12, 12, + 4, 4, 5, 7, 10, 12, 12, 12, + 5, 5, 7, 9, 12, 12, 12, 12, + 6, 6, 9, 12, 12, 12, 12, 12], + [3, 3, 5, 9, 13, 15, 15, 15, + 3, 4, 6, 10, 14, 12, 12, 12, + 5, 6, 9, 14, 12, 12, 12, 12, + 9, 10, 14, 12, 12, 12, 12, 12, + 13, 14, 12, 12, 12, 12, 12, 12, + 15, 12, 12, 12, 12, 12, 12, 12, + 15, 12, 12, 12, 12, 12, 12, 12, + 15, 12, 12, 12, 12, 12, 12, 12] + ]}, +} +# fmt: on diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/McIdasImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/McIdasImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..708b4ce2139de496bb8dd7fd87524fbaa6f0f627 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/McIdasImagePlugin.py @@ -0,0 +1,78 @@ +# +# The Python Imaging Library. +# $Id$ +# +# Basic McIdas support for PIL +# +# History: +# 1997-05-05 fl Created (8-bit images only) +# 2009-03-08 fl Added 16/32-bit support. +# +# Thanks to Richard Jones and Craig Swank for specs and samples. +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1997. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import struct + +from . import Image, ImageFile + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"\x00\x00\x00\x00\x00\x00\x00\x04") + + +## +# Image plugin for McIdas area images. + + +class McIdasImageFile(ImageFile.ImageFile): + format = "MCIDAS" + format_description = "McIdas area file" + + def _open(self) -> None: + # parse area file directory + assert self.fp is not None + + s = self.fp.read(256) + if not _accept(s) or len(s) != 256: + msg = "not an McIdas area file" + raise SyntaxError(msg) + + self.area_descriptor_raw = s + self.area_descriptor = w = [0, *struct.unpack("!64i", s)] + + # get mode + if w[11] == 1: + mode = rawmode = "L" + elif w[11] == 2: + mode = rawmode = "I;16B" + elif w[11] == 4: + # FIXME: add memory map support + mode = "I" + rawmode = "I;32B" + else: + msg = "unsupported McIdas format" + raise SyntaxError(msg) + + self._mode = mode + self._size = w[10], w[9] + + offset = w[34] + w[15] + stride = w[15] + w[10] * w[11] * w[14] + + self.tile = [ + ImageFile._Tile("raw", (0, 0) + self.size, offset, (rawmode, stride, 1)) + ] + + +# -------------------------------------------------------------------- +# registry + +Image.register_open(McIdasImageFile.format, McIdasImageFile, _accept) + +# no default extension diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MicImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MicImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..b93b3fdd67b24d73fd3f4e8d4716d05d8510ccf4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MicImagePlugin.py @@ -0,0 +1,103 @@ +# +# The Python Imaging Library. +# $Id$ +# +# Microsoft Image Composer support for PIL +# +# Notes: +# uses TiffImagePlugin.py to read the actual image streams +# +# History: +# 97-01-20 fl Created +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1997. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import olefile + +from . import Image, TiffImagePlugin + +# +# -------------------------------------------------------------------- + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(olefile.MAGIC) + + +## +# Image plugin for Microsoft's Image Composer file format. + + +class MicImageFile(TiffImagePlugin.TiffImageFile): + format = "MIC" + format_description = "Microsoft Image Composer" + _close_exclusive_fp_after_loading = False + + def _open(self) -> None: + # read the OLE directory and see if this is a likely + # to be a Microsoft Image Composer file + + try: + self.ole = olefile.OleFileIO(self.fp) + except OSError as e: + msg = "not an MIC file; invalid OLE file" + raise SyntaxError(msg) from e + + # find ACI subfiles with Image members (maybe not the + # best way to identify MIC files, but what the... ;-) + + self.images = [ + path + for path in self.ole.listdir() + if path[1:] and path[0].endswith(".ACI") and path[1] == "Image" + ] + + # if we didn't find any images, this is probably not + # an MIC file. + if not self.images: + msg = "not an MIC file; no image entries" + raise SyntaxError(msg) + + self.frame = -1 + self._n_frames = len(self.images) + self.is_animated = self._n_frames > 1 + + assert self.fp is not None + self.__fp = self.fp + self.seek(0) + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + filename = self.images[frame] + self.fp = self.ole.openstream(filename) + + TiffImagePlugin.TiffImageFile._open(self) + + self.frame = frame + + def tell(self) -> int: + return self.frame + + def close(self) -> None: + self.__fp.close() + self.ole.close() + super().close() + + def __exit__(self, *args: object) -> None: + self.__fp.close() + self.ole.close() + super().__exit__() + + +# +# -------------------------------------------------------------------- + +Image.register_open(MicImageFile.format, MicImageFile, _accept) + +Image.register_extension(MicImageFile.format, ".mic") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MpegImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MpegImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..ff1464567b0c0a10c1493409baf0b20e70d62d7c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MpegImagePlugin.py @@ -0,0 +1,84 @@ +# +# The Python Imaging Library. +# $Id$ +# +# MPEG file handling +# +# History: +# 95-09-09 fl Created +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1995. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image, ImageFile +from ._binary import i8 +from ._typing import SupportsRead + +# +# Bitstream parser + + +class BitStream: + def __init__(self, fp: SupportsRead[bytes]) -> None: + self.fp = fp + self.bits = 0 + self.bitbuffer = 0 + + def next(self) -> int: + return i8(self.fp.read(1)) + + def peek(self, bits: int) -> int: + while self.bits < bits: + self.bitbuffer = (self.bitbuffer << 8) + self.next() + self.bits += 8 + return self.bitbuffer >> (self.bits - bits) & (1 << bits) - 1 + + def skip(self, bits: int) -> None: + while self.bits < bits: + self.bitbuffer = (self.bitbuffer << 8) + i8(self.fp.read(1)) + self.bits += 8 + self.bits = self.bits - bits + + def read(self, bits: int) -> int: + v = self.peek(bits) + self.bits = self.bits - bits + return v + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"\x00\x00\x01\xb3") + + +## +# Image plugin for MPEG streams. This plugin can identify a stream, +# but it cannot read it. + + +class MpegImageFile(ImageFile.ImageFile): + format = "MPEG" + format_description = "MPEG" + + def _open(self) -> None: + assert self.fp is not None + + s = BitStream(self.fp) + if s.read(32) != 0x1B3: + msg = "not an MPEG file" + raise SyntaxError(msg) + + self._mode = "RGB" + self._size = s.read(12), s.read(12) + + +# -------------------------------------------------------------------- +# Registry stuff + +Image.register_open(MpegImageFile.format, MpegImageFile, _accept) + +Image.register_extensions(MpegImageFile.format, [".mpg", ".mpeg"]) + +Image.register_mime(MpegImageFile.format, "video/mpeg") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MpoImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MpoImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..c47c3b237bb5d14fbfe3ffc70349e6882dab9048 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MpoImagePlugin.py @@ -0,0 +1,203 @@ +# +# The Python Imaging Library. +# $Id$ +# +# MPO file handling +# +# See "Multi-Picture Format" (CIPA DC-007-Translation 2009, Standard of the +# Camera & Imaging Products Association) +# +# The multi-picture object combines multiple JPEG images (with a modified EXIF +# data format) into a single file. While it can theoretically be used much like +# a GIF animation, it is commonly used to represent 3D photographs and is (as +# of this writing) the most commonly used format by 3D cameras. +# +# History: +# 2014-03-13 Feneric Created +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +import struct +from typing import IO, Any, cast + +from . import ( + Image, + ImageFile, + ImageSequence, + JpegImagePlugin, + TiffImagePlugin, +) +from ._binary import o32le +from ._util import DeferredError + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + JpegImagePlugin._save(im, fp, filename) + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + append_images = im.encoderinfo.get("append_images", []) + if not append_images and not getattr(im, "is_animated", False): + _save(im, fp, filename) + return + + mpf_offset = 28 + offsets: list[int] = [] + im_sequences = [im, *append_images] + total = sum(getattr(seq, "n_frames", 1) for seq in im_sequences) + for im_sequence in im_sequences: + for im_frame in ImageSequence.Iterator(im_sequence): + if not offsets: + # APP2 marker + ifd_length = 66 + 16 * total + im_frame.encoderinfo["extra"] = ( + b"\xff\xe2" + + struct.pack(">H", 6 + ifd_length) + + b"MPF\0" + + b" " * ifd_length + ) + if exif := im_frame.encoderinfo.get("exif"): + if isinstance(exif, Image.Exif): + exif = exif.tobytes() + im_frame.encoderinfo["exif"] = exif + mpf_offset += 4 + len(exif) + + JpegImagePlugin._save(im_frame, fp, filename) + offsets.append(fp.tell()) + else: + encoderinfo = im_frame._attach_default_encoderinfo(im) + im_frame.save(fp, "JPEG") + im_frame.encoderinfo = encoderinfo + offsets.append(fp.tell() - offsets[-1]) + + ifd = TiffImagePlugin.ImageFileDirectory_v2() + ifd[0xB000] = b"0100" + ifd[0xB001] = len(offsets) + + mpentries = b"" + data_offset = 0 + for i, size in enumerate(offsets): + if i == 0: + mptype = 0x030000 # Baseline MP Primary Image + else: + mptype = 0x000000 # Undefined + mpentries += struct.pack(" None: + assert self.fp is not None + self.fp.seek(0) # prep the fp in order to pass the JPEG test + JpegImagePlugin.JpegImageFile._open(self) + self._after_jpeg_open() + + def _after_jpeg_open(self, mpheader: dict[int, Any] | None = None) -> None: + self.mpinfo = mpheader if mpheader is not None else self._getmp() + if self.mpinfo is None: + msg = "Image appears to be a malformed MPO file" + raise ValueError(msg) + self.n_frames = self.mpinfo[0xB001] + self.__mpoffsets = [ + mpent["DataOffset"] + self.info["mpoffset"] for mpent in self.mpinfo[0xB002] + ] + self.__mpoffsets[0] = 0 + # Note that the following assertion will only be invalid if something + # gets broken within JpegImagePlugin. + assert self.n_frames == len(self.__mpoffsets) + del self.info["mpoffset"] # no longer needed + self.is_animated = self.n_frames > 1 + assert self.fp is not None + self._fp = self.fp # FIXME: hack + self._fp.seek(self.__mpoffsets[0]) # get ready to read first frame + self.__frame = 0 + self.offset = 0 + # for now we can only handle reading and individual frame extraction + self.readonly = 1 + + def load_seek(self, pos: int) -> None: + if isinstance(self._fp, DeferredError): + raise self._fp.ex + self._fp.seek(pos) + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + if isinstance(self._fp, DeferredError): + raise self._fp.ex + self.fp = self._fp + self.offset = self.__mpoffsets[frame] + + original_exif = self.info.get("exif") + if "exif" in self.info: + del self.info["exif"] + + self.fp.seek(self.offset + 2) # skip SOI marker + if not self.fp.read(2): + msg = "No data found for frame" + raise ValueError(msg) + self.fp.seek(self.offset) + JpegImagePlugin.JpegImageFile._open(self) + if self.info.get("exif") != original_exif: + self._reload_exif() + + self.tile = [ + ImageFile._Tile("jpeg", (0, 0) + self.size, self.offset, self.tile[0][-1]) + ] + self.__frame = frame + + def tell(self) -> int: + return self.__frame + + @staticmethod + def adopt( + jpeg_instance: JpegImagePlugin.JpegImageFile, + mpheader: dict[int, Any] | None = None, + ) -> MpoImageFile: + """ + Transform the instance of JpegImageFile into + an instance of MpoImageFile. + After the call, the JpegImageFile is extended + to be an MpoImageFile. + + This is essentially useful when opening a JPEG + file that reveals itself as an MPO, to avoid + double call to _open. + """ + jpeg_instance.__class__ = MpoImageFile + mpo_instance = cast(MpoImageFile, jpeg_instance) + mpo_instance._after_jpeg_open(mpheader) + return mpo_instance + + +# --------------------------------------------------------------------- +# Registry stuff + +# Note that since MPO shares a factory with JPEG, we do not need to do a +# separate registration for it here. +# Image.register_open(MpoImageFile.format, +# JpegImagePlugin.jpeg_factory, _accept) +Image.register_save(MpoImageFile.format, _save) +Image.register_save_all(MpoImageFile.format, _save_all) + +Image.register_extension(MpoImageFile.format, ".mpo") + +Image.register_mime(MpoImageFile.format, "image/mpo") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MspImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MspImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..245ec715c522d0e84e1d0a8df6dcd93e3b184aa9 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/MspImagePlugin.py @@ -0,0 +1,200 @@ +# +# The Python Imaging Library. +# +# MSP file handling +# +# This is the format used by the Paint program in Windows 1 and 2. +# +# History: +# 95-09-05 fl Created +# 97-01-03 fl Read/write MSP images +# 17-02-21 es Fixed RLE interpretation +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1995-97. +# Copyright (c) Eric Soroos 2017. +# +# See the README file for information on usage and redistribution. +# +# More info on this format: https://archive.org/details/gg243631 +# Page 313: +# Figure 205. Windows Paint Version 1: "DanM" Format +# Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03 +# +# See also: https://www.fileformat.info/format/mspaint/egff.htm +from __future__ import annotations + +import io +import struct +from typing import IO + +from . import Image, ImageFile +from ._binary import i16le as i16 +from ._binary import o16le as o16 + +# +# read MSP files + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith((b"DanM", b"LinS")) + + +## +# Image plugin for Windows MSP images. This plugin supports both +# uncompressed (Windows 1.0). + + +class MspImageFile(ImageFile.ImageFile): + format = "MSP" + format_description = "Windows Paint" + + def _open(self) -> None: + # Header + assert self.fp is not None + + s = self.fp.read(32) + if not _accept(s): + msg = "not an MSP file" + raise SyntaxError(msg) + + # Header checksum + checksum = 0 + for i in range(0, 32, 2): + checksum = checksum ^ i16(s, i) + if checksum != 0: + msg = "bad MSP checksum" + raise SyntaxError(msg) + + self._mode = "1" + self._size = i16(s, 4), i16(s, 6) + + if s.startswith(b"DanM"): + self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 32, "1")] + else: + self.tile = [ImageFile._Tile("MSP", (0, 0) + self.size, 32)] + + +class MspDecoder(ImageFile.PyDecoder): + # The algo for the MSP decoder is from + # https://www.fileformat.info/format/mspaint/egff.htm + # cc-by-attribution -- That page references is taken from the + # Encyclopedia of Graphics File Formats and is licensed by + # O'Reilly under the Creative Common/Attribution license + # + # For RLE encoded files, the 32byte header is followed by a scan + # line map, encoded as one 16bit word of encoded byte length per + # line. + # + # NOTE: the encoded length of the line can be 0. This was not + # handled in the previous version of this encoder, and there's no + # mention of how to handle it in the documentation. From the few + # examples I've seen, I've assumed that it is a fill of the + # background color, in this case, white. + # + # + # Pseudocode of the decoder: + # Read a BYTE value as the RunType + # If the RunType value is zero + # Read next byte as the RunCount + # Read the next byte as the RunValue + # Write the RunValue byte RunCount times + # If the RunType value is non-zero + # Use this value as the RunCount + # Read and write the next RunCount bytes literally + # + # e.g.: + # 0x00 03 ff 05 00 01 02 03 04 + # would yield the bytes: + # 0xff ff ff 00 01 02 03 04 + # + # which are then interpreted as a bit packed mode '1' image + + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + + img = io.BytesIO() + blank_line = bytearray((0xFF,) * ((self.state.xsize + 7) // 8)) + try: + self.fd.seek(32) + rowmap = struct.unpack_from( + f"<{self.state.ysize}H", self.fd.read(self.state.ysize * 2) + ) + except struct.error as e: + msg = "Truncated MSP file in row map" + raise OSError(msg) from e + + for x, rowlen in enumerate(rowmap): + try: + if rowlen == 0: + img.write(blank_line) + continue + row = self.fd.read(rowlen) + if len(row) != rowlen: + msg = f"Truncated MSP file, expected {rowlen} bytes on row {x}" + raise OSError(msg) + idx = 0 + while idx < rowlen: + runtype = row[idx] + idx += 1 + if runtype == 0: + runcount, runval = struct.unpack_from("Bc", row, idx) + img.write(runval * runcount) + idx += 2 + else: + runcount = runtype + img.write(row[idx : idx + runcount]) + idx += runcount + + except struct.error as e: + msg = f"Corrupted MSP file in row {x}" + raise OSError(msg) from e + + self.set_as_raw(img.getvalue(), "1") + + return -1, 0 + + +Image.register_decoder("MSP", MspDecoder) + + +# +# write MSP files (uncompressed only) + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode != "1": + msg = f"cannot write mode {im.mode} as MSP" + raise OSError(msg) + + # create MSP header + header = [0] * 16 + + header[0], header[1] = i16(b"Da"), i16(b"nM") # version 1 + header[2], header[3] = im.size + header[4], header[5] = 1, 1 + header[6], header[7] = 1, 1 + header[8], header[9] = im.size + + checksum = 0 + for h in header: + checksum = checksum ^ h + header[12] = checksum # FIXME: is this the right field? + + # header + for h in header: + fp.write(o16(h)) + + # image body + ImageFile._save(im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 32, "1")]) + + +# +# registry + +Image.register_open(MspImageFile.format, MspImageFile, _accept) +Image.register_save(MspImageFile.format, _save) + +Image.register_extension(MspImageFile.format, ".msp") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PSDraw.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PSDraw.py new file mode 100644 index 0000000000000000000000000000000000000000..89eec69f615dba73a6563a839e8d34735e17bbd0 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PSDraw.py @@ -0,0 +1,238 @@ +# +# The Python Imaging Library +# $Id$ +# +# Simple PostScript graphics interface +# +# History: +# 1996-04-20 fl Created +# 1999-01-10 fl Added gsave/grestore to image method +# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge) +# +# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved. +# Copyright (c) 1996 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import sys +from typing import IO + +from . import EpsImagePlugin + +TYPE_CHECKING = False + + +## +# Simple PostScript graphics interface. + + +class PSDraw: + """ + Sets up printing to the given file. If ``fp`` is omitted, + ``sys.stdout.buffer`` is assumed. + """ + + def __init__(self, fp: IO[bytes] | None = None) -> None: + if not fp: + fp = sys.stdout.buffer + self.fp = fp + + def begin_document(self, id: str | None = None) -> None: + """Set up printing of a document. (Write PostScript DSC header.)""" + # FIXME: incomplete + self.fp.write( + b"%!PS-Adobe-3.0\n" + b"save\n" + b"/showpage { } def\n" + b"%%EndComments\n" + b"%%BeginDocument\n" + ) + # self.fp.write(ERROR_PS) # debugging! + self.fp.write(EDROFF_PS) + self.fp.write(VDI_PS) + self.fp.write(b"%%EndProlog\n") + self.isofont: dict[bytes, int] = {} + + def end_document(self) -> None: + """Ends printing. (Write PostScript DSC footer.)""" + self.fp.write(b"%%EndDocument\nrestore showpage\n%%End\n") + if hasattr(self.fp, "flush"): + self.fp.flush() + + def setfont(self, font: str, size: int) -> None: + """ + Selects which font to use. + + :param font: A PostScript font name + :param size: Size in points. + """ + font_bytes = bytes(font, "UTF-8") + if font_bytes not in self.isofont: + # reencode font + self.fp.write( + b"/PSDraw-%s ISOLatin1Encoding /%s E\n" % (font_bytes, font_bytes) + ) + self.isofont[font_bytes] = 1 + # rough + self.fp.write(b"/F0 %d /PSDraw-%s F\n" % (size, font_bytes)) + + def line(self, xy0: tuple[int, int], xy1: tuple[int, int]) -> None: + """ + Draws a line between the two points. Coordinates are given in + PostScript point coordinates (72 points per inch, (0, 0) is the lower + left corner of the page). + """ + self.fp.write(b"%d %d %d %d Vl\n" % (*xy0, *xy1)) + + def rectangle(self, box: tuple[int, int, int, int]) -> None: + """ + Draws a rectangle. + + :param box: A tuple of four integers, specifying left, bottom, width and + height. + """ + self.fp.write(b"%d %d M 0 %d %d Vr\n" % box) + + def text(self, xy: tuple[int, int], text: str) -> None: + """ + Draws text at the given position. You must use + :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method. + """ + # The font is loaded as ISOLatin1Encoding, so use latin-1 here. + text_bytes = bytes(text, "latin-1") + text_bytes = b"\\(".join(text_bytes.split(b"(")) + text_bytes = b"\\)".join(text_bytes.split(b")")) + self.fp.write(b"%d %d M (%s) S\n" % (xy + (text_bytes,))) + + if TYPE_CHECKING: + from . import Image + + def image( + self, box: tuple[int, int, int, int], im: Image.Image, dpi: int | None = None + ) -> None: + """Draw a PIL image, centered in the given box.""" + # default resolution depends on mode + if not dpi: + if im.mode == "1": + dpi = 200 # fax + else: + dpi = 100 # grayscale + # image size (on paper) + x = im.size[0] * 72 / dpi + y = im.size[1] * 72 / dpi + # max allowed size + xmax = float(box[2] - box[0]) + ymax = float(box[3] - box[1]) + if x > xmax: + y = y * xmax / x + x = xmax + if y > ymax: + x = x * ymax / y + y = ymax + dx = (xmax - x) / 2 + box[0] + dy = (ymax - y) / 2 + box[1] + self.fp.write(b"gsave\n%f %f translate\n" % (dx, dy)) + if (x, y) != im.size: + # EpsImagePlugin._save prints the image at (0,0,xsize,ysize) + sx = x / im.size[0] + sy = y / im.size[1] + self.fp.write(b"%f %f scale\n" % (sx, sy)) + EpsImagePlugin._save(im, self.fp, "", 0) + self.fp.write(b"\ngrestore\n") + + +# -------------------------------------------------------------------- +# PostScript driver + +# +# EDROFF.PS -- PostScript driver for Edroff 2 +# +# History: +# 94-01-25 fl: created (edroff 2.04) +# +# Copyright (c) Fredrik Lundh 1994. +# + + +EDROFF_PS = b"""\ +/S { show } bind def +/P { moveto show } bind def +/M { moveto } bind def +/X { 0 rmoveto } bind def +/Y { 0 exch rmoveto } bind def +/E { findfont + dup maxlength dict begin + { + 1 index /FID ne { def } { pop pop } ifelse + } forall + /Encoding exch def + dup /FontName exch def + currentdict end definefont pop +} bind def +/F { findfont exch scalefont dup setfont + [ exch /setfont cvx ] cvx bind def +} bind def +""" + +# +# VDI.PS -- PostScript driver for VDI meta commands +# +# History: +# 94-01-25 fl: created (edroff 2.04) +# +# Copyright (c) Fredrik Lundh 1994. +# + +VDI_PS = b"""\ +/Vm { moveto } bind def +/Va { newpath arcn stroke } bind def +/Vl { moveto lineto stroke } bind def +/Vc { newpath 0 360 arc closepath } bind def +/Vr { exch dup 0 rlineto + exch dup 0 exch rlineto + exch neg 0 rlineto + 0 exch neg rlineto + setgray fill } bind def +/Tm matrix def +/Ve { Tm currentmatrix pop + translate scale newpath 0 0 .5 0 360 arc closepath + Tm setmatrix +} bind def +/Vf { currentgray exch setgray fill setgray } bind def +""" + +# +# ERROR.PS -- Error handler +# +# History: +# 89-11-21 fl: created (pslist 1.10) +# + +ERROR_PS = b"""\ +/landscape false def +/errorBUF 200 string def +/errorNL { currentpoint 10 sub exch pop 72 exch moveto } def +errordict begin /handleerror { + initmatrix /Courier findfont 10 scalefont setfont + newpath 72 720 moveto $error begin /newerror false def + (PostScript Error) show errorNL errorNL + (Error: ) show + /errorname load errorBUF cvs show errorNL errorNL + (Command: ) show + /command load dup type /stringtype ne { errorBUF cvs } if show + errorNL errorNL + (VMstatus: ) show + vmstatus errorBUF cvs show ( bytes available, ) show + errorBUF cvs show ( bytes used at level ) show + errorBUF cvs show errorNL errorNL + (Operand stargck: ) show errorNL /ostargck load { + dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL + } forall errorNL + (Execution stargck: ) show errorNL /estargck load { + dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL + } forall + end showpage +} def end +""" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PaletteFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PaletteFile.py new file mode 100644 index 0000000000000000000000000000000000000000..8aa69fc5417c996bccd4f28979dbbbd591253dde --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PaletteFile.py @@ -0,0 +1,54 @@ +# +# Python Imaging Library +# $Id$ +# +# stuff to read simple, teragon-style palette files +# +# History: +# 97-08-23 fl Created +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1997. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from typing import IO + +from ._binary import o8 + + +class PaletteFile: + """File handler for Teragon-style palette files.""" + + rawmode = "RGB" + + def __init__(self, fp: IO[bytes]) -> None: + palette = [o8(i) * 3 for i in range(256)] + + while True: + s = fp.readline() + + if not s: + break + if s.startswith(b"#"): + continue + if len(s) > 100: + msg = "bad palette file" + raise SyntaxError(msg) + + v = [int(x) for x in s.split()] + try: + [i, r, g, b] = v + except ValueError: + [i, r] = v + g = b = r + + if 0 <= i <= 255: + palette[i] = o8(r) + o8(g) + o8(b) + + self.palette = b"".join(palette) + + def getpalette(self) -> tuple[bytes, str]: + return self.palette, self.rawmode diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PalmImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PalmImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..60adb061a6512513f1ef3667e61b5fcf666b97bd --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PalmImagePlugin.py @@ -0,0 +1,217 @@ +# +# The Python Imaging Library. +# $Id$ +# + +## +# Image plugin for Palm pixmap images (output only). +## +from __future__ import annotations + +from typing import IO + +from . import Image, ImageFile +from ._binary import o8 +from ._binary import o16be as o16b + +# fmt: off +_Palm8BitColormapValues = ( + (255, 255, 255), (255, 204, 255), (255, 153, 255), (255, 102, 255), + (255, 51, 255), (255, 0, 255), (255, 255, 204), (255, 204, 204), + (255, 153, 204), (255, 102, 204), (255, 51, 204), (255, 0, 204), + (255, 255, 153), (255, 204, 153), (255, 153, 153), (255, 102, 153), + (255, 51, 153), (255, 0, 153), (204, 255, 255), (204, 204, 255), + (204, 153, 255), (204, 102, 255), (204, 51, 255), (204, 0, 255), + (204, 255, 204), (204, 204, 204), (204, 153, 204), (204, 102, 204), + (204, 51, 204), (204, 0, 204), (204, 255, 153), (204, 204, 153), + (204, 153, 153), (204, 102, 153), (204, 51, 153), (204, 0, 153), + (153, 255, 255), (153, 204, 255), (153, 153, 255), (153, 102, 255), + (153, 51, 255), (153, 0, 255), (153, 255, 204), (153, 204, 204), + (153, 153, 204), (153, 102, 204), (153, 51, 204), (153, 0, 204), + (153, 255, 153), (153, 204, 153), (153, 153, 153), (153, 102, 153), + (153, 51, 153), (153, 0, 153), (102, 255, 255), (102, 204, 255), + (102, 153, 255), (102, 102, 255), (102, 51, 255), (102, 0, 255), + (102, 255, 204), (102, 204, 204), (102, 153, 204), (102, 102, 204), + (102, 51, 204), (102, 0, 204), (102, 255, 153), (102, 204, 153), + (102, 153, 153), (102, 102, 153), (102, 51, 153), (102, 0, 153), + (51, 255, 255), (51, 204, 255), (51, 153, 255), (51, 102, 255), + (51, 51, 255), (51, 0, 255), (51, 255, 204), (51, 204, 204), + (51, 153, 204), (51, 102, 204), (51, 51, 204), (51, 0, 204), + (51, 255, 153), (51, 204, 153), (51, 153, 153), (51, 102, 153), + (51, 51, 153), (51, 0, 153), (0, 255, 255), (0, 204, 255), + (0, 153, 255), (0, 102, 255), (0, 51, 255), (0, 0, 255), + (0, 255, 204), (0, 204, 204), (0, 153, 204), (0, 102, 204), + (0, 51, 204), (0, 0, 204), (0, 255, 153), (0, 204, 153), + (0, 153, 153), (0, 102, 153), (0, 51, 153), (0, 0, 153), + (255, 255, 102), (255, 204, 102), (255, 153, 102), (255, 102, 102), + (255, 51, 102), (255, 0, 102), (255, 255, 51), (255, 204, 51), + (255, 153, 51), (255, 102, 51), (255, 51, 51), (255, 0, 51), + (255, 255, 0), (255, 204, 0), (255, 153, 0), (255, 102, 0), + (255, 51, 0), (255, 0, 0), (204, 255, 102), (204, 204, 102), + (204, 153, 102), (204, 102, 102), (204, 51, 102), (204, 0, 102), + (204, 255, 51), (204, 204, 51), (204, 153, 51), (204, 102, 51), + (204, 51, 51), (204, 0, 51), (204, 255, 0), (204, 204, 0), + (204, 153, 0), (204, 102, 0), (204, 51, 0), (204, 0, 0), + (153, 255, 102), (153, 204, 102), (153, 153, 102), (153, 102, 102), + (153, 51, 102), (153, 0, 102), (153, 255, 51), (153, 204, 51), + (153, 153, 51), (153, 102, 51), (153, 51, 51), (153, 0, 51), + (153, 255, 0), (153, 204, 0), (153, 153, 0), (153, 102, 0), + (153, 51, 0), (153, 0, 0), (102, 255, 102), (102, 204, 102), + (102, 153, 102), (102, 102, 102), (102, 51, 102), (102, 0, 102), + (102, 255, 51), (102, 204, 51), (102, 153, 51), (102, 102, 51), + (102, 51, 51), (102, 0, 51), (102, 255, 0), (102, 204, 0), + (102, 153, 0), (102, 102, 0), (102, 51, 0), (102, 0, 0), + (51, 255, 102), (51, 204, 102), (51, 153, 102), (51, 102, 102), + (51, 51, 102), (51, 0, 102), (51, 255, 51), (51, 204, 51), + (51, 153, 51), (51, 102, 51), (51, 51, 51), (51, 0, 51), + (51, 255, 0), (51, 204, 0), (51, 153, 0), (51, 102, 0), + (51, 51, 0), (51, 0, 0), (0, 255, 102), (0, 204, 102), + (0, 153, 102), (0, 102, 102), (0, 51, 102), (0, 0, 102), + (0, 255, 51), (0, 204, 51), (0, 153, 51), (0, 102, 51), + (0, 51, 51), (0, 0, 51), (0, 255, 0), (0, 204, 0), + (0, 153, 0), (0, 102, 0), (0, 51, 0), (17, 17, 17), + (34, 34, 34), (68, 68, 68), (85, 85, 85), (119, 119, 119), + (136, 136, 136), (170, 170, 170), (187, 187, 187), (221, 221, 221), + (238, 238, 238), (192, 192, 192), (128, 0, 0), (128, 0, 128), + (0, 128, 0), (0, 128, 128), (0, 0, 0), (0, 0, 0), + (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), + (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), + (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), + (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), + (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), + (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)) +# fmt: on + + +# so build a prototype image to be used for palette resampling +def build_prototype_image() -> Image.Image: + image = Image.new("L", (1, len(_Palm8BitColormapValues))) + image.putdata(list(range(len(_Palm8BitColormapValues)))) + palettedata: tuple[int, ...] = () + for colormapValue in _Palm8BitColormapValues: + palettedata += colormapValue + palettedata += (0, 0, 0) * (256 - len(_Palm8BitColormapValues)) + image.putpalette(palettedata) + return image + + +Palm8BitColormapImage = build_prototype_image() + +# OK, we now have in Palm8BitColormapImage, +# a "P"-mode image with the right palette +# +# -------------------------------------------------------------------- + +_FLAGS = {"custom-colormap": 0x4000, "is-compressed": 0x8000, "has-transparent": 0x2000} + +_COMPRESSION_TYPES = {"none": 0xFF, "rle": 0x01, "scanline": 0x00} + + +# +# -------------------------------------------------------------------- + +## +# (Internal) Image save plugin for the Palm format. + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode == "P": + rawmode = "P" + bpp = 8 + version = 1 + + elif im.mode == "L": + if im.encoderinfo.get("bpp") in (1, 2, 4): + # this is 8-bit grayscale, so we shift it to get the high-order bits, + # and invert it because + # Palm does grayscale from white (0) to black (1) + bpp = im.encoderinfo["bpp"] + maxval = (1 << bpp) - 1 + shift = 8 - bpp + im = im.point(lambda x: maxval - (x >> shift)) + elif im.info.get("bpp") in (1, 2, 4): + # here we assume that even though the inherent mode is 8-bit grayscale, + # only the lower bpp bits are significant. + # We invert them to match the Palm. + bpp = im.info["bpp"] + maxval = (1 << bpp) - 1 + im = im.point(lambda x: maxval - (x & maxval)) + else: + msg = f"cannot write mode {im.mode} as Palm" + raise OSError(msg) + + # we ignore the palette here + im._mode = "P" + rawmode = f"P;{bpp}" + version = 1 + + elif im.mode == "1": + # monochrome -- write it inverted, as is the Palm standard + rawmode = "1;I" + bpp = 1 + version = 0 + + else: + msg = f"cannot write mode {im.mode} as Palm" + raise OSError(msg) + + # + # make sure image data is available + im.load() + + # write header + + cols = im.size[0] + rows = im.size[1] + + rowbytes = int((cols + (16 // bpp - 1)) / (16 // bpp)) * 2 + transparent_index = 0 + compression_type = _COMPRESSION_TYPES["none"] + + flags = 0 + if im.mode == "P": + flags |= _FLAGS["custom-colormap"] + colormap = im.im.getpalette() + colors = len(colormap) // 3 + colormapsize = 4 * colors + 2 + else: + colormapsize = 0 + + if "offset" in im.info: + offset = (rowbytes * rows + 16 + 3 + colormapsize) // 4 + else: + offset = 0 + + fp.write(o16b(cols) + o16b(rows) + o16b(rowbytes) + o16b(flags)) + fp.write(o8(bpp)) + fp.write(o8(version)) + fp.write(o16b(offset)) + fp.write(o8(transparent_index)) + fp.write(o8(compression_type)) + fp.write(o16b(0)) # reserved by Palm + + # now write colormap if necessary + + if colormapsize: + fp.write(o16b(colors)) + for i in range(colors): + fp.write(o8(i)) + fp.write(colormap[3 * i : 3 * i + 3]) + + # now convert data to raw form + ImageFile._save( + im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, rowbytes, 1))] + ) + + if hasattr(fp, "flush"): + fp.flush() + + +# +# -------------------------------------------------------------------- + +Image.register_save("PALM", _save) + +Image.register_extension("PALM", ".palm") + +Image.register_mime("PALM", "image/palm") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcdImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcdImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..a7e7bd5fb152830de554b4fae947ff33c3c18eb5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcdImagePlugin.py @@ -0,0 +1,68 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PCD file handling +# +# History: +# 96-05-10 fl Created +# 96-05-27 fl Added draft mode (128x192, 256x384) +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image, ImageFile + +## +# Image plugin for PhotoCD images. This plugin only reads the 768x512 +# image from the file; higher resolutions are encoded in a proprietary +# encoding. + + +class PcdImageFile(ImageFile.ImageFile): + format = "PCD" + format_description = "Kodak PhotoCD" + + def _open(self) -> None: + # rough + assert self.fp is not None + + self.fp.seek(2048) + s = self.fp.read(1539) + + if not s.startswith(b"PCD_"): + msg = "not a PCD file" + raise SyntaxError(msg) + + orientation = s[1538] & 3 + self.tile_post_rotate = None + if orientation == 1: + self.tile_post_rotate = 90 + elif orientation == 3: + self.tile_post_rotate = 270 + + self._mode = "RGB" + self._size = (512, 768) if orientation in (1, 3) else (768, 512) + self.tile = [ImageFile._Tile("pcd", (0, 0, 768, 512), 96 * 2048)] + + def load_prepare(self) -> None: + if self._im is None and self.tile_post_rotate: + self.im = Image.core.new(self.mode, (768, 512)) + ImageFile.ImageFile.load_prepare(self) + + def load_end(self) -> None: + if self.tile_post_rotate: + # Handle rotated PCDs + self.im = self.rotate(self.tile_post_rotate, expand=True).im + + +# +# registry + +Image.register_open(PcdImageFile.format, PcdImageFile) + +Image.register_extension(PcdImageFile.format, ".pcd") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcfFontFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcfFontFile.py new file mode 100644 index 0000000000000000000000000000000000000000..ec8e9d1045bb6f751ff9764d707aa3751750b71c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcfFontFile.py @@ -0,0 +1,258 @@ +# +# THIS IS WORK IN PROGRESS +# +# The Python Imaging Library +# $Id$ +# +# portable compiled font file parser +# +# history: +# 1997-08-19 fl created +# 2003-09-13 fl fixed loading of unicode fonts +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1997-2003 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io + +from . import FontFile, Image +from ._binary import i8 +from ._binary import i16be as b16 +from ._binary import i16le as l16 +from ._binary import i32be as b32 +from ._binary import i32le as l32 + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from typing import BinaryIO + +# -------------------------------------------------------------------- +# declarations + +PCF_MAGIC = 0x70636601 # "\x01fcp" + +PCF_PROPERTIES = 1 << 0 +PCF_ACCELERATORS = 1 << 1 +PCF_METRICS = 1 << 2 +PCF_BITMAPS = 1 << 3 +PCF_INK_METRICS = 1 << 4 +PCF_BDF_ENCODINGS = 1 << 5 +PCF_SWIDTHS = 1 << 6 +PCF_GLYPH_NAMES = 1 << 7 +PCF_BDF_ACCELERATORS = 1 << 8 + +BYTES_PER_ROW: list[Callable[[int], int]] = [ + lambda bits: ((bits + 7) >> 3), + lambda bits: ((bits + 15) >> 3) & ~1, + lambda bits: ((bits + 31) >> 3) & ~3, + lambda bits: ((bits + 63) >> 3) & ~7, +] + + +def sz(s: bytes, o: int) -> bytes: + return s[o : s.index(b"\0", o)] + + +class PcfFontFile(FontFile.FontFile): + """Font file plugin for the X11 PCF format.""" + + name = "name" + + def __init__(self, fp: BinaryIO, charset_encoding: str = "iso8859-1"): + self.charset_encoding = charset_encoding + + magic = l32(fp.read(4)) + if magic != PCF_MAGIC: + msg = "not a PCF file" + raise SyntaxError(msg) + + super().__init__() + + count = l32(fp.read(4)) + self.toc = {} + for i in range(count): + type = l32(fp.read(4)) + self.toc[type] = l32(fp.read(4)), l32(fp.read(4)), l32(fp.read(4)) + + self.fp = fp + + self.info = self._load_properties() + + metrics = self._load_metrics() + bitmaps = self._load_bitmaps(metrics) + encoding = self._load_encoding() + + # + # create glyph structure + + for ch, ix in enumerate(encoding): + if ix is not None: + ( + xsize, + ysize, + left, + right, + width, + ascent, + descent, + attributes, + ) = metrics[ix] + self.glyph[ch] = ( + (width, 0), + (left, descent - ysize, xsize + left, descent), + (0, 0, xsize, ysize), + bitmaps[ix], + ) + + def _getformat( + self, tag: int + ) -> tuple[BinaryIO, int, Callable[[bytes], int], Callable[[bytes], int]]: + format, size, offset = self.toc[tag] + + fp = self.fp + fp.seek(offset) + + format = l32(fp.read(4)) + + if format & 4: + i16, i32 = b16, b32 + else: + i16, i32 = l16, l32 + + return fp, format, i16, i32 + + def _load_properties(self) -> dict[bytes, bytes | int]: + # + # font properties + + properties = {} + + fp, format, i16, i32 = self._getformat(PCF_PROPERTIES) + + nprops = i32(fp.read(4)) + + # read property description + p = [(i32(fp.read(4)), i8(fp.read(1)), i32(fp.read(4))) for _ in range(nprops)] + + if nprops & 3: + fp.seek(4 - (nprops & 3), io.SEEK_CUR) # pad + + data = fp.read(i32(fp.read(4))) + + for k, s, v in p: + property_value: bytes | int = sz(data, v) if s else v + properties[sz(data, k)] = property_value + + return properties + + def _load_metrics(self) -> list[tuple[int, int, int, int, int, int, int, int]]: + # + # font metrics + + metrics: list[tuple[int, int, int, int, int, int, int, int]] = [] + + fp, format, i16, i32 = self._getformat(PCF_METRICS) + + append = metrics.append + + if (format & 0xFF00) == 0x100: + # "compressed" metrics + for i in range(i16(fp.read(2))): + left = i8(fp.read(1)) - 128 + right = i8(fp.read(1)) - 128 + width = i8(fp.read(1)) - 128 + ascent = i8(fp.read(1)) - 128 + descent = i8(fp.read(1)) - 128 + xsize = right - left + ysize = ascent + descent + append((xsize, ysize, left, right, width, ascent, descent, 0)) + + else: + # "jumbo" metrics + for i in range(i32(fp.read(4))): + left = i16(fp.read(2)) + right = i16(fp.read(2)) + width = i16(fp.read(2)) + ascent = i16(fp.read(2)) + descent = i16(fp.read(2)) + attributes = i16(fp.read(2)) + xsize = right - left + ysize = ascent + descent + append((xsize, ysize, left, right, width, ascent, descent, attributes)) + + return metrics + + def _load_bitmaps( + self, metrics: list[tuple[int, int, int, int, int, int, int, int]] + ) -> list[Image.Image]: + # + # bitmap data + + fp, format, i16, i32 = self._getformat(PCF_BITMAPS) + + nbitmaps = i32(fp.read(4)) + + if nbitmaps != len(metrics): + msg = "Wrong number of bitmaps" + raise OSError(msg) + + offsets = [i32(fp.read(4)) for _ in range(nbitmaps)] + + bitmap_sizes = [i32(fp.read(4)) for _ in range(4)] + + # byteorder = format & 4 # non-zero => MSB + bitorder = format & 8 # non-zero => MSB + padindex = format & 3 + + bitmapsize = bitmap_sizes[padindex] + offsets.append(bitmapsize) + + data = fp.read(bitmapsize) + + pad = BYTES_PER_ROW[padindex] + mode = "1;R" + if bitorder: + mode = "1" + + bitmaps = [] + for i in range(nbitmaps): + xsize, ysize = metrics[i][:2] + b, e = offsets[i : i + 2] + bitmaps.append( + Image.frombytes("1", (xsize, ysize), data[b:e], "raw", mode, pad(xsize)) + ) + + return bitmaps + + def _load_encoding(self) -> list[int | None]: + fp, format, i16, i32 = self._getformat(PCF_BDF_ENCODINGS) + + first_col, last_col = i16(fp.read(2)), i16(fp.read(2)) + first_row, last_row = i16(fp.read(2)), i16(fp.read(2)) + + i16(fp.read(2)) # default + + nencoding = (last_col - first_col + 1) * (last_row - first_row + 1) + + # map character code to bitmap index + encoding: list[int | None] = [None] * min(256, nencoding) + + encoding_offsets = [i16(fp.read(2)) for _ in range(nencoding)] + + for i in range(first_col, len(encoding)): + try: + encoding_offset = encoding_offsets[ + ord(bytearray([i]).decode(self.charset_encoding)) + ] + if encoding_offset != 0xFFFF: + encoding[i] = encoding_offset + except UnicodeDecodeError: # noqa: PERF203 + # character is not supported in selected encoding + pass + + return encoding diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcxImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcxImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..84ec5decabb82d701849b358dbcb850f933422b7 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PcxImagePlugin.py @@ -0,0 +1,232 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PCX file handling +# +# This format was originally used by ZSoft's popular PaintBrush +# program for the IBM PC. It is also supported by many MS-DOS and +# Windows applications, including the Windows PaintBrush program in +# Windows 3. +# +# history: +# 1995-09-01 fl Created +# 1996-05-20 fl Fixed RGB support +# 1997-01-03 fl Fixed 2-bit and 4-bit support +# 1999-02-03 fl Fixed 8-bit support (broken in 1.0b1) +# 1999-02-07 fl Added write support +# 2002-06-09 fl Made 2-bit and 4-bit support a bit more robust +# 2002-07-30 fl Seek from to current position, not beginning of file +# 2003-06-03 fl Extract DPI settings (info["dpi"]) +# +# Copyright (c) 1997-2003 by Secret Labs AB. +# Copyright (c) 1995-2003 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +import logging +from typing import IO + +from . import Image, ImageFile, ImagePalette +from ._binary import i16le as i16 +from ._binary import o8 +from ._binary import o16le as o16 + +logger = logging.getLogger(__name__) + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 2 and prefix[0] == 10 and prefix[1] in [0, 2, 3, 5] + + +## +# Image plugin for Paintbrush images. + + +class PcxImageFile(ImageFile.ImageFile): + format = "PCX" + format_description = "Paintbrush" + + def _open(self) -> None: + # header + assert self.fp is not None + + s = self.fp.read(68) + if not _accept(s): + msg = "not a PCX file" + raise SyntaxError(msg) + + # image + bbox = i16(s, 4), i16(s, 6), i16(s, 8) + 1, i16(s, 10) + 1 + if bbox[2] <= bbox[0] or bbox[3] <= bbox[1]: + msg = "bad PCX image size" + raise SyntaxError(msg) + logger.debug("BBox: %s %s %s %s", *bbox) + + offset = self.fp.tell() + 60 + + # format + version = s[1] + bits = s[3] + planes = s[65] + provided_stride = i16(s, 66) + logger.debug( + "PCX version %s, bits %s, planes %s, stride %s", + version, + bits, + planes, + provided_stride, + ) + + self.info["dpi"] = i16(s, 12), i16(s, 14) + + if bits == 1 and planes == 1: + mode = rawmode = "1" + + elif bits == 1 and planes in (2, 4): + mode = "P" + rawmode = f"P;{planes}L" + self.palette = ImagePalette.raw("RGB", s[16:64]) + + elif version == 5 and bits == 8 and planes == 1: + mode = rawmode = "L" + # FIXME: hey, this doesn't work with the incremental loader !!! + self.fp.seek(-769, io.SEEK_END) + s = self.fp.read(769) + if len(s) == 769 and s[0] == 12: + # check if the palette is linear grayscale + for i in range(256): + if s[i * 3 + 1 : i * 3 + 4] != o8(i) * 3: + mode = rawmode = "P" + break + if mode == "P": + self.palette = ImagePalette.raw("RGB", s[1:]) + + elif version == 5 and bits == 8 and planes == 3: + mode = "RGB" + rawmode = "RGB;L" + + else: + msg = "unknown PCX mode" + raise OSError(msg) + + self._mode = mode + self._size = bbox[2] - bbox[0], bbox[3] - bbox[1] + + # Don't trust the passed in stride. + # Calculate the approximate position for ourselves. + # CVE-2020-35653 + stride = (self._size[0] * bits + 7) // 8 + + # While the specification states that this must be even, + # not all images follow this + if provided_stride != stride: + stride += stride % 2 + + bbox = (0, 0) + self.size + logger.debug("size: %sx%s", *self.size) + + self.tile = [ImageFile._Tile("pcx", bbox, offset, (rawmode, planes * stride))] + + +# -------------------------------------------------------------------- +# save PCX files + + +SAVE = { + # mode: (version, bits, planes, raw mode) + "1": (2, 1, 1, "1"), + "L": (5, 8, 1, "L"), + "P": (5, 8, 1, "P"), + "RGB": (5, 8, 3, "RGB;L"), +} + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.width == 0 or im.height == 0: + msg = "Cannot write empty image as PCX" + raise ValueError(msg) + + try: + version, bits, planes, rawmode = SAVE[im.mode] + except KeyError as e: + msg = f"Cannot save {im.mode} images as PCX" + raise ValueError(msg) from e + + # bytes per plane + stride = (im.size[0] * bits + 7) // 8 + # stride should be even + stride += stride % 2 + # Stride needs to be kept in sync with the PcxEncode.c version. + # Ideally it should be passed in in the state, but the bytes value + # gets overwritten. + + logger.debug( + "PcxImagePlugin._save: xwidth: %d, bits: %d, stride: %d", + im.size[0], + bits, + stride, + ) + + # under windows, we could determine the current screen size with + # "Image.core.display_mode()[1]", but I think that's overkill... + + screen = im.size + + dpi = 100, 100 + + # PCX header + fp.write( + o8(10) + + o8(version) + + o8(1) + + o8(bits) + + o16(0) + + o16(0) + + o16(im.size[0] - 1) + + o16(im.size[1] - 1) + + o16(dpi[0]) + + o16(dpi[1]) + + b"\0" * 24 + + b"\xff" * 24 + + b"\0" + + o8(planes) + + o16(stride) + + o16(1) + + o16(screen[0]) + + o16(screen[1]) + + b"\0" * 54 + ) + + assert fp.tell() == 128 + + ImageFile._save( + im, fp, [ImageFile._Tile("pcx", (0, 0) + im.size, 0, (rawmode, bits * planes))] + ) + + if im.mode == "P": + # colour palette + fp.write(o8(12)) + palette = im.im.getpalette("RGB", "RGB") + palette += b"\x00" * (768 - len(palette)) + fp.write(palette) # 768 bytes + elif im.mode == "L": + # grayscale palette + fp.write(o8(12)) + for i in range(256): + fp.write(o8(i) * 3) + + +# -------------------------------------------------------------------- +# registry + + +Image.register_open(PcxImageFile.format, PcxImageFile, _accept) +Image.register_save(PcxImageFile.format, _save) + +Image.register_extension(PcxImageFile.format, ".pcx") + +Image.register_mime(PcxImageFile.format, "image/x-pcx") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PdfImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PdfImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..11ce6cbbffb687d03bc1e98e8984e49d73665622 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PdfImagePlugin.py @@ -0,0 +1,311 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PDF (Acrobat) file handling +# +# History: +# 1996-07-16 fl Created +# 1997-01-18 fl Fixed header +# 2004-02-21 fl Fixes for 1/L/CMYK images, etc. +# 2004-02-24 fl Fixes for 1 and P images. +# +# Copyright (c) 1997-2004 by Secret Labs AB. All rights reserved. +# Copyright (c) 1996-1997 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# + +## +# Image plugin for PDF images (output only). +## +from __future__ import annotations + +import io +import math +import os +import time +from typing import IO, Any + +from . import Image, ImageFile, ImageSequence, PdfParser, features + +# +# -------------------------------------------------------------------- + +# object ids: +# 1. catalogue +# 2. pages +# 3. image +# 4. page +# 5. page contents + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + _save(im, fp, filename, save_all=True) + + +## +# (Internal) Image save plugin for the PDF format. + + +def _write_image( + im: Image.Image, + filename: str | bytes, + existing_pdf: PdfParser.PdfParser, + image_refs: list[PdfParser.IndirectReference], +) -> tuple[PdfParser.IndirectReference, str]: + # FIXME: Should replace ASCIIHexDecode with RunLengthDecode + # (packbits) or LZWDecode (tiff/lzw compression). Note that + # PDF 1.2 also supports Flatedecode (zip compression). + + params = None + decode = None + + # + # Get image characteristics + + width, height = im.size + + dict_obj: dict[str, Any] = {"BitsPerComponent": 8} + if im.mode == "1": + if features.check("libtiff"): + decode_filter = "CCITTFaxDecode" + dict_obj["BitsPerComponent"] = 1 + params = PdfParser.PdfArray( + [ + PdfParser.PdfDict( + { + "K": -1, + "BlackIs1": True, + "Columns": width, + "Rows": height, + } + ) + ] + ) + else: + decode_filter = "DCTDecode" + dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceGray") + procset = "ImageB" # grayscale + elif im.mode == "L": + decode_filter = "DCTDecode" + # params = f"<< /Predictor 15 /Columns {width-2} >>" + dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceGray") + procset = "ImageB" # grayscale + elif im.mode == "LA": + decode_filter = "JPXDecode" + # params = f"<< /Predictor 15 /Columns {width-2} >>" + procset = "ImageB" # grayscale + dict_obj["SMaskInData"] = 1 + elif im.mode == "P": + decode_filter = "ASCIIHexDecode" + palette = im.getpalette() + assert palette is not None + dict_obj["ColorSpace"] = [ + PdfParser.PdfName("Indexed"), + PdfParser.PdfName("DeviceRGB"), + len(palette) // 3 - 1, + PdfParser.PdfBinary(palette), + ] + procset = "ImageI" # indexed color + + if "transparency" in im.info: + smask = im.convert("LA").getchannel("A") + smask.encoderinfo = {} + + image_ref = _write_image(smask, filename, existing_pdf, image_refs)[0] + dict_obj["SMask"] = image_ref + elif im.mode == "RGB": + decode_filter = "DCTDecode" + dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceRGB") + procset = "ImageC" # color images + elif im.mode == "RGBA": + decode_filter = "JPXDecode" + procset = "ImageC" # color images + dict_obj["SMaskInData"] = 1 + elif im.mode == "CMYK": + decode_filter = "DCTDecode" + dict_obj["ColorSpace"] = PdfParser.PdfName("DeviceCMYK") + procset = "ImageC" # color images + decode = [1, 0, 1, 0, 1, 0, 1, 0] + else: + msg = f"cannot save mode {im.mode}" + raise ValueError(msg) + + # + # image + + op = io.BytesIO() + + if decode_filter == "ASCIIHexDecode": + ImageFile._save(im, op, [ImageFile._Tile("hex", (0, 0) + im.size, 0, im.mode)]) + elif decode_filter == "CCITTFaxDecode": + im.save( + op, + "TIFF", + compression="group4", + # use a single strip + strip_size=math.ceil(width / 8) * height, + ) + elif decode_filter == "DCTDecode": + Image.SAVE["JPEG"](im, op, filename) + elif decode_filter == "JPXDecode": + del dict_obj["BitsPerComponent"] + Image.SAVE["JPEG2000"](im, op, filename) + else: + msg = f"unsupported PDF filter ({decode_filter})" + raise ValueError(msg) + + stream = op.getvalue() + filter: PdfParser.PdfArray | PdfParser.PdfName + if decode_filter == "CCITTFaxDecode": + stream = stream[8:] + filter = PdfParser.PdfArray([PdfParser.PdfName(decode_filter)]) + else: + filter = PdfParser.PdfName(decode_filter) + + image_ref = image_refs.pop(0) + existing_pdf.write_obj( + image_ref, + stream=stream, + Type=PdfParser.PdfName("XObject"), + Subtype=PdfParser.PdfName("Image"), + Width=width, # * 72.0 / x_resolution, + Height=height, # * 72.0 / y_resolution, + Filter=filter, + Decode=decode, + DecodeParms=params, + **dict_obj, + ) + + return image_ref, procset + + +def _save( + im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False +) -> None: + is_appending = im.encoderinfo.get("append", False) + filename_str = filename.decode() if isinstance(filename, bytes) else filename + if is_appending: + existing_pdf = PdfParser.PdfParser(f=fp, filename=filename_str, mode="r+b") + else: + existing_pdf = PdfParser.PdfParser(f=fp, filename=filename_str, mode="w+b") + + dpi = im.encoderinfo.get("dpi") + if dpi: + x_resolution = dpi[0] + y_resolution = dpi[1] + else: + x_resolution = y_resolution = im.encoderinfo.get("resolution", 72.0) + + info = { + "title": ( + None if is_appending else os.path.splitext(os.path.basename(filename))[0] + ), + "author": None, + "subject": None, + "keywords": None, + "creator": None, + "producer": None, + "creationDate": None if is_appending else time.gmtime(), + "modDate": None if is_appending else time.gmtime(), + } + for k, default in info.items(): + v = im.encoderinfo.get(k) if k in im.encoderinfo else default + if v: + existing_pdf.info[k[0].upper() + k[1:]] = v + + # + # make sure image data is available + im.load() + + existing_pdf.start_writing() + existing_pdf.write_header() + existing_pdf.write_comment("created by Pillow PDF driver") + + # + # pages + ims = [im] + if save_all: + append_images = im.encoderinfo.get("append_images", []) + for append_im in append_images: + append_im.encoderinfo = im.encoderinfo.copy() + ims.append(append_im) + number_of_pages = 0 + image_refs = [] + page_refs = [] + contents_refs = [] + for im in ims: + im_number_of_pages = 1 + if save_all: + im_number_of_pages = getattr(im, "n_frames", 1) + number_of_pages += im_number_of_pages + for i in range(im_number_of_pages): + image_refs.append(existing_pdf.next_object_id(0)) + if im.mode == "P" and "transparency" in im.info: + image_refs.append(existing_pdf.next_object_id(0)) + + page_refs.append(existing_pdf.next_object_id(0)) + contents_refs.append(existing_pdf.next_object_id(0)) + existing_pdf.pages.append(page_refs[-1]) + + # + # catalog and list of pages + existing_pdf.write_catalog() + + page_number = 0 + for im_sequence in ims: + im_pages: ImageSequence.Iterator | list[Image.Image] = ( + ImageSequence.Iterator(im_sequence) if save_all else [im_sequence] + ) + for im in im_pages: + image_ref, procset = _write_image(im, filename, existing_pdf, image_refs) + + # + # page + + existing_pdf.write_page( + page_refs[page_number], + Resources=PdfParser.PdfDict( + ProcSet=[PdfParser.PdfName("PDF"), PdfParser.PdfName(procset)], + XObject=PdfParser.PdfDict(image=image_ref), + ), + MediaBox=[ + 0, + 0, + im.width * 72.0 / x_resolution, + im.height * 72.0 / y_resolution, + ], + Contents=contents_refs[page_number], + ) + + # + # page contents + + page_contents = b"q %f 0 0 %f 0 0 cm /image Do Q\n" % ( + im.width * 72.0 / x_resolution, + im.height * 72.0 / y_resolution, + ) + + existing_pdf.write_obj(contents_refs[page_number], stream=page_contents) + + page_number += 1 + + # + # trailer + existing_pdf.write_xref_and_trailer() + if hasattr(fp, "flush"): + fp.flush() + existing_pdf.close() + + +# +# -------------------------------------------------------------------- + + +Image.register_save("PDF", _save) +Image.register_save_all("PDF", _save_all) + +Image.register_extension("PDF", ".pdf") + +Image.register_mime("PDF", "application/pdf") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PdfParser.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PdfParser.py new file mode 100644 index 0000000000000000000000000000000000000000..0a46af15c31788b3e3bd8848e6f49661c2fbd2ce --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PdfParser.py @@ -0,0 +1,1081 @@ +from __future__ import annotations + +import calendar +import codecs +import collections +import mmap +import os +import re +import time +import zlib +from typing import Any, NamedTuple + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import IO + + _DictBase = collections.UserDict[str | bytes, Any] +else: + _DictBase = collections.UserDict + + +# see 7.9.2.2 Text String Type on page 86 and D.3 PDFDocEncoding Character Set +# on page 656 +def encode_text(s: str) -> bytes: + return codecs.BOM_UTF16_BE + s.encode("utf_16_be") + + +PDFDocEncoding = { + 0x16: "\u0017", + 0x18: "\u02d8", + 0x19: "\u02c7", + 0x1A: "\u02c6", + 0x1B: "\u02d9", + 0x1C: "\u02dd", + 0x1D: "\u02db", + 0x1E: "\u02da", + 0x1F: "\u02dc", + 0x80: "\u2022", + 0x81: "\u2020", + 0x82: "\u2021", + 0x83: "\u2026", + 0x84: "\u2014", + 0x85: "\u2013", + 0x86: "\u0192", + 0x87: "\u2044", + 0x88: "\u2039", + 0x89: "\u203a", + 0x8A: "\u2212", + 0x8B: "\u2030", + 0x8C: "\u201e", + 0x8D: "\u201c", + 0x8E: "\u201d", + 0x8F: "\u2018", + 0x90: "\u2019", + 0x91: "\u201a", + 0x92: "\u2122", + 0x93: "\ufb01", + 0x94: "\ufb02", + 0x95: "\u0141", + 0x96: "\u0152", + 0x97: "\u0160", + 0x98: "\u0178", + 0x99: "\u017d", + 0x9A: "\u0131", + 0x9B: "\u0142", + 0x9C: "\u0153", + 0x9D: "\u0161", + 0x9E: "\u017e", + 0xA0: "\u20ac", +} + + +def decode_text(b: bytes) -> str: + if b[: len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE: + return b[len(codecs.BOM_UTF16_BE) :].decode("utf_16_be") + else: + return "".join(PDFDocEncoding.get(byte, chr(byte)) for byte in b) + + +class PdfFormatError(RuntimeError): + """An error that probably indicates a syntactic or semantic error in the + PDF file structure""" + + pass + + +def check_format_condition(condition: bool, error_message: str) -> None: + if not condition: + raise PdfFormatError(error_message) + + +class IndirectReferenceTuple(NamedTuple): + object_id: int + generation: int + + +class IndirectReference(IndirectReferenceTuple): + def __str__(self) -> str: + return f"{self.object_id} {self.generation} R" + + def __bytes__(self) -> bytes: + return self.__str__().encode("us-ascii") + + def __eq__(self, other: object) -> bool: + if self.__class__ is not other.__class__: + return False + assert isinstance(other, IndirectReference) + return other.object_id == self.object_id and other.generation == self.generation + + def __ne__(self, other: object) -> bool: + return not (self == other) + + def __hash__(self) -> int: + return hash((self.object_id, self.generation)) + + +class IndirectObjectDef(IndirectReference): + def __str__(self) -> str: + return f"{self.object_id} {self.generation} obj" + + +class XrefTable: + def __init__(self) -> None: + self.existing_entries: dict[int, tuple[int, int]] = ( + {} + ) # object ID => (offset, generation) + self.new_entries: dict[int, tuple[int, int]] = ( + {} + ) # object ID => (offset, generation) + self.deleted_entries = {0: 65536} # object ID => generation + self.reading_finished = False + + def __setitem__(self, key: int, value: tuple[int, int]) -> None: + if self.reading_finished: + self.new_entries[key] = value + else: + self.existing_entries[key] = value + if key in self.deleted_entries: + del self.deleted_entries[key] + + def __getitem__(self, key: int) -> tuple[int, int]: + try: + return self.new_entries[key] + except KeyError: + return self.existing_entries[key] + + def __delitem__(self, key: int) -> None: + if key in self.new_entries: + generation = self.new_entries[key][1] + 1 + del self.new_entries[key] + self.deleted_entries[key] = generation + elif key in self.existing_entries: + generation = self.existing_entries[key][1] + 1 + self.deleted_entries[key] = generation + elif key in self.deleted_entries: + generation = self.deleted_entries[key] + else: + msg = f"object ID {key} cannot be deleted because it doesn't exist" + raise IndexError(msg) + + def __contains__(self, key: int) -> bool: + return key in self.existing_entries or key in self.new_entries + + def __len__(self) -> int: + return len( + set(self.existing_entries.keys()) + | set(self.new_entries.keys()) + | set(self.deleted_entries.keys()) + ) + + def keys(self) -> set[int]: + return ( + set(self.existing_entries.keys()) - set(self.deleted_entries.keys()) + ) | set(self.new_entries.keys()) + + def write(self, f: IO[bytes]) -> int: + keys = sorted(set(self.new_entries.keys()) | set(self.deleted_entries.keys())) + deleted_keys = sorted(set(self.deleted_entries.keys())) + startxref = f.tell() + f.write(b"xref\n") + while keys: + # find a contiguous sequence of object IDs + prev: int | None = None + for index, key in enumerate(keys): + if prev is None or prev + 1 == key: + prev = key + else: + contiguous_keys = keys[:index] + keys = keys[index:] + break + else: + contiguous_keys = keys + keys = [] + f.write(b"%d %d\n" % (contiguous_keys[0], len(contiguous_keys))) + for object_id in contiguous_keys: + if object_id in self.new_entries: + f.write(b"%010d %05d n \n" % self.new_entries[object_id]) + else: + this_deleted_object_id = deleted_keys.pop(0) + check_format_condition( + object_id == this_deleted_object_id, + f"expected the next deleted object ID to be {object_id}, " + f"instead found {this_deleted_object_id}", + ) + try: + next_in_linked_list = deleted_keys[0] + except IndexError: + next_in_linked_list = 0 + f.write( + b"%010d %05d f \n" + % (next_in_linked_list, self.deleted_entries[object_id]) + ) + return startxref + + +class PdfName: + name: bytes + + def __init__(self, name: PdfName | bytes | str) -> None: + if isinstance(name, PdfName): + self.name = name.name + elif isinstance(name, bytes): + self.name = name + else: + self.name = name.encode("us-ascii") + + def name_as_str(self) -> str: + return self.name.decode("us-ascii") + + def __eq__(self, other: object) -> bool: + return ( + isinstance(other, PdfName) and other.name == self.name + ) or other == self.name + + def __hash__(self) -> int: + return hash(self.name) + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({repr(self.name)})" + + @classmethod + def from_pdf_stream(cls, data: bytes) -> PdfName: + return cls(PdfParser.interpret_name(data)) + + allowed_chars = set(range(33, 127)) - {ord(c) for c in "#%/()<>[]{}"} + + def __bytes__(self) -> bytes: + result = bytearray(b"/") + for b in self.name: + if b in self.allowed_chars: + result.append(b) + else: + result.extend(b"#%02X" % b) + return bytes(result) + + +class PdfArray(list[Any]): + def __bytes__(self) -> bytes: + return b"[ " + b" ".join(pdf_repr(x) for x in self) + b" ]" + + +class PdfDict(_DictBase): + def __setattr__(self, key: str, value: Any) -> None: + if key == "data": + collections.UserDict.__setattr__(self, key, value) + else: + self[key.encode("us-ascii")] = value + + def __getattr__(self, key: str) -> str | time.struct_time: + try: + value = self[key.encode("us-ascii")] + except KeyError as e: + raise AttributeError(key) from e + if isinstance(value, bytes): + value = decode_text(value) + if key.endswith("Date"): + if value.startswith("D:"): + value = value[2:] + + relationship = "Z" + if len(value) > 17: + relationship = value[14] + offset = int(value[15:17]) * 60 + if len(value) > 20: + offset += int(value[18:20]) + + format = "%Y%m%d%H%M%S"[: len(value) - 2] + value = time.strptime(value[: len(format) + 2], format) + if relationship in ["+", "-"]: + offset *= 60 + if relationship == "+": + offset *= -1 + value = time.gmtime(calendar.timegm(value) + offset) + return value + + def __bytes__(self) -> bytes: + out = bytearray(b"<<") + for key, value in self.items(): + if value is None: + continue + value = pdf_repr(value) + out.extend(b"\n") + out.extend(bytes(PdfName(key))) + out.extend(b" ") + out.extend(value) + out.extend(b"\n>>") + return bytes(out) + + +class PdfBinary: + def __init__(self, data: list[int] | bytes) -> None: + self.data = data + + def __bytes__(self) -> bytes: + return b"<%s>" % b"".join(b"%02X" % b for b in self.data) + + +class PdfStream: + def __init__(self, dictionary: PdfDict, buf: bytes) -> None: + self.dictionary = dictionary + self.buf = buf + + def decode(self) -> bytes: + try: + filter = self.dictionary[b"Filter"] + except KeyError: + return self.buf + if filter == b"FlateDecode": + try: + expected_length = self.dictionary[b"DL"] + except KeyError: + expected_length = self.dictionary[b"Length"] + return zlib.decompress(self.buf, bufsize=int(expected_length)) + else: + msg = f"stream filter {repr(filter)} unknown/unsupported" + raise NotImplementedError(msg) + + +def pdf_repr(x: Any) -> bytes: + if x is True: + return b"true" + elif x is False: + return b"false" + elif x is None: + return b"null" + elif isinstance(x, (PdfName, PdfDict, PdfArray, PdfBinary)): + return bytes(x) + elif isinstance(x, (int, float)): + return str(x).encode("us-ascii") + elif isinstance(x, time.struct_time): + return b"(D:" + time.strftime("%Y%m%d%H%M%SZ", x).encode("us-ascii") + b")" + elif isinstance(x, dict): + return bytes(PdfDict(x)) + elif isinstance(x, list): + return bytes(PdfArray(x)) + elif isinstance(x, str): + return pdf_repr(encode_text(x)) + elif isinstance(x, bytes): + # XXX escape more chars? handle binary garbage + x = x.replace(b"\\", b"\\\\") + x = x.replace(b"(", b"\\(") + x = x.replace(b")", b"\\)") + return b"(" + x + b")" + else: + return bytes(x) + + +class PdfParser: + """Based on + https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf + Supports PDF up to 1.4 + """ + + def __init__( + self, + filename: str | None = None, + f: IO[bytes] | None = None, + buf: bytes | bytearray | None = None, + start_offset: int = 0, + mode: str = "rb", + ) -> None: + if buf and f: + msg = "specify buf or f or filename, but not both buf and f" + raise RuntimeError(msg) + self.filename = filename + self.buf: bytes | bytearray | mmap.mmap | None = buf + self.f = f + self.start_offset = start_offset + self.should_close_buf = False + self.should_close_file = False + if filename is not None and f is None: + self.f = f = open(filename, mode) + self.should_close_file = True + if f is not None: + self.buf = self.get_buf_from_file(f) + self.should_close_buf = True + if not filename and hasattr(f, "name"): + self.filename = f.name + self.cached_objects: dict[IndirectReference, Any] = {} + self.root_ref: IndirectReference | None + self.info_ref: IndirectReference | None + self.pages_ref: IndirectReference | None + self.last_xref_section_offset: int | None + if self.buf: + self.read_pdf_info() + else: + self.file_size_total = self.file_size_this = 0 + self.root = PdfDict() + self.root_ref = None + self.info = PdfDict() + self.info_ref = None + self.page_tree_root = PdfDict() + self.pages: list[IndirectReference] = [] + self.orig_pages: list[IndirectReference] = [] + self.pages_ref = None + self.last_xref_section_offset = None + self.trailer_dict: dict[bytes, Any] = {} + self.xref_table = XrefTable() + self.xref_table.reading_finished = True + if f: + self.seek_end() + + def __enter__(self) -> PdfParser: + return self + + def __exit__(self, *args: object) -> None: + self.close() + + def start_writing(self) -> None: + self.close_buf() + self.seek_end() + + def close_buf(self) -> None: + if isinstance(self.buf, mmap.mmap): + self.buf.close() + self.buf = None + + def close(self) -> None: + if self.should_close_buf: + self.close_buf() + if self.f is not None and self.should_close_file: + self.f.close() + self.f = None + + def seek_end(self) -> None: + assert self.f is not None + self.f.seek(0, os.SEEK_END) + + def write_header(self) -> None: + assert self.f is not None + self.f.write(b"%PDF-1.4\n") + + def write_comment(self, s: str) -> None: + assert self.f is not None + self.f.write(f"% {s}\n".encode()) + + def write_catalog(self) -> IndirectReference: + assert self.f is not None + self.del_root() + self.root_ref = self.next_object_id(self.f.tell()) + self.pages_ref = self.next_object_id(0) + self.rewrite_pages() + self.write_obj(self.root_ref, Type=PdfName(b"Catalog"), Pages=self.pages_ref) + self.write_obj( + self.pages_ref, + Type=PdfName(b"Pages"), + Count=len(self.pages), + Kids=self.pages, + ) + return self.root_ref + + def rewrite_pages(self) -> None: + pages_tree_nodes_to_delete = [] + for i, page_ref in enumerate(self.orig_pages): + page_info = self.cached_objects[page_ref] + del self.xref_table[page_ref.object_id] + pages_tree_nodes_to_delete.append(page_info[PdfName(b"Parent")]) + if page_ref not in self.pages: + # the page has been deleted + continue + # make dict keys into strings for passing to write_page + stringified_page_info = {} + for key, value in page_info.items(): + # key should be a PdfName + stringified_page_info[key.name_as_str()] = value + stringified_page_info["Parent"] = self.pages_ref + new_page_ref = self.write_page(None, **stringified_page_info) + for j, cur_page_ref in enumerate(self.pages): + if cur_page_ref == page_ref: + # replace the page reference with the new one + self.pages[j] = new_page_ref + # delete redundant Pages tree nodes from xref table + for pages_tree_node_ref in pages_tree_nodes_to_delete: + while pages_tree_node_ref: + pages_tree_node = self.cached_objects[pages_tree_node_ref] + if pages_tree_node_ref.object_id in self.xref_table: + del self.xref_table[pages_tree_node_ref.object_id] + pages_tree_node_ref = pages_tree_node.get(b"Parent", None) + self.orig_pages = [] + + def write_xref_and_trailer( + self, new_root_ref: IndirectReference | None = None + ) -> None: + assert self.f is not None + if new_root_ref: + self.del_root() + self.root_ref = new_root_ref + if self.info: + self.info_ref = self.write_obj(None, self.info) + start_xref = self.xref_table.write(self.f) + num_entries = len(self.xref_table) + trailer_dict: dict[str | bytes, Any] = { + b"Root": self.root_ref, + b"Size": num_entries, + } + if self.last_xref_section_offset is not None: + trailer_dict[b"Prev"] = self.last_xref_section_offset + if self.info: + trailer_dict[b"Info"] = self.info_ref + self.last_xref_section_offset = start_xref + self.f.write( + b"trailer\n" + + bytes(PdfDict(trailer_dict)) + + b"\nstartxref\n%d\n%%%%EOF" % start_xref + ) + + def write_page( + self, ref: int | IndirectReference | None, *objs: Any, **dict_obj: Any + ) -> IndirectReference: + obj_ref = self.pages[ref] if isinstance(ref, int) else ref + if "Type" not in dict_obj: + dict_obj["Type"] = PdfName(b"Page") + if "Parent" not in dict_obj: + dict_obj["Parent"] = self.pages_ref + return self.write_obj(obj_ref, *objs, **dict_obj) + + def write_obj( + self, ref: IndirectReference | None, *objs: Any, **dict_obj: Any + ) -> IndirectReference: + assert self.f is not None + f = self.f + if ref is None: + ref = self.next_object_id(f.tell()) + else: + self.xref_table[ref.object_id] = (f.tell(), ref.generation) + f.write(bytes(IndirectObjectDef(*ref))) + stream = dict_obj.pop("stream", None) + if stream is not None: + dict_obj["Length"] = len(stream) + if dict_obj: + f.write(pdf_repr(dict_obj)) + for obj in objs: + f.write(pdf_repr(obj)) + if stream is not None: + f.write(b"stream\n") + f.write(stream) + f.write(b"\nendstream\n") + f.write(b"endobj\n") + return ref + + def del_root(self) -> None: + if self.root_ref is None: + return + del self.xref_table[self.root_ref.object_id] + del self.xref_table[self.root[b"Pages"].object_id] + + @staticmethod + def get_buf_from_file(f: IO[bytes]) -> bytes | mmap.mmap: + if hasattr(f, "getbuffer"): + return f.getbuffer() + elif hasattr(f, "getvalue"): + return f.getvalue() + else: + try: + return mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) + except ValueError: # cannot mmap an empty file + return b"" + + def read_pdf_info(self) -> None: + assert self.buf is not None + self.file_size_total = len(self.buf) + self.file_size_this = self.file_size_total - self.start_offset + self.read_trailer() + check_format_condition( + self.trailer_dict.get(b"Root") is not None, "Root is missing" + ) + self.root_ref = self.trailer_dict[b"Root"] + assert self.root_ref is not None + self.info_ref = self.trailer_dict.get(b"Info", None) + self.root = PdfDict(self.read_indirect(self.root_ref)) + if self.info_ref is None: + self.info = PdfDict() + else: + self.info = PdfDict(self.read_indirect(self.info_ref)) + check_format_condition(b"Type" in self.root, "/Type missing in Root") + check_format_condition( + self.root[b"Type"] == b"Catalog", "/Type in Root is not /Catalog" + ) + check_format_condition( + self.root.get(b"Pages") is not None, "/Pages missing in Root" + ) + check_format_condition( + isinstance(self.root[b"Pages"], IndirectReference), + "/Pages in Root is not an indirect reference", + ) + self.pages_ref = self.root[b"Pages"] + assert self.pages_ref is not None + self.page_tree_root = self.read_indirect(self.pages_ref) + self.pages = self.linearize_page_tree(self.page_tree_root) + # save the original list of page references + # in case the user modifies, adds or deletes some pages + # and we need to rewrite the pages and their list + self.orig_pages = self.pages[:] + + def next_object_id(self, offset: int | None = None) -> IndirectReference: + try: + # TODO: support reuse of deleted objects + reference = IndirectReference(max(self.xref_table.keys()) + 1, 0) + except ValueError: + reference = IndirectReference(1, 0) + if offset is not None: + self.xref_table[reference.object_id] = (offset, 0) + return reference + + delimiter = rb"[][()<>{}/%]" + delimiter_or_ws = rb"[][()<>{}/%\000\011\012\014\015\040]" + whitespace = rb"[\000\011\012\014\015\040]" + whitespace_or_hex = rb"[\000\011\012\014\015\0400-9a-fA-F]" + whitespace_optional = whitespace + b"*" + whitespace_mandatory = whitespace + b"+" + # No "\012" aka "\n" or "\015" aka "\r": + whitespace_optional_no_nl = rb"[\000\011\014\040]*" + newline_only = rb"[\r\n]+" + newline = whitespace_optional_no_nl + newline_only + whitespace_optional_no_nl + re_trailer_end = re.compile( + whitespace_mandatory + + rb"trailer" + + whitespace_optional + + rb"<<(.*>>)" + + newline + + rb"startxref" + + newline + + rb"([0-9]+)" + + newline + + rb"%%EOF" + + whitespace_optional + + rb"$", + re.DOTALL, + ) + re_trailer_prev = re.compile( + whitespace_optional + + rb"trailer" + + whitespace_optional + + rb"<<(.*?>>)" + + newline + + rb"startxref" + + newline + + rb"([0-9]+)" + + newline + + rb"%%EOF" + + whitespace_optional, + re.DOTALL, + ) + + def read_trailer(self) -> None: + assert self.buf is not None + search_start_offset = len(self.buf) - 16384 + if search_start_offset < self.start_offset: + search_start_offset = self.start_offset + m = self.re_trailer_end.search(self.buf, search_start_offset) + check_format_condition(m is not None, "trailer end not found") + # make sure we found the LAST trailer + last_match = m + while m: + last_match = m + m = self.re_trailer_end.search(self.buf, m.start() + 16) + if not m: + m = last_match + assert m is not None + trailer_data = m.group(1) + self.last_xref_section_offset = int(m.group(2)) + self.trailer_dict = self.interpret_trailer(trailer_data) + self.xref_table = XrefTable() + self.read_xref_table(xref_section_offset=self.last_xref_section_offset) + if b"Prev" in self.trailer_dict: + self.read_prev_trailer(self.trailer_dict[b"Prev"]) + + def read_prev_trailer( + self, xref_section_offset: int, processed_offsets: list[int] = [] + ) -> None: + assert self.buf is not None + trailer_offset = self.read_xref_table(xref_section_offset=xref_section_offset) + m = self.re_trailer_prev.search( + self.buf[trailer_offset : trailer_offset + 16384] + ) + check_format_condition(m is not None, "previous trailer not found") + assert m is not None + trailer_data = m.group(1) + check_format_condition( + int(m.group(2)) == xref_section_offset, + "xref section offset in previous trailer doesn't match what was expected", + ) + trailer_dict = self.interpret_trailer(trailer_data) + if b"Prev" in trailer_dict: + processed_offsets.append(xref_section_offset) + check_format_condition( + trailer_dict[b"Prev"] not in processed_offsets, "trailer loop found" + ) + self.read_prev_trailer(trailer_dict[b"Prev"], processed_offsets) + + re_whitespace_optional = re.compile(whitespace_optional) + re_name = re.compile( + whitespace_optional + + rb"/([!-$&'*-.0-;=?-Z\\^-z|~]+)(?=" + + delimiter_or_ws + + rb")" + ) + re_dict_start = re.compile(whitespace_optional + rb"<<") + re_dict_end = re.compile(whitespace_optional + rb">>" + whitespace_optional) + + @classmethod + def interpret_trailer(cls, trailer_data: bytes) -> dict[bytes, Any]: + trailer = {} + offset = 0 + while True: + m = cls.re_name.match(trailer_data, offset) + if not m: + m = cls.re_dict_end.match(trailer_data, offset) + check_format_condition( + m is not None and m.end() == len(trailer_data), + "name not found in trailer, remaining data: " + + repr(trailer_data[offset:]), + ) + break + key = cls.interpret_name(m.group(1)) + assert isinstance(key, bytes) + value, value_offset = cls.get_value(trailer_data, m.end()) + trailer[key] = value + if value_offset is None: + break + offset = value_offset + check_format_condition( + b"Size" in trailer and isinstance(trailer[b"Size"], int), + "/Size not in trailer or not an integer", + ) + check_format_condition( + b"Root" in trailer and isinstance(trailer[b"Root"], IndirectReference), + "/Root not in trailer or not an indirect reference", + ) + return trailer + + re_hashes_in_name = re.compile(rb"([^#]*)(#([0-9a-fA-F]{2}))?") + + @classmethod + def interpret_name(cls, raw: bytes, as_text: bool = False) -> str | bytes: + name = b"" + for m in cls.re_hashes_in_name.finditer(raw): + if m.group(3): + name += m.group(1) + bytearray.fromhex(m.group(3).decode("us-ascii")) + else: + name += m.group(1) + if as_text: + return name.decode("utf-8") + else: + return bytes(name) + + re_null = re.compile(whitespace_optional + rb"null(?=" + delimiter_or_ws + rb")") + re_true = re.compile(whitespace_optional + rb"true(?=" + delimiter_or_ws + rb")") + re_false = re.compile(whitespace_optional + rb"false(?=" + delimiter_or_ws + rb")") + re_int = re.compile( + whitespace_optional + rb"([-+]?[0-9]+)(?=" + delimiter_or_ws + rb")" + ) + re_real = re.compile( + whitespace_optional + + rb"([-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+))(?=" + + delimiter_or_ws + + rb")" + ) + re_array_start = re.compile(whitespace_optional + rb"\[") + re_array_end = re.compile(whitespace_optional + rb"]") + re_string_hex = re.compile( + whitespace_optional + rb"<(" + whitespace_or_hex + rb"*)>" + ) + re_string_lit = re.compile(whitespace_optional + rb"\(") + re_indirect_reference = re.compile( + whitespace_optional + + rb"([-+]?[0-9]+)" + + whitespace_mandatory + + rb"([-+]?[0-9]+)" + + whitespace_mandatory + + rb"R(?=" + + delimiter_or_ws + + rb")" + ) + re_indirect_def_start = re.compile( + whitespace_optional + + rb"([-+]?[0-9]+)" + + whitespace_mandatory + + rb"([-+]?[0-9]+)" + + whitespace_mandatory + + rb"obj(?=" + + delimiter_or_ws + + rb")" + ) + re_indirect_def_end = re.compile( + whitespace_optional + rb"endobj(?=" + delimiter_or_ws + rb")" + ) + re_comment = re.compile( + rb"(" + whitespace_optional + rb"%[^\r\n]*" + newline + rb")*" + ) + re_stream_start = re.compile(whitespace_optional + rb"stream\r?\n") + re_stream_end = re.compile( + whitespace_optional + rb"endstream(?=" + delimiter_or_ws + rb")" + ) + + @classmethod + def get_value( + cls, + data: bytes | bytearray | mmap.mmap, + offset: int, + expect_indirect: IndirectReference | None = None, + max_nesting: int = -1, + ) -> tuple[Any, int | None]: + if max_nesting == 0: + return None, None + m = cls.re_comment.match(data, offset) + if m: + offset = m.end() + m = cls.re_indirect_def_start.match(data, offset) + if m: + check_format_condition( + int(m.group(1)) > 0, + "indirect object definition: object ID must be greater than 0", + ) + check_format_condition( + int(m.group(2)) >= 0, + "indirect object definition: generation must be non-negative", + ) + check_format_condition( + expect_indirect is None + or expect_indirect + == IndirectReference(int(m.group(1)), int(m.group(2))), + "indirect object definition different than expected", + ) + object, object_offset = cls.get_value( + data, m.end(), max_nesting=max_nesting - 1 + ) + if object_offset is None: + return object, None + m = cls.re_indirect_def_end.match(data, object_offset) + check_format_condition( + m is not None, "indirect object definition end not found" + ) + assert m is not None + return object, m.end() + check_format_condition( + not expect_indirect, "indirect object definition not found" + ) + m = cls.re_indirect_reference.match(data, offset) + if m: + check_format_condition( + int(m.group(1)) > 0, + "indirect object reference: object ID must be greater than 0", + ) + check_format_condition( + int(m.group(2)) >= 0, + "indirect object reference: generation must be non-negative", + ) + return IndirectReference(int(m.group(1)), int(m.group(2))), m.end() + m = cls.re_dict_start.match(data, offset) + if m: + offset = m.end() + result: dict[Any, Any] = {} + m = cls.re_dict_end.match(data, offset) + current_offset: int | None = offset + while not m: + assert current_offset is not None + key, current_offset = cls.get_value( + data, current_offset, max_nesting=max_nesting - 1 + ) + if current_offset is None: + return result, None + value, current_offset = cls.get_value( + data, current_offset, max_nesting=max_nesting - 1 + ) + result[key] = value + if current_offset is None: + return result, None + m = cls.re_dict_end.match(data, current_offset) + current_offset = m.end() + m = cls.re_stream_start.match(data, current_offset) + if m: + stream_len = result.get(b"Length") + if stream_len is None or not isinstance(stream_len, int): + msg = f"bad or missing Length in stream dict ({stream_len})" + raise PdfFormatError(msg) + stream_data = data[m.end() : m.end() + stream_len] + m = cls.re_stream_end.match(data, m.end() + stream_len) + check_format_condition(m is not None, "stream end not found") + assert m is not None + current_offset = m.end() + return PdfStream(PdfDict(result), stream_data), current_offset + return PdfDict(result), current_offset + m = cls.re_array_start.match(data, offset) + if m: + offset = m.end() + results = [] + m = cls.re_array_end.match(data, offset) + current_offset = offset + while not m: + assert current_offset is not None + value, current_offset = cls.get_value( + data, current_offset, max_nesting=max_nesting - 1 + ) + results.append(value) + if current_offset is None: + return results, None + m = cls.re_array_end.match(data, current_offset) + return results, m.end() + m = cls.re_null.match(data, offset) + if m: + return None, m.end() + m = cls.re_true.match(data, offset) + if m: + return True, m.end() + m = cls.re_false.match(data, offset) + if m: + return False, m.end() + m = cls.re_name.match(data, offset) + if m: + return PdfName(cls.interpret_name(m.group(1))), m.end() + m = cls.re_int.match(data, offset) + if m: + return int(m.group(1)), m.end() + m = cls.re_real.match(data, offset) + if m: + # XXX Decimal instead of float??? + return float(m.group(1)), m.end() + m = cls.re_string_hex.match(data, offset) + if m: + # filter out whitespace + hex_string = bytearray( + b for b in m.group(1) if b in b"0123456789abcdefABCDEF" + ) + if len(hex_string) % 2 == 1: + # append a 0 if the length is not even - yes, at the end + hex_string.append(ord(b"0")) + return bytearray.fromhex(hex_string.decode("us-ascii")), m.end() + m = cls.re_string_lit.match(data, offset) + if m: + return cls.get_literal_string(data, m.end()) + # return None, offset # fallback (only for debugging) + msg = f"unrecognized object: {repr(data[offset : offset + 32])}" + raise PdfFormatError(msg) + + re_lit_str_token = re.compile( + rb"(\\[nrtbf()\\])|(\\[0-9]{1,3})|(\\(\r\n|\r|\n))|(\r\n|\r|\n)|(\()|(\))" + ) + escaped_chars = { + b"n": b"\n", + b"r": b"\r", + b"t": b"\t", + b"b": b"\b", + b"f": b"\f", + b"(": b"(", + b")": b")", + b"\\": b"\\", + ord(b"n"): b"\n", + ord(b"r"): b"\r", + ord(b"t"): b"\t", + ord(b"b"): b"\b", + ord(b"f"): b"\f", + ord(b"("): b"(", + ord(b")"): b")", + ord(b"\\"): b"\\", + } + + @classmethod + def get_literal_string( + cls, data: bytes | bytearray | mmap.mmap, offset: int + ) -> tuple[bytes, int]: + nesting_depth = 0 + result = bytearray() + for m in cls.re_lit_str_token.finditer(data, offset): + result.extend(data[offset : m.start()]) + if m.group(1): + result.extend(cls.escaped_chars[m.group(1)[1]]) + elif m.group(2): + result.append(int(m.group(2)[1:], 8)) + elif m.group(3): + pass + elif m.group(5): + result.extend(b"\n") + elif m.group(6): + result.extend(b"(") + nesting_depth += 1 + elif m.group(7): + if nesting_depth == 0: + return bytes(result), m.end() + result.extend(b")") + nesting_depth -= 1 + offset = m.end() + msg = "unfinished literal string" + raise PdfFormatError(msg) + + re_xref_section_start = re.compile(whitespace_optional + rb"xref" + newline) + re_xref_subsection_start = re.compile( + whitespace_optional + + rb"([0-9]+)" + + whitespace_mandatory + + rb"([0-9]+)" + + whitespace_optional + + newline_only + ) + re_xref_entry = re.compile(rb"([0-9]{10}) ([0-9]{5}) ([fn])( \r| \n|\r\n)") + + def read_xref_table(self, xref_section_offset: int) -> int: + assert self.buf is not None + subsection_found = False + m = self.re_xref_section_start.match( + self.buf, xref_section_offset + self.start_offset + ) + check_format_condition(m is not None, "xref section start not found") + assert m is not None + offset = m.end() + while True: + m = self.re_xref_subsection_start.match(self.buf, offset) + if not m: + check_format_condition( + subsection_found, "xref subsection start not found" + ) + break + subsection_found = True + offset = m.end() + first_object = int(m.group(1)) + num_objects = int(m.group(2)) + for i in range(first_object, first_object + num_objects): + m = self.re_xref_entry.match(self.buf, offset) + check_format_condition(m is not None, "xref entry not found") + assert m is not None + offset = m.end() + is_free = m.group(3) == b"f" + if not is_free: + generation = int(m.group(2)) + new_entry = (int(m.group(1)), generation) + if i not in self.xref_table: + self.xref_table[i] = new_entry + return offset + + def read_indirect(self, ref: IndirectReference, max_nesting: int = -1) -> Any: + offset, generation = self.xref_table[ref[0]] + check_format_condition( + generation == ref[1], + f"expected to find generation {ref[1]} for object ID {ref[0]} in xref " + f"table, instead found generation {generation} at offset {offset}", + ) + assert self.buf is not None + value = self.get_value( + self.buf, + offset + self.start_offset, + expect_indirect=IndirectReference(*ref), + max_nesting=max_nesting, + )[0] + self.cached_objects[ref] = value + return value + + def linearize_page_tree( + self, node: PdfDict | None = None + ) -> list[IndirectReference]: + page_node = node if node is not None else self.page_tree_root + check_format_condition( + page_node[b"Type"] == b"Pages", "/Type of page tree node is not /Pages" + ) + pages = [] + for kid in page_node[b"Kids"]: + kid_object = self.read_indirect(kid) + if kid_object[b"Type"] == b"Page": + pages.append(kid) + else: + pages.extend(self.linearize_page_tree(node=kid_object)) + return pages diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PixarImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PixarImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..5e3a2ff03bc34a9f2173c3f9baba896e768a533f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PixarImagePlugin.py @@ -0,0 +1,72 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PIXAR raster support for PIL +# +# history: +# 97-01-29 fl Created +# +# notes: +# This is incomplete; it is based on a few samples created with +# Photoshop 2.5 and 3.0, and a summary description provided by +# Greg Coats . Hopefully, "L" and +# "RGBA" support will be added in future versions. +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1997. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image, ImageFile +from ._binary import i16le as i16 + +# +# helpers + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"\200\350\000\000") + + +## +# Image plugin for PIXAR raster images. + + +class PixarImageFile(ImageFile.ImageFile): + format = "PIXAR" + format_description = "PIXAR raster image" + + def _open(self) -> None: + # assuming a 4-byte magic label + assert self.fp is not None + + s = self.fp.read(4) + if not _accept(s): + msg = "not a PIXAR file" + raise SyntaxError(msg) + + # read rest of header + s = s + self.fp.read(508) + + self._size = i16(s, 418), i16(s, 416) + + # get channel/depth descriptions + mode = i16(s, 424), i16(s, 426) + + if mode == (14, 2): + self._mode = "RGB" + # FIXME: to be continued... + + # create tile descriptor (assuming "dumped") + self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 1024, self.mode)] + + +# +# -------------------------------------------------------------------- + +Image.register_open(PixarImageFile.format, PixarImageFile, _accept) + +Image.register_extension(PixarImageFile.format, ".pxr") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PngImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PngImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..50027970a7dc698de6af733f07397403e1d7f872 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PngImagePlugin.py @@ -0,0 +1,1563 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PNG support code +# +# See "PNG (Portable Network Graphics) Specification, version 1.0; +# W3C Recommendation", 1996-10-01, Thomas Boutell (ed.). +# +# history: +# 1996-05-06 fl Created (couldn't resist it) +# 1996-12-14 fl Upgraded, added read and verify support (0.2) +# 1996-12-15 fl Separate PNG stream parser +# 1996-12-29 fl Added write support, added getchunks +# 1996-12-30 fl Eliminated circular references in decoder (0.3) +# 1998-07-12 fl Read/write 16-bit images as mode I (0.4) +# 2001-02-08 fl Added transparency support (from Zircon) (0.5) +# 2001-04-16 fl Don't close data source in "open" method (0.6) +# 2004-02-24 fl Don't even pretend to support interlaced files (0.7) +# 2004-08-31 fl Do basic sanity check on chunk identifiers (0.8) +# 2004-09-20 fl Added PngInfo chunk container +# 2004-12-18 fl Added DPI read support (based on code by Niki Spahiev) +# 2008-08-13 fl Added tRNS support for RGB images +# 2009-03-06 fl Support for preserving ICC profiles (by Florian Hoech) +# 2009-03-08 fl Added zTXT support (from Lowell Alleman) +# 2009-03-29 fl Read interlaced PNG files (from Conrado Porto Lopes Gouvua) +# +# Copyright (c) 1997-2009 by Secret Labs AB +# Copyright (c) 1996 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import itertools +import logging +import re +import struct +import warnings +import zlib +from enum import IntEnum +from fractions import Fraction +from typing import IO, NamedTuple, cast + +from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence +from ._binary import i16be as i16 +from ._binary import i32be as i32 +from ._binary import o8 +from ._binary import o16be as o16 +from ._binary import o32be as o32 +from ._deprecate import deprecate +from ._util import DeferredError + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Callable + from typing import Any, NoReturn + + from . import _imaging + +logger = logging.getLogger(__name__) + +is_cid = re.compile(rb"\w\w\w\w").match + + +_MAGIC = b"\211PNG\r\n\032\n" + + +_MODES = { + # supported bits/color combinations, and corresponding modes/rawmodes + # Grayscale + (1, 0): ("1", "1"), + (2, 0): ("L", "L;2"), + (4, 0): ("L", "L;4"), + (8, 0): ("L", "L"), + (16, 0): ("I;16", "I;16B"), + # Truecolour + (8, 2): ("RGB", "RGB"), + (16, 2): ("RGB", "RGB;16B"), + # Indexed-colour + (1, 3): ("P", "P;1"), + (2, 3): ("P", "P;2"), + (4, 3): ("P", "P;4"), + (8, 3): ("P", "P"), + # Grayscale with alpha + (8, 4): ("LA", "LA"), + (16, 4): ("RGBA", "LA;16B"), # LA;16B->LA not yet available + # Truecolour with alpha + (8, 6): ("RGBA", "RGBA"), + (16, 6): ("RGBA", "RGBA;16B"), +} + + +_simple_palette = re.compile(b"^\xff*\x00\xff*$") + +MAX_TEXT_CHUNK = ImageFile.SAFEBLOCK +""" +Maximum decompressed size for a iTXt or zTXt chunk. +Eliminates decompression bombs where compressed chunks can expand 1000x. +See :ref:`Text in PNG File Format`. +""" +MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK +""" +Set the maximum total text chunk size. +See :ref:`Text in PNG File Format`. +""" + + +# APNG frame disposal modes +class Disposal(IntEnum): + OP_NONE = 0 + """ + No disposal is done on this frame before rendering the next frame. + See :ref:`Saving APNG sequences`. + """ + OP_BACKGROUND = 1 + """ + This frame’s modified region is cleared to fully transparent black before rendering + the next frame. + See :ref:`Saving APNG sequences`. + """ + OP_PREVIOUS = 2 + """ + This frame’s modified region is reverted to the previous frame’s contents before + rendering the next frame. + See :ref:`Saving APNG sequences`. + """ + + +# APNG frame blend modes +class Blend(IntEnum): + OP_SOURCE = 0 + """ + All color components of this frame, including alpha, overwrite the previous output + image contents. + See :ref:`Saving APNG sequences`. + """ + OP_OVER = 1 + """ + This frame should be alpha composited with the previous output image contents. + See :ref:`Saving APNG sequences`. + """ + + +def _safe_zlib_decompress(s: bytes) -> bytes: + dobj = zlib.decompressobj() + plaintext = dobj.decompress(s, MAX_TEXT_CHUNK) + if dobj.unconsumed_tail: + msg = "Decompressed data too large for PngImagePlugin.MAX_TEXT_CHUNK" + raise ValueError(msg) + return plaintext + + +def _crc32(data: bytes, seed: int = 0) -> int: + return zlib.crc32(data, seed) & 0xFFFFFFFF + + +# -------------------------------------------------------------------- +# Support classes. Suitable for PNG and related formats like MNG etc. + + +class ChunkStream: + def __init__(self, fp: IO[bytes]) -> None: + self.fp: IO[bytes] | None = fp + self.queue: list[tuple[bytes, int, int]] | None = [] + + def read(self) -> tuple[bytes, int, int]: + """Fetch a new chunk. Returns header information.""" + cid = None + + assert self.fp is not None + if self.queue: + cid, pos, length = self.queue.pop() + self.fp.seek(pos) + else: + s = self.fp.read(8) + cid = s[4:] + pos = self.fp.tell() + length = i32(s) + + if not is_cid(cid): + if not ImageFile.LOAD_TRUNCATED_IMAGES: + msg = f"broken PNG file (chunk {repr(cid)})" + raise SyntaxError(msg) + + return cid, pos, length + + def __enter__(self) -> ChunkStream: + return self + + def __exit__(self, *args: object) -> None: + self.close() + + def close(self) -> None: + self.queue = self.fp = None + + def push(self, cid: bytes, pos: int, length: int) -> None: + assert self.queue is not None + self.queue.append((cid, pos, length)) + + def call(self, cid: bytes, pos: int, length: int) -> bytes: + """Call the appropriate chunk handler""" + + logger.debug("STREAM %r %s %s", cid, pos, length) + return getattr(self, f"chunk_{cid.decode('ascii')}")(pos, length) + + def crc(self, cid: bytes, data: bytes) -> None: + """Read and verify checksum""" + + # Skip CRC checks for ancillary chunks if allowed to load truncated + # images + # 5th byte of first char is 1 [specs, section 5.4] + if ImageFile.LOAD_TRUNCATED_IMAGES and (cid[0] >> 5 & 1): + self.crc_skip(cid, data) + return + + assert self.fp is not None + try: + crc1 = _crc32(data, _crc32(cid)) + crc2 = i32(self.fp.read(4)) + if crc1 != crc2: + msg = f"broken PNG file (bad header checksum in {repr(cid)})" + raise SyntaxError(msg) + except struct.error as e: + msg = f"broken PNG file (incomplete checksum in {repr(cid)})" + raise SyntaxError(msg) from e + + def crc_skip(self, cid: bytes, data: bytes) -> None: + """Read checksum""" + + assert self.fp is not None + self.fp.read(4) + + def verify(self, endchunk: bytes = b"IEND") -> list[bytes]: + # Simple approach; just calculate checksum for all remaining + # blocks. Must be called directly after open. + + cids = [] + + assert self.fp is not None + while True: + try: + cid, pos, length = self.read() + except struct.error as e: + msg = "truncated PNG file" + raise OSError(msg) from e + + if cid == endchunk: + break + self.crc(cid, ImageFile._safe_read(self.fp, length)) + cids.append(cid) + + return cids + + +class iTXt(str): + """ + Subclass of string to allow iTXt chunks to look like strings while + keeping their extra information + + """ + + lang: str | bytes | None + tkey: str | bytes | None + + @staticmethod + def __new__( + cls, text: str, lang: str | None = None, tkey: str | None = None + ) -> iTXt: + """ + :param cls: the class to use when creating the instance + :param text: value for this key + :param lang: language code + :param tkey: UTF-8 version of the key name + """ + + self = str.__new__(cls, text) + self.lang = lang + self.tkey = tkey + return self + + +class PngInfo: + """ + PNG chunk container (for use with save(pnginfo=)) + + """ + + def __init__(self) -> None: + self.chunks: list[tuple[bytes, bytes, bool]] = [] + + def add(self, cid: bytes, data: bytes, after_idat: bool = False) -> None: + """Appends an arbitrary chunk. Use with caution. + + :param cid: a byte string, 4 bytes long. + :param data: a byte string of the encoded data + :param after_idat: for use with private chunks. Whether the chunk + should be written after IDAT + + """ + + self.chunks.append((cid, data, after_idat)) + + def add_itxt( + self, + key: str | bytes, + value: str | bytes, + lang: str | bytes = "", + tkey: str | bytes = "", + zip: bool = False, + ) -> None: + """Appends an iTXt chunk. + + :param key: latin-1 encodable text key name + :param value: value for this key + :param lang: language code + :param tkey: UTF-8 version of the key name + :param zip: compression flag + + """ + + if not isinstance(key, bytes): + key = key.encode("latin-1", "strict") + if not isinstance(value, bytes): + value = value.encode("utf-8", "strict") + if not isinstance(lang, bytes): + lang = lang.encode("utf-8", "strict") + if not isinstance(tkey, bytes): + tkey = tkey.encode("utf-8", "strict") + + if zip: + self.add( + b"iTXt", + key + b"\0\x01\0" + lang + b"\0" + tkey + b"\0" + zlib.compress(value), + ) + else: + self.add(b"iTXt", key + b"\0\0\0" + lang + b"\0" + tkey + b"\0" + value) + + def add_text( + self, key: str | bytes, value: str | bytes | iTXt, zip: bool = False + ) -> None: + """Appends a text chunk. + + :param key: latin-1 encodable text key name + :param value: value for this key, text or an + :py:class:`PIL.PngImagePlugin.iTXt` instance + :param zip: compression flag + + """ + if isinstance(value, iTXt): + return self.add_itxt( + key, + value, + value.lang if value.lang is not None else b"", + value.tkey if value.tkey is not None else b"", + zip=zip, + ) + + # The tEXt chunk stores latin-1 text + if not isinstance(value, bytes): + try: + value = value.encode("latin-1", "strict") + except UnicodeError: + return self.add_itxt(key, value, zip=zip) + + if not isinstance(key, bytes): + key = key.encode("latin-1", "strict") + + if zip: + self.add(b"zTXt", key + b"\0\0" + zlib.compress(value)) + else: + self.add(b"tEXt", key + b"\0" + value) + + +# -------------------------------------------------------------------- +# PNG image stream (IHDR/IEND) + + +class _RewindState(NamedTuple): + info: dict[str | tuple[int, int], Any] + tile: list[ImageFile._Tile] + seq_num: int | None + + +class PngStream(ChunkStream): + def __init__(self, fp: IO[bytes]) -> None: + super().__init__(fp) + + # local copies of Image attributes + self.im_info: dict[str | tuple[int, int], Any] = {} + self.im_text: dict[str, str | iTXt] = {} + self.im_size = (0, 0) + self.im_mode = "" + self.im_tile: list[ImageFile._Tile] = [] + self.im_palette: tuple[str, bytes] | None = None + self.im_custom_mimetype: str | None = None + self.im_n_frames: int | None = None + self._seq_num: int | None = None + self.rewind_state = _RewindState({}, [], None) + + self.text_memory = 0 + + def check_text_memory(self, chunklen: int) -> None: + self.text_memory += chunklen + if self.text_memory > MAX_TEXT_MEMORY: + msg = ( + "Too much memory used in text chunks: " + f"{self.text_memory}>MAX_TEXT_MEMORY" + ) + raise ValueError(msg) + + def save_rewind(self) -> None: + self.rewind_state = _RewindState( + self.im_info.copy(), + self.im_tile, + self._seq_num, + ) + + def rewind(self) -> None: + self.im_info = self.rewind_state.info.copy() + self.im_tile = self.rewind_state.tile + self._seq_num = self.rewind_state.seq_num + + def chunk_iCCP(self, pos: int, length: int) -> bytes: + # ICC profile + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + # according to PNG spec, the iCCP chunk contains: + # Profile name 1-79 bytes (character string) + # Null separator 1 byte (null character) + # Compression method 1 byte (0) + # Compressed profile n bytes (zlib with deflate compression) + i = s.find(b"\0") + logger.debug("iCCP profile name %r", s[:i]) + comp_method = s[i + 1] + logger.debug("Compression method %s", comp_method) + if comp_method != 0: + msg = f"Unknown compression method {comp_method} in iCCP chunk" + raise SyntaxError(msg) + try: + icc_profile = _safe_zlib_decompress(s[i + 2 :]) + except ValueError: + if ImageFile.LOAD_TRUNCATED_IMAGES: + icc_profile = None + else: + raise + except zlib.error: + icc_profile = None # FIXME + self.im_info["icc_profile"] = icc_profile + return s + + def chunk_IHDR(self, pos: int, length: int) -> bytes: + # image header + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if length < 13: + if ImageFile.LOAD_TRUNCATED_IMAGES: + return s + msg = "Truncated IHDR chunk" + raise ValueError(msg) + self.im_size = i32(s, 0), i32(s, 4) + try: + self.im_mode, self.im_rawmode = _MODES[(s[8], s[9])] + except Exception: + pass + if s[12]: + self.im_info["interlace"] = 1 + if s[11]: + msg = "unknown filter category" + raise SyntaxError(msg) + return s + + def chunk_IDAT(self, pos: int, length: int) -> NoReturn: + # image data + if "bbox" in self.im_info: + tile = [ImageFile._Tile("zip", self.im_info["bbox"], pos, self.im_rawmode)] + else: + if self.im_n_frames is not None: + self.im_info["default_image"] = True + tile = [ImageFile._Tile("zip", (0, 0) + self.im_size, pos, self.im_rawmode)] + self.im_tile = tile + self.im_idat = length + msg = "image data found" + raise EOFError(msg) + + def chunk_IEND(self, pos: int, length: int) -> NoReturn: + msg = "end of PNG image" + raise EOFError(msg) + + def chunk_PLTE(self, pos: int, length: int) -> bytes: + # palette + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if self.im_mode == "P": + self.im_palette = "RGB", s + return s + + def chunk_tRNS(self, pos: int, length: int) -> bytes: + # transparency + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if self.im_mode == "P": + if _simple_palette.match(s): + # tRNS contains only one full-transparent entry, + # other entries are full opaque + i = s.find(b"\0") + if i >= 0: + self.im_info["transparency"] = i + else: + # otherwise, we have a byte string with one alpha value + # for each palette entry + self.im_info["transparency"] = s + elif self.im_mode == "1": + self.im_info["transparency"] = 255 if i16(s) else 0 + elif self.im_mode in ("L", "I;16"): + self.im_info["transparency"] = i16(s) + elif self.im_mode == "RGB": + self.im_info["transparency"] = i16(s), i16(s, 2), i16(s, 4) + return s + + def chunk_gAMA(self, pos: int, length: int) -> bytes: + # gamma setting + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + self.im_info["gamma"] = i32(s) / 100000.0 + return s + + def chunk_cHRM(self, pos: int, length: int) -> bytes: + # chromaticity, 8 unsigned ints, actual value is scaled by 100,000 + # WP x,y, Red x,y, Green x,y Blue x,y + + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + raw_vals = struct.unpack(f">{len(s) // 4}I", s) + self.im_info["chromaticity"] = tuple(elt / 100000.0 for elt in raw_vals) + return s + + def chunk_sRGB(self, pos: int, length: int) -> bytes: + # srgb rendering intent, 1 byte + # 0 perceptual + # 1 relative colorimetric + # 2 saturation + # 3 absolute colorimetric + + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if length < 1: + if ImageFile.LOAD_TRUNCATED_IMAGES: + return s + msg = "Truncated sRGB chunk" + raise ValueError(msg) + self.im_info["srgb"] = s[0] + return s + + def chunk_pHYs(self, pos: int, length: int) -> bytes: + # pixels per unit + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if length < 9: + if ImageFile.LOAD_TRUNCATED_IMAGES: + return s + msg = "Truncated pHYs chunk" + raise ValueError(msg) + px, py = i32(s, 0), i32(s, 4) + unit = s[8] + if unit == 1: # meter + dpi = px * 0.0254, py * 0.0254 + self.im_info["dpi"] = dpi + elif unit == 0: + self.im_info["aspect"] = px, py + return s + + def chunk_tEXt(self, pos: int, length: int) -> bytes: + # text + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + try: + k, v = s.split(b"\0", 1) + except ValueError: + # fallback for broken tEXt tags + k = s + v = b"" + if k: + k_str = k.decode("latin-1", "strict") + v_str = v.decode("latin-1", "replace") + + self.im_info[k_str] = v if k == b"exif" else v_str + self.im_text[k_str] = v_str + self.check_text_memory(len(v_str)) + + return s + + def chunk_zTXt(self, pos: int, length: int) -> bytes: + # compressed text + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + try: + k, v = s.split(b"\0", 1) + except ValueError: + k = s + v = b"" + if v: + comp_method = v[0] + else: + comp_method = 0 + if comp_method != 0: + msg = f"Unknown compression method {comp_method} in zTXt chunk" + raise SyntaxError(msg) + try: + v = _safe_zlib_decompress(v[1:]) + except ValueError: + if ImageFile.LOAD_TRUNCATED_IMAGES: + v = b"" + else: + raise + except zlib.error: + v = b"" + + if k: + k_str = k.decode("latin-1", "strict") + v_str = v.decode("latin-1", "replace") + + self.im_info[k_str] = self.im_text[k_str] = v_str + self.check_text_memory(len(v_str)) + + return s + + def chunk_iTXt(self, pos: int, length: int) -> bytes: + # international text + assert self.fp is not None + r = s = ImageFile._safe_read(self.fp, length) + try: + k, r = r.split(b"\0", 1) + except ValueError: + return s + if len(r) < 2: + return s + cf, cm, r = r[0], r[1], r[2:] + try: + lang, tk, v = r.split(b"\0", 2) + except ValueError: + return s + if cf != 0: + if cm == 0: + try: + v = _safe_zlib_decompress(v) + except ValueError: + if ImageFile.LOAD_TRUNCATED_IMAGES: + return s + else: + raise + except zlib.error: + return s + else: + return s + if k == b"XML:com.adobe.xmp": + self.im_info["xmp"] = v + try: + k_str = k.decode("latin-1", "strict") + lang_str = lang.decode("utf-8", "strict") + tk_str = tk.decode("utf-8", "strict") + v_str = v.decode("utf-8", "strict") + except UnicodeError: + return s + + self.im_info[k_str] = self.im_text[k_str] = iTXt(v_str, lang_str, tk_str) + self.check_text_memory(len(v_str)) + + return s + + def chunk_eXIf(self, pos: int, length: int) -> bytes: + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + self.im_info["exif"] = b"Exif\x00\x00" + s + return s + + # APNG chunks + def chunk_acTL(self, pos: int, length: int) -> bytes: + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if length < 8: + if ImageFile.LOAD_TRUNCATED_IMAGES: + return s + msg = "APNG contains truncated acTL chunk" + raise ValueError(msg) + if self.im_n_frames is not None: + self.im_n_frames = None + warnings.warn("Invalid APNG, will use default PNG image if possible") + return s + n_frames = i32(s) + if n_frames == 0 or n_frames > 0x80000000: + warnings.warn("Invalid APNG, will use default PNG image if possible") + return s + self.im_n_frames = n_frames + self.im_info["loop"] = i32(s, 4) + self.im_custom_mimetype = "image/apng" + return s + + def chunk_fcTL(self, pos: int, length: int) -> bytes: + assert self.fp is not None + s = ImageFile._safe_read(self.fp, length) + if length < 26: + if ImageFile.LOAD_TRUNCATED_IMAGES: + return s + msg = "APNG contains truncated fcTL chunk" + raise ValueError(msg) + seq = i32(s) + if (self._seq_num is None and seq != 0) or ( + self._seq_num is not None and self._seq_num != seq - 1 + ): + msg = "APNG contains frame sequence errors" + raise SyntaxError(msg) + self._seq_num = seq + width, height = i32(s, 4), i32(s, 8) + px, py = i32(s, 12), i32(s, 16) + im_w, im_h = self.im_size + if px + width > im_w or py + height > im_h: + msg = "APNG contains invalid frames" + raise SyntaxError(msg) + self.im_info["bbox"] = (px, py, px + width, py + height) + delay_num, delay_den = i16(s, 20), i16(s, 22) + if delay_den == 0: + delay_den = 100 + self.im_info["duration"] = float(delay_num) / float(delay_den) * 1000 + self.im_info["disposal"] = s[24] + self.im_info["blend"] = s[25] + return s + + def chunk_fdAT(self, pos: int, length: int) -> bytes: + assert self.fp is not None + if length < 4: + if ImageFile.LOAD_TRUNCATED_IMAGES: + s = ImageFile._safe_read(self.fp, length) + return s + msg = "APNG contains truncated fDAT chunk" + raise ValueError(msg) + s = ImageFile._safe_read(self.fp, 4) + seq = i32(s) + if self._seq_num != seq - 1: + msg = "APNG contains frame sequence errors" + raise SyntaxError(msg) + self._seq_num = seq + return self.chunk_IDAT(pos + 4, length - 4) + + +# -------------------------------------------------------------------- +# PNG reader + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(_MAGIC) + + +## +# Image plugin for PNG images. + + +class PngImageFile(ImageFile.ImageFile): + format = "PNG" + format_description = "Portable network graphics" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(8)): + msg = "not a PNG file" + raise SyntaxError(msg) + self._fp = self.fp + self.__frame = 0 + + # + # Parse headers up to the first IDAT or fDAT chunk + + self.private_chunks: list[tuple[bytes, bytes] | tuple[bytes, bytes, bool]] = [] + self.png: PngStream | None = PngStream(self.fp) + + while True: + # + # get next chunk + + cid, pos, length = self.png.read() + + try: + s = self.png.call(cid, pos, length) + except EOFError: + break + except AttributeError: + logger.debug("%r %s %s (unknown)", cid, pos, length) + s = ImageFile._safe_read(self.fp, length) + if cid[1:2].islower(): + self.private_chunks.append((cid, s)) + + self.png.crc(cid, s) + + # + # Copy relevant attributes from the PngStream. An alternative + # would be to let the PngStream class modify these attributes + # directly, but that introduces circular references which are + # difficult to break if things go wrong in the decoder... + # (believe me, I've tried ;-) + + self._mode = self.png.im_mode + self._size = self.png.im_size + self.info = self.png.im_info + self._text: dict[str, str | iTXt] | None = None + self.tile = self.png.im_tile + self.custom_mimetype = self.png.im_custom_mimetype + self.n_frames = self.png.im_n_frames or 1 + self.default_image = self.info.get("default_image", False) + + if self.png.im_palette: + rawmode, data = self.png.im_palette + self.palette = ImagePalette.raw(rawmode, data) + + if cid == b"fdAT": + self.__prepare_idat = length - 4 + else: + self.__prepare_idat = length # used by load_prepare() + + if self.png.im_n_frames is not None: + self._close_exclusive_fp_after_loading = False + self.png.save_rewind() + self.__rewind_idat = self.__prepare_idat + self.__rewind = self._fp.tell() + if self.default_image: + # IDAT chunk contains default image and not first animation frame + self.n_frames += 1 + self._seek(0) + self.is_animated = self.n_frames > 1 + + @property + def text(self) -> dict[str, str | iTXt]: + # experimental + if self._text is None: + # iTxt, tEXt and zTXt chunks may appear at the end of the file + # So load the file to ensure that they are read + if self.is_animated: + frame = self.__frame + # for APNG, seek to the final frame before loading + self.seek(self.n_frames - 1) + self.load() + if self.is_animated: + self.seek(frame) + assert self._text is not None + return self._text + + def verify(self) -> None: + """Verify PNG file""" + + if self.fp is None: + msg = "verify must be called directly after open" + raise RuntimeError(msg) + + # back up to beginning of IDAT block + self.fp.seek(self.tile[0][2] - 8) + + assert self.png is not None + self.png.verify() + self.png.close() + + super().verify() + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + if frame < self.__frame: + self._seek(0, True) + + last_frame = self.__frame + try: + for f in range(self.__frame + 1, frame + 1): + self._seek(f) + except EOFError as e: + self.seek(last_frame) + msg = "no more images in APNG file" + raise EOFError(msg) from e + + def _seek(self, frame: int, rewind: bool = False) -> None: + assert self.png is not None + if isinstance(self._fp, DeferredError): + raise self._fp.ex + + self.dispose: _imaging.ImagingCore | None + dispose_extent = None + if frame == 0: + if rewind: + self._fp.seek(self.__rewind) + self.png.rewind() + self.__prepare_idat = self.__rewind_idat + self._im = None + self.info = self.png.im_info + self.tile = self.png.im_tile + self.fp = self._fp + self._prev_im = None + self.dispose = None + self.default_image = self.info.get("default_image", False) + self.dispose_op = self.info.get("disposal") + self.blend_op = self.info.get("blend") + dispose_extent = self.info.get("bbox") + self.__frame = 0 + else: + if frame != self.__frame + 1: + msg = f"cannot seek to frame {frame}" + raise ValueError(msg) + + # ensure previous frame was loaded + self.load() + + if self.dispose: + self.im.paste(self.dispose, self.dispose_extent) + self._prev_im = self.im.copy() + + self.fp = self._fp + + # advance to the next frame + if self.__prepare_idat: + ImageFile._safe_read(self.fp, self.__prepare_idat) + self.__prepare_idat = 0 + frame_start = False + while True: + self.fp.read(4) # CRC + + try: + cid, pos, length = self.png.read() + except (struct.error, SyntaxError): + break + + if cid == b"IEND": + msg = "No more images in APNG file" + raise EOFError(msg) + if cid == b"fcTL": + if frame_start: + # there must be at least one fdAT chunk between fcTL chunks + msg = "APNG missing frame data" + raise SyntaxError(msg) + frame_start = True + + try: + self.png.call(cid, pos, length) + except UnicodeDecodeError: + break + except EOFError: + if cid == b"fdAT": + length -= 4 + if frame_start: + self.__prepare_idat = length + break + ImageFile._safe_read(self.fp, length) + except AttributeError: + logger.debug("%r %s %s (unknown)", cid, pos, length) + ImageFile._safe_read(self.fp, length) + + self.__frame = frame + self.tile = self.png.im_tile + self.dispose_op = self.info.get("disposal") + self.blend_op = self.info.get("blend") + dispose_extent = self.info.get("bbox") + + if not self.tile: + msg = "image not found in APNG frame" + raise EOFError(msg) + if dispose_extent: + self.dispose_extent: tuple[float, float, float, float] = dispose_extent + + # setup frame disposal (actual disposal done when needed in the next _seek()) + if self._prev_im is None and self.dispose_op == Disposal.OP_PREVIOUS: + self.dispose_op = Disposal.OP_BACKGROUND + + self.dispose = None + if self.dispose_op == Disposal.OP_PREVIOUS: + if self._prev_im: + self.dispose = self._prev_im.copy() + self.dispose = self._crop(self.dispose, self.dispose_extent) + elif self.dispose_op == Disposal.OP_BACKGROUND: + self.dispose = Image.core.fill(self.mode, self.size) + self.dispose = self._crop(self.dispose, self.dispose_extent) + + def tell(self) -> int: + return self.__frame + + def load_prepare(self) -> None: + """internal: prepare to read PNG file""" + + if self.info.get("interlace"): + self.decoderconfig = self.decoderconfig + (1,) + + self.__idat = self.__prepare_idat # used by load_read() + ImageFile.ImageFile.load_prepare(self) + + def load_read(self, read_bytes: int) -> bytes: + """internal: read more image data""" + + assert self.png is not None + assert self.fp is not None + while self.__idat == 0: + # end of chunk, skip forward to next one + + self.fp.read(4) # CRC + + cid, pos, length = self.png.read() + + if cid not in [b"IDAT", b"DDAT", b"fdAT"]: + self.png.push(cid, pos, length) + return b"" + + if cid == b"fdAT": + try: + self.png.call(cid, pos, length) + except EOFError: + pass + self.__idat = length - 4 # sequence_num has already been read + else: + self.__idat = length # empty chunks are allowed + + # read more data from this chunk + if read_bytes <= 0: + read_bytes = self.__idat + else: + read_bytes = min(read_bytes, self.__idat) + + self.__idat = self.__idat - read_bytes + + return self.fp.read(read_bytes) + + def load_end(self) -> None: + """internal: finished reading image data""" + assert self.png is not None + assert self.fp is not None + if self.__idat != 0: + self.fp.read(self.__idat) + while True: + self.fp.read(4) # CRC + + try: + cid, pos, length = self.png.read() + except (struct.error, SyntaxError): + break + + if cid == b"IEND": + break + elif cid == b"fcTL" and self.is_animated: + # start of the next frame, stop reading + self.__prepare_idat = 0 + self.png.push(cid, pos, length) + break + + try: + self.png.call(cid, pos, length) + except UnicodeDecodeError: + break + except EOFError: + if cid == b"fdAT": + length -= 4 + try: + ImageFile._safe_read(self.fp, length) + except OSError as e: + if ImageFile.LOAD_TRUNCATED_IMAGES: + break + else: + raise e + except AttributeError: + logger.debug("%r %s %s (unknown)", cid, pos, length) + s = ImageFile._safe_read(self.fp, length) + if cid[1:2].islower(): + self.private_chunks.append((cid, s, True)) + self._text = self.png.im_text + if not self.is_animated: + self.png.close() + self.png = None + else: + if self._prev_im and self.blend_op == Blend.OP_OVER: + updated = self._crop(self.im, self.dispose_extent) + if self.im.mode == "RGB" and "transparency" in self.info: + mask = updated.convert_transparent( + "RGBA", self.info["transparency"] + ) + else: + if self.im.mode == "P" and "transparency" in self.info: + t = self.info["transparency"] + if isinstance(t, bytes): + updated.putpalettealphas(t) + elif isinstance(t, int): + updated.putpalettealpha(t) + mask = updated.convert("RGBA") + self._prev_im.paste(updated, self.dispose_extent, mask) + self.im = self._prev_im + + def _getexif(self) -> dict[int, Any] | None: + if "exif" not in self.info: + self.load() + if "exif" not in self.info and "Raw profile type exif" not in self.info: + return None + return self.getexif()._get_merged_dict() + + def getexif(self) -> Image.Exif: + if "exif" not in self.info: + self.load() + + return super().getexif() + + +# -------------------------------------------------------------------- +# PNG writer + +_OUTMODES = { + # supported PIL modes, and corresponding rawmode, bit depth and color type + "1": ("1", b"\x01", b"\x00"), + "L;1": ("L;1", b"\x01", b"\x00"), + "L;2": ("L;2", b"\x02", b"\x00"), + "L;4": ("L;4", b"\x04", b"\x00"), + "L": ("L", b"\x08", b"\x00"), + "LA": ("LA", b"\x08", b"\x04"), + "I": ("I;16B", b"\x10", b"\x00"), + "I;16": ("I;16B", b"\x10", b"\x00"), + "I;16B": ("I;16B", b"\x10", b"\x00"), + "P;1": ("P;1", b"\x01", b"\x03"), + "P;2": ("P;2", b"\x02", b"\x03"), + "P;4": ("P;4", b"\x04", b"\x03"), + "P": ("P", b"\x08", b"\x03"), + "RGB": ("RGB", b"\x08", b"\x02"), + "RGBA": ("RGBA", b"\x08", b"\x06"), +} + + +def putchunk(fp: IO[bytes], cid: bytes, *data: bytes) -> None: + """Write a PNG chunk (including CRC field)""" + + byte_data = b"".join(data) + + fp.write(o32(len(byte_data)) + cid) + fp.write(byte_data) + crc = _crc32(byte_data, _crc32(cid)) + fp.write(o32(crc)) + + +class _idat: + # wrap output from the encoder in IDAT chunks + + def __init__(self, fp: IO[bytes], chunk: Callable[..., None]) -> None: + self.fp = fp + self.chunk = chunk + + def write(self, data: bytes) -> None: + self.chunk(self.fp, b"IDAT", data) + + +class _fdat: + # wrap encoder output in fdAT chunks + + def __init__(self, fp: IO[bytes], chunk: Callable[..., None], seq_num: int) -> None: + self.fp = fp + self.chunk = chunk + self.seq_num = seq_num + + def write(self, data: bytes) -> None: + self.chunk(self.fp, b"fdAT", o32(self.seq_num), data) + self.seq_num += 1 + + +def _apply_encoderinfo(im: Image.Image, encoderinfo: dict[str, Any]) -> None: + im.encoderconfig = ( + encoderinfo.get("optimize", False), + encoderinfo.get("compress_level", -1), + encoderinfo.get("compress_type", -1), + encoderinfo.get("dictionary", b""), + ) + + +class _Frame(NamedTuple): + im: Image.Image + bbox: tuple[int, int, int, int] | None + encoderinfo: dict[str, Any] + + +def _write_multiple_frames( + im: Image.Image, + fp: IO[bytes], + chunk: Callable[..., None], + mode: str, + rawmode: str, + default_image: Image.Image | None, + append_images: list[Image.Image], +) -> Image.Image | None: + duration = im.encoderinfo.get("duration") + loop = im.encoderinfo.get("loop", im.info.get("loop", 0)) + disposal = im.encoderinfo.get("disposal", im.info.get("disposal", Disposal.OP_NONE)) + blend = im.encoderinfo.get("blend", im.info.get("blend", Blend.OP_SOURCE)) + + if default_image: + chain = itertools.chain(append_images) + else: + chain = itertools.chain([im], append_images) + + im_frames: list[_Frame] = [] + frame_count = 0 + for im_seq in chain: + for im_frame in ImageSequence.Iterator(im_seq): + if im_frame.mode == mode: + im_frame = im_frame.copy() + else: + im_frame = im_frame.convert(mode) + encoderinfo = im.encoderinfo.copy() + if isinstance(duration, (list, tuple)): + encoderinfo["duration"] = duration[frame_count] + elif duration is None and "duration" in im_frame.info: + encoderinfo["duration"] = im_frame.info["duration"] + if isinstance(disposal, (list, tuple)): + encoderinfo["disposal"] = disposal[frame_count] + if isinstance(blend, (list, tuple)): + encoderinfo["blend"] = blend[frame_count] + frame_count += 1 + + if im_frames: + previous = im_frames[-1] + prev_disposal = previous.encoderinfo.get("disposal") + prev_blend = previous.encoderinfo.get("blend") + if prev_disposal == Disposal.OP_PREVIOUS and len(im_frames) < 2: + prev_disposal = Disposal.OP_BACKGROUND + + if prev_disposal == Disposal.OP_BACKGROUND: + base_im = previous.im.copy() + dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0)) + bbox = previous.bbox + if bbox: + dispose = dispose.crop(bbox) + else: + bbox = (0, 0) + im.size + base_im.paste(dispose, bbox) + elif prev_disposal == Disposal.OP_PREVIOUS: + base_im = im_frames[-2].im + else: + base_im = previous.im + delta = ImageChops.subtract_modulo( + im_frame.convert("RGBA"), base_im.convert("RGBA") + ) + bbox = delta.getbbox(alpha_only=False) + if ( + not bbox + and prev_disposal == encoderinfo.get("disposal") + and prev_blend == encoderinfo.get("blend") + and "duration" in encoderinfo + ): + previous.encoderinfo["duration"] += encoderinfo["duration"] + continue + else: + bbox = None + im_frames.append(_Frame(im_frame, bbox, encoderinfo)) + + if len(im_frames) == 1 and not default_image: + return im_frames[0].im + + # animation control + chunk( + fp, + b"acTL", + o32(len(im_frames)), # 0: num_frames + o32(loop), # 4: num_plays + ) + + # default image IDAT (if it exists) + if default_image: + default_im = im if im.mode == mode else im.convert(mode) + _apply_encoderinfo(default_im, im.encoderinfo) + ImageFile._save( + default_im, + cast(IO[bytes], _idat(fp, chunk)), + [ImageFile._Tile("zip", (0, 0) + im.size, 0, rawmode)], + ) + + seq_num = 0 + for frame, frame_data in enumerate(im_frames): + im_frame = frame_data.im + if not frame_data.bbox: + bbox = (0, 0) + im_frame.size + else: + bbox = frame_data.bbox + im_frame = im_frame.crop(bbox) + size = im_frame.size + encoderinfo = frame_data.encoderinfo + frame_duration = encoderinfo.get("duration", 0) + delay = Fraction(frame_duration / 1000).limit_denominator(65535) + if delay.numerator > 65535: + msg = "cannot write duration" + raise ValueError(msg) + frame_disposal = encoderinfo.get("disposal", disposal) + frame_blend = encoderinfo.get("blend", blend) + # frame control + chunk( + fp, + b"fcTL", + o32(seq_num), # sequence_number + o32(size[0]), # width + o32(size[1]), # height + o32(bbox[0]), # x_offset + o32(bbox[1]), # y_offset + o16(delay.numerator), # delay_numerator + o16(delay.denominator), # delay_denominator + o8(frame_disposal), # dispose_op + o8(frame_blend), # blend_op + ) + seq_num += 1 + # frame data + _apply_encoderinfo(im_frame, im.encoderinfo) + if frame == 0 and not default_image: + # first frame must be in IDAT chunks for backwards compatibility + ImageFile._save( + im_frame, + cast(IO[bytes], _idat(fp, chunk)), + [ImageFile._Tile("zip", (0, 0) + im_frame.size, 0, rawmode)], + ) + else: + fdat_chunks = _fdat(fp, chunk, seq_num) + ImageFile._save( + im_frame, + cast(IO[bytes], fdat_chunks), + [ImageFile._Tile("zip", (0, 0) + im_frame.size, 0, rawmode)], + ) + seq_num = fdat_chunks.seq_num + return None + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + _save(im, fp, filename, save_all=True) + + +def _save( + im: Image.Image, + fp: IO[bytes], + filename: str | bytes, + chunk: Callable[..., None] = putchunk, + save_all: bool = False, +) -> None: + # save an image to disk (called by the save method) + + if save_all: + default_image = im.encoderinfo.get( + "default_image", im.info.get("default_image") + ) + modes = set() + sizes = set() + append_images = im.encoderinfo.get("append_images", []) + for im_seq in itertools.chain([im], append_images): + for im_frame in ImageSequence.Iterator(im_seq): + modes.add(im_frame.mode) + sizes.add(im_frame.size) + for mode in ("RGBA", "RGB", "P"): + if mode in modes: + break + else: + mode = modes.pop() + size = tuple(max(frame_size[i] for frame_size in sizes) for i in range(2)) + else: + size = im.size + mode = im.mode + + outmode = mode + palette = [] + if im.palette: + palette = im.getpalette() or [] + if mode == "P": + # + # attempt to minimize storage requirements for palette images + if "bits" in im.encoderinfo: + # number of bits specified by user + colors = min(1 << im.encoderinfo["bits"], 256) + else: + # check palette contents + if im.palette: + colors = max(min(len(palette) // 3, 256), 1) + else: + colors = 256 + + if colors <= 16: + if colors <= 2: + bits = 1 + elif colors <= 4: + bits = 2 + else: + bits = 4 + outmode += f";{bits}" + + # get the corresponding PNG mode + try: + rawmode, bit_depth, color_type = _OUTMODES[outmode] + except KeyError as e: + msg = f"cannot write mode {mode} as PNG" + raise OSError(msg) from e + if outmode == "I": + deprecate("Saving I mode images as PNG", 13, stacklevel=4) + + # + # write minimal PNG file + + fp.write(_MAGIC) + + chunk( + fp, + b"IHDR", + o32(size[0]), # 0: size + o32(size[1]), + bit_depth, + color_type, + b"\0", # 10: compression + b"\0", # 11: filter category + b"\0", # 12: interlace flag + ) + + chunks = [b"cHRM", b"cICP", b"gAMA", b"sBIT", b"sRGB", b"tIME"] + + if icc := im.encoderinfo.get("icc_profile", im.info.get("icc_profile")): + # ICC profile + # according to PNG spec, the iCCP chunk contains: + # Profile name 1-79 bytes (character string) + # Null separator 1 byte (null character) + # Compression method 1 byte (0) + # Compressed profile n bytes (zlib with deflate compression) + name = b"ICC Profile" + data = name + b"\0\0" + zlib.compress(icc) + chunk(fp, b"iCCP", data) + + # You must either have sRGB or iCCP. + # Disallow sRGB chunks when an iCCP-chunk has been emitted. + chunks.remove(b"sRGB") + + if info := im.encoderinfo.get("pnginfo"): + chunks_multiple_allowed = [b"sPLT", b"iTXt", b"tEXt", b"zTXt"] + for info_chunk in info.chunks: + cid, data = info_chunk[:2] + if cid in chunks: + chunks.remove(cid) + chunk(fp, cid, data) + elif cid in chunks_multiple_allowed: + chunk(fp, cid, data) + elif cid[1:2].islower(): + # Private chunk + after_idat = len(info_chunk) == 3 and info_chunk[2] + if not after_idat: + chunk(fp, cid, data) + + if im.mode == "P": + palette_byte_number = colors * 3 + palette_bytes = bytes(palette[:palette_byte_number]) + while len(palette_bytes) < palette_byte_number: + palette_bytes += b"\0" + chunk(fp, b"PLTE", palette_bytes) + + transparency = im.encoderinfo.get("transparency", im.info.get("transparency", None)) + + if transparency or transparency == 0: + if im.mode == "P": + # limit to actual palette size + alpha_bytes = colors + if isinstance(transparency, bytes): + chunk(fp, b"tRNS", transparency[:alpha_bytes]) + else: + transparency = max(0, min(255, transparency)) + alpha = b"\xff" * transparency + b"\0" + chunk(fp, b"tRNS", alpha[:alpha_bytes]) + elif im.mode in ("1", "L", "I", "I;16"): + transparency = max(0, min(65535, transparency)) + chunk(fp, b"tRNS", o16(transparency)) + elif im.mode == "RGB": + red, green, blue = transparency + chunk(fp, b"tRNS", o16(red) + o16(green) + o16(blue)) + else: + if "transparency" in im.encoderinfo: + # don't bother with transparency if it's an RGBA + # and it's in the info dict. It's probably just stale. + msg = "cannot use transparency for this mode" + raise OSError(msg) + else: + if im.mode == "P" and im.im.getpalettemode() == "RGBA": + alpha = im.im.getpalette("RGBA", "A") + alpha_bytes = colors + chunk(fp, b"tRNS", alpha[:alpha_bytes]) + + if dpi := im.encoderinfo.get("dpi"): + chunk( + fp, + b"pHYs", + o32(int(dpi[0] / 0.0254 + 0.5)), + o32(int(dpi[1] / 0.0254 + 0.5)), + b"\x01", + ) + + if info: + chunks = [b"bKGD", b"hIST"] + for info_chunk in info.chunks: + cid, data = info_chunk[:2] + if cid in chunks: + chunks.remove(cid) + chunk(fp, cid, data) + + if exif := im.encoderinfo.get("exif"): + if isinstance(exif, Image.Exif): + exif = exif.tobytes(8) + if exif.startswith(b"Exif\x00\x00"): + exif = exif[6:] + chunk(fp, b"eXIf", exif) + + single_im: Image.Image | None = im + if save_all: + single_im = _write_multiple_frames( + im, fp, chunk, mode, rawmode, default_image, append_images + ) + if single_im: + _apply_encoderinfo(single_im, im.encoderinfo) + ImageFile._save( + single_im, + cast(IO[bytes], _idat(fp, chunk)), + [ImageFile._Tile("zip", (0, 0) + single_im.size, 0, rawmode)], + ) + + if info: + for info_chunk in info.chunks: + cid, data = info_chunk[:2] + if cid[1:2].islower(): + # Private chunk + after_idat = len(info_chunk) == 3 and info_chunk[2] + if after_idat: + chunk(fp, cid, data) + + chunk(fp, b"IEND", b"") + + if hasattr(fp, "flush"): + fp.flush() + + +# -------------------------------------------------------------------- +# PNG chunk converter + + +def getchunks(im: Image.Image, **params: Any) -> list[tuple[bytes, bytes, bytes]]: + """Return a list of PNG chunks representing this image.""" + from io import BytesIO + + chunks = [] + + def append(fp: IO[bytes], cid: bytes, *data: bytes) -> None: + byte_data = b"".join(data) + crc = o32(_crc32(byte_data, _crc32(cid))) + chunks.append((cid, byte_data, crc)) + + fp = BytesIO() + + try: + im.encoderinfo = params + _save(im, fp, "", append) + finally: + del im.encoderinfo + + return chunks + + +# -------------------------------------------------------------------- +# Registry + +Image.register_open(PngImageFile.format, PngImageFile, _accept) +Image.register_save(PngImageFile.format, _save) +Image.register_save_all(PngImageFile.format, _save_all) + +Image.register_extensions(PngImageFile.format, [".png", ".apng"]) + +Image.register_mime(PngImageFile.format, "image/png") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PpmImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PpmImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..7f785ee6ae5787185e40e382e6da1d165af33f84 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PpmImagePlugin.py @@ -0,0 +1,375 @@ +# +# The Python Imaging Library. +# $Id$ +# +# PPM support for PIL +# +# History: +# 96-03-24 fl Created +# 98-03-06 fl Write RGBA images (as RGB, that is) +# +# Copyright (c) Secret Labs AB 1997-98. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import math +from typing import IO + +from . import Image, ImageFile +from ._binary import i16be as i16 +from ._binary import o8 +from ._binary import o32le as o32 + +# +# -------------------------------------------------------------------- + +b_whitespace = b"\x20\x09\x0a\x0b\x0c\x0d" + +MODES = { + # standard + b"P1": "1", + b"P2": "L", + b"P3": "RGB", + b"P4": "1", + b"P5": "L", + b"P6": "RGB", + # extensions + b"P0CMYK": "CMYK", + b"Pf": "F", + # PIL extensions (for test purposes only) + b"PyP": "P", + b"PyRGBA": "RGBA", + b"PyCMYK": "CMYK", +} + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 2 and prefix.startswith(b"P") and prefix[1] in b"0123456fy" + + +## +# Image plugin for PBM, PGM, and PPM images. + + +class PpmImageFile(ImageFile.ImageFile): + format = "PPM" + format_description = "Pbmplus image" + + def _read_magic(self) -> bytes: + assert self.fp is not None + + magic = b"" + # read until whitespace or longest available magic number + for _ in range(6): + c = self.fp.read(1) + if not c or c in b_whitespace: + break + magic += c + return magic + + def _read_token(self) -> bytes: + assert self.fp is not None + + token = b"" + while len(token) <= 10: # read until next whitespace or limit of 10 characters + c = self.fp.read(1) + if not c: + break + elif c in b_whitespace: # token ended + if not token: + # skip whitespace at start + continue + break + elif c == b"#": + # ignores rest of the line; stops at CR, LF or EOF + while self.fp.read(1) not in b"\r\n": + pass + continue + token += c + if not token: + # Token was not even 1 byte + msg = "Reached EOF while reading header" + raise ValueError(msg) + elif len(token) > 10: + msg_too_long = b"Token too long in file header: %s" % token + raise ValueError(msg_too_long) + return token + + def _open(self) -> None: + assert self.fp is not None + + magic_number = self._read_magic() + try: + mode = MODES[magic_number] + except KeyError: + msg = "not a PPM file" + raise SyntaxError(msg) + self._mode = mode + + if magic_number in (b"P1", b"P4"): + self.custom_mimetype = "image/x-portable-bitmap" + elif magic_number in (b"P2", b"P5"): + self.custom_mimetype = "image/x-portable-graymap" + elif magic_number in (b"P3", b"P6"): + self.custom_mimetype = "image/x-portable-pixmap" + + self._size = int(self._read_token()), int(self._read_token()) + + decoder_name = "raw" + if magic_number in (b"P1", b"P2", b"P3"): + decoder_name = "ppm_plain" + + args: str | tuple[str | int, ...] + if mode == "1": + args = "1;I" + elif mode == "F": + scale = float(self._read_token()) + if scale == 0.0 or not math.isfinite(scale): + msg = "scale must be finite and non-zero" + raise ValueError(msg) + self.info["scale"] = abs(scale) + + rawmode = "F;32F" if scale < 0 else "F;32BF" + args = (rawmode, 0, -1) + else: + maxval = int(self._read_token()) + if not 0 < maxval < 65536: + msg = "maxval must be greater than 0 and less than 65536" + raise ValueError(msg) + if maxval > 255 and mode == "L": + self._mode = "I" + + rawmode = mode + if decoder_name != "ppm_plain": + # If maxval matches a bit depth, use the raw decoder directly + if maxval == 65535 and mode == "L": + rawmode = "I;16B" + elif maxval != 255: + decoder_name = "ppm" + + args = rawmode if decoder_name == "raw" else (rawmode, maxval) + self.tile = [ + ImageFile._Tile(decoder_name, (0, 0) + self.size, self.fp.tell(), args) + ] + + +# +# -------------------------------------------------------------------- + + +class PpmPlainDecoder(ImageFile.PyDecoder): + _pulls_fd = True + _comment_spans: bool + + def _read_block(self) -> bytes: + assert self.fd is not None + + return self.fd.read(ImageFile.SAFEBLOCK) + + def _find_comment_end(self, block: bytes, start: int = 0) -> int: + a = block.find(b"\n", start) + b = block.find(b"\r", start) + return min(a, b) if a * b > 0 else max(a, b) # lowest nonnegative index (or -1) + + def _ignore_comments(self, block: bytes) -> bytes: + if self._comment_spans: + # Finish current comment + while block: + comment_end = self._find_comment_end(block) + if comment_end != -1: + # Comment ends in this block + # Delete tail of comment + block = block[comment_end + 1 :] + break + else: + # Comment spans whole block + # So read the next block, looking for the end + block = self._read_block() + + # Search for any further comments + self._comment_spans = False + while True: + comment_start = block.find(b"#") + if comment_start == -1: + # No comment found + break + comment_end = self._find_comment_end(block, comment_start) + if comment_end != -1: + # Comment ends in this block + # Delete comment + block = block[:comment_start] + block[comment_end + 1 :] + else: + # Comment continues to next block(s) + block = block[:comment_start] + self._comment_spans = True + break + return block + + def _decode_bitonal(self) -> bytearray: + """ + This is a separate method because in the plain PBM format, all data tokens are + exactly one byte, so the inter-token whitespace is optional. + """ + data = bytearray() + total_bytes = self.state.xsize * self.state.ysize + + while len(data) != total_bytes: + block = self._read_block() # read next block + if not block: + # eof + break + + block = self._ignore_comments(block) + + tokens = b"".join(block.split()) + for token in tokens: + if token not in (48, 49): + msg = b"Invalid token for this mode: %s" % bytes([token]) + raise ValueError(msg) + data = (data + tokens)[:total_bytes] + invert = bytes.maketrans(b"01", b"\xff\x00") + return data.translate(invert) + + def _decode_blocks(self, maxval: int) -> bytearray: + data = bytearray() + max_len = 10 + out_byte_count = 4 if self.mode == "I" else 1 + out_max = 65535 if self.mode == "I" else 255 + bands = Image.getmodebands(self.mode) + total_bytes = self.state.xsize * self.state.ysize * bands * out_byte_count + + half_token = b"" + while len(data) != total_bytes: + block = self._read_block() # read next block + if not block: + if half_token: + block = bytearray(b" ") # flush half_token + else: + # eof + break + + block = self._ignore_comments(block) + + if half_token: + block = half_token + block # stitch half_token to new block + half_token = b"" + + tokens = block.split() + + if block and not block[-1:].isspace(): # block might split token + half_token = tokens.pop() # save half token for later + if len(half_token) > max_len: # prevent buildup of half_token + msg = ( + b"Token too long found in data: %s" % half_token[: max_len + 1] + ) + raise ValueError(msg) + + for token in tokens: + if len(token) > max_len: + msg = b"Token too long found in data: %s" % token[: max_len + 1] + raise ValueError(msg) + value = int(token) + if value < 0: + msg_str = f"Channel value is negative: {value}" + raise ValueError(msg_str) + if value > maxval: + msg_str = f"Channel value too large for this mode: {value}" + raise ValueError(msg_str) + value = round(value / maxval * out_max) + data += o32(value) if self.mode == "I" else o8(value) + if len(data) == total_bytes: # finished! + break + return data + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + self._comment_spans = False + if self.mode == "1": + data = self._decode_bitonal() + rawmode = "1;8" + else: + maxval = self.args[-1] + data = self._decode_blocks(maxval) + rawmode = "I;32" if self.mode == "I" else self.mode + self.set_as_raw(bytes(data), rawmode) + return -1, 0 + + +class PpmDecoder(ImageFile.PyDecoder): + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + + data = bytearray() + maxval = self.args[-1] + in_byte_count = 1 if maxval < 256 else 2 + out_byte_count = 4 if self.mode == "I" else 1 + out_max = 65535 if self.mode == "I" else 255 + bands = Image.getmodebands(self.mode) + dest_length = self.state.xsize * self.state.ysize * bands * out_byte_count + while len(data) < dest_length: + pixels = self.fd.read(in_byte_count * bands) + if len(pixels) < in_byte_count * bands: + # eof + break + for b in range(bands): + value = ( + pixels[b] if in_byte_count == 1 else i16(pixels, b * in_byte_count) + ) + value = min(out_max, round(value / maxval * out_max)) + data += o32(value) if self.mode == "I" else o8(value) + rawmode = "I;32" if self.mode == "I" else self.mode + self.set_as_raw(bytes(data), rawmode) + return -1, 0 + + +# +# -------------------------------------------------------------------- + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode == "1": + rawmode, head = "1;I", b"P4" + elif im.mode == "L": + rawmode, head = "L", b"P5" + elif im.mode in ("I", "I;16"): + rawmode, head = "I;16B", b"P5" + elif im.mode in ("RGB", "RGBA"): + rawmode, head = "RGB", b"P6" + elif im.mode == "F": + rawmode, head = "F;32F", b"Pf" + else: + msg = f"cannot write mode {im.mode} as PPM" + raise OSError(msg) + fp.write(head + b"\n%d %d\n" % im.size) + if head == b"P6": + fp.write(b"255\n") + elif head == b"P5": + if rawmode == "L": + fp.write(b"255\n") + else: + fp.write(b"65535\n") + elif head == b"Pf": + fp.write(b"-1.0\n") + row_order = -1 if im.mode == "F" else 1 + ImageFile._save( + im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, 0, row_order))] + ) + + +# +# -------------------------------------------------------------------- + + +Image.register_open(PpmImageFile.format, PpmImageFile, _accept) +Image.register_save(PpmImageFile.format, _save) + +Image.register_decoder("ppm", PpmDecoder) +Image.register_decoder("ppm_plain", PpmPlainDecoder) + +Image.register_extensions(PpmImageFile.format, [".pbm", ".pgm", ".ppm", ".pnm", ".pfm"]) + +Image.register_mime(PpmImageFile.format, "image/x-portable-anymap") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PsdImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PsdImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..30f121187959c33388b8f78adb35d48c4f98fbef --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/PsdImagePlugin.py @@ -0,0 +1,337 @@ +# +# The Python Imaging Library +# $Id$ +# +# Adobe PSD 2.5/3.0 file handling +# +# History: +# 1995-09-01 fl Created +# 1997-01-03 fl Read most PSD images +# 1997-01-18 fl Fixed P and CMYK support +# 2001-10-21 fl Added seek/tell support (for layers) +# +# Copyright (c) 1997-2001 by Secret Labs AB. +# Copyright (c) 1995-2001 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +from functools import cached_property +from typing import IO + +from . import Image, ImageFile, ImagePalette +from ._binary import i8 +from ._binary import i16be as i16 +from ._binary import i32be as i32 +from ._binary import si16be as si16 +from ._binary import si32be as si32 +from ._util import DeferredError + +MODES = { + # (photoshop mode, bits) -> (pil mode, required channels) + (0, 1): ("1", 1), + (0, 8): ("L", 1), + (1, 8): ("L", 1), + (2, 8): ("P", 1), + (3, 8): ("RGB", 3), + (4, 8): ("CMYK", 4), + (7, 8): ("L", 1), # FIXME: multilayer + (8, 8): ("L", 1), # duotone + (9, 8): ("LAB", 3), +} + + +# --------------------------------------------------------------------. +# read PSD images + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"8BPS") + + +## +# Image plugin for Photoshop images. + + +class PsdImageFile(ImageFile.ImageFile): + format = "PSD" + format_description = "Adobe Photoshop" + _close_exclusive_fp_after_loading = False + + def _open(self) -> None: + assert self.fp is not None + read = self.fp.read + + # + # header + + s = read(26) + if not _accept(s) or i16(s, 4) != 1: + msg = "not a PSD file" + raise SyntaxError(msg) + + psd_bits = i16(s, 22) + psd_channels = i16(s, 12) + psd_mode = i16(s, 24) + + mode, channels = MODES[(psd_mode, psd_bits)] + + if channels > psd_channels: + msg = "not enough channels" + raise OSError(msg) + if mode == "RGB" and psd_channels == 4: + mode = "RGBA" + channels = 4 + + self._mode = mode + self._size = i32(s, 18), i32(s, 14) + + # + # color mode data + + size = i32(read(4)) + if size: + data = read(size) + if mode == "P" and size == 768: + self.palette = ImagePalette.raw("RGB;L", data) + + # + # image resources + + self.resources = [] + + size = i32(read(4)) + if size: + # load resources + end = self.fp.tell() + size + while self.fp.tell() < end: + read(4) # signature + id = i16(read(2)) + name = read(i8(read(1))) + if not (len(name) & 1): + read(1) # padding + data = read(i32(read(4))) + if len(data) & 1: + read(1) # padding + self.resources.append((id, name, data)) + if id == 1039: # ICC profile + self.info["icc_profile"] = data + + # + # layer and mask information + + self._layers_position = None + + size = i32(read(4)) + if size: + end = self.fp.tell() + size + size = i32(read(4)) + if size: + self._layers_position = self.fp.tell() + self._layers_size = size + self.fp.seek(end) + self._n_frames: int | None = None + + # + # image descriptor + + self.tile = _maketile(self.fp, mode, (0, 0) + self.size, channels) + + # keep the file open + self._fp = self.fp + self.frame = 1 + self._min_frame = 1 + + @cached_property + def layers( + self, + ) -> list[tuple[str, str, tuple[int, int, int, int], list[ImageFile._Tile]]]: + layers = [] + if self._layers_position is not None: + if isinstance(self._fp, DeferredError): + raise self._fp.ex + self._fp.seek(self._layers_position) + _layer_data = io.BytesIO(ImageFile._safe_read(self._fp, self._layers_size)) + layers = _layerinfo(_layer_data, self._layers_size) + self._n_frames = len(layers) + return layers + + @property + def n_frames(self) -> int: + if self._n_frames is None: + self._n_frames = len(self.layers) + return self._n_frames + + @property + def is_animated(self) -> bool: + return len(self.layers) > 1 + + def seek(self, layer: int) -> None: + if not self._seek_check(layer): + return + if isinstance(self._fp, DeferredError): + raise self._fp.ex + + # seek to given layer (1..max) + if layer > len(self.layers): + msg = "no more images in PSD file" + raise EOFError(msg) + _, mode, _, tile = self.layers[layer - 1] + self._mode = mode + self.tile = tile + self.frame = layer + self.fp = self._fp + + def tell(self) -> int: + # return layer number (0=image, 1..max=layers) + return self.frame + + +def _layerinfo( + fp: IO[bytes], ct_bytes: int +) -> list[tuple[str, str, tuple[int, int, int, int], list[ImageFile._Tile]]]: + # read layerinfo block + layers = [] + + def read(size: int) -> bytes: + return ImageFile._safe_read(fp, size) + + ct = si16(read(2)) + + # sanity check + if ct_bytes < (abs(ct) * 20): + msg = "Layer block too short for number of layers requested" + raise SyntaxError(msg) + + for _ in range(abs(ct)): + # bounding box + y0 = si32(read(4)) + x0 = si32(read(4)) + y1 = si32(read(4)) + x1 = si32(read(4)) + + # image info + bands = [] + ct_types = i16(read(2)) + if ct_types > 4: + fp.seek(ct_types * 6 + 12, io.SEEK_CUR) + size = i32(read(4)) + fp.seek(size, io.SEEK_CUR) + continue + + for _ in range(ct_types): + type = i16(read(2)) + + if type == 65535: + b = "A" + else: + b = "RGBA"[type] + + bands.append(b) + read(4) # size + + # figure out the image mode + bands.sort() + if bands == ["R"]: + mode = "L" + elif bands == ["B", "G", "R"]: + mode = "RGB" + elif bands == ["A", "B", "G", "R"]: + mode = "RGBA" + else: + mode = "" # unknown + + # skip over blend flags and extra information + read(12) # filler + name = "" + size = i32(read(4)) # length of the extra data field + if size: + data_end = fp.tell() + size + + length = i32(read(4)) + if length: + fp.seek(length - 16, io.SEEK_CUR) + + length = i32(read(4)) + if length: + fp.seek(length, io.SEEK_CUR) + + length = i8(read(1)) + if length: + # Don't know the proper encoding, + # Latin-1 should be a good guess + name = read(length).decode("latin-1", "replace") + + fp.seek(data_end) + layers.append((name, mode, (x0, y0, x1, y1))) + + # get tiles + layerinfo = [] + for i, (name, mode, bbox) in enumerate(layers): + tile = [] + for m in mode: + t = _maketile(fp, m, bbox, 1) + if t: + tile.extend(t) + layerinfo.append((name, mode, bbox, tile)) + + return layerinfo + + +def _maketile( + file: IO[bytes], mode: str, bbox: tuple[int, int, int, int], channels: int +) -> list[ImageFile._Tile]: + tiles = [] + read = file.read + + compression = i16(read(2)) + + xsize = bbox[2] - bbox[0] + ysize = bbox[3] - bbox[1] + + offset = file.tell() + + if compression == 0: + # + # raw compression + for channel in range(channels): + layer = mode[channel] + if mode == "CMYK": + layer += ";I" + tiles.append(ImageFile._Tile("raw", bbox, offset, layer)) + offset = offset + xsize * ysize + + elif compression == 1: + # + # packbits compression + i = 0 + bytecount = read(channels * ysize * 2) + offset = file.tell() + for channel in range(channels): + layer = mode[channel] + if mode == "CMYK": + layer += ";I" + tiles.append(ImageFile._Tile("packbits", bbox, offset, layer)) + for y in range(ysize): + offset = offset + i16(bytecount, i) + i += 2 + + file.seek(offset) + + if offset & 1: + read(1) # padding + + return tiles + + +# -------------------------------------------------------------------- +# registry + + +Image.register_open(PsdImageFile.format, PsdImageFile, _accept) + +Image.register_extension(PsdImageFile.format, ".psd") + +Image.register_mime(PsdImageFile.format, "image/vnd.adobe.photoshop") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/QoiImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/QoiImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..b73819c4c137caa0abf7670b7590c620cbc8c6b1 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/QoiImagePlugin.py @@ -0,0 +1,235 @@ +# +# The Python Imaging Library. +# +# QOI support for PIL +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +from typing import IO + +from . import Image, ImageFile +from ._binary import i32be as i32 +from ._binary import o8 +from ._binary import o32be as o32 + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"qoif") + + +class QoiImageFile(ImageFile.ImageFile): + format = "QOI" + format_description = "Quite OK Image" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(4)): + msg = "not a QOI file" + raise SyntaxError(msg) + + self._size = i32(self.fp.read(4)), i32(self.fp.read(4)) + + channels = self.fp.read(1)[0] + self._mode = "RGB" if channels == 3 else "RGBA" + + self.fp.seek(1, os.SEEK_CUR) # colorspace + self.tile = [ImageFile._Tile("qoi", (0, 0) + self._size, self.fp.tell())] + + +class QoiDecoder(ImageFile.PyDecoder): + _pulls_fd = True + _previous_pixel: bytes | bytearray | None = None + _previously_seen_pixels: dict[int, bytes | bytearray] = {} + + def _add_to_previous_pixels(self, value: bytes | bytearray) -> None: + self._previous_pixel = value + + r, g, b, a = value + hash_value = (r * 3 + g * 5 + b * 7 + a * 11) % 64 + self._previously_seen_pixels[hash_value] = value + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + + self._previously_seen_pixels = {} + self._previous_pixel = bytearray((0, 0, 0, 255)) + + data = bytearray() + bands = Image.getmodebands(self.mode) + dest_length = self.state.xsize * self.state.ysize * bands + while len(data) < dest_length: + byte = self.fd.read(1)[0] + value: bytes | bytearray + if byte == 0b11111110 and self._previous_pixel: # QOI_OP_RGB + value = bytearray(self.fd.read(3)) + self._previous_pixel[3:] + elif byte == 0b11111111: # QOI_OP_RGBA + value = self.fd.read(4) + else: + op = byte >> 6 + if op == 0: # QOI_OP_INDEX + op_index = byte & 0b00111111 + value = self._previously_seen_pixels.get( + op_index, bytearray((0, 0, 0, 0)) + ) + elif op == 1 and self._previous_pixel: # QOI_OP_DIFF + value = bytearray( + ( + (self._previous_pixel[0] + ((byte & 0b00110000) >> 4) - 2) + % 256, + (self._previous_pixel[1] + ((byte & 0b00001100) >> 2) - 2) + % 256, + (self._previous_pixel[2] + (byte & 0b00000011) - 2) % 256, + self._previous_pixel[3], + ) + ) + elif op == 2 and self._previous_pixel: # QOI_OP_LUMA + second_byte = self.fd.read(1)[0] + diff_green = (byte & 0b00111111) - 32 + diff_red = ((second_byte & 0b11110000) >> 4) - 8 + diff_blue = (second_byte & 0b00001111) - 8 + + value = bytearray( + tuple( + (self._previous_pixel[i] + diff_green + diff) % 256 + for i, diff in enumerate((diff_red, 0, diff_blue)) + ) + ) + value += self._previous_pixel[3:] + elif op == 3 and self._previous_pixel: # QOI_OP_RUN + run_length = (byte & 0b00111111) + 1 + value = self._previous_pixel + if bands == 3: + value = value[:3] + data += value * run_length + continue + self._add_to_previous_pixels(value) + + if bands == 3: + value = value[:3] + data += value + self.set_as_raw(data) + return -1, 0 + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode == "RGB": + channels = 3 + elif im.mode == "RGBA": + channels = 4 + else: + msg = "Unsupported QOI image mode" + raise ValueError(msg) + + colorspace = 0 if im.encoderinfo.get("colorspace") == "sRGB" else 1 + + fp.write(b"qoif") + fp.write(o32(im.size[0])) + fp.write(o32(im.size[1])) + fp.write(o8(channels)) + fp.write(o8(colorspace)) + + ImageFile._save(im, fp, [ImageFile._Tile("qoi", (0, 0) + im.size)]) + + +class QoiEncoder(ImageFile.PyEncoder): + _pushes_fd = True + _previous_pixel: tuple[int, int, int, int] | None = None + _previously_seen_pixels: dict[int, tuple[int, int, int, int]] = {} + _run = 0 + + def _write_run(self) -> bytes: + data = o8(0b11000000 | (self._run - 1)) # QOI_OP_RUN + self._run = 0 + return data + + def _delta(self, left: int, right: int) -> int: + result = (left - right) & 255 + if result >= 128: + result -= 256 + return result + + def encode(self, bufsize: int) -> tuple[int, int, bytes]: + assert self.im is not None + + self._previously_seen_pixels = {0: (0, 0, 0, 0)} + self._previous_pixel = (0, 0, 0, 255) + + data = bytearray() + w, h = self.im.size + bands = Image.getmodebands(self.mode) + + for y in range(h): + for x in range(w): + pixel = self.im.getpixel((x, y)) + if bands == 3: + pixel = (*pixel, 255) + + if pixel == self._previous_pixel: + self._run += 1 + if self._run == 62: + data += self._write_run() + else: + if self._run: + data += self._write_run() + + r, g, b, a = pixel + hash_value = (r * 3 + g * 5 + b * 7 + a * 11) % 64 + if self._previously_seen_pixels.get(hash_value) == pixel: + data += o8(hash_value) # QOI_OP_INDEX + elif self._previous_pixel: + self._previously_seen_pixels[hash_value] = pixel + + prev_r, prev_g, prev_b, prev_a = self._previous_pixel + if prev_a == a: + delta_r = self._delta(r, prev_r) + delta_g = self._delta(g, prev_g) + delta_b = self._delta(b, prev_b) + + if ( + -2 <= delta_r < 2 + and -2 <= delta_g < 2 + and -2 <= delta_b < 2 + ): + data += o8( + 0b01000000 + | (delta_r + 2) << 4 + | (delta_g + 2) << 2 + | (delta_b + 2) + ) # QOI_OP_DIFF + else: + delta_gr = self._delta(delta_r, delta_g) + delta_gb = self._delta(delta_b, delta_g) + if ( + -8 <= delta_gr < 8 + and -32 <= delta_g < 32 + and -8 <= delta_gb < 8 + ): + data += o8( + 0b10000000 | (delta_g + 32) + ) # QOI_OP_LUMA + data += o8((delta_gr + 8) << 4 | (delta_gb + 8)) + else: + data += o8(0b11111110) # QOI_OP_RGB + data += bytes(pixel[:3]) + else: + data += o8(0b11111111) # QOI_OP_RGBA + data += bytes(pixel) + + self._previous_pixel = pixel + + if self._run: + data += self._write_run() + data += bytes((0, 0, 0, 0, 0, 0, 0, 1)) # padding + + return len(data), 0, data + + +Image.register_open(QoiImageFile.format, QoiImageFile, _accept) +Image.register_decoder("qoi", QoiDecoder) +Image.register_extension(QoiImageFile.format, ".qoi") + +Image.register_save(QoiImageFile.format, _save) +Image.register_encoder("qoi", QoiEncoder) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SgiImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SgiImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..24de079d33faaca31ad8e091e544714bd4508d9b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SgiImagePlugin.py @@ -0,0 +1,231 @@ +# +# The Python Imaging Library. +# $Id$ +# +# SGI image file handling +# +# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli. +# +# +# +# History: +# 2017-22-07 mb Add RLE decompression +# 2016-16-10 mb Add save method without compression +# 1995-09-10 fl Created +# +# Copyright (c) 2016 by Mickael Bonfill. +# Copyright (c) 2008 by Karsten Hiddemann. +# Copyright (c) 1997 by Secret Labs AB. +# Copyright (c) 1995 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +import struct +from typing import IO + +from . import Image, ImageFile +from ._binary import i16be as i16 +from ._binary import o8 + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 2 and i16(prefix) == 474 + + +MODES = { + (1, 1, 1): "L", + (1, 2, 1): "L", + (2, 1, 1): "L;16B", + (2, 2, 1): "L;16B", + (1, 3, 3): "RGB", + (2, 3, 3): "RGB;16B", + (1, 3, 4): "RGBA", + (2, 3, 4): "RGBA;16B", +} + + +## +# Image plugin for SGI images. +class SgiImageFile(ImageFile.ImageFile): + format = "SGI" + format_description = "SGI Image File Format" + + def _open(self) -> None: + # HEAD + assert self.fp is not None + + headlen = 512 + s = self.fp.read(headlen) + + if not _accept(s): + msg = "Not an SGI image file" + raise ValueError(msg) + + # compression : verbatim or RLE + compression = s[2] + + # bpc : 1 or 2 bytes (8bits or 16bits) + bpc = s[3] + + # dimension : 1, 2 or 3 (depending on xsize, ysize and zsize) + dimension = i16(s, 4) + + # xsize : width + xsize = i16(s, 6) + + # ysize : height + ysize = i16(s, 8) + + # zsize : channels count + zsize = i16(s, 10) + + # determine mode from bits/zsize + try: + rawmode = MODES[(bpc, dimension, zsize)] + except KeyError: + msg = "Unsupported SGI image mode" + raise ValueError(msg) + + self._size = xsize, ysize + self._mode = rawmode.split(";")[0] + if self.mode == "RGB": + self.custom_mimetype = "image/rgb" + + # orientation -1 : scanlines begins at the bottom-left corner + orientation = -1 + + # decoder info + if compression == 0: + pagesize = xsize * ysize * bpc + if bpc == 2: + self.tile = [ + ImageFile._Tile( + "SGI16", + (0, 0) + self.size, + headlen, + (self.mode, 0, orientation), + ) + ] + else: + self.tile = [] + offset = headlen + for layer in self.mode: + self.tile.append( + ImageFile._Tile( + "raw", (0, 0) + self.size, offset, (layer, 0, orientation) + ) + ) + offset += pagesize + elif compression == 1: + self.tile = [ + ImageFile._Tile( + "sgi_rle", (0, 0) + self.size, headlen, (rawmode, orientation, bpc) + ) + ] + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode not in {"RGB", "RGBA", "L"}: + msg = "Unsupported SGI image mode" + raise ValueError(msg) + + # Get the keyword arguments + info = im.encoderinfo + + # Byte-per-pixel precision, 1 = 8bits per pixel + bpc = info.get("bpc", 1) + + if bpc not in (1, 2): + msg = "Unsupported number of bytes per pixel" + raise ValueError(msg) + + # Flip the image, since the origin of SGI file is the bottom-left corner + orientation = -1 + # Define the file as SGI File Format + magic_number = 474 + # Run-Length Encoding Compression - Unsupported at this time + rle = 0 + + # X Dimension = width / Y Dimension = height + x, y = im.size + # Z Dimension: Number of channels + z = len(im.mode) + # Number of dimensions (x,y,z) + if im.mode == "L": + dimension = 1 if y == 1 else 2 + else: + dimension = 3 + + # Minimum Byte value + pinmin = 0 + # Maximum Byte value (255 = 8bits per pixel) + pinmax = 255 + # Image name (79 characters max, truncated below in write) + img_name = os.path.splitext(os.path.basename(filename))[0] + if isinstance(img_name, str): + img_name = img_name.encode("ascii", "ignore") + # Standard representation of pixel in the file + colormap = 0 + fp.write(struct.pack(">h", magic_number)) + fp.write(o8(rle)) + fp.write(o8(bpc)) + fp.write(struct.pack(">H", dimension)) + fp.write(struct.pack(">H", x)) + fp.write(struct.pack(">H", y)) + fp.write(struct.pack(">H", z)) + fp.write(struct.pack(">l", pinmin)) + fp.write(struct.pack(">l", pinmax)) + fp.write(struct.pack("4s", b"")) # dummy + fp.write(struct.pack("79s", img_name)) # truncates to 79 chars + fp.write(struct.pack("s", b"")) # force null byte after img_name + fp.write(struct.pack(">l", colormap)) + fp.write(struct.pack("404s", b"")) # dummy + + rawmode = "L" + if bpc == 2: + rawmode = "L;16B" + + for channel in im.split(): + fp.write(channel.tobytes("raw", rawmode, 0, orientation)) + + if hasattr(fp, "flush"): + fp.flush() + + +class SGI16Decoder(ImageFile.PyDecoder): + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + assert self.im is not None + + rawmode, stride, orientation = self.args + pagesize = self.state.xsize * self.state.ysize + zsize = len(self.mode) + self.fd.seek(512) + + for band in range(zsize): + channel = Image.new("L", (self.state.xsize, self.state.ysize)) + channel.frombytes( + self.fd.read(2 * pagesize), "raw", "L;16B", stride, orientation + ) + self.im.putband(channel.im, band) + + return -1, 0 + + +# +# registry + + +Image.register_decoder("SGI16", SGI16Decoder) +Image.register_open(SgiImageFile.format, SgiImageFile, _accept) +Image.register_save(SgiImageFile.format, _save) +Image.register_mime(SgiImageFile.format, "image/sgi") + +Image.register_extensions(SgiImageFile.format, [".bw", ".rgb", ".rgba", ".sgi"]) + +# End of file diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SpiderImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SpiderImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..8410fe5f648f08cc91c10b956498511592edf68c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SpiderImagePlugin.py @@ -0,0 +1,332 @@ +# +# The Python Imaging Library. +# +# SPIDER image file handling +# +# History: +# 2004-08-02 Created BB +# 2006-03-02 added save method +# 2006-03-13 added support for stack images +# +# Copyright (c) 2004 by Health Research Inc. (HRI) RENSSELAER, NY 12144. +# Copyright (c) 2004 by William Baxter. +# Copyright (c) 2004 by Secret Labs AB. +# Copyright (c) 2004 by Fredrik Lundh. +# + +## +# Image plugin for the Spider image format. This format is used +# by the SPIDER software, in processing image data from electron +# microscopy and tomography. +## + +# +# SpiderImagePlugin.py +# +# The Spider image format is used by SPIDER software, in processing +# image data from electron microscopy and tomography. +# +# Spider home page: +# https://spider.wadsworth.org/spider_doc/spider/docs/spider.html +# +# Details about the Spider image format: +# https://spider.wadsworth.org/spider_doc/spider/docs/image_doc.html +# +from __future__ import annotations + +import os +import struct +import sys +from typing import IO, Any, cast + +from . import Image, ImageFile +from ._util import DeferredError + +TYPE_CHECKING = False + + +def isInt(f: Any) -> int: + try: + i = int(f) + if f - i == 0: + return 1 + else: + return 0 + except (ValueError, OverflowError): + return 0 + + +iforms = [1, 3, -11, -12, -21, -22] + + +# There is no magic number to identify Spider files, so just check a +# series of header locations to see if they have reasonable values. +# Returns no. of bytes in the header, if it is a valid Spider header, +# otherwise returns 0 + + +def isSpiderHeader(t: tuple[float, ...]) -> int: + h = (99,) + t # add 1 value so can use spider header index start=1 + # header values 1,2,5,12,13,22,23 should be integers + for i in [1, 2, 5, 12, 13, 22, 23]: + if not isInt(h[i]): + return 0 + # check iform + iform = int(h[5]) + if iform not in iforms: + return 0 + # check other header values + labrec = int(h[13]) # no. records in file header + labbyt = int(h[22]) # total no. of bytes in header + lenbyt = int(h[23]) # record length in bytes + if labbyt != (labrec * lenbyt): + return 0 + # looks like a valid header + return labbyt + + +def isSpiderImage(filename: str) -> int: + with open(filename, "rb") as fp: + f = fp.read(92) # read 23 * 4 bytes + t = struct.unpack(">23f", f) # try big-endian first + hdrlen = isSpiderHeader(t) + if hdrlen == 0: + t = struct.unpack("<23f", f) # little-endian + hdrlen = isSpiderHeader(t) + return hdrlen + + +class SpiderImageFile(ImageFile.ImageFile): + format = "SPIDER" + format_description = "Spider 2D image" + _close_exclusive_fp_after_loading = False + + def _open(self) -> None: + # check header + n = 27 * 4 # read 27 float values + assert self.fp is not None + f = self.fp.read(n) + + try: + self.bigendian = 1 + t = struct.unpack(">27f", f) # try big-endian first + hdrlen = isSpiderHeader(t) + if hdrlen == 0: + self.bigendian = 0 + t = struct.unpack("<27f", f) # little-endian + hdrlen = isSpiderHeader(t) + if hdrlen == 0: + msg = "not a valid Spider file" + raise SyntaxError(msg) + except struct.error as e: + msg = "not a valid Spider file" + raise SyntaxError(msg) from e + + h = (99,) + t # add 1 value : spider header index starts at 1 + iform = int(h[5]) + if iform != 1: + msg = "not a Spider 2D image" + raise SyntaxError(msg) + + self._size = int(h[12]), int(h[2]) # size in pixels (width, height) + self.istack = int(h[24]) + self.imgnumber = int(h[27]) + + if self.istack == 0 and self.imgnumber == 0: + # stk=0, img=0: a regular 2D image + offset = hdrlen + self._nimages = 1 + elif self.istack > 0 and self.imgnumber == 0: + # stk>0, img=0: Opening the stack for the first time + self.imgbytes = int(h[12]) * int(h[2]) * 4 + self.hdrlen = hdrlen + self._nimages = int(h[26]) + # Point to the first image in the stack + offset = hdrlen * 2 + self.imgnumber = 1 + elif self.istack == 0 and self.imgnumber > 0: + # stk=0, img>0: an image within the stack + offset = hdrlen + self.stkoffset + self.istack = 2 # So Image knows it's still a stack + else: + msg = "inconsistent stack header values" + raise SyntaxError(msg) + + if self.bigendian: + self.rawmode = "F;32BF" + else: + self.rawmode = "F;32F" + self._mode = "F" + + self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, offset, self.rawmode)] + self._fp = self.fp # FIXME: hack + + @property + def n_frames(self) -> int: + return self._nimages + + @property + def is_animated(self) -> bool: + return self._nimages > 1 + + # 1st image index is zero (although SPIDER imgnumber starts at 1) + def tell(self) -> int: + if self.imgnumber < 1: + return 0 + else: + return self.imgnumber - 1 + + def seek(self, frame: int) -> None: + if self.istack == 0: + msg = "attempt to seek in a non-stack file" + raise EOFError(msg) + if not self._seek_check(frame): + return + if isinstance(self._fp, DeferredError): + raise self._fp.ex + self.stkoffset = self.hdrlen + frame * (self.hdrlen + self.imgbytes) + self.fp = self._fp + self.fp.seek(self.stkoffset) + self._open() + + # returns a byte image after rescaling to 0..255 + def convert2byte(self, depth: int = 255) -> Image.Image: + extrema = self.getextrema() + assert isinstance(extrema[0], float) + minimum, maximum = cast(tuple[float, float], extrema) + m: float = 1 + if maximum != minimum: + m = depth / (maximum - minimum) + b = -m * minimum + return self.point(lambda i: i * m + b).convert("L") + + if TYPE_CHECKING: + from . import ImageTk + + # returns a ImageTk.PhotoImage object, after rescaling to 0..255 + def tkPhotoImage(self) -> ImageTk.PhotoImage: + from . import ImageTk + + return ImageTk.PhotoImage(self.convert2byte(), palette=256) + + +# -------------------------------------------------------------------- +# Image series + + +# given a list of filenames, return a list of images +def loadImageSeries(filelist: list[str] | None = None) -> list[Image.Image] | None: + """create a list of :py:class:`~PIL.Image.Image` objects for use in a montage""" + if filelist is None or len(filelist) < 1: + return None + + byte_imgs = [] + for img in filelist: + if not os.path.exists(img): + print(f"unable to find {img}") + continue + try: + with Image.open(img) as im: + assert isinstance(im, SpiderImageFile) + byte_im = im.convert2byte() + except Exception: + if not isSpiderImage(img): + print(f"{img} is not a Spider image file") + continue + byte_im.info["filename"] = img + byte_imgs.append(byte_im) + return byte_imgs + + +# -------------------------------------------------------------------- +# For saving images in Spider format + + +def makeSpiderHeader(im: Image.Image) -> list[bytes]: + nsam, nrow = im.size + lenbyt = max(1, nsam) * 4 # There are labrec records in the header + labrec = int(1024 / lenbyt) + if 1024 % lenbyt != 0: + labrec += 1 + labbyt = labrec * lenbyt + nvalues = int(labbyt / 4) + if nvalues < 23: + return [] + + hdr = [0.0] * nvalues + + # NB these are Fortran indices + hdr[1] = 1.0 # nslice (=1 for an image) + hdr[2] = float(nrow) # number of rows per slice + hdr[3] = float(nrow) # number of records in the image + hdr[5] = 1.0 # iform for 2D image + hdr[12] = float(nsam) # number of pixels per line + hdr[13] = float(labrec) # number of records in file header + hdr[22] = float(labbyt) # total number of bytes in header + hdr[23] = float(lenbyt) # record length in bytes + + # adjust for Fortran indexing + hdr = hdr[1:] + hdr.append(0.0) + # pack binary data into a string + return [struct.pack("f", v) for v in hdr] + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode != "F": + im = im.convert("F") + + hdr = makeSpiderHeader(im) + if len(hdr) < 256: + msg = "Error creating Spider header" + raise OSError(msg) + + # write the SPIDER header + fp.writelines(hdr) + + rawmode = "F;32NF" # 32-bit native floating point + ImageFile._save(im, fp, [ImageFile._Tile("raw", (0, 0) + im.size, 0, rawmode)]) + + +def _save_spider(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + # get the filename extension and register it with Image + if filename_ext := os.path.splitext(filename)[1]: + ext = filename_ext.decode() if isinstance(filename_ext, bytes) else filename_ext + Image.register_extension(SpiderImageFile.format, ext) + _save(im, fp, filename) + + +# -------------------------------------------------------------------- + + +Image.register_open(SpiderImageFile.format, SpiderImageFile) +Image.register_save(SpiderImageFile.format, _save_spider) + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Syntax: python3 SpiderImagePlugin.py [infile] [outfile]") + sys.exit() + + filename = sys.argv[1] + if not isSpiderImage(filename): + print("input image must be in Spider format") + sys.exit() + + with Image.open(filename) as im: + print(f"image: {im}") + print(f"format: {im.format}") + print(f"size: {im.size}") + print(f"mode: {im.mode}") + print("max, min: ", end=" ") + print(im.getextrema()) + + if len(sys.argv) > 2: + outfile = sys.argv[2] + + # perform some image operation + transposed_im = im.transpose(Image.Transpose.FLIP_LEFT_RIGHT) + print( + f"saving a flipped version of {os.path.basename(filename)} " + f"as {outfile} " + ) + transposed_im.save(outfile, SpiderImageFile.format) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SunImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SunImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..1587ce6332572fb59d77fb7ab7664037c390551f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/SunImagePlugin.py @@ -0,0 +1,145 @@ +# +# The Python Imaging Library. +# $Id$ +# +# Sun image file handling +# +# History: +# 1995-09-10 fl Created +# 1996-05-28 fl Fixed 32-bit alignment +# 1998-12-29 fl Import ImagePalette module +# 2001-12-18 fl Fixed palette loading (from Jean-Claude Rimbault) +# +# Copyright (c) 1997-2001 by Secret Labs AB +# Copyright (c) 1995-1996 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +from . import Image, ImageFile, ImagePalette +from ._binary import i32be as i32 + + +def _accept(prefix: bytes) -> bool: + return len(prefix) >= 4 and i32(prefix) == 0x59A66A95 + + +## +# Image plugin for Sun raster files. + + +class SunImageFile(ImageFile.ImageFile): + format = "SUN" + format_description = "Sun Raster File" + + def _open(self) -> None: + # The Sun Raster file header is 32 bytes in length + # and has the following format: + + # typedef struct _SunRaster + # { + # DWORD MagicNumber; /* Magic (identification) number */ + # DWORD Width; /* Width of image in pixels */ + # DWORD Height; /* Height of image in pixels */ + # DWORD Depth; /* Number of bits per pixel */ + # DWORD Length; /* Size of image data in bytes */ + # DWORD Type; /* Type of raster file */ + # DWORD ColorMapType; /* Type of color map */ + # DWORD ColorMapLength; /* Size of the color map in bytes */ + # } SUNRASTER; + + assert self.fp is not None + + # HEAD + s = self.fp.read(32) + if not _accept(s): + msg = "not an SUN raster file" + raise SyntaxError(msg) + + offset = 32 + + self._size = i32(s, 4), i32(s, 8) + + depth = i32(s, 12) + # data_length = i32(s, 16) # unreliable, ignore. + file_type = i32(s, 20) + palette_type = i32(s, 24) # 0: None, 1: RGB, 2: Raw/arbitrary + palette_length = i32(s, 28) + + if depth == 1: + self._mode, rawmode = "1", "1;I" + elif depth == 4: + self._mode, rawmode = "L", "L;4" + elif depth == 8: + self._mode = rawmode = "L" + elif depth == 24: + if file_type == 3: + self._mode, rawmode = "RGB", "RGB" + else: + self._mode, rawmode = "RGB", "BGR" + elif depth == 32: + if file_type == 3: + self._mode, rawmode = "RGB", "RGBX" + else: + self._mode, rawmode = "RGB", "BGRX" + else: + msg = "Unsupported Mode/Bit Depth" + raise SyntaxError(msg) + + if palette_length: + if palette_length > 1024: + msg = "Unsupported Color Palette Length" + raise SyntaxError(msg) + + if palette_type != 1: + msg = "Unsupported Palette Type" + raise SyntaxError(msg) + + offset = offset + palette_length + self.palette = ImagePalette.raw("RGB;L", self.fp.read(palette_length)) + if self.mode == "L": + self._mode = "P" + rawmode = rawmode.replace("L", "P") + + # 16 bit boundaries on stride + stride = ((self.size[0] * depth + 15) // 16) * 2 + + # file type: Type is the version (or flavor) of the bitmap + # file. The following values are typically found in the Type + # field: + # 0000h Old + # 0001h Standard + # 0002h Byte-encoded + # 0003h RGB format + # 0004h TIFF format + # 0005h IFF format + # FFFFh Experimental + + # Old and standard are the same, except for the length tag. + # byte-encoded is run-length-encoded + # RGB looks similar to standard, but RGB byte order + # TIFF and IFF mean that they were converted from T/IFF + # Experimental means that it's something else. + # (https://www.fileformat.info/format/sunraster/egff.htm) + + if file_type in (0, 1, 3, 4, 5): + self.tile = [ + ImageFile._Tile("raw", (0, 0) + self.size, offset, (rawmode, stride)) + ] + elif file_type == 2: + self.tile = [ + ImageFile._Tile("sun_rle", (0, 0) + self.size, offset, rawmode) + ] + else: + msg = "Unsupported Sun Raster file type" + raise SyntaxError(msg) + + +# +# registry + + +Image.register_open(SunImageFile.format, SunImageFile, _accept) + +Image.register_extension(SunImageFile.format, ".ras") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TarIO.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TarIO.py new file mode 100644 index 0000000000000000000000000000000000000000..8a9a20699c46f1da521cc59b1b1cc235b0b4615f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TarIO.py @@ -0,0 +1,61 @@ +# +# The Python Imaging Library. +# $Id$ +# +# read files from within a tar file +# +# History: +# 95-06-18 fl Created +# 96-05-28 fl Open files in binary mode +# +# Copyright (c) Secret Labs AB 1997. +# Copyright (c) Fredrik Lundh 1995-96. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io + +from . import ContainerIO + + +class TarIO(ContainerIO.ContainerIO[bytes]): + """A file object that provides read access to a given member of a TAR file.""" + + def __init__(self, tarfile: str, file: str) -> None: + """ + Create file object. + + :param tarfile: Name of TAR file. + :param file: Name of member file. + """ + self.fh = open(tarfile, "rb") + + while True: + s = self.fh.read(512) + if len(s) != 512: + self.fh.close() + + msg = "unexpected end of tar file" + raise OSError(msg) + + name = s[:100].decode("utf-8") + i = name.find("\0") + if i == 0: + self.fh.close() + + msg = "cannot find subfile" + raise OSError(msg) + if i > 0: + name = name[:i] + + size = int(s[124:135], 8) + + if file == name: + break + + self.fh.seek((size + 511) & (~511), io.SEEK_CUR) + + # Open region + super().__init__(self.fh, self.fh.tell(), size) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TgaImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TgaImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..622984229f1f3174d5c0d3474f7e24d01bd51d65 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TgaImagePlugin.py @@ -0,0 +1,280 @@ +# +# The Python Imaging Library. +# $Id$ +# +# TGA file handling +# +# History: +# 95-09-01 fl created (reads 24-bit files only) +# 97-01-04 fl support more TGA versions, including compressed images +# 98-07-04 fl fixed orientation and alpha layer bugs +# 98-09-11 fl fixed orientation for runlength decoder +# +# Copyright (c) Secret Labs AB 1997-98. +# Copyright (c) Fredrik Lundh 1995-97. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import os +import warnings +from typing import IO + +from . import Image, ImageFile, ImagePalette +from ._binary import i16le as i16 +from ._binary import i32le as i32 +from ._binary import o8 +from ._binary import o16le as o16 + +# +# -------------------------------------------------------------------- +# Read RGA file + + +MODES = { + # map imagetype/depth to rawmode + (1, 8): "P", + (3, 1): "1", + (3, 8): "L", + (3, 16): "LA", + (2, 16): "BGRA;15Z", + (2, 24): "BGR", + (2, 32): "BGRA", +} + + +## +# Image plugin for Targa files. + + +class TgaImageFile(ImageFile.ImageFile): + format = "TGA" + format_description = "Targa" + + def _open(self) -> None: + # process header + assert self.fp is not None + + s = self.fp.read(18) + + id_len = s[0] + + colormaptype = s[1] + imagetype = s[2] + + depth = s[16] + + flags = s[17] + + self._size = i16(s, 12), i16(s, 14) + + # validate header fields + if ( + colormaptype not in (0, 1) + or self.size[0] <= 0 + or self.size[1] <= 0 + or depth not in (1, 8, 16, 24, 32) + ): + msg = "not a TGA file" + raise SyntaxError(msg) + + # image mode + if imagetype in (3, 11): + self._mode = "L" + if depth == 1: + self._mode = "1" # ??? + elif depth == 16: + self._mode = "LA" + elif imagetype in (1, 9): + self._mode = "P" if colormaptype else "L" + elif imagetype in (2, 10): + self._mode = "RGB" if depth == 24 else "RGBA" + else: + msg = "unknown TGA mode" + raise SyntaxError(msg) + + # orientation + orientation = flags & 0x30 + self._flip_horizontally = orientation in [0x10, 0x30] + if orientation in [0x20, 0x30]: + orientation = 1 + elif orientation in [0, 0x10]: + orientation = -1 + else: + msg = "unknown TGA orientation" + raise SyntaxError(msg) + + self.info["orientation"] = orientation + + if imagetype & 8: + self.info["compression"] = "tga_rle" + + if id_len: + self.info["id_section"] = self.fp.read(id_len) + + if colormaptype: + # read palette + start, size, mapdepth = i16(s, 3), i16(s, 5), s[7] + if mapdepth == 16: + self.palette = ImagePalette.raw( + "BGRA;15Z", bytes(2 * start) + self.fp.read(2 * size) + ) + self.palette.mode = "RGBA" + elif mapdepth == 24: + self.palette = ImagePalette.raw( + "BGR", bytes(3 * start) + self.fp.read(3 * size) + ) + elif mapdepth == 32: + self.palette = ImagePalette.raw( + "BGRA", bytes(4 * start) + self.fp.read(4 * size) + ) + else: + msg = "unknown TGA map depth" + raise SyntaxError(msg) + + # setup tile descriptor + try: + rawmode = MODES[(imagetype & 7, depth)] + if imagetype & 8: + # compressed + self.tile = [ + ImageFile._Tile( + "tga_rle", + (0, 0) + self.size, + self.fp.tell(), + (rawmode, orientation, depth), + ) + ] + else: + self.tile = [ + ImageFile._Tile( + "raw", + (0, 0) + self.size, + self.fp.tell(), + (rawmode, 0, orientation), + ) + ] + except KeyError: + pass # cannot decode + + def load_end(self) -> None: + if self.mode == "RGBA": + assert self.fp is not None + self.fp.seek(-26, os.SEEK_END) + footer = self.fp.read(26) + if footer.endswith(b"TRUEVISION-XFILE.\x00"): + # version 2 + extension_offset = i32(footer) + if extension_offset: + self.fp.seek(extension_offset + 494) + attributes_type = self.fp.read(1) + if attributes_type == b"\x00": + # No alpha + self.im.fillband(3, 255) + + if self._flip_horizontally: + self.im = self.im.transpose(Image.Transpose.FLIP_LEFT_RIGHT) + + +# +# -------------------------------------------------------------------- +# Write TGA file + + +SAVE = { + "1": ("1", 1, 0, 3), + "L": ("L", 8, 0, 3), + "LA": ("LA", 16, 0, 3), + "P": ("P", 8, 1, 1), + "RGB": ("BGR", 24, 0, 2), + "RGBA": ("BGRA", 32, 0, 2), +} + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + try: + rawmode, bits, colormaptype, imagetype = SAVE[im.mode] + except KeyError as e: + msg = f"cannot write mode {im.mode} as TGA" + raise OSError(msg) from e + + if "rle" in im.encoderinfo: + rle = im.encoderinfo["rle"] + else: + compression = im.encoderinfo.get("compression", im.info.get("compression")) + rle = compression == "tga_rle" + if rle: + imagetype += 8 + + id_section = im.encoderinfo.get("id_section", im.info.get("id_section", "")) + id_len = len(id_section) + if id_len > 255: + id_len = 255 + id_section = id_section[:255] + warnings.warn("id_section has been trimmed to 255 characters") + + if colormaptype: + palette = im.im.getpalette("RGB", "BGR") + colormaplength, colormapentry = len(palette) // 3, 24 + else: + colormaplength, colormapentry = 0, 0 + + if im.mode in ("LA", "RGBA"): + flags = 8 + else: + flags = 0 + + orientation = im.encoderinfo.get("orientation", im.info.get("orientation", -1)) + if orientation > 0: + flags = flags | 0x20 + + fp.write( + o8(id_len) + + o8(colormaptype) + + o8(imagetype) + + o16(0) # colormapfirst + + o16(colormaplength) + + o8(colormapentry) + + o16(0) + + o16(0) + + o16(im.size[0]) + + o16(im.size[1]) + + o8(bits) + + o8(flags) + ) + + if id_section: + fp.write(id_section) + + if colormaptype: + fp.write(palette) + + if rle: + ImageFile._save( + im, + fp, + [ImageFile._Tile("tga_rle", (0, 0) + im.size, 0, (rawmode, orientation))], + ) + else: + ImageFile._save( + im, + fp, + [ImageFile._Tile("raw", (0, 0) + im.size, 0, (rawmode, 0, orientation))], + ) + + # write targa version 2 footer + fp.write(b"\000" * 8 + b"TRUEVISION-XFILE." + b"\000") + + +# +# -------------------------------------------------------------------- +# Registry + + +Image.register_open(TgaImageFile.format, TgaImageFile) +Image.register_save(TgaImageFile.format, _save) + +Image.register_extensions(TgaImageFile.format, [".tga", ".icb", ".vda", ".vst"]) + +Image.register_mime(TgaImageFile.format, "image/x-tga") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TiffImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TiffImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..e15492b3c0459258a7eb8dd47a9189c79d58bc5f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TiffImagePlugin.py @@ -0,0 +1,2353 @@ +# +# The Python Imaging Library. +# $Id$ +# +# TIFF file handling +# +# TIFF is a flexible, if somewhat aged, image file format originally +# defined by Aldus. Although TIFF supports a wide variety of pixel +# layouts and compression methods, the name doesn't really stand for +# "thousands of incompatible file formats," it just feels that way. +# +# To read TIFF data from a stream, the stream must be seekable. For +# progressive decoding, make sure to use TIFF files where the tag +# directory is placed first in the file. +# +# History: +# 1995-09-01 fl Created +# 1996-05-04 fl Handle JPEGTABLES tag +# 1996-05-18 fl Fixed COLORMAP support +# 1997-01-05 fl Fixed PREDICTOR support +# 1997-08-27 fl Added support for rational tags (from Perry Stoll) +# 1998-01-10 fl Fixed seek/tell (from Jan Blom) +# 1998-07-15 fl Use private names for internal variables +# 1999-06-13 fl Rewritten for PIL 1.0 (1.0) +# 2000-10-11 fl Additional fixes for Python 2.0 (1.1) +# 2001-04-17 fl Fixed rewind support (seek to frame 0) (1.2) +# 2001-05-12 fl Added write support for more tags (from Greg Couch) (1.3) +# 2001-12-18 fl Added workaround for broken Matrox library +# 2002-01-18 fl Don't mess up if photometric tag is missing (D. Alan Stewart) +# 2003-05-19 fl Check FILLORDER tag +# 2003-09-26 fl Added RGBa support +# 2004-02-24 fl Added DPI support; fixed rational write support +# 2005-02-07 fl Added workaround for broken Corel Draw 10 files +# 2006-01-09 fl Added support for float/double tags (from Russell Nelson) +# +# Copyright (c) 1997-2006 by Secret Labs AB. All rights reserved. +# Copyright (c) 1995-1997 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import io +import itertools +import logging +import math +import os +import struct +import warnings +from collections.abc import Callable, MutableMapping +from fractions import Fraction +from numbers import Number, Rational +from typing import IO, Any, cast + +from . import ExifTags, Image, ImageFile, ImageOps, ImagePalette, TiffTags +from ._binary import i16be as i16 +from ._binary import i32be as i32 +from ._binary import o8 +from ._util import DeferredError, is_path +from .TiffTags import TYPES + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Iterator + from typing import NoReturn + + from ._typing import Buffer, IntegralLike, StrOrBytesPath + +logger = logging.getLogger(__name__) + +# Set these to true to force use of libtiff for reading or writing. +READ_LIBTIFF = False +WRITE_LIBTIFF = False +STRIP_SIZE = 65536 + +II = b"II" # little-endian (Intel style) +MM = b"MM" # big-endian (Motorola style) + +# +# -------------------------------------------------------------------- +# Read TIFF files + +# a few tag names, just to make the code below a bit more readable +OSUBFILETYPE = 255 +IMAGEWIDTH = 256 +IMAGELENGTH = 257 +BITSPERSAMPLE = 258 +COMPRESSION = 259 +PHOTOMETRIC_INTERPRETATION = 262 +FILLORDER = 266 +IMAGEDESCRIPTION = 270 +STRIPOFFSETS = 273 +SAMPLESPERPIXEL = 277 +ROWSPERSTRIP = 278 +STRIPBYTECOUNTS = 279 +X_RESOLUTION = 282 +Y_RESOLUTION = 283 +PLANAR_CONFIGURATION = 284 +RESOLUTION_UNIT = 296 +TRANSFERFUNCTION = 301 +SOFTWARE = 305 +DATE_TIME = 306 +ARTIST = 315 +PREDICTOR = 317 +COLORMAP = 320 +TILEWIDTH = 322 +TILELENGTH = 323 +TILEOFFSETS = 324 +TILEBYTECOUNTS = 325 +SUBIFD = 330 +EXTRASAMPLES = 338 +SAMPLEFORMAT = 339 +JPEGTABLES = 347 +YCBCRSUBSAMPLING = 530 +REFERENCEBLACKWHITE = 532 +COPYRIGHT = 33432 +IPTC_NAA_CHUNK = 33723 # newsphoto properties +PHOTOSHOP_CHUNK = 34377 # photoshop properties +ICCPROFILE = 34675 +EXIFIFD = 34665 +XMP = 700 +JPEGQUALITY = 65537 # pseudo-tag by libtiff + +# https://github.com/imagej/ImageJA/blob/master/src/main/java/ij/io/TiffDecoder.java +IMAGEJ_META_DATA_BYTE_COUNTS = 50838 +IMAGEJ_META_DATA = 50839 + +COMPRESSION_INFO = { + # Compression => pil compression name + 1: "raw", + 2: "tiff_ccitt", + 3: "group3", + 4: "group4", + 5: "tiff_lzw", + 6: "tiff_jpeg", # obsolete + 7: "jpeg", + 8: "tiff_adobe_deflate", + 32771: "tiff_raw_16", # 16-bit padding + 32773: "packbits", + 32809: "tiff_thunderscan", + 32946: "tiff_deflate", + 34676: "tiff_sgilog", + 34677: "tiff_sgilog24", + 34925: "lzma", + 50000: "zstd", + 50001: "webp", +} + +COMPRESSION_INFO_REV = {v: k for k, v in COMPRESSION_INFO.items()} + +OPEN_INFO = { + # (ByteOrder, PhotoInterpretation, SampleFormat, FillOrder, BitsPerSample, + # ExtraSamples) => mode, rawmode + (II, 0, (1,), 1, (1,), ()): ("1", "1;I"), + (MM, 0, (1,), 1, (1,), ()): ("1", "1;I"), + (II, 0, (1,), 2, (1,), ()): ("1", "1;IR"), + (MM, 0, (1,), 2, (1,), ()): ("1", "1;IR"), + (II, 1, (1,), 1, (1,), ()): ("1", "1"), + (MM, 1, (1,), 1, (1,), ()): ("1", "1"), + (II, 1, (1,), 2, (1,), ()): ("1", "1;R"), + (MM, 1, (1,), 2, (1,), ()): ("1", "1;R"), + (II, 0, (1,), 1, (2,), ()): ("L", "L;2I"), + (MM, 0, (1,), 1, (2,), ()): ("L", "L;2I"), + (II, 0, (1,), 2, (2,), ()): ("L", "L;2IR"), + (MM, 0, (1,), 2, (2,), ()): ("L", "L;2IR"), + (II, 1, (1,), 1, (2,), ()): ("L", "L;2"), + (MM, 1, (1,), 1, (2,), ()): ("L", "L;2"), + (II, 1, (1,), 2, (2,), ()): ("L", "L;2R"), + (MM, 1, (1,), 2, (2,), ()): ("L", "L;2R"), + (II, 0, (1,), 1, (4,), ()): ("L", "L;4I"), + (MM, 0, (1,), 1, (4,), ()): ("L", "L;4I"), + (II, 0, (1,), 2, (4,), ()): ("L", "L;4IR"), + (MM, 0, (1,), 2, (4,), ()): ("L", "L;4IR"), + (II, 1, (1,), 1, (4,), ()): ("L", "L;4"), + (MM, 1, (1,), 1, (4,), ()): ("L", "L;4"), + (II, 1, (1,), 2, (4,), ()): ("L", "L;4R"), + (MM, 1, (1,), 2, (4,), ()): ("L", "L;4R"), + (II, 0, (1,), 1, (8,), ()): ("L", "L;I"), + (MM, 0, (1,), 1, (8,), ()): ("L", "L;I"), + (II, 0, (1,), 2, (8,), ()): ("L", "L;IR"), + (MM, 0, (1,), 2, (8,), ()): ("L", "L;IR"), + (II, 1, (1,), 1, (8,), ()): ("L", "L"), + (MM, 1, (1,), 1, (8,), ()): ("L", "L"), + (II, 1, (2,), 1, (8,), ()): ("L", "L"), + (MM, 1, (2,), 1, (8,), ()): ("L", "L"), + (II, 1, (1,), 2, (8,), ()): ("L", "L;R"), + (MM, 1, (1,), 2, (8,), ()): ("L", "L;R"), + (II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"), + (II, 0, (1,), 1, (16,), ()): ("I;16", "I;16"), + (II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"), + (MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"), + (II, 1, (1,), 2, (16,), ()): ("I;16", "I;16R"), + (II, 1, (2,), 1, (16,), ()): ("I", "I;16S"), + (MM, 1, (2,), 1, (16,), ()): ("I", "I;16BS"), + (II, 0, (3,), 1, (32,), ()): ("F", "F;32F"), + (MM, 0, (3,), 1, (32,), ()): ("F", "F;32BF"), + (II, 1, (1,), 1, (32,), ()): ("I", "I;32N"), + (II, 1, (2,), 1, (32,), ()): ("I", "I;32S"), + (MM, 1, (2,), 1, (32,), ()): ("I", "I;32BS"), + (II, 1, (3,), 1, (32,), ()): ("F", "F;32F"), + (MM, 1, (3,), 1, (32,), ()): ("F", "F;32BF"), + (II, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"), + (MM, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"), + (II, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"), + (MM, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"), + (II, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"), + (MM, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"), + (II, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples + (MM, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples + (II, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGB", "RGBX"), + (MM, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGB", "RGBX"), + (II, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGB", "RGBXX"), + (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGB", "RGBXX"), + (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGB", "RGBXXX"), + (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGB", "RGBXXX"), + (II, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"), + (MM, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"), + (II, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"), + (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"), + (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"), + (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"), + (II, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"), + (MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"), + (II, 2, (1,), 1, (8, 8, 8, 8, 8), (2, 0)): ("RGBA", "RGBAX"), + (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (2, 0)): ("RGBA", "RGBAX"), + (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (2, 0, 0)): ("RGBA", "RGBAXX"), + (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (2, 0, 0)): ("RGBA", "RGBAXX"), + (II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10 + (MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10 + (II, 2, (1,), 1, (16, 16, 16), ()): ("RGB", "RGB;16L"), + (MM, 2, (1,), 1, (16, 16, 16), ()): ("RGB", "RGB;16B"), + (II, 2, (1,), 1, (16, 16, 16, 16), ()): ("RGBA", "RGBA;16L"), + (MM, 2, (1,), 1, (16, 16, 16, 16), ()): ("RGBA", "RGBA;16B"), + (II, 2, (1,), 1, (16, 16, 16, 16), (0,)): ("RGB", "RGBX;16L"), + (MM, 2, (1,), 1, (16, 16, 16, 16), (0,)): ("RGB", "RGBX;16B"), + (II, 2, (1,), 1, (16, 16, 16, 16), (1,)): ("RGBA", "RGBa;16L"), + (MM, 2, (1,), 1, (16, 16, 16, 16), (1,)): ("RGBA", "RGBa;16B"), + (II, 2, (1,), 1, (16, 16, 16, 16), (2,)): ("RGBA", "RGBA;16L"), + (MM, 2, (1,), 1, (16, 16, 16, 16), (2,)): ("RGBA", "RGBA;16B"), + (II, 3, (1,), 1, (1,), ()): ("P", "P;1"), + (MM, 3, (1,), 1, (1,), ()): ("P", "P;1"), + (II, 3, (1,), 2, (1,), ()): ("P", "P;1R"), + (MM, 3, (1,), 2, (1,), ()): ("P", "P;1R"), + (II, 3, (1,), 1, (2,), ()): ("P", "P;2"), + (MM, 3, (1,), 1, (2,), ()): ("P", "P;2"), + (II, 3, (1,), 2, (2,), ()): ("P", "P;2R"), + (MM, 3, (1,), 2, (2,), ()): ("P", "P;2R"), + (II, 3, (1,), 1, (4,), ()): ("P", "P;4"), + (MM, 3, (1,), 1, (4,), ()): ("P", "P;4"), + (II, 3, (1,), 2, (4,), ()): ("P", "P;4R"), + (MM, 3, (1,), 2, (4,), ()): ("P", "P;4R"), + (II, 3, (1,), 1, (8,), ()): ("P", "P"), + (MM, 3, (1,), 1, (8,), ()): ("P", "P"), + (II, 3, (1,), 1, (8, 8), (0,)): ("P", "PX"), + (MM, 3, (1,), 1, (8, 8), (0,)): ("P", "PX"), + (II, 3, (1,), 1, (8, 8), (2,)): ("PA", "PA"), + (MM, 3, (1,), 1, (8, 8), (2,)): ("PA", "PA"), + (II, 3, (1,), 2, (8,), ()): ("P", "P;R"), + (MM, 3, (1,), 2, (8,), ()): ("P", "P;R"), + (II, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"), + (MM, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"), + (II, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"), + (MM, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"), + (II, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"), + (MM, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"), + (II, 5, (1,), 1, (16, 16, 16, 16), ()): ("CMYK", "CMYK;16L"), + (MM, 5, (1,), 1, (16, 16, 16, 16), ()): ("CMYK", "CMYK;16B"), + (II, 6, (1,), 1, (8,), ()): ("L", "L"), + (MM, 6, (1,), 1, (8,), ()): ("L", "L"), + # JPEG compressed images handled by LibTiff and auto-converted to RGBX + # Minimal Baseline TIFF requires YCbCr images to have 3 SamplesPerPixel + (II, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"), + (MM, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"), + (II, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"), + (MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"), +} + +MAX_SAMPLESPERPIXEL = max(len(key_tp[4]) for key_tp in OPEN_INFO) + +PREFIXES = [ + b"MM\x00\x2a", # Valid TIFF header with big-endian byte order + b"II\x2a\x00", # Valid TIFF header with little-endian byte order + b"MM\x2a\x00", # Invalid TIFF header, assume big-endian + b"II\x00\x2a", # Invalid TIFF header, assume little-endian + b"MM\x00\x2b", # BigTIFF with big-endian byte order + b"II\x2b\x00", # BigTIFF with little-endian byte order +] + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(tuple(PREFIXES)) + + +def _limit_rational( + val: float | Fraction | IFDRational, max_val: int +) -> tuple[IntegralLike, IntegralLike]: + inv = abs(val) > 1 + n_d = IFDRational(1 / val if inv else val).limit_rational(max_val) + return n_d[::-1] if inv else n_d + + +def _limit_signed_rational( + val: IFDRational, max_val: int, min_val: int +) -> tuple[IntegralLike, IntegralLike]: + frac = Fraction(val) + n_d: tuple[IntegralLike, IntegralLike] = frac.numerator, frac.denominator + + if min(float(i) for i in n_d) < min_val: + n_d = _limit_rational(val, abs(min_val)) + + n_d_float = tuple(float(i) for i in n_d) + if max(n_d_float) > max_val: + n_d = _limit_rational(n_d_float[0] / n_d_float[1], max_val) + + return n_d + + +## +# Wrapper for TIFF IFDs. + +_load_dispatch = {} +_write_dispatch = {} + + +def _delegate(op: str) -> Any: + def delegate( + self: IFDRational, *args: tuple[float, ...] + ) -> bool | float | Fraction: + return getattr(self._val, op)(*args) + + return delegate + + +class IFDRational(Rational): + """Implements a rational class where 0/0 is a legal value to match + the in the wild use of exif rationals. + + e.g., DigitalZoomRatio - 0.00/0.00 indicates that no digital zoom was used + """ + + """ If the denominator is 0, store this as a float('nan'), otherwise store + as a fractions.Fraction(). Delegate as appropriate + + """ + + __slots__ = ("_numerator", "_denominator", "_val") + + def __init__( + self, value: float | Fraction | IFDRational, denominator: int = 1 + ) -> None: + """ + :param value: either an integer numerator, a + float/rational/other number, or an IFDRational + :param denominator: Optional integer denominator + """ + self._val: Fraction | float + if isinstance(value, IFDRational): + self._numerator = value.numerator + self._denominator = value.denominator + self._val = value._val + return + + if isinstance(value, Fraction): + self._numerator = value.numerator + self._denominator = value.denominator + else: + if TYPE_CHECKING: + self._numerator = cast(IntegralLike, value) + else: + self._numerator = value + self._denominator = denominator + + if denominator == 0: + self._val = float("nan") + elif denominator == 1: + self._val = Fraction(value) + elif int(value) == value: + self._val = Fraction(int(value), denominator) + else: + self._val = Fraction(value / denominator) + + @property + def numerator(self) -> IntegralLike: + return self._numerator + + @property + def denominator(self) -> int: + return self._denominator + + def limit_rational(self, max_denominator: int) -> tuple[IntegralLike, int]: + """ + + :param max_denominator: Integer, the maximum denominator value + :returns: Tuple of (numerator, denominator) + """ + + if self.denominator == 0: + return self.numerator, self.denominator + + assert isinstance(self._val, Fraction) + f = self._val.limit_denominator(max_denominator) + return f.numerator, f.denominator + + def __repr__(self) -> str: + return str(float(self._val)) + + def __hash__(self) -> int: # type: ignore[override] + return self._val.__hash__() + + def __eq__(self, other: object) -> bool: + val = self._val + if isinstance(other, IFDRational): + other = other._val + if isinstance(other, float): + val = float(val) + return val == other + + def __getstate__(self) -> list[float | Fraction | IntegralLike]: + return [self._val, self._numerator, self._denominator] + + def __setstate__(self, state: list[float | Fraction | IntegralLike]) -> None: + IFDRational.__init__(self, 0) + _val, _numerator, _denominator = state + assert isinstance(_val, (float, Fraction)) + self._val = _val + if TYPE_CHECKING: + self._numerator = cast(IntegralLike, _numerator) + else: + self._numerator = _numerator + assert isinstance(_denominator, int) + self._denominator = _denominator + + """ a = ['add','radd', 'sub', 'rsub', 'mul', 'rmul', + 'truediv', 'rtruediv', 'floordiv', 'rfloordiv', + 'mod','rmod', 'pow','rpow', 'pos', 'neg', + 'abs', 'trunc', 'lt', 'gt', 'le', 'ge', 'bool', + 'ceil', 'floor', 'round'] + print("\n".join("__%s__ = _delegate('__%s__')" % (s,s) for s in a)) + """ + + __add__ = _delegate("__add__") + __radd__ = _delegate("__radd__") + __sub__ = _delegate("__sub__") + __rsub__ = _delegate("__rsub__") + __mul__ = _delegate("__mul__") + __rmul__ = _delegate("__rmul__") + __truediv__ = _delegate("__truediv__") + __rtruediv__ = _delegate("__rtruediv__") + __floordiv__ = _delegate("__floordiv__") + __rfloordiv__ = _delegate("__rfloordiv__") + __mod__ = _delegate("__mod__") + __rmod__ = _delegate("__rmod__") + __pow__ = _delegate("__pow__") + __rpow__ = _delegate("__rpow__") + __pos__ = _delegate("__pos__") + __neg__ = _delegate("__neg__") + __abs__ = _delegate("__abs__") + __trunc__ = _delegate("__trunc__") + __lt__ = _delegate("__lt__") + __gt__ = _delegate("__gt__") + __le__ = _delegate("__le__") + __ge__ = _delegate("__ge__") + __bool__ = _delegate("__bool__") + __ceil__ = _delegate("__ceil__") + __floor__ = _delegate("__floor__") + __round__ = _delegate("__round__") + # Python >= 3.11 + if hasattr(Fraction, "__int__"): + __int__ = _delegate("__int__") + + +_LoaderFunc = Callable[["ImageFileDirectory_v2", bytes, bool], Any] + + +def _register_loader(idx: int, size: int) -> Callable[[_LoaderFunc], _LoaderFunc]: + def decorator(func: _LoaderFunc) -> _LoaderFunc: + from .TiffTags import TYPES + + if func.__name__.startswith("load_"): + TYPES[idx] = func.__name__[5:].replace("_", " ") + _load_dispatch[idx] = size, func # noqa: F821 + return func + + return decorator + + +def _register_writer(idx: int) -> Callable[[Callable[..., Any]], Callable[..., Any]]: + def decorator(func: Callable[..., Any]) -> Callable[..., Any]: + _write_dispatch[idx] = func # noqa: F821 + return func + + return decorator + + +def _register_basic(idx_fmt_name: tuple[int, str, str]) -> None: + from .TiffTags import TYPES + + idx, fmt, name = idx_fmt_name + TYPES[idx] = name + size = struct.calcsize(f"={fmt}") + + def basic_handler( + self: ImageFileDirectory_v2, data: bytes, legacy_api: bool = True + ) -> tuple[Any, ...]: + return self._unpack(f"{len(data) // size}{fmt}", data) + + _load_dispatch[idx] = size, basic_handler # noqa: F821 + _write_dispatch[idx] = lambda self, *values: ( # noqa: F821 + b"".join(self._pack(fmt, value) for value in values) + ) + + +if TYPE_CHECKING: + _IFDv2Base = MutableMapping[int, Any] +else: + _IFDv2Base = MutableMapping + + +class ImageFileDirectory_v2(_IFDv2Base): + """This class represents a TIFF tag directory. To speed things up, we + don't decode tags unless they're asked for. + + Exposes a dictionary interface of the tags in the directory:: + + ifd = ImageFileDirectory_v2() + ifd[key] = 'Some Data' + ifd.tagtype[key] = TiffTags.ASCII + print(ifd[key]) + 'Some Data' + + Individual values are returned as the strings or numbers, sequences are + returned as tuples of the values. + + The tiff metadata type of each item is stored in a dictionary of + tag types in + :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype`. The types + are read from a tiff file, guessed from the type added, or added + manually. + + Data Structures: + + * ``self.tagtype = {}`` + + * Key: numerical TIFF tag number + * Value: integer corresponding to the data type from + :py:data:`.TiffTags.TYPES` + + .. versionadded:: 3.0.0 + + 'Internal' data structures: + + * ``self._tags_v2 = {}`` + + * Key: numerical TIFF tag number + * Value: decoded data, as tuple for multiple values + + * ``self._tagdata = {}`` + + * Key: numerical TIFF tag number + * Value: undecoded byte string from file + + * ``self._tags_v1 = {}`` + + * Key: numerical TIFF tag number + * Value: decoded data in the v1 format + + Tags will be found in the private attributes ``self._tagdata``, and in + ``self._tags_v2`` once decoded. + + ``self.legacy_api`` is a value for internal use, and shouldn't be changed + from outside code. In cooperation with + :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`, if ``legacy_api`` + is true, then decoded tags will be populated into both ``_tags_v1`` and + ``_tags_v2``. ``_tags_v2`` will be used if this IFD is used in the TIFF + save routine. Tags should be read from ``_tags_v1`` if + ``legacy_api == true``. + + """ + + _load_dispatch: dict[int, tuple[int, _LoaderFunc]] = {} + _write_dispatch: dict[int, Callable[..., Any]] = {} + + def __init__( + self, + ifh: bytes = b"II\x2a\x00\x00\x00\x00\x00", + prefix: bytes | None = None, + group: int | None = None, + ) -> None: + """Initialize an ImageFileDirectory. + + To construct an ImageFileDirectory from a real file, pass the 8-byte + magic header to the constructor. To only set the endianness, pass it + as the 'prefix' keyword argument. + + :param ifh: One of the accepted magic headers (cf. PREFIXES); also sets + endianness. + :param prefix: Override the endianness of the file. + """ + if not _accept(ifh): + msg = f"not a TIFF file (header {repr(ifh)} not valid)" + raise SyntaxError(msg) + self._prefix = prefix if prefix is not None else ifh[:2] + if self._prefix == MM: + self._endian = ">" + elif self._prefix == II: + self._endian = "<" + else: + msg = "not a TIFF IFD" + raise SyntaxError(msg) + self._bigtiff = ifh[2] == 43 + self.group = group + self.tagtype: dict[int, int] = {} + """ Dictionary of tag types """ + self.reset() + self.next = ( + self._unpack("Q", ifh[8:])[0] + if self._bigtiff + else self._unpack("L", ifh[4:])[0] + ) + self._legacy_api = False + + prefix = property(lambda self: self._prefix) + offset = property(lambda self: self._offset) + + @property + def legacy_api(self) -> bool: + return self._legacy_api + + @legacy_api.setter + def legacy_api(self, value: bool) -> NoReturn: + msg = "Not allowing setting of legacy api" + raise Exception(msg) + + def reset(self) -> None: + self._tags_v1: dict[int, Any] = {} # will remain empty if legacy_api is false + self._tags_v2: dict[int, Any] = {} # main tag storage + self._tagdata: dict[int, bytes] = {} + self.tagtype = {} # added 2008-06-05 by Florian Hoech + self._next = None + self._offset: int | None = None + + def __str__(self) -> str: + return str(dict(self)) + + def named(self) -> dict[str, Any]: + """ + :returns: dict of name|key: value + + Returns the complete tag dictionary, with named tags where possible. + """ + return { + TiffTags.lookup(code, self.group).name: value + for code, value in self.items() + } + + def __len__(self) -> int: + return len(set(self._tagdata) | set(self._tags_v2)) + + def __getitem__(self, tag: int) -> Any: + if tag not in self._tags_v2: # unpack on the fly + data = self._tagdata[tag] + typ = self.tagtype[tag] + size, handler = self._load_dispatch[typ] + self[tag] = handler(self, data, self.legacy_api) # check type + val = self._tags_v2[tag] + if self.legacy_api and not isinstance(val, (tuple, bytes)): + val = (val,) + return val + + def __contains__(self, tag: object) -> bool: + return tag in self._tags_v2 or tag in self._tagdata + + def __setitem__(self, tag: int, value: Any) -> None: + self._setitem(tag, value, self.legacy_api) + + def _setitem(self, tag: int, value: Any, legacy_api: bool) -> None: + basetypes = (Number, bytes, str) + + info = TiffTags.lookup(tag, self.group) + values = [value] if isinstance(value, basetypes) else value + + if tag not in self.tagtype: + if info.type: + self.tagtype[tag] = info.type + else: + self.tagtype[tag] = TiffTags.UNDEFINED + if all(isinstance(v, IFDRational) for v in values): + for v in values: + assert isinstance(v, IFDRational) + if v < 0: + self.tagtype[tag] = TiffTags.SIGNED_RATIONAL + break + else: + self.tagtype[tag] = TiffTags.RATIONAL + elif all(isinstance(v, int) for v in values): + short = True + signed_short = True + long = True + for v in values: + assert isinstance(v, int) + if short and not (0 <= v < 2**16): + short = False + if signed_short and not (-(2**15) < v < 2**15): + signed_short = False + if long and v < 0: + long = False + if short: + self.tagtype[tag] = TiffTags.SHORT + elif signed_short: + self.tagtype[tag] = TiffTags.SIGNED_SHORT + elif long: + self.tagtype[tag] = TiffTags.LONG + else: + self.tagtype[tag] = TiffTags.SIGNED_LONG + elif all(isinstance(v, float) for v in values): + self.tagtype[tag] = TiffTags.DOUBLE + elif all(isinstance(v, str) for v in values): + self.tagtype[tag] = TiffTags.ASCII + elif all(isinstance(v, bytes) for v in values): + self.tagtype[tag] = TiffTags.BYTE + + if self.tagtype[tag] == TiffTags.UNDEFINED: + values = [ + v.encode("ascii", "replace") if isinstance(v, str) else v + for v in values + ] + elif self.tagtype[tag] == TiffTags.RATIONAL: + values = [float(v) if isinstance(v, int) else v for v in values] + + is_ifd = self.tagtype[tag] == TiffTags.LONG and isinstance(values, dict) + if not is_ifd: + values = tuple( + info.cvt_enum(value) if isinstance(value, str) else value + for value in values + ) + + dest = self._tags_v1 if legacy_api else self._tags_v2 + + # Three branches: + # Spec'd length == 1, Actual length 1, store as element + # Spec'd length == 1, Actual > 1, Warn and truncate. Formerly barfed. + # No Spec, Actual length 1, Formerly (<4.2) returned a 1 element tuple. + # Don't mess with the legacy api, since it's frozen. + if not is_ifd and ( + (info.length == 1) + or self.tagtype[tag] == TiffTags.BYTE + or (info.length is None and len(values) == 1 and not legacy_api) + ): + # Don't mess with the legacy api, since it's frozen. + if legacy_api and self.tagtype[tag] in [ + TiffTags.RATIONAL, + TiffTags.SIGNED_RATIONAL, + ]: # rationals + values = (values,) + try: + (dest[tag],) = values + except ValueError: + # We've got a builtin tag with 1 expected entry + warnings.warn( + f"Metadata Warning, tag {tag} had too many entries: " + f"{len(values)}, expected 1" + ) + dest[tag] = values[0] + + else: + # Spec'd length > 1 or undefined + # Unspec'd, and length > 1 + dest[tag] = values + + def __delitem__(self, tag: int) -> None: + self._tags_v2.pop(tag, None) + self._tags_v1.pop(tag, None) + self._tagdata.pop(tag, None) + + def __iter__(self) -> Iterator[int]: + return iter(set(self._tagdata) | set(self._tags_v2)) + + def _unpack(self, fmt: str, data: bytes) -> tuple[Any, ...]: + return struct.unpack(self._endian + fmt, data) + + def _pack(self, fmt: str, *values: Any) -> bytes: + return struct.pack(self._endian + fmt, *values) + + list( + map( + _register_basic, + [ + (TiffTags.SHORT, "H", "short"), + (TiffTags.LONG, "L", "long"), + (TiffTags.SIGNED_BYTE, "b", "signed byte"), + (TiffTags.SIGNED_SHORT, "h", "signed short"), + (TiffTags.SIGNED_LONG, "l", "signed long"), + (TiffTags.FLOAT, "f", "float"), + (TiffTags.DOUBLE, "d", "double"), + (TiffTags.IFD, "L", "long"), + (TiffTags.LONG8, "Q", "long8"), + ], + ) + ) + + @_register_loader(1, 1) # Basic type, except for the legacy API. + def load_byte(self, data: bytes, legacy_api: bool = True) -> bytes: + return data + + @_register_writer(1) # Basic type, except for the legacy API. + def write_byte(self, data: bytes | int | IFDRational) -> bytes: + if isinstance(data, IFDRational): + data = int(data) + if isinstance(data, int): + data = bytes((data,)) + return data + + @_register_loader(2, 1) + def load_string(self, data: bytes, legacy_api: bool = True) -> str: + if data.endswith(b"\0"): + data = data[:-1] + return data.decode("latin-1", "replace") + + @_register_writer(2) + def write_string(self, value: str | bytes | int) -> bytes: + # remerge of https://github.com/python-pillow/Pillow/pull/1416 + if isinstance(value, int): + value = str(value) + if not isinstance(value, bytes): + value = value.encode("ascii", "replace") + return value + b"\0" + + @_register_loader(5, 8) + def load_rational( + self, data: bytes, legacy_api: bool = True + ) -> tuple[tuple[int, int] | IFDRational, ...]: + vals = self._unpack(f"{len(data) // 4}L", data) + + def combine(a: int, b: int) -> tuple[int, int] | IFDRational: + return (a, b) if legacy_api else IFDRational(a, b) + + return tuple(combine(num, denom) for num, denom in zip(vals[::2], vals[1::2])) + + @_register_writer(5) + def write_rational(self, *values: IFDRational) -> bytes: + return b"".join( + self._pack("2L", *_limit_rational(frac, 2**32 - 1)) for frac in values + ) + + @_register_loader(7, 1) + def load_undefined(self, data: bytes, legacy_api: bool = True) -> bytes: + return data + + @_register_writer(7) + def write_undefined(self, value: bytes | int | IFDRational) -> bytes: + if isinstance(value, IFDRational): + value = int(value) + if isinstance(value, int): + value = str(value).encode("ascii", "replace") + return value + + @_register_loader(10, 8) + def load_signed_rational( + self, data: bytes, legacy_api: bool = True + ) -> tuple[tuple[int, int] | IFDRational, ...]: + vals = self._unpack(f"{len(data) // 4}l", data) + + def combine(a: int, b: int) -> tuple[int, int] | IFDRational: + return (a, b) if legacy_api else IFDRational(a, b) + + return tuple(combine(num, denom) for num, denom in zip(vals[::2], vals[1::2])) + + @_register_writer(10) + def write_signed_rational(self, *values: IFDRational) -> bytes: + return b"".join( + self._pack("2l", *_limit_signed_rational(frac, 2**31 - 1, -(2**31))) + for frac in values + ) + + def _ensure_read(self, fp: IO[bytes], size: int) -> bytes: + ret = fp.read(size) + if len(ret) != size: + msg = ( + "Corrupt EXIF data. " + f"Expecting to read {size} bytes but only got {len(ret)}. " + ) + raise OSError(msg) + return ret + + def load(self, fp: IO[bytes]) -> None: + self.reset() + self._offset = fp.tell() + + try: + tag_count = ( + self._unpack("Q", self._ensure_read(fp, 8)) + if self._bigtiff + else self._unpack("H", self._ensure_read(fp, 2)) + )[0] + for i in range(tag_count): + tag, typ, count, data = ( + self._unpack("HHQ8s", self._ensure_read(fp, 20)) + if self._bigtiff + else self._unpack("HHL4s", self._ensure_read(fp, 12)) + ) + + tagname = TiffTags.lookup(tag, self.group).name + typname = TYPES.get(typ, "unknown") + msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})" + + try: + unit_size, handler = self._load_dispatch[typ] + except KeyError: + logger.debug("%s - unsupported type %s", msg, typ) + continue # ignore unsupported type + size = count * unit_size + if size > (8 if self._bigtiff else 4): + here = fp.tell() + (offset,) = self._unpack("Q" if self._bigtiff else "L", data) + msg += f" Tag Location: {here} - Data Location: {offset}" + fp.seek(offset) + data = ImageFile._safe_read(fp, size) + fp.seek(here) + else: + data = data[:size] + + if len(data) != size: + warnings.warn( + "Possibly corrupt EXIF data. " + f"Expecting to read {size} bytes but only got {len(data)}." + f" Skipping tag {tag}" + ) + logger.debug(msg) + continue + + if not data: + logger.debug(msg) + continue + + self._tagdata[tag] = data + self.tagtype[tag] = typ + + msg += " - value: " + msg += f"" if size > 32 else repr(data) + + logger.debug(msg) + + (self.next,) = ( + self._unpack("Q", self._ensure_read(fp, 8)) + if self._bigtiff + else self._unpack("L", self._ensure_read(fp, 4)) + ) + except OSError as msg: + warnings.warn(str(msg)) + return + + def _get_ifh(self) -> bytes: + ifh = self._prefix + self._pack("H", 43 if self._bigtiff else 42) + if self._bigtiff: + ifh += self._pack("HH", 8, 0) + ifh += self._pack("Q", 16) if self._bigtiff else self._pack("L", 8) + + return ifh + + def tobytes(self, offset: int = 0) -> bytes: + # FIXME What about tagdata? + result = self._pack("Q" if self._bigtiff else "H", len(self._tags_v2)) + + entries: list[tuple[int, int, int, bytes, bytes]] = [] + + fmt = "Q" if self._bigtiff else "L" + fmt_size = 8 if self._bigtiff else 4 + offset += ( + len(result) + len(self._tags_v2) * (20 if self._bigtiff else 12) + fmt_size + ) + stripoffsets = None + + # pass 1: convert tags to binary format + # always write tags in ascending order + for tag, value in sorted(self._tags_v2.items()): + if tag == STRIPOFFSETS: + stripoffsets = len(entries) + typ = self.tagtype[tag] + logger.debug("Tag %s, Type: %s, Value: %s", tag, typ, repr(value)) + is_ifd = typ == TiffTags.LONG and isinstance(value, dict) + if is_ifd: + ifd = ImageFileDirectory_v2(self._get_ifh(), group=tag) + values = self._tags_v2[tag] + for ifd_tag, ifd_value in values.items(): + ifd[ifd_tag] = ifd_value + data = ifd.tobytes(offset) + else: + values = value if isinstance(value, tuple) else (value,) + data = self._write_dispatch[typ](self, *values) + + tagname = TiffTags.lookup(tag, self.group).name + typname = "ifd" if is_ifd else TYPES.get(typ, "unknown") + msg = f"save: {tagname} ({tag}) - type: {typname} ({typ}) - value: " + msg += f"" if len(data) >= 16 else str(values) + logger.debug(msg) + + # count is sum of lengths for string and arbitrary data + if is_ifd: + count = 1 + elif typ in [TiffTags.BYTE, TiffTags.ASCII, TiffTags.UNDEFINED]: + count = len(data) + else: + count = len(values) + # figure out if data fits into the entry + if len(data) <= fmt_size: + entries.append((tag, typ, count, data.ljust(fmt_size, b"\0"), b"")) + else: + entries.append((tag, typ, count, self._pack(fmt, offset), data)) + offset += (len(data) + 1) // 2 * 2 # pad to word + + # update strip offset data to point beyond auxiliary data + if stripoffsets is not None: + tag, typ, count, value, data = entries[stripoffsets] + if data: + size, handler = self._load_dispatch[typ] + values = [val + offset for val in handler(self, data, self.legacy_api)] + data = self._write_dispatch[typ](self, *values) + else: + value = self._pack(fmt, self._unpack(fmt, value)[0] + offset) + entries[stripoffsets] = tag, typ, count, value, data + + # pass 2: write entries to file + for tag, typ, count, value, data in entries: + logger.debug("%s %s %s %s %s", tag, typ, count, repr(value), repr(data)) + result += self._pack( + "HHQ8s" if self._bigtiff else "HHL4s", tag, typ, count, value + ) + + # -- overwrite here for multi-page -- + result += self._pack(fmt, 0) # end of entries + + # pass 3: write auxiliary data to file + for tag, typ, count, value, data in entries: + result += data + if len(data) & 1: + result += b"\0" + + return result + + def save(self, fp: IO[bytes]) -> int: + if fp.tell() == 0: # skip TIFF header on subsequent pages + fp.write(self._get_ifh()) + + offset = fp.tell() + result = self.tobytes(offset) + fp.write(result) + return offset + len(result) + + +ImageFileDirectory_v2._load_dispatch = _load_dispatch +ImageFileDirectory_v2._write_dispatch = _write_dispatch +for idx, name in TYPES.items(): + name = name.replace(" ", "_") + setattr(ImageFileDirectory_v2, f"load_{name}", _load_dispatch[idx][1]) + setattr(ImageFileDirectory_v2, f"write_{name}", _write_dispatch[idx]) +del _load_dispatch, _write_dispatch, idx, name + + +# Legacy ImageFileDirectory support. +class ImageFileDirectory_v1(ImageFileDirectory_v2): + """This class represents the **legacy** interface to a TIFF tag directory. + + Exposes a dictionary interface of the tags in the directory:: + + ifd = ImageFileDirectory_v1() + ifd[key] = 'Some Data' + ifd.tagtype[key] = TiffTags.ASCII + print(ifd[key]) + ('Some Data',) + + Also contains a dictionary of tag types as read from the tiff image file, + :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v1.tagtype`. + + Values are returned as a tuple. + + .. deprecated:: 3.0.0 + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self._legacy_api = True + + tags = property(lambda self: self._tags_v1) + tagdata = property(lambda self: self._tagdata) + + # defined in ImageFileDirectory_v2 + tagtype: dict[int, int] + """Dictionary of tag types""" + + @classmethod + def from_v2(cls, original: ImageFileDirectory_v2) -> ImageFileDirectory_v1: + """Returns an + :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` + instance with the same data as is contained in the original + :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` + instance. + + :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` + + """ + + ifd = cls(prefix=original.prefix) + ifd._tagdata = original._tagdata + ifd.tagtype = original.tagtype + ifd.next = original.next # an indicator for multipage tiffs + return ifd + + def to_v2(self) -> ImageFileDirectory_v2: + """Returns an + :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` + instance with the same data as is contained in the original + :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1` + instance. + + :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2` + + """ + + ifd = ImageFileDirectory_v2(prefix=self.prefix) + ifd._tagdata = dict(self._tagdata) + ifd.tagtype = dict(self.tagtype) + ifd._tags_v2 = dict(self._tags_v2) + return ifd + + def __contains__(self, tag: object) -> bool: + return tag in self._tags_v1 or tag in self._tagdata + + def __len__(self) -> int: + return len(set(self._tagdata) | set(self._tags_v1)) + + def __iter__(self) -> Iterator[int]: + return iter(set(self._tagdata) | set(self._tags_v1)) + + def __setitem__(self, tag: int, value: Any) -> None: + for legacy_api in (False, True): + self._setitem(tag, value, legacy_api) + + def __getitem__(self, tag: int) -> Any: + if tag not in self._tags_v1: # unpack on the fly + data = self._tagdata[tag] + typ = self.tagtype[tag] + size, handler = self._load_dispatch[typ] + for legacy in (False, True): + self._setitem(tag, handler(self, data, legacy), legacy) + val = self._tags_v1[tag] + if not isinstance(val, (tuple, bytes)): + val = (val,) + return val + + +# undone -- switch this pointer +ImageFileDirectory = ImageFileDirectory_v1 + + +## +# Image plugin for TIFF files. + + +class TiffImageFile(ImageFile.ImageFile): + format = "TIFF" + format_description = "Adobe TIFF" + _close_exclusive_fp_after_loading = False + + def __init__( + self, + fp: StrOrBytesPath | IO[bytes], + filename: str | bytes | None = None, + ) -> None: + self.tag_v2: ImageFileDirectory_v2 + """ Image file directory (tag dictionary) """ + + self.tag: ImageFileDirectory_v1 + """ Legacy tag entries """ + + super().__init__(fp, filename) + + def _open(self) -> None: + """Open the first image in a TIFF file""" + + # Header + assert self.fp is not None + ifh = self.fp.read(8) + if ifh[2] == 43: + ifh += self.fp.read(8) + + self.tag_v2 = ImageFileDirectory_v2(ifh) + + # setup frame pointers + self.__first = self.__next = self.tag_v2.next + self.__frame = -1 + self._fp = self.fp + self._frame_pos: list[int] = [] + self._n_frames: int | None = None + + logger.debug("*** TiffImageFile._open ***") + logger.debug("- __first: %s", self.__first) + logger.debug("- ifh: %s", repr(ifh)) # Use repr to avoid str(bytes) + + # and load the first frame + self._seek(0) + + @property + def n_frames(self) -> int: + current_n_frames = self._n_frames + if current_n_frames is None: + current = self.tell() + self._seek(len(self._frame_pos)) + while self._n_frames is None: + self._seek(self.tell() + 1) + self.seek(current) + assert self._n_frames is not None + return self._n_frames + + def seek(self, frame: int) -> None: + """Select a given frame as current image""" + if not self._seek_check(frame): + return + self._seek(frame) + if self._im is not None and ( + self.im.size != self._tile_size + or self.im.mode != self.mode + or self.readonly + ): + self._im = None + + def _seek(self, frame: int) -> None: + if isinstance(self._fp, DeferredError): + raise self._fp.ex + self.fp = self._fp + + while len(self._frame_pos) <= frame: + if not self.__next: + msg = "no more images in TIFF file" + raise EOFError(msg) + logger.debug( + "Seeking to frame %s, on frame %s, __next %s, location: %s", + frame, + self.__frame, + self.__next, + self.fp.tell(), + ) + if self.__next >= 2**63: + msg = "Unable to seek to frame" + raise ValueError(msg) + self.fp.seek(self.__next) + self._frame_pos.append(self.__next) + logger.debug("Loading tags, location: %s", self.fp.tell()) + self.tag_v2.load(self.fp) + if self.tag_v2.next in self._frame_pos: + # This IFD has already been processed + # Declare this to be the end of the image + self.__next = 0 + else: + self.__next = self.tag_v2.next + if self.__next == 0: + self._n_frames = frame + 1 + if len(self._frame_pos) == 1: + self.is_animated = self.__next != 0 + self.__frame += 1 + self.fp.seek(self._frame_pos[frame]) + self.tag_v2.load(self.fp) + if XMP in self.tag_v2: + xmp = self.tag_v2[XMP] + if isinstance(xmp, tuple) and len(xmp) == 1: + xmp = xmp[0] + self.info["xmp"] = xmp + elif "xmp" in self.info: + del self.info["xmp"] + self._reload_exif() + # fill the legacy tag/ifd entries + self.tag = self.ifd = ImageFileDirectory_v1.from_v2(self.tag_v2) + self.__frame = frame + self._setup() + + def tell(self) -> int: + """Return the current frame number""" + return self.__frame + + def get_photoshop_blocks(self) -> dict[int, dict[str, bytes]]: + """ + Returns a dictionary of Photoshop "Image Resource Blocks". + The keys are the image resource ID. For more information, see + https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727 + + :returns: Photoshop "Image Resource Blocks" in a dictionary. + """ + blocks = {} + val = self.tag_v2.get(ExifTags.Base.ImageResources) + if val: + while val.startswith(b"8BIM") and len(val) >= 12: + id = i16(val[4:6]) + n = math.ceil((val[6] + 1) / 2) * 2 + try: + size = i32(val[6 + n : 10 + n]) + except struct.error: + break + data = val[10 + n : 10 + n + size] + blocks[id] = {"data": data} + + val = val[math.ceil((10 + n + size) / 2) * 2 :] + return blocks + + def load(self) -> Image.core.PixelAccess | None: + if self.tile and self.use_load_libtiff: + return self._load_libtiff() + return super().load() + + def load_prepare(self) -> None: + if self._im is None: + Image._decompression_bomb_check(self._tile_size) + self.im = Image.core.new(self.mode, self._tile_size) + ImageFile.ImageFile.load_prepare(self) + + def load_end(self) -> None: + # allow closing if we're on the first frame, there's no next + # This is the ImageFile.load path only, libtiff specific below. + if not self.is_animated: + self._close_exclusive_fp_after_loading = True + + # load IFD data from fp before it is closed + exif = self.getexif() + for key in TiffTags.TAGS_V2_GROUPS: + if key not in exif: + continue + exif.get_ifd(key) + + ImageOps.exif_transpose(self, in_place=True) + if ExifTags.Base.Orientation in self.tag_v2: + del self.tag_v2[ExifTags.Base.Orientation] + + def _load_libtiff(self) -> Image.core.PixelAccess | None: + """Overload method triggered when we detect a compressed tiff + Calls out to libtiff""" + + Image.Image.load(self) + + self.load_prepare() + + if not len(self.tile) == 1: + msg = "Not exactly one tile" + raise OSError(msg) + + # (self._compression, (extents tuple), + # 0, (rawmode, self._compression, fp)) + extents = self.tile[0][1] + args = self.tile[0][3] + + # To be nice on memory footprint, if there's a + # file descriptor, use that instead of reading + # into a string in python. + assert self.fp is not None + try: + fp = hasattr(self.fp, "fileno") and self.fp.fileno() + # flush the file descriptor, prevents error on pypy 2.4+ + # should also eliminate the need for fp.tell + # in _seek + if hasattr(self.fp, "flush"): + self.fp.flush() + except OSError: + # io.BytesIO have a fileno, but returns an OSError if + # it doesn't use a file descriptor. + fp = False + + if fp: + assert isinstance(args, tuple) + args_list = list(args) + args_list[2] = fp + args = tuple(args_list) + + decoder = Image._getdecoder(self.mode, "libtiff", args, self.decoderconfig) + try: + decoder.setimage(self.im, extents) + except ValueError as e: + msg = "Couldn't set the image" + raise OSError(msg) from e + + close_self_fp = self._exclusive_fp and not self.is_animated + if hasattr(self.fp, "getvalue"): + # We've got a stringio like thing passed in. Yay for all in memory. + # The decoder needs the entire file in one shot, so there's not + # a lot we can do here other than give it the entire file. + # unless we could do something like get the address of the + # underlying string for stringio. + # + # Rearranging for supporting byteio items, since they have a fileno + # that returns an OSError if there's no underlying fp. Easier to + # deal with here by reordering. + logger.debug("have getvalue. just sending in a string from getvalue") + n, err = decoder.decode(self.fp.getvalue()) + elif fp: + # we've got a actual file on disk, pass in the fp. + logger.debug("have fileno, calling fileno version of the decoder.") + if not close_self_fp: + self.fp.seek(0) + # Save and restore the file position, because libtiff will move it + # outside of the Python runtime, and that will confuse + # io.BufferedReader and possible others. + # NOTE: This must use os.lseek(), and not fp.tell()/fp.seek(), + # because the buffer read head already may not equal the actual + # file position, and fp.seek() may just adjust it's internal + # pointer and not actually seek the OS file handle. + pos = os.lseek(fp, 0, os.SEEK_CUR) + # 4 bytes, otherwise the trace might error out + n, err = decoder.decode(b"fpfp") + os.lseek(fp, pos, os.SEEK_SET) + else: + # we have something else. + logger.debug("don't have fileno or getvalue. just reading") + self.fp.seek(0) + # UNDONE -- so much for that buffer size thing. + n, err = decoder.decode(self.fp.read()) + + self.tile = [] + self.readonly = 0 + + self.load_end() + + if close_self_fp: + self.fp.close() + self.fp = None # might be shared + + if err < 0: + msg = f"decoder error {err}" + raise OSError(msg) + + return Image.Image.load(self) + + def _setup(self) -> None: + """Setup this image object based on current tags""" + + if 0xBC01 in self.tag_v2: + msg = "Windows Media Photo files not yet supported" + raise OSError(msg) + + # extract relevant tags + self._compression = COMPRESSION_INFO[self.tag_v2.get(COMPRESSION, 1)] + self._planar_configuration = self.tag_v2.get(PLANAR_CONFIGURATION, 1) + + # photometric is a required tag, but not everyone is reading + # the specification + photo = self.tag_v2.get(PHOTOMETRIC_INTERPRETATION, 0) + + # old style jpeg compression images most certainly are YCbCr + if self._compression == "tiff_jpeg": + photo = 6 + + fillorder = self.tag_v2.get(FILLORDER, 1) + + logger.debug("*** Summary ***") + logger.debug("- compression: %s", self._compression) + logger.debug("- photometric_interpretation: %s", photo) + logger.debug("- planar_configuration: %s", self._planar_configuration) + logger.debug("- fill_order: %s", fillorder) + logger.debug("- YCbCr subsampling: %s", self.tag_v2.get(YCBCRSUBSAMPLING)) + + # size + try: + xsize = self.tag_v2[IMAGEWIDTH] + ysize = self.tag_v2[IMAGELENGTH] + except KeyError as e: + msg = "Missing dimensions" + raise TypeError(msg) from e + if not isinstance(xsize, int) or not isinstance(ysize, int): + msg = "Invalid dimensions" + raise ValueError(msg) + self._tile_size = xsize, ysize + orientation = self.tag_v2.get(ExifTags.Base.Orientation) + if orientation in (5, 6, 7, 8): + self._size = ysize, xsize + else: + self._size = xsize, ysize + + logger.debug("- size: %s", self.size) + + sample_format = self.tag_v2.get(SAMPLEFORMAT, (1,)) + if len(sample_format) > 1 and max(sample_format) == min(sample_format): + # SAMPLEFORMAT is properly per band, so an RGB image will + # be (1,1,1). But, we don't support per band pixel types, + # and anything more than one band is a uint8. So, just + # take the first element. Revisit this if adding support + # for more exotic images. + sample_format = (sample_format[0],) + + bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,)) + extra_tuple = self.tag_v2.get(EXTRASAMPLES, ()) + samples_per_pixel = self.tag_v2.get( + SAMPLESPERPIXEL, + 3 if self._compression == "tiff_jpeg" and photo in (2, 6) else 1, + ) + if photo in (2, 6, 8): # RGB, YCbCr, LAB + bps_count = 3 + elif photo == 5: # CMYK + bps_count = 4 + else: + bps_count = 1 + if self._planar_configuration == 2 and extra_tuple and max(extra_tuple) == 0: + # If components are stored separately, + # then unspecified extra components at the end can be ignored + bps_tuple = bps_tuple[: -len(extra_tuple)] + samples_per_pixel -= len(extra_tuple) + extra_tuple = () + bps_count += len(extra_tuple) + bps_actual_count = len(bps_tuple) + + if samples_per_pixel > MAX_SAMPLESPERPIXEL: + # DOS check, samples_per_pixel can be a Long, and we extend the tuple below + logger.error( + "More samples per pixel than can be decoded: %s", samples_per_pixel + ) + msg = "Invalid value for samples per pixel" + raise SyntaxError(msg) + + if samples_per_pixel < bps_actual_count: + # If a file has more values in bps_tuple than expected, + # remove the excess. + bps_tuple = bps_tuple[:samples_per_pixel] + elif samples_per_pixel > bps_actual_count and bps_actual_count == 1: + # If a file has only one value in bps_tuple, when it should have more, + # presume it is the same number of bits for all of the samples. + bps_tuple = bps_tuple * samples_per_pixel + + if len(bps_tuple) != samples_per_pixel: + msg = "unknown data organization" + raise SyntaxError(msg) + + # mode: check photometric interpretation and bits per pixel + key = ( + self.tag_v2.prefix, + photo, + sample_format, + fillorder, + bps_tuple, + extra_tuple, + ) + logger.debug("format key: %s", key) + try: + self._mode, rawmode = OPEN_INFO[key] + except KeyError as e: + logger.debug("- unsupported format") + msg = "unknown pixel mode" + raise SyntaxError(msg) from e + + logger.debug("- raw mode: %s", rawmode) + logger.debug("- pil mode: %s", self.mode) + + self.info["compression"] = self._compression + + xres = self.tag_v2.get(X_RESOLUTION, 1) + yres = self.tag_v2.get(Y_RESOLUTION, 1) + + if xres and yres: + resunit = self.tag_v2.get(RESOLUTION_UNIT) + if resunit == 2: # dots per inch + self.info["dpi"] = (xres, yres) + elif resunit == 3: # dots per centimeter. convert to dpi + self.info["dpi"] = (xres * 2.54, yres * 2.54) + elif resunit is None: # used to default to 1, but now 2) + self.info["dpi"] = (xres, yres) + # For backward compatibility, + # we also preserve the old behavior + self.info["resolution"] = xres, yres + else: # No absolute unit of measurement + self.info["resolution"] = xres, yres + + # build tile descriptors + x = y = layer = 0 + self.tile = [] + self.use_load_libtiff = READ_LIBTIFF or self._compression != "raw" + if self.use_load_libtiff: + # Decoder expects entire file as one tile. + # There's a buffer size limit in load (64k) + # so large g4 images will fail if we use that + # function. + # + # Setup the one tile for the whole image, then + # use the _load_libtiff function. + + # libtiff handles the fillmode for us, so 1;IR should + # actually be 1;I. Including the R double reverses the + # bits, so stripes of the image are reversed. See + # https://github.com/python-pillow/Pillow/issues/279 + if fillorder == 2: + # Replace fillorder with fillorder=1 + key = key[:3] + (1,) + key[4:] + logger.debug("format key: %s", key) + # this should always work, since all the + # fillorder==2 modes have a corresponding + # fillorder=1 mode + self._mode, rawmode = OPEN_INFO[key] + # YCbCr images with new jpeg compression with pixels in one plane + # unpacked straight into RGB values + if ( + photo == 6 + and self._compression == "jpeg" + and self._planar_configuration == 1 + ): + rawmode = "RGB" + # libtiff always returns the bytes in native order. + # we're expecting image byte order. So, if the rawmode + # contains I;16, we need to convert from native to image + # byte order. + elif rawmode == "I;16": + rawmode = "I;16N" + elif rawmode.endswith((";16B", ";16L")): + rawmode = rawmode[:-1] + "N" + + # Offset in the tile tuple is 0, we go from 0,0 to + # w,h, and we only do this once -- eds + a = (rawmode, self._compression, False, self.tag_v2.offset) + self.tile.append(ImageFile._Tile("libtiff", (0, 0, xsize, ysize), 0, a)) + + elif STRIPOFFSETS in self.tag_v2 or TILEOFFSETS in self.tag_v2: + # striped image + if STRIPOFFSETS in self.tag_v2: + offsets = self.tag_v2[STRIPOFFSETS] + h = self.tag_v2.get(ROWSPERSTRIP, ysize) + w = xsize + else: + # tiled image + offsets = self.tag_v2[TILEOFFSETS] + tilewidth = self.tag_v2.get(TILEWIDTH) + h = self.tag_v2.get(TILELENGTH) + if not isinstance(tilewidth, int) or not isinstance(h, int): + msg = "Invalid tile dimensions" + raise ValueError(msg) + w = tilewidth + + if w == xsize and h == ysize and self._planar_configuration != 2: + # Every tile covers the image. Only use the last offset + offsets = offsets[-1:] + + for offset in offsets: + if x + w > xsize: + stride = w * sum(bps_tuple) / 8 # bytes per line + else: + stride = 0 + + tile_rawmode = rawmode + if self._planar_configuration == 2: + # each band on it's own layer + tile_rawmode = rawmode[layer] + # adjust stride width accordingly + stride /= bps_count + + args = (tile_rawmode, int(stride), 1) + self.tile.append( + ImageFile._Tile( + self._compression, + (x, y, min(x + w, xsize), min(y + h, ysize)), + offset, + args, + ) + ) + x += w + if x >= xsize: + x, y = 0, y + h + if y >= ysize: + y = 0 + layer += 1 + else: + logger.debug("- unsupported data organization") + msg = "unknown data organization" + raise SyntaxError(msg) + + # Fix up info. + if ICCPROFILE in self.tag_v2: + self.info["icc_profile"] = self.tag_v2[ICCPROFILE] + + # fixup palette descriptor + + if self.mode in ["P", "PA"]: + palette = [o8(b // 256) for b in self.tag_v2[COLORMAP]] + self.palette = ImagePalette.raw("RGB;L", b"".join(palette)) + + +# +# -------------------------------------------------------------------- +# Write TIFF files + +# little endian is default except for image modes with +# explicit big endian byte-order + +SAVE_INFO = { + # mode => rawmode, byteorder, photometrics, + # sampleformat, bitspersample, extra + "1": ("1", II, 1, 1, (1,), None), + "L": ("L", II, 1, 1, (8,), None), + "LA": ("LA", II, 1, 1, (8, 8), 2), + "P": ("P", II, 3, 1, (8,), None), + "PA": ("PA", II, 3, 1, (8, 8), 2), + "I": ("I;32S", II, 1, 2, (32,), None), + "I;16": ("I;16", II, 1, 1, (16,), None), + "I;16L": ("I;16L", II, 1, 1, (16,), None), + "F": ("F;32F", II, 1, 3, (32,), None), + "RGB": ("RGB", II, 2, 1, (8, 8, 8), None), + "RGBX": ("RGBX", II, 2, 1, (8, 8, 8, 8), 0), + "RGBA": ("RGBA", II, 2, 1, (8, 8, 8, 8), 2), + "CMYK": ("CMYK", II, 5, 1, (8, 8, 8, 8), None), + "YCbCr": ("YCbCr", II, 6, 1, (8, 8, 8), None), + "LAB": ("LAB", II, 8, 1, (8, 8, 8), None), + "I;16B": ("I;16B", MM, 1, 1, (16,), None), +} + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + try: + rawmode, prefix, photo, format, bits, extra = SAVE_INFO[im.mode] + except KeyError as e: + msg = f"cannot write mode {im.mode} as TIFF" + raise OSError(msg) from e + + encoderinfo = im.encoderinfo + encoderconfig = im.encoderconfig + + ifd = ImageFileDirectory_v2(prefix=prefix) + if encoderinfo.get("big_tiff"): + ifd._bigtiff = True + + try: + compression = encoderinfo["compression"] + except KeyError: + compression = im.info.get("compression") + if isinstance(compression, int): + # compression value may be from BMP. Ignore it + compression = None + if compression is None: + compression = "raw" + elif compression == "tiff_jpeg": + # OJPEG is obsolete, so use new-style JPEG compression instead + compression = "jpeg" + elif compression == "tiff_deflate": + compression = "tiff_adobe_deflate" + + libtiff = WRITE_LIBTIFF or compression != "raw" + + # required for color libtiff images + ifd[PLANAR_CONFIGURATION] = 1 + + ifd[IMAGEWIDTH] = im.size[0] + ifd[IMAGELENGTH] = im.size[1] + + # write any arbitrary tags passed in as an ImageFileDirectory + if "tiffinfo" in encoderinfo: + info = encoderinfo["tiffinfo"] + elif "exif" in encoderinfo: + info = encoderinfo["exif"] + if isinstance(info, bytes): + exif = Image.Exif() + exif.load(info) + info = exif + else: + info = {} + logger.debug("Tiffinfo Keys: %s", list(info)) + if isinstance(info, ImageFileDirectory_v1): + info = info.to_v2() + for key in info: + if isinstance(info, Image.Exif) and key in TiffTags.TAGS_V2_GROUPS: + ifd[key] = info.get_ifd(key) + else: + ifd[key] = info.get(key) + try: + ifd.tagtype[key] = info.tagtype[key] + except Exception: + pass # might not be an IFD. Might not have populated type + + legacy_ifd = {} + if hasattr(im, "tag"): + legacy_ifd = im.tag.to_v2() + + supplied_tags = {**legacy_ifd, **getattr(im, "tag_v2", {})} + if supplied_tags.get(PLANAR_CONFIGURATION) == 2 and EXTRASAMPLES in supplied_tags: + # If the image used separate component planes, + # then EXTRASAMPLES should be ignored when saving contiguously + if SAMPLESPERPIXEL in supplied_tags: + supplied_tags[SAMPLESPERPIXEL] -= len(supplied_tags[EXTRASAMPLES]) + del supplied_tags[EXTRASAMPLES] + for tag in ( + # IFD offset that may not be correct in the saved image + EXIFIFD, + # Determined by the image format and should not be copied from legacy_ifd. + SAMPLEFORMAT, + ): + if tag in supplied_tags: + del supplied_tags[tag] + + # additions written by Greg Couch, gregc@cgl.ucsf.edu + # inspired by image-sig posting from Kevin Cazabon, kcazabon@home.com + if hasattr(im, "tag_v2"): + # preserve tags from original TIFF image file + for key in ( + RESOLUTION_UNIT, + X_RESOLUTION, + Y_RESOLUTION, + IPTC_NAA_CHUNK, + PHOTOSHOP_CHUNK, + XMP, + ): + if key in im.tag_v2: + if key == IPTC_NAA_CHUNK and im.tag_v2.tagtype[key] not in ( + TiffTags.BYTE, + TiffTags.UNDEFINED, + ): + del supplied_tags[key] + else: + ifd[key] = im.tag_v2[key] + ifd.tagtype[key] = im.tag_v2.tagtype[key] + + # preserve ICC profile (should also work when saving other formats + # which support profiles as TIFF) -- 2008-06-06 Florian Hoech + icc = encoderinfo.get("icc_profile", im.info.get("icc_profile")) + if icc: + ifd[ICCPROFILE] = icc + + for key, name in [ + (IMAGEDESCRIPTION, "description"), + (X_RESOLUTION, "resolution"), + (Y_RESOLUTION, "resolution"), + (X_RESOLUTION, "x_resolution"), + (Y_RESOLUTION, "y_resolution"), + (RESOLUTION_UNIT, "resolution_unit"), + (SOFTWARE, "software"), + (DATE_TIME, "date_time"), + (ARTIST, "artist"), + (COPYRIGHT, "copyright"), + ]: + if name in encoderinfo: + ifd[key] = encoderinfo[name] + + dpi = encoderinfo.get("dpi") + if dpi: + ifd[RESOLUTION_UNIT] = 2 + ifd[X_RESOLUTION] = dpi[0] + ifd[Y_RESOLUTION] = dpi[1] + + if bits != (1,): + ifd[BITSPERSAMPLE] = bits + if len(bits) != 1: + ifd[SAMPLESPERPIXEL] = len(bits) + if extra is not None: + ifd[EXTRASAMPLES] = extra + if format != 1: + ifd[SAMPLEFORMAT] = format + + if PHOTOMETRIC_INTERPRETATION not in ifd: + ifd[PHOTOMETRIC_INTERPRETATION] = photo + elif im.mode in ("1", "L") and ifd[PHOTOMETRIC_INTERPRETATION] == 0: + if im.mode == "1": + inverted_im = im.copy() + px = inverted_im.load() + if px is not None: + for y in range(inverted_im.height): + for x in range(inverted_im.width): + px[x, y] = 0 if px[x, y] == 255 else 255 + im = inverted_im + else: + im = ImageOps.invert(im) + + if im.mode in ["P", "PA"]: + lut = im.im.getpalette("RGB", "RGB;L") + colormap = [] + colors = len(lut) // 3 + for i in range(3): + colormap += [v * 256 for v in lut[colors * i : colors * (i + 1)]] + colormap += [0] * (256 - colors) + ifd[COLORMAP] = colormap + # data orientation + w, h = ifd[IMAGEWIDTH], ifd[IMAGELENGTH] + stride = len(bits) * ((w * bits[0] + 7) // 8) + if ROWSPERSTRIP not in ifd: + # aim for given strip size (64 KB by default) when using libtiff writer + if libtiff: + im_strip_size = encoderinfo.get("strip_size", STRIP_SIZE) + rows_per_strip = 1 if stride == 0 else min(im_strip_size // stride, h) + # JPEG encoder expects multiple of 8 rows + if compression == "jpeg": + rows_per_strip = min(((rows_per_strip + 7) // 8) * 8, h) + else: + rows_per_strip = h + if rows_per_strip == 0: + rows_per_strip = 1 + ifd[ROWSPERSTRIP] = rows_per_strip + strip_byte_counts = 1 if stride == 0 else stride * ifd[ROWSPERSTRIP] + strips_per_image = (h + ifd[ROWSPERSTRIP] - 1) // ifd[ROWSPERSTRIP] + if strip_byte_counts >= 2**16: + ifd.tagtype[STRIPBYTECOUNTS] = TiffTags.LONG + ifd[STRIPBYTECOUNTS] = (strip_byte_counts,) * (strips_per_image - 1) + ( + stride * h - strip_byte_counts * (strips_per_image - 1), + ) + ifd[STRIPOFFSETS] = tuple( + range(0, strip_byte_counts * strips_per_image, strip_byte_counts) + ) # this is adjusted by IFD writer + # no compression by default: + ifd[COMPRESSION] = COMPRESSION_INFO_REV.get(compression, 1) + + if im.mode == "YCbCr": + for tag, default_value in { + YCBCRSUBSAMPLING: (1, 1), + REFERENCEBLACKWHITE: (0, 255, 128, 255, 128, 255), + }.items(): + ifd.setdefault(tag, default_value) + + blocklist = [TILEWIDTH, TILELENGTH, TILEOFFSETS, TILEBYTECOUNTS] + if libtiff: + if "quality" in encoderinfo: + quality = encoderinfo["quality"] + if not isinstance(quality, int) or quality < 0 or quality > 100: + msg = "Invalid quality setting" + raise ValueError(msg) + if compression != "jpeg": + msg = "quality setting only supported for 'jpeg' compression" + raise ValueError(msg) + ifd[JPEGQUALITY] = quality + + logger.debug("Saving using libtiff encoder") + logger.debug("Items: %s", sorted(ifd.items())) + _fp = 0 + if hasattr(fp, "fileno"): + try: + fp.seek(0) + _fp = fp.fileno() + except io.UnsupportedOperation: + pass + + # optional types for non core tags + types = {} + # STRIPOFFSETS and STRIPBYTECOUNTS are added by the library + # based on the data in the strip. + # OSUBFILETYPE is deprecated. + # The other tags expect arrays with a certain length (fixed or depending on + # BITSPERSAMPLE, etc), passing arrays with a different length will result in + # segfaults. Block these tags until we add extra validation. + # SUBIFD may also cause a segfault. + blocklist += [ + OSUBFILETYPE, + REFERENCEBLACKWHITE, + STRIPBYTECOUNTS, + STRIPOFFSETS, + TRANSFERFUNCTION, + SUBIFD, + ] + + # bits per sample is a single short in the tiff directory, not a list. + atts: dict[int, Any] = {BITSPERSAMPLE: bits[0]} + # Merge the ones that we have with (optional) more bits from + # the original file, e.g x,y resolution so that we can + # save(load('')) == original file. + for tag, value in itertools.chain(ifd.items(), supplied_tags.items()): + # Libtiff can only process certain core items without adding + # them to the custom dictionary. + # Custom items are supported for int, float, unicode, string and byte + # values. Other types and tuples require a tagtype. + if tag not in TiffTags.LIBTIFF_CORE: + if tag in TiffTags.TAGS_V2_GROUPS: + types[tag] = TiffTags.LONG8 + elif tag in ifd.tagtype: + types[tag] = ifd.tagtype[tag] + elif isinstance(value, (int, float, str, bytes)) or ( + isinstance(value, tuple) + and all(isinstance(v, (int, float, IFDRational)) for v in value) + ): + type = TiffTags.lookup(tag).type + if type: + types[tag] = type + if tag not in atts and tag not in blocklist: + if isinstance(value, str): + atts[tag] = value.encode("ascii", "replace") + b"\0" + elif isinstance(value, IFDRational): + atts[tag] = float(value) + else: + atts[tag] = value + + if SAMPLEFORMAT in atts and len(atts[SAMPLEFORMAT]) == 1: + atts[SAMPLEFORMAT] = atts[SAMPLEFORMAT][0] + + logger.debug("Converted items: %s", sorted(atts.items())) + + # libtiff always expects the bytes in native order. + # we're storing image byte order. So, if the rawmode + # contains I;16, we need to convert from native to image + # byte order. + if im.mode in ("I;16", "I;16B", "I;16L"): + rawmode = "I;16N" + + # Pass tags as sorted list so that the tags are set in a fixed order. + # This is required by libtiff for some tags. For example, the JPEGQUALITY + # pseudo tag requires that the COMPRESS tag was already set. + tags = list(atts.items()) + tags.sort() + a = (rawmode, compression, _fp, filename, tags, types) + encoder = Image._getencoder(im.mode, "libtiff", a, encoderconfig) + encoder.setimage(im.im, (0, 0) + im.size) + while True: + errcode, data = encoder.encode(ImageFile.MAXBLOCK)[1:] + if not _fp: + fp.write(data) + if errcode: + break + if errcode < 0: + msg = f"encoder error {errcode} when writing image file" + raise OSError(msg) + + else: + for tag in blocklist: + del ifd[tag] + offset = ifd.save(fp) + + ImageFile._save( + im, + fp, + [ImageFile._Tile("raw", (0, 0) + im.size, offset, (rawmode, stride, 1))], + ) + + # -- helper for multi-page save -- + if "_debug_multipage" in encoderinfo: + # just to access o32 and o16 (using correct byte order) + setattr(im, "_debug_multipage", ifd) + + +class AppendingTiffWriter(io.BytesIO): + fieldSizes = [ + 0, # None + 1, # byte + 1, # ascii + 2, # short + 4, # long + 8, # rational + 1, # sbyte + 1, # undefined + 2, # sshort + 4, # slong + 8, # srational + 4, # float + 8, # double + 4, # ifd + 2, # unicode + 4, # complex + 8, # long8 + ] + + Tags = { + 273, # StripOffsets + 288, # FreeOffsets + 324, # TileOffsets + 519, # JPEGQTables + 520, # JPEGDCTables + 521, # JPEGACTables + } + + def __init__(self, fn: StrOrBytesPath | IO[bytes], new: bool = False) -> None: + self.f: IO[bytes] + if is_path(fn): + self.name = fn + self.close_fp = True + try: + self.f = open(fn, "w+b" if new else "r+b") + except OSError: + self.f = open(fn, "w+b") + else: + self.f = cast(IO[bytes], fn) + self.close_fp = False + self.beginning = self.f.tell() + self.setup() + + def setup(self) -> None: + # Reset everything. + self.f.seek(self.beginning, os.SEEK_SET) + + self.whereToWriteNewIFDOffset: int | None = None + self.offsetOfNewPage = 0 + + self.IIMM = iimm = self.f.read(4) + self._bigtiff = b"\x2b" in iimm + if not iimm: + # empty file - first page + self.isFirst = True + return + + self.isFirst = False + if iimm not in PREFIXES: + msg = "Invalid TIFF file header" + raise RuntimeError(msg) + + self.setEndian("<" if iimm.startswith(II) else ">") + + if self._bigtiff: + self.f.seek(4, os.SEEK_CUR) + self.skipIFDs() + self.goToEnd() + + def finalize(self) -> None: + if self.isFirst: + return + + # fix offsets + self.f.seek(self.offsetOfNewPage) + + iimm = self.f.read(4) + if not iimm: + # Make it easy to finish a frame without committing to a new one. + return + + if iimm != self.IIMM: + msg = "IIMM of new page doesn't match IIMM of first page" + raise RuntimeError(msg) + + if self._bigtiff: + self.f.seek(4, os.SEEK_CUR) + ifd_offset = self._read(8 if self._bigtiff else 4) + ifd_offset += self.offsetOfNewPage + assert self.whereToWriteNewIFDOffset is not None + self.f.seek(self.whereToWriteNewIFDOffset) + self._write(ifd_offset, 8 if self._bigtiff else 4) + self.f.seek(ifd_offset) + self.fixIFD() + + def newFrame(self) -> None: + # Call this to finish a frame. + self.finalize() + self.setup() + + def __enter__(self) -> AppendingTiffWriter: + return self + + def __exit__(self, *args: object) -> None: + if self.close_fp: + self.close() + + def tell(self) -> int: + return self.f.tell() - self.offsetOfNewPage + + def seek(self, offset: int, whence: int = io.SEEK_SET) -> int: + """ + :param offset: Distance to seek. + :param whence: Whether the distance is relative to the start, + end or current position. + :returns: The resulting position, relative to the start. + """ + if whence == os.SEEK_SET: + offset += self.offsetOfNewPage + + self.f.seek(offset, whence) + return self.tell() + + def goToEnd(self) -> None: + self.f.seek(0, os.SEEK_END) + pos = self.f.tell() + + # pad to 16 byte boundary + pad_bytes = 16 - pos % 16 + if 0 < pad_bytes < 16: + self.f.write(bytes(pad_bytes)) + self.offsetOfNewPage = self.f.tell() + + def setEndian(self, endian: str) -> None: + self.endian = endian + self.longFmt = f"{self.endian}L" + self.shortFmt = f"{self.endian}H" + self.tagFormat = f"{self.endian}HH" + ("Q" if self._bigtiff else "L") + + def skipIFDs(self) -> None: + while True: + ifd_offset = self._read(8 if self._bigtiff else 4) + if ifd_offset == 0: + self.whereToWriteNewIFDOffset = self.f.tell() - ( + 8 if self._bigtiff else 4 + ) + break + + self.f.seek(ifd_offset) + num_tags = self._read(8 if self._bigtiff else 2) + self.f.seek(num_tags * (20 if self._bigtiff else 12), os.SEEK_CUR) + + def write(self, data: Buffer, /) -> int: + return self.f.write(data) + + def _fmt(self, field_size: int) -> str: + try: + return {2: "H", 4: "L", 8: "Q"}[field_size] + except KeyError: + msg = "offset is not supported" + raise RuntimeError(msg) + + def _read(self, field_size: int) -> int: + (value,) = struct.unpack( + self.endian + self._fmt(field_size), self.f.read(field_size) + ) + return value + + def readShort(self) -> int: + return self._read(2) + + def readLong(self) -> int: + return self._read(4) + + @staticmethod + def _verify_bytes_written(bytes_written: int | None, expected: int) -> None: + if bytes_written is not None and bytes_written != expected: + msg = f"wrote only {bytes_written} bytes but wanted {expected}" + raise RuntimeError(msg) + + def _rewriteLast( + self, value: int, field_size: int, new_field_size: int = 0 + ) -> None: + self.f.seek(-field_size, os.SEEK_CUR) + if not new_field_size: + new_field_size = field_size + bytes_written = self.f.write( + struct.pack(self.endian + self._fmt(new_field_size), value) + ) + self._verify_bytes_written(bytes_written, new_field_size) + + def rewriteLastShortToLong(self, value: int) -> None: + self._rewriteLast(value, 2, 4) + + def rewriteLastShort(self, value: int) -> None: + return self._rewriteLast(value, 2) + + def rewriteLastLong(self, value: int) -> None: + return self._rewriteLast(value, 4) + + def _write(self, value: int, field_size: int) -> None: + bytes_written = self.f.write( + struct.pack(self.endian + self._fmt(field_size), value) + ) + self._verify_bytes_written(bytes_written, field_size) + + def writeShort(self, value: int) -> None: + self._write(value, 2) + + def writeLong(self, value: int) -> None: + self._write(value, 4) + + def close(self) -> None: + self.finalize() + if self.close_fp: + self.f.close() + + def fixIFD(self) -> None: + num_tags = self._read(8 if self._bigtiff else 2) + + for i in range(num_tags): + tag, field_type, count = struct.unpack( + self.tagFormat, self.f.read(12 if self._bigtiff else 8) + ) + + field_size = self.fieldSizes[field_type] + total_size = field_size * count + fmt_size = 8 if self._bigtiff else 4 + is_local = total_size <= fmt_size + if not is_local: + offset = self._read(fmt_size) + self.offsetOfNewPage + self._rewriteLast(offset, fmt_size) + + if tag in self.Tags: + cur_pos = self.f.tell() + + logger.debug( + "fixIFD: %s (%d) - type: %s (%d) - type size: %d - count: %d", + TiffTags.lookup(tag).name, + tag, + TYPES.get(field_type, "unknown"), + field_type, + field_size, + count, + ) + + if is_local: + self._fixOffsets(count, field_size) + self.f.seek(cur_pos + fmt_size) + else: + self.f.seek(offset) + self._fixOffsets(count, field_size) + self.f.seek(cur_pos) + + elif is_local: + # skip the locally stored value that is not an offset + self.f.seek(fmt_size, os.SEEK_CUR) + + def _fixOffsets(self, count: int, field_size: int) -> None: + for i in range(count): + offset = self._read(field_size) + offset += self.offsetOfNewPage + + new_field_size = 0 + if self._bigtiff and field_size in (2, 4) and offset >= 2**32: + # offset is now too large - we must convert long to long8 + new_field_size = 8 + elif field_size == 2 and offset >= 2**16: + # offset is now too large - we must convert short to long + new_field_size = 4 + if new_field_size: + if count != 1: + msg = "not implemented" + raise RuntimeError(msg) # XXX TODO + + # simple case - the offset is just one and therefore it is + # local (not referenced with another offset) + self._rewriteLast(offset, field_size, new_field_size) + # Move back past the new offset, past 'count', and before 'field_type' + rewind = -new_field_size - 4 - 2 + self.f.seek(rewind, os.SEEK_CUR) + self.writeShort(new_field_size) # rewrite the type + self.f.seek(2 - rewind, os.SEEK_CUR) + else: + self._rewriteLast(offset, field_size) + + def fixOffsets( + self, count: int, isShort: bool = False, isLong: bool = False + ) -> None: + if isShort: + field_size = 2 + elif isLong: + field_size = 4 + else: + field_size = 0 + return self._fixOffsets(count, field_size) + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + append_images = list(im.encoderinfo.get("append_images", [])) + if not hasattr(im, "n_frames") and not append_images: + return _save(im, fp, filename) + + cur_idx = im.tell() + try: + with AppendingTiffWriter(fp) as tf: + for ims in [im] + append_images: + encoderinfo = ims._attach_default_encoderinfo(im) + if not hasattr(ims, "encoderconfig"): + ims.encoderconfig = () + nfr = getattr(ims, "n_frames", 1) + + for idx in range(nfr): + ims.seek(idx) + ims.load() + _save(ims, tf, filename) + tf.newFrame() + ims.encoderinfo = encoderinfo + finally: + im.seek(cur_idx) + + +# +# -------------------------------------------------------------------- +# Register + +Image.register_open(TiffImageFile.format, TiffImageFile, _accept) +Image.register_save(TiffImageFile.format, _save) +Image.register_save_all(TiffImageFile.format, _save_all) + +Image.register_extensions(TiffImageFile.format, [".tif", ".tiff"]) + +Image.register_mime(TiffImageFile.format, "image/tiff") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TiffTags.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TiffTags.py new file mode 100644 index 0000000000000000000000000000000000000000..f053cfef64082475bbfa296efd5d126a60c776d5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/TiffTags.py @@ -0,0 +1,566 @@ +# +# The Python Imaging Library. +# $Id$ +# +# TIFF tags +# +# This module provides clear-text names for various well-known +# TIFF tags. the TIFF codec works just fine without it. +# +# Copyright (c) Secret Labs AB 1999. +# +# See the README file for information on usage and redistribution. +# + +## +# This module provides constants and clear-text names for various +# well-known TIFF tags. +## +from __future__ import annotations + +from typing import NamedTuple + + +class _TagInfo(NamedTuple): + value: int | None + name: str + type: int | None + length: int | None + enum: dict[str, int] + + +class TagInfo(_TagInfo): + __slots__: list[str] = [] + + def __new__( + cls, + value: int | None = None, + name: str = "unknown", + type: int | None = None, + length: int | None = None, + enum: dict[str, int] | None = None, + ) -> TagInfo: + return super().__new__(cls, value, name, type, length, enum or {}) + + def cvt_enum(self, value: str) -> int | str: + # Using get will call hash(value), which can be expensive + # for some types (e.g. Fraction). Since self.enum is rarely + # used, it's usually better to test it first. + return self.enum.get(value, value) if self.enum else value + + +def lookup(tag: int, group: int | None = None) -> TagInfo: + """ + :param tag: Integer tag number + :param group: Which :py:data:`~PIL.TiffTags.TAGS_V2_GROUPS` to look in + + .. versionadded:: 8.3.0 + + :returns: Taginfo namedtuple, From the ``TAGS_V2`` info if possible, + otherwise just populating the value and name from ``TAGS``. + If the tag is not recognized, "unknown" is returned for the name + + """ + + if group is not None: + info = TAGS_V2_GROUPS[group].get(tag) if group in TAGS_V2_GROUPS else None + else: + info = TAGS_V2.get(tag) + return info or TagInfo(tag, TAGS.get(tag, "unknown")) + + +## +# Map tag numbers to tag info. +# +# id: (Name, Type, Length[, enum_values]) +# +# The length here differs from the length in the tiff spec. For +# numbers, the tiff spec is for the number of fields returned. We +# agree here. For string-like types, the tiff spec uses the length of +# field in bytes. In Pillow, we are using the number of expected +# fields, in general 1 for string-like types. + + +BYTE = 1 +ASCII = 2 +SHORT = 3 +LONG = 4 +RATIONAL = 5 +SIGNED_BYTE = 6 +UNDEFINED = 7 +SIGNED_SHORT = 8 +SIGNED_LONG = 9 +SIGNED_RATIONAL = 10 +FLOAT = 11 +DOUBLE = 12 +IFD = 13 +LONG8 = 16 + +_tags_v2: dict[int, tuple[str, int, int] | tuple[str, int, int, dict[str, int]]] = { + 254: ("NewSubfileType", LONG, 1), + 255: ("SubfileType", SHORT, 1), + 256: ("ImageWidth", LONG, 1), + 257: ("ImageLength", LONG, 1), + 258: ("BitsPerSample", SHORT, 0), + 259: ( + "Compression", + SHORT, + 1, + { + "Uncompressed": 1, + "CCITT 1d": 2, + "Group 3 Fax": 3, + "Group 4 Fax": 4, + "LZW": 5, + "JPEG": 6, + "PackBits": 32773, + }, + ), + 262: ( + "PhotometricInterpretation", + SHORT, + 1, + { + "WhiteIsZero": 0, + "BlackIsZero": 1, + "RGB": 2, + "RGB Palette": 3, + "Transparency Mask": 4, + "CMYK": 5, + "YCbCr": 6, + "CieLAB": 8, + "CFA": 32803, # TIFF/EP, Adobe DNG + "LinearRaw": 32892, # Adobe DNG + }, + ), + 263: ("Threshholding", SHORT, 1), + 264: ("CellWidth", SHORT, 1), + 265: ("CellLength", SHORT, 1), + 266: ("FillOrder", SHORT, 1), + 269: ("DocumentName", ASCII, 1), + 270: ("ImageDescription", ASCII, 1), + 271: ("Make", ASCII, 1), + 272: ("Model", ASCII, 1), + 273: ("StripOffsets", LONG, 0), + 274: ("Orientation", SHORT, 1), + 277: ("SamplesPerPixel", SHORT, 1), + 278: ("RowsPerStrip", LONG, 1), + 279: ("StripByteCounts", LONG, 0), + 280: ("MinSampleValue", SHORT, 0), + 281: ("MaxSampleValue", SHORT, 0), + 282: ("XResolution", RATIONAL, 1), + 283: ("YResolution", RATIONAL, 1), + 284: ("PlanarConfiguration", SHORT, 1, {"Contiguous": 1, "Separate": 2}), + 285: ("PageName", ASCII, 1), + 286: ("XPosition", RATIONAL, 1), + 287: ("YPosition", RATIONAL, 1), + 288: ("FreeOffsets", LONG, 1), + 289: ("FreeByteCounts", LONG, 1), + 290: ("GrayResponseUnit", SHORT, 1), + 291: ("GrayResponseCurve", SHORT, 0), + 292: ("T4Options", LONG, 1), + 293: ("T6Options", LONG, 1), + 296: ("ResolutionUnit", SHORT, 1, {"none": 1, "inch": 2, "cm": 3}), + 297: ("PageNumber", SHORT, 2), + 301: ("TransferFunction", SHORT, 0), + 305: ("Software", ASCII, 1), + 306: ("DateTime", ASCII, 1), + 315: ("Artist", ASCII, 1), + 316: ("HostComputer", ASCII, 1), + 317: ("Predictor", SHORT, 1, {"none": 1, "Horizontal Differencing": 2}), + 318: ("WhitePoint", RATIONAL, 2), + 319: ("PrimaryChromaticities", RATIONAL, 6), + 320: ("ColorMap", SHORT, 0), + 321: ("HalftoneHints", SHORT, 2), + 322: ("TileWidth", LONG, 1), + 323: ("TileLength", LONG, 1), + 324: ("TileOffsets", LONG, 0), + 325: ("TileByteCounts", LONG, 0), + 330: ("SubIFDs", LONG, 0), + 332: ("InkSet", SHORT, 1), + 333: ("InkNames", ASCII, 1), + 334: ("NumberOfInks", SHORT, 1), + 336: ("DotRange", SHORT, 0), + 337: ("TargetPrinter", ASCII, 1), + 338: ("ExtraSamples", SHORT, 0), + 339: ("SampleFormat", SHORT, 0), + 340: ("SMinSampleValue", DOUBLE, 0), + 341: ("SMaxSampleValue", DOUBLE, 0), + 342: ("TransferRange", SHORT, 6), + 347: ("JPEGTables", UNDEFINED, 1), + # obsolete JPEG tags + 512: ("JPEGProc", SHORT, 1), + 513: ("JPEGInterchangeFormat", LONG, 1), + 514: ("JPEGInterchangeFormatLength", LONG, 1), + 515: ("JPEGRestartInterval", SHORT, 1), + 517: ("JPEGLosslessPredictors", SHORT, 0), + 518: ("JPEGPointTransforms", SHORT, 0), + 519: ("JPEGQTables", LONG, 0), + 520: ("JPEGDCTables", LONG, 0), + 521: ("JPEGACTables", LONG, 0), + 529: ("YCbCrCoefficients", RATIONAL, 3), + 530: ("YCbCrSubSampling", SHORT, 2), + 531: ("YCbCrPositioning", SHORT, 1), + 532: ("ReferenceBlackWhite", RATIONAL, 6), + 700: ("XMP", BYTE, 0), + # Four private SGI tags + 32995: ("Matteing", SHORT, 1), + 32996: ("DataType", SHORT, 0), + 32997: ("ImageDepth", LONG, 1), + 32998: ("TileDepth", LONG, 1), + 33432: ("Copyright", ASCII, 1), + 33723: ("IptcNaaInfo", UNDEFINED, 1), + 34377: ("PhotoshopInfo", BYTE, 0), + # FIXME add more tags here + 34665: ("ExifIFD", LONG, 1), + 34675: ("ICCProfile", UNDEFINED, 1), + 34853: ("GPSInfoIFD", LONG, 1), + 36864: ("ExifVersion", UNDEFINED, 1), + 37724: ("ImageSourceData", UNDEFINED, 1), + 40965: ("InteroperabilityIFD", LONG, 1), + 41730: ("CFAPattern", UNDEFINED, 1), + # MPInfo + 45056: ("MPFVersion", UNDEFINED, 1), + 45057: ("NumberOfImages", LONG, 1), + 45058: ("MPEntry", UNDEFINED, 1), + 45059: ("ImageUIDList", UNDEFINED, 0), # UNDONE, check + 45060: ("TotalFrames", LONG, 1), + 45313: ("MPIndividualNum", LONG, 1), + 45569: ("PanOrientation", LONG, 1), + 45570: ("PanOverlap_H", RATIONAL, 1), + 45571: ("PanOverlap_V", RATIONAL, 1), + 45572: ("BaseViewpointNum", LONG, 1), + 45573: ("ConvergenceAngle", SIGNED_RATIONAL, 1), + 45574: ("BaselineLength", RATIONAL, 1), + 45575: ("VerticalDivergence", SIGNED_RATIONAL, 1), + 45576: ("AxisDistance_X", SIGNED_RATIONAL, 1), + 45577: ("AxisDistance_Y", SIGNED_RATIONAL, 1), + 45578: ("AxisDistance_Z", SIGNED_RATIONAL, 1), + 45579: ("YawAngle", SIGNED_RATIONAL, 1), + 45580: ("PitchAngle", SIGNED_RATIONAL, 1), + 45581: ("RollAngle", SIGNED_RATIONAL, 1), + 40960: ("FlashPixVersion", UNDEFINED, 1), + 50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}), + 50780: ("BestQualityScale", RATIONAL, 1), + 50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one + 50839: ("ImageJMetaData", UNDEFINED, 1), # see Issue #2006 +} +_tags_v2_groups = { + # ExifIFD + 34665: { + 36864: ("ExifVersion", UNDEFINED, 1), + 40960: ("FlashPixVersion", UNDEFINED, 1), + 40965: ("InteroperabilityIFD", LONG, 1), + 41730: ("CFAPattern", UNDEFINED, 1), + }, + # GPSInfoIFD + 34853: { + 0: ("GPSVersionID", BYTE, 4), + 1: ("GPSLatitudeRef", ASCII, 2), + 2: ("GPSLatitude", RATIONAL, 3), + 3: ("GPSLongitudeRef", ASCII, 2), + 4: ("GPSLongitude", RATIONAL, 3), + 5: ("GPSAltitudeRef", BYTE, 1), + 6: ("GPSAltitude", RATIONAL, 1), + 7: ("GPSTimeStamp", RATIONAL, 3), + 8: ("GPSSatellites", ASCII, 0), + 9: ("GPSStatus", ASCII, 2), + 10: ("GPSMeasureMode", ASCII, 2), + 11: ("GPSDOP", RATIONAL, 1), + 12: ("GPSSpeedRef", ASCII, 2), + 13: ("GPSSpeed", RATIONAL, 1), + 14: ("GPSTrackRef", ASCII, 2), + 15: ("GPSTrack", RATIONAL, 1), + 16: ("GPSImgDirectionRef", ASCII, 2), + 17: ("GPSImgDirection", RATIONAL, 1), + 18: ("GPSMapDatum", ASCII, 0), + 19: ("GPSDestLatitudeRef", ASCII, 2), + 20: ("GPSDestLatitude", RATIONAL, 3), + 21: ("GPSDestLongitudeRef", ASCII, 2), + 22: ("GPSDestLongitude", RATIONAL, 3), + 23: ("GPSDestBearingRef", ASCII, 2), + 24: ("GPSDestBearing", RATIONAL, 1), + 25: ("GPSDestDistanceRef", ASCII, 2), + 26: ("GPSDestDistance", RATIONAL, 1), + 27: ("GPSProcessingMethod", UNDEFINED, 0), + 28: ("GPSAreaInformation", UNDEFINED, 0), + 29: ("GPSDateStamp", ASCII, 11), + 30: ("GPSDifferential", SHORT, 1), + }, + # InteroperabilityIFD + 40965: {1: ("InteropIndex", ASCII, 1), 2: ("InteropVersion", UNDEFINED, 1)}, +} + +# Legacy Tags structure +# these tags aren't included above, but were in the previous versions +TAGS: dict[int | tuple[int, int], str] = { + 347: "JPEGTables", + 700: "XMP", + # Additional Exif Info + 32932: "Wang Annotation", + 33434: "ExposureTime", + 33437: "FNumber", + 33445: "MD FileTag", + 33446: "MD ScalePixel", + 33447: "MD ColorTable", + 33448: "MD LabName", + 33449: "MD SampleInfo", + 33450: "MD PrepDate", + 33451: "MD PrepTime", + 33452: "MD FileUnits", + 33550: "ModelPixelScaleTag", + 33723: "IptcNaaInfo", + 33918: "INGR Packet Data Tag", + 33919: "INGR Flag Registers", + 33920: "IrasB Transformation Matrix", + 33922: "ModelTiepointTag", + 34264: "ModelTransformationTag", + 34377: "PhotoshopInfo", + 34735: "GeoKeyDirectoryTag", + 34736: "GeoDoubleParamsTag", + 34737: "GeoAsciiParamsTag", + 34850: "ExposureProgram", + 34852: "SpectralSensitivity", + 34855: "ISOSpeedRatings", + 34856: "OECF", + 34864: "SensitivityType", + 34865: "StandardOutputSensitivity", + 34866: "RecommendedExposureIndex", + 34867: "ISOSpeed", + 34868: "ISOSpeedLatitudeyyy", + 34869: "ISOSpeedLatitudezzz", + 34908: "HylaFAX FaxRecvParams", + 34909: "HylaFAX FaxSubAddress", + 34910: "HylaFAX FaxRecvTime", + 36864: "ExifVersion", + 36867: "DateTimeOriginal", + 36868: "DateTimeDigitized", + 37121: "ComponentsConfiguration", + 37122: "CompressedBitsPerPixel", + 37724: "ImageSourceData", + 37377: "ShutterSpeedValue", + 37378: "ApertureValue", + 37379: "BrightnessValue", + 37380: "ExposureBiasValue", + 37381: "MaxApertureValue", + 37382: "SubjectDistance", + 37383: "MeteringMode", + 37384: "LightSource", + 37385: "Flash", + 37386: "FocalLength", + 37396: "SubjectArea", + 37500: "MakerNote", + 37510: "UserComment", + 37520: "SubSec", + 37521: "SubSecTimeOriginal", + 37522: "SubsecTimeDigitized", + 40960: "FlashPixVersion", + 40961: "ColorSpace", + 40962: "PixelXDimension", + 40963: "PixelYDimension", + 40964: "RelatedSoundFile", + 40965: "InteroperabilityIFD", + 41483: "FlashEnergy", + 41484: "SpatialFrequencyResponse", + 41486: "FocalPlaneXResolution", + 41487: "FocalPlaneYResolution", + 41488: "FocalPlaneResolutionUnit", + 41492: "SubjectLocation", + 41493: "ExposureIndex", + 41495: "SensingMethod", + 41728: "FileSource", + 41729: "SceneType", + 41730: "CFAPattern", + 41985: "CustomRendered", + 41986: "ExposureMode", + 41987: "WhiteBalance", + 41988: "DigitalZoomRatio", + 41989: "FocalLengthIn35mmFilm", + 41990: "SceneCaptureType", + 41991: "GainControl", + 41992: "Contrast", + 41993: "Saturation", + 41994: "Sharpness", + 41995: "DeviceSettingDescription", + 41996: "SubjectDistanceRange", + 42016: "ImageUniqueID", + 42032: "CameraOwnerName", + 42033: "BodySerialNumber", + 42034: "LensSpecification", + 42035: "LensMake", + 42036: "LensModel", + 42037: "LensSerialNumber", + 42112: "GDAL_METADATA", + 42113: "GDAL_NODATA", + 42240: "Gamma", + 50215: "Oce Scanjob Description", + 50216: "Oce Application Selector", + 50217: "Oce Identification Number", + 50218: "Oce ImageLogic Characteristics", + # Adobe DNG + 50706: "DNGVersion", + 50707: "DNGBackwardVersion", + 50708: "UniqueCameraModel", + 50709: "LocalizedCameraModel", + 50710: "CFAPlaneColor", + 50711: "CFALayout", + 50712: "LinearizationTable", + 50713: "BlackLevelRepeatDim", + 50714: "BlackLevel", + 50715: "BlackLevelDeltaH", + 50716: "BlackLevelDeltaV", + 50717: "WhiteLevel", + 50718: "DefaultScale", + 50719: "DefaultCropOrigin", + 50720: "DefaultCropSize", + 50721: "ColorMatrix1", + 50722: "ColorMatrix2", + 50723: "CameraCalibration1", + 50724: "CameraCalibration2", + 50725: "ReductionMatrix1", + 50726: "ReductionMatrix2", + 50727: "AnalogBalance", + 50728: "AsShotNeutral", + 50729: "AsShotWhiteXY", + 50730: "BaselineExposure", + 50731: "BaselineNoise", + 50732: "BaselineSharpness", + 50733: "BayerGreenSplit", + 50734: "LinearResponseLimit", + 50735: "CameraSerialNumber", + 50736: "LensInfo", + 50737: "ChromaBlurRadius", + 50738: "AntiAliasStrength", + 50740: "DNGPrivateData", + 50778: "CalibrationIlluminant1", + 50779: "CalibrationIlluminant2", + 50784: "Alias Layer Metadata", +} + +TAGS_V2: dict[int, TagInfo] = {} +TAGS_V2_GROUPS: dict[int, dict[int, TagInfo]] = {} + + +def _populate() -> None: + for k, v in _tags_v2.items(): + # Populate legacy structure. + TAGS[k] = v[0] + if len(v) == 4: + for sk, sv in v[3].items(): + TAGS[(k, sv)] = sk + + TAGS_V2[k] = TagInfo(k, *v) + + for group, tags in _tags_v2_groups.items(): + TAGS_V2_GROUPS[group] = {k: TagInfo(k, *v) for k, v in tags.items()} + + +_populate() +## +# Map type numbers to type names -- defined in ImageFileDirectory. + +TYPES: dict[int, str] = {} + +# +# These tags are handled by default in libtiff, without +# adding to the custom dictionary. From tif_dir.c, searching for +# case TIFFTAG in the _TIFFVSetField function: +# Line: item. +# 148: case TIFFTAG_SUBFILETYPE: +# 151: case TIFFTAG_IMAGEWIDTH: +# 154: case TIFFTAG_IMAGELENGTH: +# 157: case TIFFTAG_BITSPERSAMPLE: +# 181: case TIFFTAG_COMPRESSION: +# 202: case TIFFTAG_PHOTOMETRIC: +# 205: case TIFFTAG_THRESHHOLDING: +# 208: case TIFFTAG_FILLORDER: +# 214: case TIFFTAG_ORIENTATION: +# 221: case TIFFTAG_SAMPLESPERPIXEL: +# 228: case TIFFTAG_ROWSPERSTRIP: +# 238: case TIFFTAG_MINSAMPLEVALUE: +# 241: case TIFFTAG_MAXSAMPLEVALUE: +# 244: case TIFFTAG_SMINSAMPLEVALUE: +# 247: case TIFFTAG_SMAXSAMPLEVALUE: +# 250: case TIFFTAG_XRESOLUTION: +# 256: case TIFFTAG_YRESOLUTION: +# 262: case TIFFTAG_PLANARCONFIG: +# 268: case TIFFTAG_XPOSITION: +# 271: case TIFFTAG_YPOSITION: +# 274: case TIFFTAG_RESOLUTIONUNIT: +# 280: case TIFFTAG_PAGENUMBER: +# 284: case TIFFTAG_HALFTONEHINTS: +# 288: case TIFFTAG_COLORMAP: +# 294: case TIFFTAG_EXTRASAMPLES: +# 298: case TIFFTAG_MATTEING: +# 305: case TIFFTAG_TILEWIDTH: +# 316: case TIFFTAG_TILELENGTH: +# 327: case TIFFTAG_TILEDEPTH: +# 333: case TIFFTAG_DATATYPE: +# 344: case TIFFTAG_SAMPLEFORMAT: +# 361: case TIFFTAG_IMAGEDEPTH: +# 364: case TIFFTAG_SUBIFD: +# 376: case TIFFTAG_YCBCRPOSITIONING: +# 379: case TIFFTAG_YCBCRSUBSAMPLING: +# 383: case TIFFTAG_TRANSFERFUNCTION: +# 389: case TIFFTAG_REFERENCEBLACKWHITE: +# 393: case TIFFTAG_INKNAMES: + +# Following pseudo-tags are also handled by default in libtiff: +# TIFFTAG_JPEGQUALITY 65537 + +# some of these are not in our TAGS_V2 dict and were included from tiff.h + +# This list also exists in encode.c +LIBTIFF_CORE = { + 255, + 256, + 257, + 258, + 259, + 262, + 263, + 266, + 274, + 277, + 278, + 280, + 281, + 340, + 341, + 282, + 283, + 284, + 286, + 287, + 296, + 297, + 321, + 320, + 338, + 32995, + 322, + 323, + 32998, + 32996, + 339, + 32997, + 330, + 531, + 530, + 301, + 532, + 333, + # as above + 269, # this has been in our tests forever, and works + 65537, +} + +LIBTIFF_CORE.remove(255) # We don't have support for subfiletypes +LIBTIFF_CORE.remove(322) # We don't have support for writing tiled images with libtiff +LIBTIFF_CORE.remove(323) # Tiled images + +# Note to advanced users: There may be combinations of these +# parameters and values that when added properly, will work and +# produce valid tiff images that may work in your application. +# It is safe to add and remove tags from this set from Pillow's point +# of view so long as you test against libtiff. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WalImageFile.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WalImageFile.py new file mode 100644 index 0000000000000000000000000000000000000000..ee10c0c001bfbae68df3635518ec6aaac54e1bbb --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WalImageFile.py @@ -0,0 +1,129 @@ +# +# The Python Imaging Library. +# $Id$ +# +# WAL file handling +# +# History: +# 2003-04-23 fl created +# +# Copyright (c) 2003 by Fredrik Lundh. +# +# See the README file for information on usage and redistribution. +# + +""" +This reader is based on the specification available from: +https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml +and has been tested with a few sample files found using google. + +.. note:: + This format cannot be automatically recognized, so the reader + is not registered for use with :py:func:`PIL.Image.open()`. + To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead. +""" + +from __future__ import annotations + +from typing import IO + +from . import Image, ImageFile +from ._binary import i32le as i32 +from ._typing import StrOrBytesPath + + +class WalImageFile(ImageFile.ImageFile): + format = "WAL" + format_description = "Quake2 Texture" + + def _open(self) -> None: + self._mode = "P" + + # read header fields + assert self.fp is not None + header = self.fp.read(32 + 24 + 32 + 12) + self._size = i32(header, 32), i32(header, 36) + Image._decompression_bomb_check(self.size) + + # load pixel data + offset = i32(header, 40) + self.fp.seek(offset) + + # strings are null-terminated + self.info["name"] = header[:32].split(b"\0", 1)[0] + if next_name := header[56 : 56 + 32].split(b"\0", 1)[0]: + self.info["next_name"] = next_name + + def load(self) -> Image.core.PixelAccess | None: + if self._im is None: + assert self.fp is not None + self.im = Image.core.new(self.mode, self.size) + self.frombytes(self.fp.read(self.size[0] * self.size[1])) + self.putpalette(quake2palette) + return Image.Image.load(self) + + +def open(filename: StrOrBytesPath | IO[bytes]) -> WalImageFile: + """ + Load texture from a Quake2 WAL texture file. + + By default, a Quake2 standard palette is attached to the texture. + To override the palette, use the :py:func:`PIL.Image.Image.putpalette()` method. + + :param filename: WAL file name, or an opened file handle. + :returns: An image instance. + """ + return WalImageFile(filename) + + +quake2palette = ( + # default palette taken from piffo 0.93 by Hans Häggström + b"\x01\x01\x01\x0b\x0b\x0b\x12\x12\x12\x17\x17\x17\x1b\x1b\x1b\x1e" + b"\x1e\x1e\x22\x22\x22\x26\x26\x26\x29\x29\x29\x2c\x2c\x2c\x2f\x2f" + b"\x2f\x32\x32\x32\x35\x35\x35\x37\x37\x37\x3a\x3a\x3a\x3c\x3c\x3c" + b"\x24\x1e\x13\x22\x1c\x12\x20\x1b\x12\x1f\x1a\x10\x1d\x19\x10\x1b" + b"\x17\x0f\x1a\x16\x0f\x18\x14\x0d\x17\x13\x0d\x16\x12\x0d\x14\x10" + b"\x0b\x13\x0f\x0b\x10\x0d\x0a\x0f\x0b\x0a\x0d\x0b\x07\x0b\x0a\x07" + b"\x23\x23\x26\x22\x22\x25\x22\x20\x23\x21\x1f\x22\x20\x1e\x20\x1f" + b"\x1d\x1e\x1d\x1b\x1c\x1b\x1a\x1a\x1a\x19\x19\x18\x17\x17\x17\x16" + b"\x16\x14\x14\x14\x13\x13\x13\x10\x10\x10\x0f\x0f\x0f\x0d\x0d\x0d" + b"\x2d\x28\x20\x29\x24\x1c\x27\x22\x1a\x25\x1f\x17\x38\x2e\x1e\x31" + b"\x29\x1a\x2c\x25\x17\x26\x20\x14\x3c\x30\x14\x37\x2c\x13\x33\x28" + b"\x12\x2d\x24\x10\x28\x1f\x0f\x22\x1a\x0b\x1b\x14\x0a\x13\x0f\x07" + b"\x31\x1a\x16\x30\x17\x13\x2e\x16\x10\x2c\x14\x0d\x2a\x12\x0b\x27" + b"\x0f\x0a\x25\x0f\x07\x21\x0d\x01\x1e\x0b\x01\x1c\x0b\x01\x1a\x0b" + b"\x01\x18\x0a\x01\x16\x0a\x01\x13\x0a\x01\x10\x07\x01\x0d\x07\x01" + b"\x29\x23\x1e\x27\x21\x1c\x26\x20\x1b\x25\x1f\x1a\x23\x1d\x19\x21" + b"\x1c\x18\x20\x1b\x17\x1e\x19\x16\x1c\x18\x14\x1b\x17\x13\x19\x14" + b"\x10\x17\x13\x0f\x14\x10\x0d\x12\x0f\x0b\x0f\x0b\x0a\x0b\x0a\x07" + b"\x26\x1a\x0f\x23\x19\x0f\x20\x17\x0f\x1c\x16\x0f\x19\x13\x0d\x14" + b"\x10\x0b\x10\x0d\x0a\x0b\x0a\x07\x33\x22\x1f\x35\x29\x26\x37\x2f" + b"\x2d\x39\x35\x34\x37\x39\x3a\x33\x37\x39\x30\x34\x36\x2b\x31\x34" + b"\x27\x2e\x31\x22\x2b\x2f\x1d\x28\x2c\x17\x25\x2a\x0f\x20\x26\x0d" + b"\x1e\x25\x0b\x1c\x22\x0a\x1b\x20\x07\x19\x1e\x07\x17\x1b\x07\x14" + b"\x18\x01\x12\x16\x01\x0f\x12\x01\x0b\x0d\x01\x07\x0a\x01\x01\x01" + b"\x2c\x21\x21\x2a\x1f\x1f\x29\x1d\x1d\x27\x1c\x1c\x26\x1a\x1a\x24" + b"\x18\x18\x22\x17\x17\x21\x16\x16\x1e\x13\x13\x1b\x12\x12\x18\x10" + b"\x10\x16\x0d\x0d\x12\x0b\x0b\x0d\x0a\x0a\x0a\x07\x07\x01\x01\x01" + b"\x2e\x30\x29\x2d\x2e\x27\x2b\x2c\x26\x2a\x2a\x24\x28\x29\x23\x27" + b"\x27\x21\x26\x26\x1f\x24\x24\x1d\x22\x22\x1c\x1f\x1f\x1a\x1c\x1c" + b"\x18\x19\x19\x16\x17\x17\x13\x13\x13\x10\x0f\x0f\x0d\x0b\x0b\x0a" + b"\x30\x1e\x1b\x2d\x1c\x19\x2c\x1a\x17\x2a\x19\x14\x28\x17\x13\x26" + b"\x16\x10\x24\x13\x0f\x21\x12\x0d\x1f\x10\x0b\x1c\x0f\x0a\x19\x0d" + b"\x0a\x16\x0b\x07\x12\x0a\x07\x0f\x07\x01\x0a\x01\x01\x01\x01\x01" + b"\x28\x29\x38\x26\x27\x36\x25\x26\x34\x24\x24\x31\x22\x22\x2f\x20" + b"\x21\x2d\x1e\x1f\x2a\x1d\x1d\x27\x1b\x1b\x25\x19\x19\x21\x17\x17" + b"\x1e\x14\x14\x1b\x13\x12\x17\x10\x0f\x13\x0d\x0b\x0f\x0a\x07\x07" + b"\x2f\x32\x29\x2d\x30\x26\x2b\x2e\x24\x29\x2c\x21\x27\x2a\x1e\x25" + b"\x28\x1c\x23\x26\x1a\x21\x25\x18\x1e\x22\x14\x1b\x1f\x10\x19\x1c" + b"\x0d\x17\x1a\x0a\x13\x17\x07\x10\x13\x01\x0d\x0f\x01\x0a\x0b\x01" + b"\x01\x3f\x01\x13\x3c\x0b\x1b\x39\x10\x20\x35\x14\x23\x31\x17\x23" + b"\x2d\x18\x23\x29\x18\x3f\x3f\x3f\x3f\x3f\x39\x3f\x3f\x31\x3f\x3f" + b"\x2a\x3f\x3f\x20\x3f\x3f\x14\x3f\x3c\x12\x3f\x39\x0f\x3f\x35\x0b" + b"\x3f\x32\x07\x3f\x2d\x01\x3d\x2a\x01\x3b\x26\x01\x39\x21\x01\x37" + b"\x1d\x01\x34\x1a\x01\x32\x16\x01\x2f\x12\x01\x2d\x0f\x01\x2a\x0b" + b"\x01\x27\x07\x01\x23\x01\x01\x1d\x01\x01\x17\x01\x01\x10\x01\x01" + b"\x3d\x01\x01\x19\x19\x3f\x3f\x01\x01\x01\x01\x3f\x16\x16\x13\x10" + b"\x10\x0f\x0d\x0d\x0b\x3c\x2e\x2a\x36\x27\x20\x30\x21\x18\x29\x1b" + b"\x10\x3c\x39\x37\x37\x32\x2f\x31\x2c\x28\x2b\x26\x21\x30\x22\x20" +) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WebPImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WebPImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..06ca3e851fbb307c0859ce9b1e765fc7537282d1 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WebPImagePlugin.py @@ -0,0 +1,317 @@ +from __future__ import annotations + +from io import BytesIO + +from . import Image, ImageFile + +try: + from . import _webp + + SUPPORTED = True +except ImportError: + SUPPORTED = False + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import IO, Any + +_VP8_MODES_BY_IDENTIFIER = { + b"VP8 ": "RGB", + b"VP8X": "RGBA", + b"VP8L": "RGBA", # lossless +} + + +def _accept(prefix: bytes) -> bool | str: + is_riff_file_format = prefix.startswith(b"RIFF") + is_webp_file = prefix[8:12] == b"WEBP" + is_valid_vp8_mode = prefix[12:16] in _VP8_MODES_BY_IDENTIFIER + + if is_riff_file_format and is_webp_file and is_valid_vp8_mode: + if not SUPPORTED: + return ( + "image file could not be identified because WEBP support not installed" + ) + return True + return False + + +class WebPImageFile(ImageFile.ImageFile): + format = "WEBP" + format_description = "WebP image" + __loaded = 0 + __logical_frame = 0 + + def _open(self) -> None: + # Use the newer AnimDecoder API to parse the (possibly) animated file, + # and access muxed chunks like ICC/EXIF/XMP. + assert self.fp is not None + self._decoder = _webp.WebPAnimDecoder(self.fp.read()) + + # Get info from decoder + self._size, self.info["loop"], bgcolor, self.n_frames, self.rawmode = ( + self._decoder.get_info() + ) + self.info["background"] = ( + (bgcolor >> 16) & 0xFF, # R + (bgcolor >> 8) & 0xFF, # G + bgcolor & 0xFF, # B + (bgcolor >> 24) & 0xFF, # A + ) + self.is_animated = self.n_frames > 1 + self._mode = "RGB" if self.rawmode == "RGBX" else self.rawmode + + # Attempt to read ICC / EXIF / XMP chunks from file + for key, chunk_name in { + "icc_profile": "ICCP", + "exif": "EXIF", + "xmp": "XMP ", + }.items(): + if value := self._decoder.get_chunk(chunk_name): + self.info[key] = value + + # Initialize seek state + self._reset(reset=False) + + def _getexif(self) -> dict[int, Any] | None: + if "exif" not in self.info: + return None + return self.getexif()._get_merged_dict() + + def seek(self, frame: int) -> None: + if not self._seek_check(frame): + return + + # Set logical frame to requested position + self.__logical_frame = frame + + def _reset(self, reset: bool = True) -> None: + if reset: + self._decoder.reset() + self.__physical_frame = 0 + self.__loaded = -1 + self.__timestamp = 0 + + def _get_next(self) -> tuple[bytes, int, int]: + # Get next frame + ret = self._decoder.get_next() + self.__physical_frame += 1 + + # Check if an error occurred + if ret is None: + self._reset() # Reset just to be safe + self.seek(0) + msg = "failed to decode next frame in WebP file" + raise EOFError(msg) + + # Compute duration + data, timestamp = ret + duration = timestamp - self.__timestamp + self.__timestamp = timestamp + + # libwebp gives frame end, adjust to start of frame + timestamp -= duration + return data, timestamp, duration + + def _seek(self, frame: int) -> None: + if self.__physical_frame == frame: + return # Nothing to do + if frame < self.__physical_frame: + self._reset() # Rewind to beginning + while self.__physical_frame < frame: + self._get_next() # Advance to the requested frame + + def load(self) -> Image.core.PixelAccess | None: + if self.__loaded != self.__logical_frame: + self._seek(self.__logical_frame) + + # We need to load the image data for this frame + data, self.info["timestamp"], self.info["duration"] = self._get_next() + self.__loaded = self.__logical_frame + + # Set tile + if self.fp and self._exclusive_fp: + self.fp.close() + self.fp = BytesIO(data) + self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.rawmode)] + + return super().load() + + def load_seek(self, pos: int) -> None: + pass + + def tell(self) -> int: + return self.__logical_frame + + +def _convert_frame(im: Image.Image) -> Image.Image: + # Make sure image mode is supported + if im.mode not in ("RGBX", "RGBA", "RGB"): + im = im.convert("RGBA" if im.has_transparency_data else "RGB") + return im + + +def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + encoderinfo = im.encoderinfo.copy() + append_images = list(encoderinfo.get("append_images", [])) + + # If total frame count is 1, then save using the legacy API, which + # will preserve non-alpha modes + total = 0 + for ims in [im] + append_images: + total += getattr(ims, "n_frames", 1) + if total == 1: + _save(im, fp, filename) + return + + background: int | tuple[int, ...] = (0, 0, 0, 0) + if "background" in encoderinfo: + background = encoderinfo["background"] + elif "background" in im.info: + background = im.info["background"] + if isinstance(background, int): + # GifImagePlugin stores a global color table index in + # info["background"]. So it must be converted to an RGBA value + palette = im.getpalette() + if palette: + r, g, b = palette[background * 3 : (background + 1) * 3] + background = (r, g, b, 255) + else: + background = (background, background, background, 255) + + duration = im.encoderinfo.get("duration", im.info.get("duration", 0)) + loop = im.encoderinfo.get("loop", 0) + minimize_size = im.encoderinfo.get("minimize_size", False) + kmin = im.encoderinfo.get("kmin", None) + kmax = im.encoderinfo.get("kmax", None) + allow_mixed = im.encoderinfo.get("allow_mixed", False) + verbose = False + lossless = im.encoderinfo.get("lossless", False) + quality = im.encoderinfo.get("quality", 80) + alpha_quality = im.encoderinfo.get("alpha_quality", 100) + method = im.encoderinfo.get("method", 0) + icc_profile = im.encoderinfo.get("icc_profile") or "" + exif = im.encoderinfo.get("exif", "") + if isinstance(exif, Image.Exif): + exif = exif.tobytes() + xmp = im.encoderinfo.get("xmp", "") + if allow_mixed: + lossless = False + + # Sensible keyframe defaults are from gif2webp.c script + if kmin is None: + kmin = 9 if lossless else 3 + if kmax is None: + kmax = 17 if lossless else 5 + + # Validate background color + if ( + not isinstance(background, (list, tuple)) + or len(background) != 4 + or not all(0 <= v < 256 for v in background) + ): + msg = f"Background color is not an RGBA tuple clamped to (0-255): {background}" + raise OSError(msg) + + # Convert to packed uint + bg_r, bg_g, bg_b, bg_a = background + background = (bg_a << 24) | (bg_r << 16) | (bg_g << 8) | (bg_b << 0) + + # Setup the WebP animation encoder + enc = _webp.WebPAnimEncoder( + im.size, + background, + loop, + minimize_size, + kmin, + kmax, + allow_mixed, + verbose, + ) + + # Add each frame + frame_idx = 0 + timestamp = 0 + cur_idx = im.tell() + try: + for ims in [im] + append_images: + # Get number of frames in this image + nfr = getattr(ims, "n_frames", 1) + + for idx in range(nfr): + ims.seek(idx) + + frame = _convert_frame(ims) + + # Append the frame to the animation encoder + enc.add( + frame.getim(), + round(timestamp), + lossless, + quality, + alpha_quality, + method, + ) + + # Update timestamp and frame index + if isinstance(duration, (list, tuple)): + timestamp += duration[frame_idx] + else: + timestamp += duration + frame_idx += 1 + + finally: + im.seek(cur_idx) + + # Force encoder to flush frames + enc.add(None, round(timestamp), lossless, quality, alpha_quality, 0) + + # Get the final output from the encoder + data = enc.assemble(icc_profile, exif, xmp) + if data is None: + msg = "cannot write file as WebP (encoder returned None)" + raise OSError(msg) + + fp.write(data) + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + lossless = im.encoderinfo.get("lossless", False) + quality = im.encoderinfo.get("quality", 80) + alpha_quality = im.encoderinfo.get("alpha_quality", 100) + icc_profile = im.encoderinfo.get("icc_profile") or "" + exif = im.encoderinfo.get("exif", b"") + if isinstance(exif, Image.Exif): + exif = exif.tobytes() + if exif.startswith(b"Exif\x00\x00"): + exif = exif[6:] + xmp = im.encoderinfo.get("xmp", "") + method = im.encoderinfo.get("method", 4) + exact = 1 if im.encoderinfo.get("exact") else 0 + + im = _convert_frame(im) + + data = _webp.WebPEncode( + im.getim(), + lossless, + float(quality), + float(alpha_quality), + icc_profile, + method, + exact, + exif, + xmp, + ) + if data is None: + msg = "cannot write file as WebP (encoder returned None)" + raise OSError(msg) + + fp.write(data) + + +Image.register_open(WebPImageFile.format, WebPImageFile, _accept) +if SUPPORTED: + Image.register_save(WebPImageFile.format, _save) + Image.register_save_all(WebPImageFile.format, _save_all) + Image.register_extension(WebPImageFile.format, ".webp") + Image.register_mime(WebPImageFile.format, "image/webp") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WmfImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WmfImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..cd6071a501c9bfcf2c7fb56dba6f289a317bb618 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/WmfImagePlugin.py @@ -0,0 +1,183 @@ +# +# The Python Imaging Library +# $Id$ +# +# WMF stub codec +# +# history: +# 1996-12-14 fl Created +# 2004-02-22 fl Turned into a stub driver +# 2004-02-23 fl Added EMF support +# +# Copyright (c) Secret Labs AB 1997-2004. All rights reserved. +# Copyright (c) Fredrik Lundh 1996. +# +# See the README file for information on usage and redistribution. +# +# WMF/EMF reference documentation: +# https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/[MS-WMF].pdf +# http://wvware.sourceforge.net/caolan/index.html +# http://wvware.sourceforge.net/caolan/ora-wmf.html +from __future__ import annotations + +from typing import IO + +from . import Image, ImageFile +from ._binary import i16le as word +from ._binary import si16le as short +from ._binary import si32le as _long + +_handler = None + + +def register_handler(handler: ImageFile.StubHandler | None) -> None: + """ + Install application-specific WMF image handler. + + :param handler: Handler object. + """ + global _handler + _handler = handler + + +if hasattr(Image.core, "drawwmf"): + # install default handler (windows only) + + class WmfHandler(ImageFile.StubHandler): + def open(self, im: ImageFile.StubImageFile) -> None: + self.bbox = im.info["wmf_bbox"] + + def load(self, im: ImageFile.StubImageFile) -> Image.Image: + assert im.fp is not None + im.fp.seek(0) # rewind + return Image.frombytes( + "RGB", + im.size, + Image.core.drawwmf(im.fp.read(), im.size, self.bbox), + "raw", + "BGR", + (im.size[0] * 3 + 3) & -4, + -1, + ) + + register_handler(WmfHandler()) + +# +# -------------------------------------------------------------------- +# Read WMF file + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith((b"\xd7\xcd\xc6\x9a\x00\x00", b"\x01\x00\x00\x00")) + + +## +# Image plugin for Windows metafiles. + + +class WmfStubImageFile(ImageFile.StubImageFile): + format = "WMF" + format_description = "Windows Metafile" + + def _open(self) -> None: + # check placeable header + assert self.fp is not None + s = self.fp.read(44) + + if s.startswith(b"\xd7\xcd\xc6\x9a\x00\x00"): + # placeable windows metafile + + # get units per inch + inch = word(s, 14) + if inch == 0: + msg = "Invalid inch" + raise ValueError(msg) + self._inch: tuple[float, float] = inch, inch + + # get bounding box + x0 = short(s, 6) + y0 = short(s, 8) + x1 = short(s, 10) + y1 = short(s, 12) + + # normalize size to 72 dots per inch + self.info["dpi"] = 72 + size = ( + (x1 - x0) * self.info["dpi"] // inch, + (y1 - y0) * self.info["dpi"] // inch, + ) + + self.info["wmf_bbox"] = x0, y0, x1, y1 + + # sanity check (standard metafile header) + if s[22:26] != b"\x01\x00\t\x00": + msg = "Unsupported WMF file format" + raise SyntaxError(msg) + + elif s.startswith(b"\x01\x00\x00\x00") and s[40:44] == b" EMF": + # enhanced metafile + + # get bounding box + x0 = _long(s, 8) + y0 = _long(s, 12) + x1 = _long(s, 16) + y1 = _long(s, 20) + + # get frame (in 0.01 millimeter units) + frame = _long(s, 24), _long(s, 28), _long(s, 32), _long(s, 36) + + size = x1 - x0, y1 - y0 + + # calculate dots per inch from bbox and frame + xdpi = 2540.0 * (x1 - x0) / (frame[2] - frame[0]) + ydpi = 2540.0 * (y1 - y0) / (frame[3] - frame[1]) + + self.info["wmf_bbox"] = x0, y0, x1, y1 + + if xdpi == ydpi: + self.info["dpi"] = xdpi + else: + self.info["dpi"] = xdpi, ydpi + self._inch = xdpi, ydpi + + else: + msg = "Unsupported file format" + raise SyntaxError(msg) + + self._mode = "RGB" + self._size = size + + def _load(self) -> ImageFile.StubHandler | None: + return _handler + + def load( + self, dpi: float | tuple[float, float] | None = None + ) -> Image.core.PixelAccess | None: + if dpi is not None: + self.info["dpi"] = dpi + x0, y0, x1, y1 = self.info["wmf_bbox"] + if not isinstance(dpi, tuple): + dpi = dpi, dpi + self._size = ( + int((x1 - x0) * dpi[0] / self._inch[0]), + int((y1 - y0) * dpi[1] / self._inch[1]), + ) + return super().load() + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if _handler is None or not hasattr(_handler, "save"): + msg = "WMF save handler not installed" + raise OSError(msg) + _handler.save(im, fp, filename) + + +# +# -------------------------------------------------------------------- +# Registry stuff + + +Image.register_open(WmfStubImageFile.format, WmfStubImageFile, _accept) +Image.register_save(WmfStubImageFile.format, _save) + +Image.register_extensions(WmfStubImageFile.format, [".wmf", ".emf"]) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XVThumbImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XVThumbImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..9a3f9316af8b2b2941cb9f561d1473724aa59e29 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XVThumbImagePlugin.py @@ -0,0 +1,83 @@ +# +# The Python Imaging Library. +# $Id$ +# +# XV Thumbnail file handler by Charles E. "Gene" Cash +# (gcash@magicnet.net) +# +# see xvcolor.c and xvbrowse.c in the sources to John Bradley's XV, +# available from ftp://ftp.cis.upenn.edu/pub/xv/ +# +# history: +# 98-08-15 cec created (b/w only) +# 98-12-09 cec added color palette +# 98-12-28 fl added to PIL (with only a few very minor modifications) +# +# To do: +# FIXME: make save work (this requires quantization support) +# +from __future__ import annotations + +from . import Image, ImageFile, ImagePalette +from ._binary import o8 + +_MAGIC = b"P7 332" + +# standard color palette for thumbnails (RGB332) +PALETTE = b"" +for r in range(8): + for g in range(8): + for b in range(4): + PALETTE = PALETTE + ( + o8((r * 255) // 7) + o8((g * 255) // 7) + o8((b * 255) // 3) + ) + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(_MAGIC) + + +## +# Image plugin for XV thumbnail images. + + +class XVThumbImageFile(ImageFile.ImageFile): + format = "XVThumb" + format_description = "XV thumbnail image" + + def _open(self) -> None: + # check magic + assert self.fp is not None + + if not _accept(self.fp.read(6)): + msg = "not an XV thumbnail file" + raise SyntaxError(msg) + + # Skip to beginning of next line + self.fp.readline() + + # skip info comments + while True: + s = self.fp.readline() + if not s: + msg = "Unexpected EOF reading XV thumbnail file" + raise SyntaxError(msg) + if s[0] != 35: # ie. when not a comment: '#' + break + + # parse header line (already read) + w, h = s.strip().split(maxsplit=2)[:2] + + self._mode = "P" + self._size = int(w), int(h) + + self.palette = ImagePalette.raw("RGB", PALETTE) + + self.tile = [ + ImageFile._Tile("raw", (0, 0) + self.size, self.fp.tell(), self.mode) + ] + + +# -------------------------------------------------------------------- + +Image.register_open(XVThumbImageFile.format, XVThumbImageFile, _accept) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XbmImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XbmImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..32a858f363fcdd7493f77198be48817b476a9b03 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XbmImagePlugin.py @@ -0,0 +1,98 @@ +# +# The Python Imaging Library. +# $Id$ +# +# XBM File handling +# +# History: +# 1995-09-08 fl Created +# 1996-11-01 fl Added save support +# 1997-07-07 fl Made header parser more tolerant +# 1997-07-22 fl Fixed yet another parser bug +# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4) +# 2001-05-13 fl Added hotspot handling (based on code from Bernhard Herzog) +# 2004-02-24 fl Allow some whitespace before first #define +# +# Copyright (c) 1997-2004 by Secret Labs AB +# Copyright (c) 1996-1997 by Fredrik Lundh +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import re +from typing import IO + +from . import Image, ImageFile + +# XBM header +xbm_head = re.compile( + rb"\s*#define[ \t]+.*_width[ \t]+(?P[0-9]+)[\r\n]+" + b"#define[ \t]+.*_height[ \t]+(?P[0-9]+)[\r\n]+" + b"(?P" + b"#define[ \t]+[^_]*_x_hot[ \t]+(?P[0-9]+)[\r\n]+" + b"#define[ \t]+[^_]*_y_hot[ \t]+(?P[0-9]+)[\r\n]+" + b")?" + rb"[\000-\377]*_bits\[]" +) + + +def _accept(prefix: bytes) -> bool: + return prefix.lstrip().startswith(b"#define") + + +## +# Image plugin for X11 bitmaps. + + +class XbmImageFile(ImageFile.ImageFile): + format = "XBM" + format_description = "X11 Bitmap" + + def _open(self) -> None: + assert self.fp is not None + + m = xbm_head.match(self.fp.read(512)) + + if not m: + msg = "not a XBM file" + raise SyntaxError(msg) + + xsize = int(m.group("width")) + ysize = int(m.group("height")) + + if m.group("hotspot"): + self.info["hotspot"] = (int(m.group("xhot")), int(m.group("yhot"))) + + self._mode = "1" + self._size = xsize, ysize + + self.tile = [ImageFile._Tile("xbm", (0, 0) + self.size, m.end())] + + +def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None: + if im.mode != "1": + msg = f"cannot write mode {im.mode} as XBM" + raise OSError(msg) + + fp.write(f"#define im_width {im.size[0]}\n".encode("ascii")) + fp.write(f"#define im_height {im.size[1]}\n".encode("ascii")) + + hotspot = im.encoderinfo.get("hotspot") + if hotspot: + fp.write(f"#define im_x_hot {hotspot[0]}\n".encode("ascii")) + fp.write(f"#define im_y_hot {hotspot[1]}\n".encode("ascii")) + + fp.write(b"static char im_bits[] = {\n") + + ImageFile._save(im, fp, [ImageFile._Tile("xbm", (0, 0) + im.size)]) + + fp.write(b"};\n") + + +Image.register_open(XbmImageFile.format, XbmImageFile, _accept) +Image.register_save(XbmImageFile.format, _save) + +Image.register_extension(XbmImageFile.format, ".xbm") + +Image.register_mime(XbmImageFile.format, "image/xbm") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XpmImagePlugin.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XpmImagePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..e65e6cea24eba16a7c6e1f40f5e01cc768858a63 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/XpmImagePlugin.py @@ -0,0 +1,157 @@ +# +# The Python Imaging Library. +# $Id$ +# +# XPM File handling +# +# History: +# 1996-12-29 fl Created +# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7) +# +# Copyright (c) Secret Labs AB 1997-2001. +# Copyright (c) Fredrik Lundh 1996-2001. +# +# See the README file for information on usage and redistribution. +# +from __future__ import annotations + +import re + +from . import Image, ImageFile, ImagePalette +from ._binary import o8 + +# XPM header +xpm_head = re.compile(b'"([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)') + + +def _accept(prefix: bytes) -> bool: + return prefix.startswith(b"/* XPM */") + + +## +# Image plugin for X11 pixel maps. + + +class XpmImageFile(ImageFile.ImageFile): + format = "XPM" + format_description = "X11 Pixel Map" + + def _open(self) -> None: + assert self.fp is not None + if not _accept(self.fp.read(9)): + msg = "not an XPM file" + raise SyntaxError(msg) + + # skip forward to next string + while True: + line = self.fp.readline() + if not line: + msg = "broken XPM file" + raise SyntaxError(msg) + m = xpm_head.match(line) + if m: + break + + self._size = int(m.group(1)), int(m.group(2)) + + palette_length = int(m.group(3)) + bpp = int(m.group(4)) + + # + # load palette description + + palette = {} + + for _ in range(palette_length): + line = self.fp.readline().rstrip() + + c = line[1 : bpp + 1] + s = line[bpp + 1 : -2].split() + + for i in range(0, len(s), 2): + if s[i] == b"c": + # process colour key + rgb = s[i + 1] + if rgb == b"None": + self.info["transparency"] = c + elif rgb.startswith(b"#"): + rgb_int = int(rgb[1:], 16) + palette[c] = ( + o8((rgb_int >> 16) & 255) + + o8((rgb_int >> 8) & 255) + + o8(rgb_int & 255) + ) + else: + # unknown colour + msg = "cannot read this XPM file" + raise ValueError(msg) + break + + else: + # missing colour key + msg = "cannot read this XPM file" + raise ValueError(msg) + + args: tuple[int, dict[bytes, bytes] | tuple[bytes, ...]] + if palette_length > 256: + self._mode = "RGB" + args = (bpp, palette) + else: + self._mode = "P" + self.palette = ImagePalette.raw("RGB", b"".join(palette.values())) + args = (bpp, tuple(palette.keys())) + + self.tile = [ImageFile._Tile("xpm", (0, 0) + self.size, self.fp.tell(), args)] + + def load_read(self, read_bytes: int) -> bytes: + # + # load all image data in one chunk + + xsize, ysize = self.size + + assert self.fp is not None + s = [self.fp.readline()[1 : xsize + 1].ljust(xsize) for i in range(ysize)] + + return b"".join(s) + + +class XpmDecoder(ImageFile.PyDecoder): + _pulls_fd = True + + def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]: + assert self.fd is not None + + data = bytearray() + bpp, palette = self.args + dest_length = self.state.xsize * self.state.ysize + if self.mode == "RGB": + dest_length *= 3 + pixel_header = False + while len(data) < dest_length: + line = self.fd.readline() + if not line: + break + if line.rstrip() == b"/* pixels */" and not pixel_header: + pixel_header = True + continue + line = b'"'.join(line.split(b'"')[1:-1]) + for i in range(0, len(line), bpp): + key = line[i : i + bpp] + if self.mode == "RGB": + data += palette[key] + else: + data += o8(palette.index(key)) + self.set_as_raw(bytes(data)) + return -1, 0 + + +# +# Registry + + +Image.register_open(XpmImageFile.format, XpmImageFile, _accept) +Image.register_decoder("xpm", XpmDecoder) + +Image.register_extension(XpmImageFile.format, ".xpm") + +Image.register_mime(XpmImageFile.format, "image/xpm") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3290d4319938db67ee18548c27773755a4776824 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/__init__.py @@ -0,0 +1,87 @@ +"""Pillow (Fork of the Python Imaging Library) + +Pillow is the friendly PIL fork by Jeffrey 'Alex' Clark and contributors. + https://github.com/python-pillow/Pillow/ + +Pillow is forked from PIL 1.1.7. + +PIL is the Python Imaging Library by Fredrik Lundh and contributors. +Copyright (c) 1999 by Secret Labs AB. + +Use PIL.__version__ for this Pillow version. + +;-) +""" + +from __future__ import annotations + +from . import _version + +# VERSION was removed in Pillow 6.0.0. +# PILLOW_VERSION was removed in Pillow 9.0.0. +# Use __version__ instead. +__version__ = _version.__version__ +del _version + + +_plugins = [ + "AvifImagePlugin", + "BlpImagePlugin", + "BmpImagePlugin", + "BufrStubImagePlugin", + "CurImagePlugin", + "DcxImagePlugin", + "DdsImagePlugin", + "EpsImagePlugin", + "FitsImagePlugin", + "FliImagePlugin", + "FpxImagePlugin", + "FtexImagePlugin", + "GbrImagePlugin", + "GifImagePlugin", + "GribStubImagePlugin", + "Hdf5StubImagePlugin", + "IcnsImagePlugin", + "IcoImagePlugin", + "ImImagePlugin", + "ImtImagePlugin", + "IptcImagePlugin", + "JpegImagePlugin", + "Jpeg2KImagePlugin", + "McIdasImagePlugin", + "MicImagePlugin", + "MpegImagePlugin", + "MpoImagePlugin", + "MspImagePlugin", + "PalmImagePlugin", + "PcdImagePlugin", + "PcxImagePlugin", + "PdfImagePlugin", + "PixarImagePlugin", + "PngImagePlugin", + "PpmImagePlugin", + "PsdImagePlugin", + "QoiImagePlugin", + "SgiImagePlugin", + "SpiderImagePlugin", + "SunImagePlugin", + "TgaImagePlugin", + "TiffImagePlugin", + "WebPImagePlugin", + "WmfImagePlugin", + "XbmImagePlugin", + "XpmImagePlugin", + "XVThumbImagePlugin", +] + + +class UnidentifiedImageError(OSError): + """ + Raised in :py:meth:`PIL.Image.open` if an image cannot be opened and identified. + + If a PNG image raises this error, setting :data:`.ImageFile.LOAD_TRUNCATED_IMAGES` + to true may allow the image to be opened after all. The setting will ignore missing + data and checksum failures. + """ + + pass diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/__main__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..833a73959bd3d4d6711d6335945e85e56ca7e538 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/__main__.py @@ -0,0 +1,7 @@ +from __future__ import annotations + +import sys + +from .features import pilinfo + +pilinfo(supported_formats="--report" not in sys.argv) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_avif.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_avif.pyi new file mode 100644 index 0000000000000000000000000000000000000000..9342f10b9c8d9c139fab885fac4c08aad29c3804 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_avif.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_binary.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_binary.py new file mode 100644 index 0000000000000000000000000000000000000000..fe53fa9c08df61439ae66f5cc93d9613585aa9c3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_binary.py @@ -0,0 +1,113 @@ +# +# The Python Imaging Library. +# $Id$ +# +# Binary input/output support routines. +# +# Copyright (c) 1997-2003 by Secret Labs AB +# Copyright (c) 1995-2003 by Fredrik Lundh +# Copyright (c) 2012 by Brian Crowell +# +# See the README file for information on usage and redistribution. +# + + +"""Binary input/output support routines.""" + +from __future__ import annotations + +from struct import pack, unpack_from + + +def i8(c: bytes) -> int: + return c[0] + + +def o8(i: int) -> bytes: + return bytes((i & 255,)) + + +# Input, le = little endian, be = big endian +def i16le(c: bytes, o: int = 0) -> int: + """ + Converts a 2-bytes (16 bits) string to an unsigned integer. + + :param c: string containing bytes to convert + :param o: offset of bytes to convert in string + """ + return unpack_from(" int: + """ + Converts a 2-bytes (16 bits) string to a signed integer. + + :param c: string containing bytes to convert + :param o: offset of bytes to convert in string + """ + return unpack_from(" int: + """ + Converts a 2-bytes (16 bits) string to a signed integer, big endian. + + :param c: string containing bytes to convert + :param o: offset of bytes to convert in string + """ + return unpack_from(">h", c, o)[0] + + +def i32le(c: bytes, o: int = 0) -> int: + """ + Converts a 4-bytes (32 bits) string to an unsigned integer. + + :param c: string containing bytes to convert + :param o: offset of bytes to convert in string + """ + return unpack_from(" int: + """ + Converts a 4-bytes (32 bits) string to a signed integer. + + :param c: string containing bytes to convert + :param o: offset of bytes to convert in string + """ + return unpack_from(" int: + """ + Converts a 4-bytes (32 bits) string to a signed integer, big endian. + + :param c: string containing bytes to convert + :param o: offset of bytes to convert in string + """ + return unpack_from(">i", c, o)[0] + + +def i16be(c: bytes, o: int = 0) -> int: + return unpack_from(">H", c, o)[0] + + +def i32be(c: bytes, o: int = 0) -> int: + return unpack_from(">I", c, o)[0] + + +# Output, le = little endian, be = big endian +def o16le(i: int) -> bytes: + return pack(" bytes: + return pack(" bytes: + return pack(">H", i) + + +def o32be(i: int) -> bytes: + return pack(">I", i) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_deprecate.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_deprecate.py new file mode 100644 index 0000000000000000000000000000000000000000..7915c3cd28632a9fee7f8a976bafd7cfde36357d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_deprecate.py @@ -0,0 +1,72 @@ +from __future__ import annotations + +import warnings + +from . import __version__ + + +def deprecate( + deprecated: str, + when: int | None, + replacement: str | None = None, + *, + action: str | None = None, + plural: bool = False, + stacklevel: int = 3, +) -> None: + """ + Deprecations helper. + + :param deprecated: Name of thing to be deprecated. + :param when: Pillow major version to be removed in. + :param replacement: Name of replacement. + :param action: Instead of "replacement", give a custom call to action + e.g. "Upgrade to new thing". + :param plural: if the deprecated thing is plural, needing "are" instead of "is". + + Usually of the form: + + "[deprecated] is deprecated and will be removed in Pillow [when] (yyyy-mm-dd). + Use [replacement] instead." + + You can leave out the replacement sentence: + + "[deprecated] is deprecated and will be removed in Pillow [when] (yyyy-mm-dd)" + + Or with another call to action: + + "[deprecated] is deprecated and will be removed in Pillow [when] (yyyy-mm-dd). + [action]." + """ + + is_ = "are" if plural else "is" + + if when is None: + removed = "a future version" + elif when <= int(__version__.split(".")[0]): + msg = f"{deprecated} {is_} deprecated and should be removed." + raise RuntimeError(msg) + elif when == 13: + removed = "Pillow 13 (2026-10-15)" + elif when == 14: + removed = "Pillow 14 (2027-10-15)" + else: + msg = f"Unknown removal version: {when}. Update {__name__}?" + raise ValueError(msg) + + if replacement and action: + msg = "Use only one of 'replacement' and 'action'" + raise ValueError(msg) + + if replacement: + action = f". Use {replacement} instead." + elif action: + action = f". {action.rstrip('.')}." + else: + action = "" + + warnings.warn( + f"{deprecated} {is_} deprecated and will be removed in {removed}{action}", + DeprecationWarning, + stacklevel=stacklevel, + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imaging.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imaging.pyi new file mode 100644 index 0000000000000000000000000000000000000000..91c2463aca3a334e35356d1993ce9f86b5d3c13b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imaging.pyi @@ -0,0 +1,31 @@ +from typing import Any + +class ImagingCore: + def __getitem__(self, index: int) -> float | tuple[int, ...] | None: ... + def __getattr__(self, name: str) -> Any: ... + +class ImagingFont: + def __getattr__(self, name: str) -> Any: ... + +class ImagingDraw: + def __getattr__(self, name: str) -> Any: ... + +class PixelAccess: + def __getitem__(self, xy: tuple[int, int]) -> float | tuple[int, ...]: ... + def __setitem__( + self, xy: tuple[int, int], color: float | tuple[int, ...] + ) -> None: ... + +class ImagingDecoder: + def __getattr__(self, name: str) -> Any: ... + +class ImagingEncoder: + def __getattr__(self, name: str) -> Any: ... + +class _Outline: + def close(self) -> None: ... + def __getattr__(self, name: str) -> Any: ... + +def font(image: ImagingCore, glyphdata: bytes) -> ImagingFont: ... +def outline() -> _Outline: ... +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingcms.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingcms.pyi new file mode 100644 index 0000000000000000000000000000000000000000..f8e8a6f6f2208df11d9626629be2bca5c0b521ec --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingcms.pyi @@ -0,0 +1,143 @@ +import datetime +import sys +from typing import Literal, SupportsFloat, TypeAlias, TypedDict + +from ._typing import CapsuleType + +littlecms_version: str | None + +_Tuple3f: TypeAlias = tuple[float, float, float] +_Tuple2x3f: TypeAlias = tuple[_Tuple3f, _Tuple3f] +_Tuple3x3f: TypeAlias = tuple[_Tuple3f, _Tuple3f, _Tuple3f] + +class _IccMeasurementCondition(TypedDict): + observer: int + backing: _Tuple3f + geo: str + flare: float + illuminant_type: str + +class _IccViewingCondition(TypedDict): + illuminant: _Tuple3f + surround: _Tuple3f + illuminant_type: str + +class CmsProfile: + @property + def rendering_intent(self) -> int: ... + @property + def creation_date(self) -> datetime.datetime | None: ... + @property + def copyright(self) -> str | None: ... + @property + def target(self) -> str | None: ... + @property + def manufacturer(self) -> str | None: ... + @property + def model(self) -> str | None: ... + @property + def profile_description(self) -> str | None: ... + @property + def screening_description(self) -> str | None: ... + @property + def viewing_condition(self) -> str | None: ... + @property + def version(self) -> float: ... + @property + def icc_version(self) -> int: ... + @property + def attributes(self) -> int: ... + @property + def header_flags(self) -> int: ... + @property + def header_manufacturer(self) -> str: ... + @property + def header_model(self) -> str: ... + @property + def device_class(self) -> str: ... + @property + def connection_space(self) -> str: ... + @property + def xcolor_space(self) -> str: ... + @property + def profile_id(self) -> bytes: ... + @property + def is_matrix_shaper(self) -> bool: ... + @property + def technology(self) -> str | None: ... + @property + def colorimetric_intent(self) -> str | None: ... + @property + def perceptual_rendering_intent_gamut(self) -> str | None: ... + @property + def saturation_rendering_intent_gamut(self) -> str | None: ... + @property + def red_colorant(self) -> _Tuple2x3f | None: ... + @property + def green_colorant(self) -> _Tuple2x3f | None: ... + @property + def blue_colorant(self) -> _Tuple2x3f | None: ... + @property + def red_primary(self) -> _Tuple2x3f | None: ... + @property + def green_primary(self) -> _Tuple2x3f | None: ... + @property + def blue_primary(self) -> _Tuple2x3f | None: ... + @property + def media_white_point_temperature(self) -> float | None: ... + @property + def media_white_point(self) -> _Tuple2x3f | None: ... + @property + def media_black_point(self) -> _Tuple2x3f | None: ... + @property + def luminance(self) -> _Tuple2x3f | None: ... + @property + def chromatic_adaptation(self) -> tuple[_Tuple3x3f, _Tuple3x3f] | None: ... + @property + def chromaticity(self) -> _Tuple3x3f | None: ... + @property + def colorant_table(self) -> list[str] | None: ... + @property + def colorant_table_out(self) -> list[str] | None: ... + @property + def intent_supported(self) -> dict[int, tuple[bool, bool, bool]] | None: ... + @property + def clut(self) -> dict[int, tuple[bool, bool, bool]] | None: ... + @property + def icc_measurement_condition(self) -> _IccMeasurementCondition | None: ... + @property + def icc_viewing_condition(self) -> _IccViewingCondition | None: ... + def is_intent_supported(self, intent: int, direction: int, /) -> int: ... + +class CmsTransform: + def apply(self, id_in: CapsuleType, id_out: CapsuleType) -> int: ... + +def profile_open(profile: str, /) -> CmsProfile: ... +def profile_frombytes(profile: bytes, /) -> CmsProfile: ... +def profile_tobytes(profile: CmsProfile, /) -> bytes: ... +def buildTransform( + input_profile: CmsProfile, + output_profile: CmsProfile, + in_mode: str, + out_mode: str, + rendering_intent: int = 0, + cms_flags: int = 0, + /, +) -> CmsTransform: ... +def buildProofTransform( + input_profile: CmsProfile, + output_profile: CmsProfile, + proof_profile: CmsProfile, + in_mode: str, + out_mode: str, + rendering_intent: int = 0, + proof_intent: int = 0, + cms_flags: int = 0, + /, +) -> CmsTransform: ... +def createProfile( + color_space: Literal["LAB", "XYZ", "sRGB"], color_temp: SupportsFloat = 0.0, / +) -> CmsProfile: ... + +if sys.platform == "win32": + def get_display_profile_win32(handle: int = 0, is_dc: int = 0, /) -> str | None: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingft.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingft.pyi new file mode 100644 index 0000000000000000000000000000000000000000..8ae049abc7e754fec50a61531b12f98eac269edd --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingft.pyi @@ -0,0 +1,70 @@ +from collections.abc import Callable +from typing import Any + +from . import ImageFont, _imaging + +class Font: + @property + def family(self) -> str | None: ... + @property + def style(self) -> str | None: ... + @property + def ascent(self) -> int: ... + @property + def descent(self) -> int: ... + @property + def height(self) -> int: ... + @property + def x_ppem(self) -> int: ... + @property + def y_ppem(self) -> int: ... + @property + def glyphs(self) -> int: ... + def render( + self, + string: str | bytes, + fill: Callable[[int, int], _imaging.ImagingCore], + mode: str, + dir: str | None, + features: list[str] | None, + lang: str | None, + stroke_width: float, + stroke_filled: bool, + anchor: str | None, + foreground_ink_long: int, + start: tuple[float, float], + /, + ) -> tuple[_imaging.ImagingCore, tuple[int, int]]: ... + def getsize( + self, + string: str | bytes | bytearray, + mode: str, + dir: str | None, + features: list[str] | None, + lang: str | None, + anchor: str | None, + /, + ) -> tuple[tuple[int, int], tuple[int, int]]: ... + def getlength( + self, + string: str | bytes, + mode: str, + dir: str | None, + features: list[str] | None, + lang: str | None, + /, + ) -> float: ... + def getvarnames(self) -> list[bytes]: ... + def getvaraxes(self) -> list[ImageFont.Axis]: ... + def setvarname(self, instance_index: int, /) -> None: ... + def setvaraxes(self, axes: list[float], /) -> None: ... + +def getfont( + filename: str | bytes, + size: float, + index: int, + encoding: str, + font_bytes: bytes, + layout_engine: int, +) -> Font: ... +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmath.cp311-win_amd64.pyd b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmath.cp311-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..dc470818428dcfee62825258279adad3c8c5faf5 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmath.cp311-win_amd64.pyd differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmath.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmath.pyi new file mode 100644 index 0000000000000000000000000000000000000000..9342f10b9c8d9c139fab885fac4c08aad29c3804 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmath.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmorph.cp311-win_amd64.pyd b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmorph.cp311-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..10e04b06df5fc41ffb91fc82f2134d4970ca30ff Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmorph.cp311-win_amd64.pyd differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmorph.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmorph.pyi new file mode 100644 index 0000000000000000000000000000000000000000..9342f10b9c8d9c139fab885fac4c08aad29c3804 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingmorph.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingtk.cp311-win_amd64.pyd b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingtk.cp311-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..94b05103085043f8713c76019549950c35478075 Binary files /dev/null and b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingtk.cp311-win_amd64.pyd differ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingtk.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingtk.pyi new file mode 100644 index 0000000000000000000000000000000000000000..9342f10b9c8d9c139fab885fac4c08aad29c3804 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_imagingtk.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_tkinter_finder.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_tkinter_finder.py new file mode 100644 index 0000000000000000000000000000000000000000..a2813dfb45f9966eca6d1f10b9da0793470ac318 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_tkinter_finder.py @@ -0,0 +1,20 @@ +"""Find compiled module linking to Tcl / Tk libraries""" + +from __future__ import annotations + +import sys +import tkinter + +tk = getattr(tkinter, "_tkinter") + +try: + if hasattr(sys, "pypy_find_executable"): + TKINTER_LIB = tk.tklib_cffi.__file__ + else: + TKINTER_LIB = tk.__file__ +except AttributeError: + # _tkinter may be compiled directly into Python, in which case __file__ is + # not available. load_tkinter_funcs will check the binary first in any case. + TKINTER_LIB = None + +tk_version = str(tkinter.TkVersion) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_typing.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_typing.py new file mode 100644 index 0000000000000000000000000000000000000000..f2cff3560cfa0f82a5e72298d12035ff27b1990f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_typing.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import os +import sys +from collections.abc import Sequence +from typing import Any, Protocol, TypeVar + +TYPE_CHECKING = False +if TYPE_CHECKING: + from numbers import _IntegralLike as IntegralLike + + try: + import numpy.typing as npt + + NumpyArray = npt.NDArray[Any] + except ImportError: + pass + +if sys.version_info >= (3, 13): + from types import CapsuleType +else: + CapsuleType = object + +if sys.version_info >= (3, 12): + from collections.abc import Buffer +else: + Buffer = Any + + +_Ink = float | tuple[int, ...] | str + +Coords = Sequence[float] | Sequence[Sequence[float]] + + +_T_co = TypeVar("_T_co", covariant=True) + + +class SupportsRead(Protocol[_T_co]): + def read(self, length: int = ..., /) -> _T_co: ... + + +StrOrBytesPath = str | bytes | os.PathLike[str] | os.PathLike[bytes] + + +__all__ = ["Buffer", "IntegralLike", "StrOrBytesPath", "SupportsRead"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_util.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_util.py new file mode 100644 index 0000000000000000000000000000000000000000..3e7e1ccfd130896e1de0d3b95bb87e69dc598749 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_util.py @@ -0,0 +1,29 @@ +from __future__ import annotations + +import os + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Any, NoReturn, TypeGuard + + from ._typing import StrOrBytesPath + + +def is_path(f: Any) -> TypeGuard[StrOrBytesPath]: + return isinstance(f, (bytes, str, os.PathLike)) + + +class DeferredError: + def __init__(self, ex: BaseException): + self.ex = ex + + def __getattr__(self, elt: str) -> NoReturn: + raise self.ex + + @staticmethod + def new(ex: BaseException) -> Any: + """ + Creates an object that raises the wrapped exception ``ex`` when used, + and casts it to :py:obj:`~typing.Any` type. + """ + return DeferredError(ex) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_version.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_version.py new file mode 100644 index 0000000000000000000000000000000000000000..9f83f757f19cee058e655b08c94ff4deba883873 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_version.py @@ -0,0 +1,4 @@ +# Master version for Pillow +from __future__ import annotations + +__version__ = "12.2.0" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_webp.pyi b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_webp.pyi new file mode 100644 index 0000000000000000000000000000000000000000..9342f10b9c8d9c139fab885fac4c08aad29c3804 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/_webp.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/features.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/features.py new file mode 100644 index 0000000000000000000000000000000000000000..95ea8972b05e0e07d88f7d870f8f6a3077a40b88 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/features.py @@ -0,0 +1,343 @@ +from __future__ import annotations + +import collections +import os +import sys +import warnings +from typing import IO + +import PIL + +from . import Image + +modules = { + "pil": ("PIL._imaging", "PILLOW_VERSION"), + "tkinter": ("PIL._tkinter_finder", "tk_version"), + "freetype2": ("PIL._imagingft", "freetype2_version"), + "littlecms2": ("PIL._imagingcms", "littlecms_version"), + "webp": ("PIL._webp", "webpdecoder_version"), + "avif": ("PIL._avif", "libavif_version"), +} + + +def check_module(feature: str) -> bool: + """ + Checks if a module is available. + + :param feature: The module to check for. + :returns: ``True`` if available, ``False`` otherwise. + :raises ValueError: If the module is not defined in this version of Pillow. + """ + if feature not in modules: + msg = f"Unknown module {feature}" + raise ValueError(msg) + + module, ver = modules[feature] + + try: + __import__(module) + return True + except ModuleNotFoundError: + return False + except ImportError as ex: + warnings.warn(str(ex)) + return False + + +def version_module(feature: str) -> str | None: + """ + :param feature: The module to check for. + :returns: + The loaded version number as a string, or ``None`` if unknown or not available. + :raises ValueError: If the module is not defined in this version of Pillow. + """ + if not check_module(feature): + return None + + module, ver = modules[feature] + + return getattr(__import__(module, fromlist=[ver]), ver) + + +def get_supported_modules() -> list[str]: + """ + :returns: A list of all supported modules. + """ + return [f for f in modules if check_module(f)] + + +codecs = { + "jpg": ("jpeg", "jpeglib"), + "jpg_2000": ("jpeg2k", "jp2klib"), + "zlib": ("zip", "zlib"), + "libtiff": ("libtiff", "libtiff"), +} + + +def check_codec(feature: str) -> bool: + """ + Checks if a codec is available. + + :param feature: The codec to check for. + :returns: ``True`` if available, ``False`` otherwise. + :raises ValueError: If the codec is not defined in this version of Pillow. + """ + if feature not in codecs: + msg = f"Unknown codec {feature}" + raise ValueError(msg) + + codec, lib = codecs[feature] + + return f"{codec}_encoder" in dir(Image.core) + + +def version_codec(feature: str) -> str | None: + """ + :param feature: The codec to check for. + :returns: + The version number as a string, or ``None`` if not available. + Checked at compile time for ``jpg``, run-time otherwise. + :raises ValueError: If the codec is not defined in this version of Pillow. + """ + if not check_codec(feature): + return None + + codec, lib = codecs[feature] + + version = getattr(Image.core, f"{lib}_version") + + if feature == "libtiff": + return version.split("\n")[0].split("Version ")[1] + + return version + + +def get_supported_codecs() -> list[str]: + """ + :returns: A list of all supported codecs. + """ + return [f for f in codecs if check_codec(f)] + + +features: dict[str, tuple[str, str, str | None]] = { + "raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"), + "fribidi": ("PIL._imagingft", "HAVE_FRIBIDI", "fribidi_version"), + "harfbuzz": ("PIL._imagingft", "HAVE_HARFBUZZ", "harfbuzz_version"), + "libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"), + "mozjpeg": ("PIL._imaging", "HAVE_MOZJPEG", "libjpeg_turbo_version"), + "zlib_ng": ("PIL._imaging", "HAVE_ZLIBNG", "zlib_ng_version"), + "libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"), + "xcb": ("PIL._imaging", "HAVE_XCB", None), +} + + +def check_feature(feature: str) -> bool | None: + """ + Checks if a feature is available. + + :param feature: The feature to check for. + :returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown. + :raises ValueError: If the feature is not defined in this version of Pillow. + """ + if feature not in features: + msg = f"Unknown feature {feature}" + raise ValueError(msg) + + module, flag, ver = features[feature] + + try: + imported_module = __import__(module, fromlist=["PIL"]) + return getattr(imported_module, flag) + except ModuleNotFoundError: + return None + except ImportError as ex: + warnings.warn(str(ex)) + return None + + +def version_feature(feature: str) -> str | None: + """ + :param feature: The feature to check for. + :returns: The version number as a string, or ``None`` if not available. + :raises ValueError: If the feature is not defined in this version of Pillow. + """ + if not check_feature(feature): + return None + + module, flag, ver = features[feature] + + if ver is None: + return None + + return getattr(__import__(module, fromlist=[ver]), ver) + + +def get_supported_features() -> list[str]: + """ + :returns: A list of all supported features. + """ + return [f for f in features if check_feature(f)] + + +def check(feature: str) -> bool | None: + """ + :param feature: A module, codec, or feature name. + :returns: + ``True`` if the module, codec, or feature is available, + ``False`` or ``None`` otherwise. + """ + + if feature in modules: + return check_module(feature) + if feature in codecs: + return check_codec(feature) + if feature in features: + return check_feature(feature) + warnings.warn(f"Unknown feature '{feature}'.", stacklevel=2) + return False + + +def version(feature: str) -> str | None: + """ + :param feature: + The module, codec, or feature to check for. + :returns: + The version number as a string, or ``None`` if unknown or not available. + """ + if feature in modules: + return version_module(feature) + if feature in codecs: + return version_codec(feature) + if feature in features: + return version_feature(feature) + return None + + +def get_supported() -> list[str]: + """ + :returns: A list of all supported modules, features, and codecs. + """ + + ret = get_supported_modules() + ret.extend(get_supported_features()) + ret.extend(get_supported_codecs()) + return ret + + +def pilinfo(out: IO[str] | None = None, supported_formats: bool = True) -> None: + """ + Prints information about this installation of Pillow. + This function can be called with ``python3 -m PIL``. + It can also be called with ``python3 -m PIL.report`` or ``python3 -m PIL --report`` + to have "supported_formats" set to ``False``, omitting the list of all supported + image file formats. + + :param out: + The output stream to print to. Defaults to ``sys.stdout`` if ``None``. + :param supported_formats: + If ``True``, a list of all supported image file formats will be printed. + """ + + if out is None: + out = sys.stdout + + Image.init() + + print("-" * 68, file=out) + print(f"Pillow {PIL.__version__}", file=out) + py_version_lines = sys.version.splitlines() + print(f"Python {py_version_lines[0].strip()}", file=out) + for py_version in py_version_lines[1:]: + print(f" {py_version.strip()}", file=out) + print("-" * 68, file=out) + print(f"Python executable is {sys.executable or 'unknown'}", file=out) + if sys.prefix != sys.base_prefix: + print(f"Environment Python files loaded from {sys.prefix}", file=out) + print(f"System Python files loaded from {sys.base_prefix}", file=out) + print("-" * 68, file=out) + print( + f"Python Pillow modules loaded from {os.path.dirname(Image.__file__)}", + file=out, + ) + print( + f"Binary Pillow modules loaded from {os.path.dirname(Image.core.__file__)}", + file=out, + ) + print("-" * 68, file=out) + + for name, feature in [ + ("pil", "PIL CORE"), + ("tkinter", "TKINTER"), + ("freetype2", "FREETYPE2"), + ("littlecms2", "LITTLECMS2"), + ("webp", "WEBP"), + ("avif", "AVIF"), + ("jpg", "JPEG"), + ("jpg_2000", "OPENJPEG (JPEG2000)"), + ("zlib", "ZLIB (PNG/ZIP)"), + ("libtiff", "LIBTIFF"), + ("raqm", "RAQM (Bidirectional Text)"), + ("libimagequant", "LIBIMAGEQUANT (Quantization method)"), + ("xcb", "XCB (X protocol)"), + ]: + if check(name): + v: str | None = None + if name == "jpg": + libjpeg_turbo_version = version_feature("libjpeg_turbo") + if libjpeg_turbo_version is not None: + v = "mozjpeg" if check_feature("mozjpeg") else "libjpeg-turbo" + v += " " + libjpeg_turbo_version + if v is None: + v = version(name) + if v is not None: + version_static = name in ("pil", "jpg") + if name == "littlecms2": + # this check is also in src/_imagingcms.c:setup_module() + version_static = tuple(int(x) for x in v.split(".")) < (2, 7) + t = "compiled for" if version_static else "loaded" + if name == "zlib": + zlib_ng_version = version_feature("zlib_ng") + if zlib_ng_version is not None: + v += ", compiled for zlib-ng " + zlib_ng_version + elif name == "raqm": + for f in ("fribidi", "harfbuzz"): + v2 = version_feature(f) + if v2 is not None: + v += f", {f} {v2}" + print("---", feature, "support ok,", t, v, file=out) + else: + print("---", feature, "support ok", file=out) + else: + print("***", feature, "support not installed", file=out) + print("-" * 68, file=out) + + if supported_formats: + extensions = collections.defaultdict(list) + for ext, i in Image.EXTENSION.items(): + extensions[i].append(ext) + + for i in sorted(Image.ID): + line = f"{i}" + if i in Image.MIME: + line = f"{line} {Image.MIME[i]}" + print(line, file=out) + + if i in extensions: + print( + "Extensions: {}".format(", ".join(sorted(extensions[i]))), file=out + ) + + features = [] + if i in Image.OPEN: + features.append("open") + if i in Image.SAVE: + features.append("save") + if i in Image.SAVE_ALL: + features.append("save_all") + if i in Image.DECODERS: + features.append("decode") + if i in Image.ENCODERS: + features.append("encode") + + print("Features: {}".format(", ".join(features)), file=out) + print("-" * 68, file=out) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/report.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/report.py new file mode 100644 index 0000000000000000000000000000000000000000..5abafd44eaf42f2b74a5abdc41f54b53075e9db3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/PIL/report.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from .features import pilinfo + +pilinfo(supported_formats=False) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..3451ef1c30aab750fda4d4bbb0b9c74cf6fc2b05 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD @@ -0,0 +1,33 @@ +jsonschema_specifications-2025.9.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +jsonschema_specifications-2025.9.1.dist-info/METADATA,sha256=NavUF1fzK06iR1aSDe1HtwFz13y8BSpabTq1g7Lo2J0,2907 +jsonschema_specifications-2025.9.1.dist-info/RECORD,, +jsonschema_specifications-2025.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87 +jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING,sha256=QtzWNJX4e063x3V6-jebtVpT-Ur9el9lfZrfVyNuUVw,1057 +jsonschema_specifications/__init__.py,sha256=qoTB2DKY7qvNrGhMPH6gtmAJRLilmVQ-fFZwT6ryqw0,386 +jsonschema_specifications/__pycache__/__init__.cpython-311.pyc,, +jsonschema_specifications/__pycache__/_core.cpython-311.pyc,, +jsonschema_specifications/_core.py,sha256=tFhc1CMleJ3AJOK_bjxOpFQTdrsUClFGfFxPBU_CebM,1140 +jsonschema_specifications/schemas/draft201909/metaschema.json,sha256=e3YbPhIfCgyh6ioLjizIVrz4AWBLgmjXG6yqICvAwTs,1785 +jsonschema_specifications/schemas/draft201909/vocabularies/applicator,sha256=aJUQDplyb7sQcFhRK77D7P1LJOj9L6zuPlBe5ysNTDE,1860 +jsonschema_specifications/schemas/draft201909/vocabularies/content,sha256=m31PVaTi_bAsQwBo_f-rxzKt3OI42j8d8mkCScM1MnQ,517 +jsonschema_specifications/schemas/draft201909/vocabularies/core,sha256=taLElX9kldClCB8ECevooU5BOayyA_x0hHH47eKvWyw,1531 +jsonschema_specifications/schemas/draft201909/vocabularies/format,sha256=UOu_55BhGoSbjMQAoJwdDg-2q1wNQ6DyIgH9NiUFa_Q,403 +jsonschema_specifications/schemas/draft201909/vocabularies/meta-data,sha256=1H4kRd1qgicaKY2DzGxsuNSuHhXg3Fa-zTehY-zwEoY,892 +jsonschema_specifications/schemas/draft201909/vocabularies/validation,sha256=HlJsHTNac0gF_ILPV5jBK5YK19olF8Zs2lobCTWcPBw,2834 +jsonschema_specifications/schemas/draft202012/metaschema.json,sha256=Qdp29a-3zgYtJI92JGOpL3ykfk4PkFsiS6av7vkd7Q8,2452 +jsonschema_specifications/schemas/draft202012/vocabularies/applicator,sha256=xKbkFHuR_vf-ptwFjLG_k0AvdBS3ZXiosWqvHa1qrO8,1659 +jsonschema_specifications/schemas/draft202012/vocabularies/content,sha256=CDQ3R3ZOSlgUJieTz01lIFenkThjxZUNQyl-jh_axbY,519 +jsonschema_specifications/schemas/draft202012/vocabularies/core,sha256=wtEqjk3RHTNt_IOj9mOqTGnwtJs76wlP_rJbUxb0gD0,1564 +jsonschema_specifications/schemas/draft202012/vocabularies/format-annotation,sha256=q8d1rf79idIjWBcNm_k_Tr0jSVY7u-3WDwK-98gSvMA,448 +jsonschema_specifications/schemas/draft202012/vocabularies/format-assertion,sha256=xSJCuaG7eGsmw-gset1CjDH5yW5XXc6Z5W6l_qptogw,445 +jsonschema_specifications/schemas/draft202012/vocabularies/meta-data,sha256=j3bW4U9Bubku-TO3CM3FFEyLUmhlGtEZGEhfsXVPHHY,892 +jsonschema_specifications/schemas/draft202012/vocabularies/unevaluated,sha256=Lb-8tzmUtnCwl2SSre4f_7RsIWgnhNL1pMpWH54tDLQ,506 +jsonschema_specifications/schemas/draft202012/vocabularies/validation,sha256=cBCjHlQfMtK-ch4t40jfdcmzaHaj7TBId_wKvaHTelg,2834 +jsonschema_specifications/schemas/draft3/metaschema.json,sha256=LPdfZENvtb43Si6qJ6uLfh_WUcm0ba6mxnsC_WTiRYs,2600 +jsonschema_specifications/schemas/draft4/metaschema.json,sha256=4UidC0dV8CeTMCWR0_y48Htok6gqlPJIlfjk7fEbguI,4357 +jsonschema_specifications/schemas/draft6/metaschema.json,sha256=wp386fVINcOgbAOzxdXsDtp3cGVo-cTffPvHVmpRAG0,4437 +jsonschema_specifications/schemas/draft7/metaschema.json,sha256=PVOSCIJhYGxVm2A_OFMpyfGrRbXWZ-uZBodFOwVdQF4,4819 +jsonschema_specifications/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jsonschema_specifications/tests/__pycache__/__init__.cpython-311.pyc,, +jsonschema_specifications/tests/__pycache__/test_jsonschema_specifications.cpython-311.pyc,, +jsonschema_specifications/tests/test_jsonschema_specifications.py,sha256=WkbYRW6A6FoZ0rivShfqVLSCsAiHJ2x8TxqECJTXPTY,1106 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/jsonschema_specifications-2025.9.1.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/jsonschema_specifications-2025.9.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..12228d414b6cfed7c39d3781c85c63256a1d7fb5 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/jsonschema_specifications-2025.9.1.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/kubernetes-35.0.0.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..f5ad25738af77cdcc3a8631fe8556cbb55c7d114 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/METADATA @@ -0,0 +1,50 @@ +Metadata-Version: 2.4 +Name: kubernetes +Version: 35.0.0 +Summary: Kubernetes python client +Home-page: https://github.com/kubernetes-client/python +Author: Kubernetes +Author-email: +License: Apache License Version 2.0 +Keywords: Swagger,OpenAPI,Kubernetes +Classifier: Development Status :: 5 - Production/Stable +Classifier: Topic :: Utilities +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Information Technology +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +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 +Requires-Python: >=3.6 +License-File: LICENSE +Requires-Dist: certifi>=14.05.14 +Requires-Dist: six>=1.9.0 +Requires-Dist: python-dateutil>=2.5.3 +Requires-Dist: pyyaml>=5.4.1 +Requires-Dist: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 +Requires-Dist: requests +Requires-Dist: requests-oauthlib +Requires-Dist: urllib3!=2.6.0,>=1.24.2 +Requires-Dist: durationpy>=0.7 +Provides-Extra: adal +Requires-Dist: adal>=1.0.2; extra == "adal" +Provides-Extra: google-auth +Requires-Dist: google-auth>=1.0.1; extra == "google-auth" +Dynamic: author +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: provides-extra +Dynamic: requires-dist +Dynamic: requires-python +Dynamic: summary + +Python client for kubernetes http://kubernetes.io/ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..bf80355cfcce69752798ea5eb43bc6e0b78c6c2b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/RECORD @@ -0,0 +1,1668 @@ +kubernetes-35.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +kubernetes-35.0.0.dist-info/METADATA,sha256=DsDvu3zJ6oCWhf22KzxhkxBthkJwD7piytu2Li-Yj3c,1682 +kubernetes-35.0.0.dist-info/RECORD,, +kubernetes-35.0.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109 +kubernetes-35.0.0.dist-info/licenses/LICENSE,sha256=X1Kn-eahP3zk7IT-cvvx96mCe-6F3ZkQJqqsz-K9ZVw,11354 +kubernetes-35.0.0.dist-info/top_level.txt,sha256=lfBi9Orzf5WO-d6GHVm37K5NUUH5hLOCYOz66nbEnGM,11 +kubernetes/__init__.py,sha256=4yU4kfzv_pyrYVbm2l9PQQVA6RqYRCNYKqi0C3vQhJA,844 +kubernetes/__pycache__/__init__.cpython-311.pyc,, +kubernetes/client/__init__.py,sha256=4Dl8a7Agx3r6FhqjnFjiNOeT6itCF0y7iiZyB30rj14,65964 +kubernetes/client/__pycache__/__init__.cpython-311.pyc,, +kubernetes/client/__pycache__/api_client.cpython-311.pyc,, +kubernetes/client/__pycache__/configuration.cpython-311.pyc,, +kubernetes/client/__pycache__/exceptions.cpython-311.pyc,, +kubernetes/client/__pycache__/rest.cpython-311.pyc,, +kubernetes/client/api/__init__.py,sha256=BChl04HgsvDJeyQdJbXU243Ndp2pv8erpu71VV8M1OM,4628 +kubernetes/client/api/__pycache__/__init__.cpython-311.pyc,, +kubernetes/client/api/__pycache__/admissionregistration_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/admissionregistration_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/admissionregistration_v1alpha1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/admissionregistration_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apiextensions_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apiextensions_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apiregistration_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apiregistration_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apis_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apps_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/apps_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/authentication_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/authentication_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/authorization_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/authorization_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/autoscaling_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/autoscaling_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/autoscaling_v2_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/batch_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/batch_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/certificates_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/certificates_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/certificates_v1alpha1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/certificates_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/coordination_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/coordination_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/coordination_v1alpha2_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/coordination_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/core_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/core_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/custom_objects_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/discovery_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/discovery_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/events_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/events_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/flowcontrol_apiserver_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/flowcontrol_apiserver_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/internal_apiserver_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/internal_apiserver_v1alpha1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/logs_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/networking_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/networking_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/networking_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/node_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/node_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/openid_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/policy_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/policy_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/rbac_authorization_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/rbac_authorization_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/resource_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/resource_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/resource_v1alpha3_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/resource_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/resource_v1beta2_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/scheduling_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/scheduling_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/scheduling_v1alpha1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/storage_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/storage_v1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/storage_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/storagemigration_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/storagemigration_v1beta1_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/version_api.cpython-311.pyc,, +kubernetes/client/api/__pycache__/well_known_api.cpython-311.pyc,, +kubernetes/client/api/admissionregistration_api.py,sha256=Ul1O0vuwdvcv_h7oTAko5iQEps2QZmz2ne1zkdi3EgY,5215 +kubernetes/client/api/admissionregistration_v1_api.py,sha256=gmScIGAn2XCk2eL7U1pGd7HTDzmdhF9uqk4DsNOum_M,403195 +kubernetes/client/api/admissionregistration_v1alpha1_api.py,sha256=08vjkEOyO-YGiJTcTYf7V_-25kMfuRW9m_w-q5iDm-8,190062 +kubernetes/client/api/admissionregistration_v1beta1_api.py,sha256=EvC81vjUOEFu0ZLl6VufUgrkn4Qtc3j7cNNYjt-q7UI,190008 +kubernetes/client/api/apiextensions_api.py,sha256=lSfpB8G6UFIkVZqJJ27BP70jyCMt7wPRZ0EaQMIthvc,5199 +kubernetes/client/api/apiextensions_v1_api.py,sha256=NQ_G-ZqpOMw5nmXVZH16OJDXlxDffX1bwETEp0GLI_4,125123 +kubernetes/client/api/apiregistration_api.py,sha256=pcY4jg2niIi6BPp__tSVlNphePuWxFb5uvUcLH4C_Yo,5203 +kubernetes/client/api/apiregistration_v1_api.py,sha256=WiKnRrKU8E6OZRWXrZnPQcpdLPDFRBrlwB81qSZxL2c,122735 +kubernetes/client/api/apis_api.py,sha256=cdTdt_IkhPXG5NN1D_vHY1DEPCyD5heBTwOw07kd2T4,5205 +kubernetes/client/api/apps_api.py,sha256=d8iGYNRc9AE_6dg5q5-WVZqlnZGcPk5N_9_dnvOwVlw,5174 +kubernetes/client/api/apps_v1_api.py,sha256=XuWA7CyhsHaT_re5uFGwo72nh1Xb_XtSzmvHG-P7uZk,794629 +kubernetes/client/api/authentication_api.py,sha256=WpJtfs3xYddqmDyZEdskXQjTphJlAu4ego1AUtGgIBc,5201 +kubernetes/client/api/authentication_v1_api.py,sha256=_BpkDZvdw5ax3zG8QHNJrOgc19yqXzuGln02Oqv8uKs,24070 +kubernetes/client/api/authorization_api.py,sha256=r7MtzxhZNGoD4tSTQAx6djNZmmNJfNJWq6pg-aGk_7w,5199 +kubernetes/client/api/authorization_v1_api.py,sha256=wls0hgjys0x3Cm_K__zH5pcCSLJjIYwxYjG_F15v5iU,44409 +kubernetes/client/api/autoscaling_api.py,sha256=JG7bQTVpdC10AzIxN_dHKtehGwuXbo8NS0BUlMk7N3M,5188 +kubernetes/client/api/autoscaling_v1_api.py,sha256=S4zpf7K2oGiDIZCHLEXcy2m-JroMh5enxfkk-_AYOAg,153671 +kubernetes/client/api/autoscaling_v2_api.py,sha256=YJMZ7CbF28A-bBFryniqHygst7aSleRN6qG9RftmzPg,153671 +kubernetes/client/api/batch_api.py,sha256=Ic91NHIMDNgY2GbCzjWa16D43zrtGUy7DGfbOgK1mqI,5176 +kubernetes/client/api/batch_v1_api.py,sha256=cXN8Tp4pVWVA5HTG1-1q__hq48ZVSo_9O2Mrg079H1U,294768 +kubernetes/client/api/certificates_api.py,sha256=1G9qN2K3PczBLVk_PMgYtFP2tr3D88fDOELbDskNUbE,5197 +kubernetes/client/api/certificates_v1_api.py,sha256=QcWm9-n_MJdN_YPfMmgLYntodX1bWculk3xQTpiRgvk,153400 +kubernetes/client/api/certificates_v1alpha1_api.py,sha256=xsw-_wBdWVkVpNNBwRccH_LrxZZ194BAtvhX_0Ymkto,96621 +kubernetes/client/api/certificates_v1beta1_api.py,sha256=uVji7qTOKZF93VeF8uwhSjbdKbpCsQyN7RoIiAryUj0,244932 +kubernetes/client/api/coordination_api.py,sha256=i_gPNjoJ15QLNPk2D5UguS94TnOa2ry1AFLUfLqs3KY,5197 +kubernetes/client/api/coordination_v1_api.py,sha256=40mUCqtM-qp897e3EyhyCzSe5auEBrMLe5FjiP-5Qmc,120387 +kubernetes/client/api/coordination_v1alpha2_api.py,sha256=13W4Ra0U3CClvdNXGzBeX0rJRSM7BHKedw1F09mb5LY,121845 +kubernetes/client/api/coordination_v1beta1_api.py,sha256=mHiCcoC7-yjvIf6W-u_5UiOa6n02HrdeYKC-Hp1xQ34,121813 +kubernetes/client/api/core_api.py,sha256=9l1H1BECbmzU5DriHPWRwVtHmUcx8w393WVV4Y6uWvo,5201 +kubernetes/client/api/core_v1_api.py,sha256=iizaJSXE0L9hm2M_xh6F6J7a4hHTufEvSbxFHUi7evA,2378292 +kubernetes/client/api/custom_objects_api.py,sha256=kk7xDTKfK9GN7n7VFRyP4U8d8NjH-Ge3JP4BpFsxYaM,334797 +kubernetes/client/api/discovery_api.py,sha256=sDRtI9K4WuzlGOWix1iQYbQ918QsYbZheG_rNBPbNkU,5191 +kubernetes/client/api/discovery_v1_api.py,sha256=ilh2ahLlYjqa5gBchr1AE_zyPwY4AhvbVgG5nj-MJas,121495 +kubernetes/client/api/events_api.py,sha256=gDU-Onw3GABBPfK8M1hG6PDkRb1-8fDXWA--LxQqS9A,5185 +kubernetes/client/api/events_v1_api.py,sha256=jAGH9zvvFfIWFkcmXuEM_SgYy_qZs7_gT_9eyNYhTLQ,120463 +kubernetes/client/api/flowcontrol_apiserver_api.py,sha256=xG99P6JsNJzjgV2f_SByII8XnroKNCTN_BwV4s8vkIA,5214 +kubernetes/client/api/flowcontrol_apiserver_v1_api.py,sha256=VHNdLZ8PYZbcMI1fuzIsHCIrmybFfCGOR5xhxp4S5Cg,243066 +kubernetes/client/api/internal_apiserver_api.py,sha256=svgzxerMGKw6feN1T7n3v_IyR2l_nEr2h5E7Hdjt9UI,5208 +kubernetes/client/api/internal_apiserver_v1alpha1_api.py,sha256=UPXhNgw5ZHclGsXo76cfugVyx2Bv3Qp1H6h_q_WZ1jA,123682 +kubernetes/client/api/logs_api.py,sha256=OTMUHocqXDTC87TxGbU2PWW0aLNO93XDwJdvHuHUS6M,9507 +kubernetes/client/api/networking_api.py,sha256=g5V4hltXfe7HCrB7dQTctV2Jg780kMwnLpQQ8TIFbfI,5193 +kubernetes/client/api/networking_v1_api.py,sha256=KGm22BCXQeFiZ1F1W6Aa-8SSrHIPPLgk6wb8KhKhI0g,564884 +kubernetes/client/api/networking_v1beta1_api.py,sha256=1kcJ5Orz8oVQokKiSRLjiscuinLrPZUIenFktZ5-o9g,213296 +kubernetes/client/api/node_api.py,sha256=R1VZHFsrrtHwtdWUA1fdIIhEa1T6p5RnrfawsKSdNCw,5181 +kubernetes/client/api/node_v1_api.py,sha256=e-W0pdmN8qOuD0Bounut6iT3YbgBups63GoCB79nfgo,95659 +kubernetes/client/api/openid_api.py,sha256=eEtAU9AWNRzN0wXp-Xsu8CLKHlQ6TANGW0Nph66Pkn0,5464 +kubernetes/client/api/policy_api.py,sha256=l_jWzFVJ4tepfgtsM_CglzLKJYqAFdDdScdeqPbEBRI,5178 +kubernetes/client/api/policy_v1_api.py,sha256=mtRtmVuZrJG_wEE8H4_MuSmM0RKfopOfIzmiujJvAOM,152846 +kubernetes/client/api/rbac_authorization_api.py,sha256=VVPDhwmpAuT0myQaaiw-NsMiQf4C__wzPKo7vfwJWgM,5208 +kubernetes/client/api/rbac_authorization_v1_api.py,sha256=BNbL7ZXX1f6h9MpEy6FBczfFEtKEAspuB1F_RpDgmlk,417962 +kubernetes/client/api/resource_api.py,sha256=bu636WPJYXCLgw-brdKTuHFUOuszmjD8hu-_DDSH6eA,5189 +kubernetes/client/api/resource_v1_api.py,sha256=5HSRRkiscwQn-MIlnkHeUOu_MT26IAT7gwezlEpebXU,450263 +kubernetes/client/api/resource_v1alpha3_api.py,sha256=AQXvzaynhqaLHi-7V4YwAHPW_w98bvFlvg4reOIaPZc,123866 +kubernetes/client/api/resource_v1beta1_api.py,sha256=QTmfbwttCgpe0_4mfLOcCi559Pey6rAgT2YcLridYg0,450723 +kubernetes/client/api/resource_v1beta2_api.py,sha256=DsSbe7fehzu-Xr_f7N1iYT9ww_OFwRALRg_NMMmp0to,450723 +kubernetes/client/api/scheduling_api.py,sha256=p1AdBGl7Ho3bI358Q9vMkn5Jf7gV_kWCU3NEQd9KVrg,5193 +kubernetes/client/api/scheduling_v1_api.py,sha256=_NHjEiDnRgjKw8RqhyrscnZpF3l-wB4VABFEFDqg_4s,95824 +kubernetes/client/api/scheduling_v1alpha1_api.py,sha256=wfT5gU7I3xszzLCZ1boElsX6jkIw9WrxMIevoG9DFOs,120955 +kubernetes/client/api/storage_api.py,sha256=mUih8h-zAdFKpoU5Q7DLtKUf_QtCKiEtO373NSkcKGc,5187 +kubernetes/client/api/storage_v1_api.py,sha256=0P8J2X4N20PML9yPtMB8wZkON99lSP3wdZOAQJ2REVA,602562 +kubernetes/client/api/storage_v1beta1_api.py,sha256=am-P4lL7IvLHEv0O_2Ao48rDODRyyXxcTQLzc0EfqYo,96948 +kubernetes/client/api/storagemigration_api.py,sha256=um_imse3asZQElDP1Krq-jMd64XCwBZoVbVh1NBFczY,5205 +kubernetes/client/api/storagemigration_v1beta1_api.py,sha256=0DPIsRLLio2ie5BN3yxkf54ZaFIk3dYEn-hMr-R-Ad8,125203 +kubernetes/client/api/version_api.py,sha256=UxzafHbq8xibZGXxCxQxeLXDt0xZLCIGjBkqY1_EXpY,5113 +kubernetes/client/api/well_known_api.py,sha256=f-zCtxSafkCDYOc-T6H5al_arBKk5b1enXSLhsR4-Wg,5523 +kubernetes/client/api_client.py,sha256=j95xPJY0uZ3M0szqtWYoFiYXsLKtdkfdxrMLWWf3Gp8,25581 +kubernetes/client/apis/__init__.py,sha256=7YOy2L56gwx6GKnESDPIZfVc1AORwFeTivDv6pE1Pyo,435 +kubernetes/client/apis/__pycache__/__init__.cpython-311.pyc,, +kubernetes/client/configuration.py,sha256=2myvaKBA5XNA82zggdnrSBfamByV6nUn8lk5zVoXJh8,14070 +kubernetes/client/exceptions.py,sha256=whrEJrQUpHaup3xzKMwejDIFd8Ka0ra2t4gSLNthR4U,3794 +kubernetes/client/models/__init__.py,sha256=f926vWp5ofZjji8A28d851Xoqy8yBPKvUNiQqpiCGfo,60965 +kubernetes/client/models/__pycache__/__init__.cpython-311.pyc,, +kubernetes/client/models/__pycache__/admissionregistration_v1_service_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/admissionregistration_v1_webhook_client_config.cpython-311.pyc,, +kubernetes/client/models/__pycache__/apiextensions_v1_service_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/apiextensions_v1_webhook_client_config.cpython-311.pyc,, +kubernetes/client/models/__pycache__/apiregistration_v1_service_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/authentication_v1_token_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/core_v1_endpoint_port.cpython-311.pyc,, +kubernetes/client/models/__pycache__/core_v1_event.cpython-311.pyc,, +kubernetes/client/models/__pycache__/core_v1_event_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/core_v1_event_series.cpython-311.pyc,, +kubernetes/client/models/__pycache__/core_v1_resource_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/discovery_v1_endpoint_port.cpython-311.pyc,, +kubernetes/client/models/__pycache__/events_v1_event.cpython-311.pyc,, +kubernetes/client/models/__pycache__/events_v1_event_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/events_v1_event_series.cpython-311.pyc,, +kubernetes/client/models/__pycache__/flowcontrol_v1_subject.cpython-311.pyc,, +kubernetes/client/models/__pycache__/rbac_v1_subject.cpython-311.pyc,, +kubernetes/client/models/__pycache__/resource_v1_resource_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/storage_v1_token_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_affinity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_aggregation_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_allocated_device_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_group.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_group_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_resource.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_resource_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_service.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_service_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_service_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_service_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_service_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_api_versions.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_app_armor_profile.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_attached_volume.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_audit_annotation.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_aws_elastic_block_store_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_azure_disk_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_azure_file_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_azure_file_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_binding.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_bound_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_capabilities.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_capacity_request_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_capacity_request_policy_range.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_capacity_requirements.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cel_device_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ceph_fs_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ceph_fs_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_certificate_signing_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_certificate_signing_request_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_certificate_signing_request_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_certificate_signing_request_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_certificate_signing_request_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cinder_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cinder_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_client_ip_config.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cluster_role.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cluster_role_binding.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cluster_role_binding_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cluster_role_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cluster_trust_bundle_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_component_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_component_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_component_status_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map_env_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map_key_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map_node_config_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_config_map_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_extended_resource_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_image.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_port.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_resize_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_restart_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_restart_rule_on_exit_codes.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_state.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_state_running.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_state_terminated.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_state_waiting.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_container_user.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_controller_revision.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_controller_revision_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_counter.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_counter_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cron_job.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cron_job_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cron_job_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cron_job_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_cross_version_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_driver.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_driver_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_driver_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_node.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_node_driver.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_node_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_node_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_storage_capacity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_storage_capacity_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_csi_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_column_definition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_conversion.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition_names.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_definition_version.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_subresource_scale.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_subresources.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_custom_resource_validation.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_endpoint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_set_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_set_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_set_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_set_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_daemon_set_update_strategy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_delete_options.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_deployment.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_deployment_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_deployment_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_deployment_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_deployment_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_deployment_strategy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_allocation_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_attribute.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_capacity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_claim_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_class_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_class_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_constraint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_counter_consumption.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_request_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_sub_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_taint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_device_toleration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_downward_api_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_downward_api_volume_file.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_downward_api_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_empty_dir_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint_address.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint_conditions.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint_hints.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint_slice.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint_slice_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoint_subset.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoints.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_endpoints_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_env_from_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_env_var.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_env_var_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ephemeral_container.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ephemeral_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_event_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_eviction.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_exact_device_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_exec_action.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_exempt_priority_level_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_expression_warning.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_external_documentation.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_fc_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_field_selector_attributes.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_field_selector_requirement.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_file_key_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flex_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flex_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flocker_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flow_distinguisher_method.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flow_schema.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flow_schema_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flow_schema_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flow_schema_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_flow_schema_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_for_node.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_for_zone.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_gce_persistent_disk_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_git_repo_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_glusterfs_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_glusterfs_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_group_resource.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_group_subject.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_group_version_for_discovery.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_grpc_action.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_horizontal_pod_autoscaler.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_horizontal_pod_autoscaler_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_horizontal_pod_autoscaler_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_horizontal_pod_autoscaler_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_host_alias.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_host_ip.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_host_path_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_http_get_action.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_http_header.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_http_ingress_path.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_http_ingress_rule_value.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_image_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_backend.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_class_parameters_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_class_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_load_balancer_ingress.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_load_balancer_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_port_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_service_backend.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ingress_tls.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ip_address.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ip_address_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ip_address_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_ip_block.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_iscsi_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_iscsi_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_job.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_job_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_job_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_job_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_job_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_job_template_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_json_schema_props.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_key_to_path.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_label_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_label_selector_attributes.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_label_selector_requirement.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_lease.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_lease_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_lease_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_lifecycle.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_lifecycle_handler.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_limit_range.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_limit_range_item.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_limit_range_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_limit_range_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_limit_response.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_limited_priority_level_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_linux_container_user.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_list_meta.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_load_balancer_ingress.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_load_balancer_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_local_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_local_subject_access_review.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_local_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_managed_fields_entry.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_match_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_match_resources.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_modify_volume_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_mutating_webhook.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_mutating_webhook_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_mutating_webhook_configuration_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_named_rule_with_operations.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_namespace.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_namespace_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_namespace_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_namespace_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_namespace_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_device_data.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy_egress_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy_ingress_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy_peer.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy_port.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_network_policy_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_nfs_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_address.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_affinity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_config_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_config_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_daemon_endpoints.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_features.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_runtime_handler.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_runtime_handler_features.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_selector_requirement.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_selector_term.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_swap_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_node_system_info.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_non_resource_attributes.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_non_resource_policy_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_non_resource_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_object_field_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_object_meta.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_opaque_device_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_overhead.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_owner_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_param_kind.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_param_ref.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_parent_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim_template.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_claim_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_persistent_volume_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_photon_persistent_disk_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_affinity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_affinity_term.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_anti_affinity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_certificate_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_disruption_budget.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_disruption_budget_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_disruption_budget_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_disruption_budget_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_dns_config.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_dns_config_option.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_extended_resource_claim_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_failure_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_failure_policy_on_exit_codes_requirement.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_failure_policy_on_pod_conditions_pattern.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_failure_policy_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_ip.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_os.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_readiness_gate.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_resource_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_resource_claim_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_scheduling_gate.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_security_context.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_template.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_template_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_pod_template_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_policy_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_policy_rules_with_subjects.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_port_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_portworx_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_preconditions.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_preferred_scheduling_term.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_level_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_level_configuration_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_level_configuration_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_level_configuration_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_level_configuration_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_priority_level_configuration_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_probe.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_projected_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_queuing_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_quobyte_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_rbd_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_rbd_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replica_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replica_set_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replica_set_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replica_set_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replica_set_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replication_controller.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replication_controller_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replication_controller_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replication_controller_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_replication_controller_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_attributes.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_consumer_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_template.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_template_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_claim_template_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_field_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_health.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_policy_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_pool.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_quota.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_quota_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_quota_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_quota_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_requirements.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_slice.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_slice_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_slice_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_resource_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_role.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_role_binding.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_role_binding_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_role_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_role_ref.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_rolling_update_daemon_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_rolling_update_deployment.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_rolling_update_stateful_set_strategy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_rule_with_operations.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_runtime_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_runtime_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scale.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scale_io_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scale_io_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scale_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scale_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scheduling.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scope_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_scoped_resource_selector_requirement.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_se_linux_options.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_seccomp_profile.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret_env_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret_key_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_secret_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_security_context.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_selectable_field.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_self_subject_access_review.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_self_subject_access_review_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_self_subject_review.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_self_subject_review_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_self_subject_rules_review.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_self_subject_rules_review_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_server_address_by_client_cidr.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_account.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_account_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_account_subject.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_account_token_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_backend_port.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_cidr.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_cidr_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_cidr_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_cidr_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_port.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_service_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_session_affinity_config.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_sleep_action.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_ordinals.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_persistent_volume_claim_retention_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_stateful_set_update_strategy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_status_cause.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_status_details.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_storage_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_storage_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_storage_os_persistent_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_storage_os_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_subject_access_review.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_subject_access_review_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_subject_access_review_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_subject_rules_review_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_success_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_success_policy_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_sysctl.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_taint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_tcp_socket_action.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_token_request_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_token_request_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_token_review.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_token_review_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_token_review_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_toleration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_topology_selector_label_requirement.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_topology_selector_term.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_topology_spread_constraint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_type_checking.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_typed_local_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_typed_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_uncounted_terminated_pods.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_user_info.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_user_subject.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy_binding.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy_binding_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy_binding_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_admission_policy_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_webhook.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_webhook_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validating_webhook_configuration_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validation.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_validation_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_variable.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attachment.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attachment_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attachment_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attachment_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attachment_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attributes_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_attributes_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_device.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_error.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_mount.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_mount_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_node_affinity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_node_resources.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_projection.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_volume_resource_requirements.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_vsphere_virtual_disk_volume_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_watch_event.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_webhook_conversion.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_weighted_pod_affinity_term.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_windows_security_context_options.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1_workload_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_apply_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_cluster_trust_bundle.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_cluster_trust_bundle_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_cluster_trust_bundle_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_gang_scheduling_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_json_patch.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_match_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_match_resources.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutating_admission_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutating_admission_policy_binding.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutating_admission_policy_binding_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutating_admission_policy_binding_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutating_admission_policy_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutating_admission_policy_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_mutation.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_named_rule_with_operations.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_param_kind.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_param_ref.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_pod_group.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_pod_group_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_server_storage_version.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_storage_version.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_storage_version_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_storage_version_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_storage_version_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_typed_local_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_variable.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_workload.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_workload_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha1_workload_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha2_lease_candidate.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha2_lease_candidate_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha2_lease_candidate_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha3_device_taint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha3_device_taint_rule.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha3_device_taint_rule_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha3_device_taint_rule_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha3_device_taint_rule_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1alpha3_device_taint_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_allocated_device_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_apply_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_basic_device.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_capacity_request_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_capacity_request_policy_range.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_capacity_requirements.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_cel_device_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_cluster_trust_bundle.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_cluster_trust_bundle_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_cluster_trust_bundle_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_counter.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_counter_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_allocation_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_attribute.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_capacity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_claim_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_class_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_class_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_constraint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_counter_consumption.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_request_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_sub_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_taint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_device_toleration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_ip_address.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_ip_address_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_ip_address_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_json_patch.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_lease_candidate.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_lease_candidate_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_lease_candidate_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_match_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_match_resources.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutating_admission_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutating_admission_policy_binding.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutating_admission_policy_binding_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutating_admission_policy_binding_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutating_admission_policy_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutating_admission_policy_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_mutation.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_named_rule_with_operations.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_network_device_data.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_opaque_device_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_param_kind.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_param_ref.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_parent_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_pod_certificate_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_pod_certificate_request_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_pod_certificate_request_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_pod_certificate_request_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_consumer_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_template.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_template_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_claim_template_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_pool.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_slice.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_slice_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_resource_slice_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_service_cidr.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_service_cidr_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_service_cidr_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_service_cidr_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_storage_version_migration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_storage_version_migration_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_storage_version_migration_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_storage_version_migration_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_variable.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_volume_attributes_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta1_volume_attributes_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_allocated_device_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_capacity_request_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_capacity_request_policy_range.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_capacity_requirements.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_cel_device_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_counter.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_counter_set.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_allocation_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_attribute.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_capacity.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_claim_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_class.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_class_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_class_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_class_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_constraint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_counter_consumption.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_request_allocation_result.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_selector.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_sub_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_taint.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_device_toleration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_exact_device_request.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_network_device_data.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_opaque_device_configuration.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_consumer_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_template.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_template_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_claim_template_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_pool.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_slice.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_slice_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v1beta2_resource_slice_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_container_resource_metric_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_container_resource_metric_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_cross_version_object_reference.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_external_metric_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_external_metric_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_horizontal_pod_autoscaler.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_horizontal_pod_autoscaler_behavior.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_horizontal_pod_autoscaler_condition.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_horizontal_pod_autoscaler_list.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_horizontal_pod_autoscaler_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_horizontal_pod_autoscaler_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_hpa_scaling_policy.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_hpa_scaling_rules.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_metric_identifier.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_metric_spec.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_metric_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_metric_target.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_metric_value_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_object_metric_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_object_metric_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_pods_metric_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_pods_metric_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_resource_metric_source.cpython-311.pyc,, +kubernetes/client/models/__pycache__/v2_resource_metric_status.cpython-311.pyc,, +kubernetes/client/models/__pycache__/version_info.cpython-311.pyc,, +kubernetes/client/models/admissionregistration_v1_service_reference.py,sha256=ibS1sbFFoKsV-AEEo5K4Vz4qNE9LgRSybYsqsrtwE0Y,6812 +kubernetes/client/models/admissionregistration_v1_webhook_client_config.py,sha256=8JwbllqFrKmkyax_92IcvWrgp5teeW_HpRDM3czk2Ac,8236 +kubernetes/client/models/apiextensions_v1_service_reference.py,sha256=_7eaUtvmwzCN4Ygwo1xA2Mrfo5rTg3FC7cKCUWU6Us8,6646 +kubernetes/client/models/apiextensions_v1_webhook_client_config.py,sha256=jywK0DDnaY-iUwQhroQectkjuNiTgGe3bTXJcIbCQvM,8076 +kubernetes/client/models/apiregistration_v1_service_reference.py,sha256=QA83ttu7ALH9TRLsDGxRZy4At2ctGv-9bc87gJh9O1o,5462 +kubernetes/client/models/authentication_v1_token_request.py,sha256=V0cdmlgqjIFSc550PAhS_5eIuFMpi8EQM70d6c1BPlY,7746 +kubernetes/client/models/core_v1_endpoint_port.py,sha256=8gxfIVaLjBvuBKbc4hvullRAzIEfRlIR8k2oUGJAe5Q,7954 +kubernetes/client/models/core_v1_event.py,sha256=fynq-IjOoTsUrh8IPQfKptrxMOvc4LubM4RRfW1gPJY,17942 +kubernetes/client/models/core_v1_event_list.py,sha256=WR4WAO-CFwyg-44sgR1d36kY8WcPKTwFfpCUh0njuFA,6840 +kubernetes/client/models/core_v1_event_series.py,sha256=f-e1B9SY5HUPr5XAFBIQMD6QIK2l95R1lSToYwrgetY,4514 +kubernetes/client/models/core_v1_resource_claim.py,sha256=0u_FhAaCP-mPMYoI3jfRHs8BNTJYpXmKkOL5ifkj_t4,4869 +kubernetes/client/models/discovery_v1_endpoint_port.py,sha256=YCfw6uZSXjOSgdeng346B8RDi2dDCnkLmFcPiter7QQ,8898 +kubernetes/client/models/events_v1_event.py,sha256=f-waa1K71yKHkRjO1otb4Sjh6PjqEs79FH_tYXjSV84,19892 +kubernetes/client/models/events_v1_event_list.py,sha256=O9U4URVmxjM_bkCEaYX8NhXSPfLvIOUQ3tViKbpE7dA,6926 +kubernetes/client/models/events_v1_event_series.py,sha256=WIFg0Gq_Q_pLsw3R7XwwCiztCFLL9yT7XndgUZQbNpM,5001 +kubernetes/client/models/flowcontrol_v1_subject.py,sha256=x3raQGaPcCoboJjarugUrlM7dVPUNOce9NTBnQ3e6dI,5859 +kubernetes/client/models/rbac_v1_subject.py,sha256=A6viMJErAy1t5XaIVPdXh1uNnxrgX58tWgn9bMDjBCU,6882 +kubernetes/client/models/resource_v1_resource_claim.py,sha256=vnXmkcI7p1LzV41k4g-YmVGesgcHvlvWzItARVz4dfk,7632 +kubernetes/client/models/storage_v1_token_request.py,sha256=Wm82Z6m0zBRId87R6fZLUnffgELf6nT00XdA6UZZDgQ,5134 +kubernetes/client/models/v1_affinity.py,sha256=BTb2bnole6KBrK8Y1BIb3dHwVgOX-idwnOke3BdG89E,5091 +kubernetes/client/models/v1_aggregation_rule.py,sha256=HFPitJt3d7YDSih3MnCpYkEHaazkdVq-ZePipZ7FEck,4142 +kubernetes/client/models/v1_allocated_device_status.py,sha256=thRTjuVH5zgD3MbrwNInEABKtX6qANn5ZL4HtwCczwQ,10451 +kubernetes/client/models/v1_allocation_result.py,sha256=LsTTWibm9BW3xx7uHpbaUTy3ObvBN8eUkRM_kBTso2s,5773 +kubernetes/client/models/v1_api_group.py,sha256=OG7cFGMLlTCE80XXPRoXfMbRoyWq34Ng7y-CjniwIMs,10450 +kubernetes/client/models/v1_api_group_list.py,sha256=u3rll41KVTUivGiTpejhSlwMGxwxFsWXHAOg6oJ2rdw,6182 +kubernetes/client/models/v1_api_resource.py,sha256=SnrAj3gKN1KjckZK-eOCvXZn9dJbFPvCJ8qwBYYlO7k,13876 +kubernetes/client/models/v1_api_resource_list.py,sha256=Ybnhb46dRq-z0U99MIssVj5w3CI-spVscfCOimU_vd0,7505 +kubernetes/client/models/v1_api_service.py,sha256=fkBEbYBR437_CIzZ5-KW8hcMiUiRYT5aBjm_zuTwwjg,7196 +kubernetes/client/models/v1_api_service_condition.py,sha256=_4G8nCrgjr1Dmhaxa7oEYGA34aNxcQPjtp08Mo2eCRU,7405 +kubernetes/client/models/v1_api_service_list.py,sha256=dWCZDnpL7p8bxI-n0a6Fu_JePg-ZkBYh1pByolSuwkA,6897 +kubernetes/client/models/v1_api_service_spec.py,sha256=xylEBaxo3yY03HYE-cKEJnkN4T4ZO7T_3oUH75J1dDQ,13305 +kubernetes/client/models/v1_api_service_status.py,sha256=D9Ose0mCS2oxcIEoD9oV38iVSjXThaFoB7gme3dznEc,3626 +kubernetes/client/models/v1_api_versions.py,sha256=kN5AH_4Z524OiAhWzyEcnL-kQlg8u5yDgr445mftb34,8894 +kubernetes/client/models/v1_app_armor_profile.py,sha256=y3IR3OIu-WHHjiUomTzsWRaqXuBB2mtpc_cs8Vl2iBU,5316 +kubernetes/client/models/v1_attached_volume.py,sha256=M5oL_l4cX563mEgCSs2y5jWFB3eWXPMfTDHxbel8e7c,4641 +kubernetes/client/models/v1_audit_annotation.py,sha256=Pz_56Kq_H7LNtYhp1zrfl5Ci-ZWNwxnZmNE3ZfkXcns,7449 +kubernetes/client/models/v1_aws_elastic_block_store_volume_source.py,sha256=34CpMt3SBOPl5e71tEerCMHVdsY6PSIP8U6OZgwLoPI,7972 +kubernetes/client/models/v1_azure_disk_volume_source.py,sha256=U5qRnpjYkHOvyKCyq7VUf-LCmdOtFsVmr_Ts-0_fqrI,8896 +kubernetes/client/models/v1_azure_file_persistent_volume_source.py,sha256=AOwQ53pt8OIX7Bu7btyB67kpTzQ3zt9SjqGZa-uLyA8,7209 +kubernetes/client/models/v1_azure_file_volume_source.py,sha256=pKG9SF8pyVBzpY_TXZU1tvM6fPArLAPg-PCPRP0rnAE,5853 +kubernetes/client/models/v1_binding.py,sha256=52K-t1hP3uZKTN3C41GDah1qWmTKZ7S4p-Z6UDmOnjk,6673 +kubernetes/client/models/v1_bound_object_reference.py,sha256=-8mm8PzNa1jU_s33fvLIsR2tPWfGcnngLkKgbaT5GM0,5754 +kubernetes/client/models/v1_capabilities.py,sha256=fW7KUIRUYkb5ALlCBu4QTfKXU6GAzSDKggEI3aFRbh8,4053 +kubernetes/client/models/v1_capacity_request_policy.py,sha256=ckv9uU1Ir6y6W5yFI88J7VUF2MJAQEA8aidcKr6zefE,6709 +kubernetes/client/models/v1_capacity_request_policy_range.py,sha256=Jay9MZ2nrJMXAjC_5H1SuezVROMm8B3-5M3oC1OMBD4,6167 +kubernetes/client/models/v1_capacity_requirements.py,sha256=wFTa56QtrtvI6AYwbFD5pDuVwblicw2hJPLbbgtbr6U,6141 +kubernetes/client/models/v1_cel_device_selector.py,sha256=6p3Ei8ABTWHSdfO8BRo3RiDyWcFAMnvs-mocsNRnc7g,8590 +kubernetes/client/models/v1_ceph_fs_persistent_volume_source.py,sha256=cFrOD0UCZXyNWKrPG_megDP4fKVYESFUiwsW-st63EY,8999 +kubernetes/client/models/v1_ceph_fs_volume_source.py,sha256=Tk4yKiXkC38qNU2-pwTvZo-UyqY5fG-kyfYSQ8TFS34,8734 +kubernetes/client/models/v1_certificate_signing_request.py,sha256=vx6AwjYcCm6V5tLDxroxWVTX9nZMwMa1KoIdmKoNCgQ,7800 +kubernetes/client/models/v1_certificate_signing_request_condition.py,sha256=cIDtKX0WYvS3u_utauEcYZoiXXUgOsve1kwkTcMASvc,10545 +kubernetes/client/models/v1_certificate_signing_request_list.py,sha256=RKF7hLdXr67S9xIzfbf0ELhi3Hj_o-Qy-LdyJilepAk,7296 +kubernetes/client/models/v1_certificate_signing_request_spec.py,sha256=W8IoYwBGzf87UO1NztqaCoZUKhWbAo3LWo4Tzio-02s,18541 +kubernetes/client/models/v1_certificate_signing_request_status.py,sha256=0_a1H000TXo_7XIyi7qvh9MtnWJDiuS6JAyyxgPnf14,7881 +kubernetes/client/models/v1_cinder_persistent_volume_source.py,sha256=DL898H67uVy2dgPKRjPoD82dcA027DOSuOKBDjDoJMA,7145 +kubernetes/client/models/v1_cinder_volume_source.py,sha256=CiyNFetejMWLo99iNcY2rUW04ET78kRvVPRbzLAoiEE,6948 +kubernetes/client/models/v1_client_ip_config.py,sha256=yt2Vsrgxs5-UMKiQGB7dvout87qCH-jlNKpsw8ZAq0U,3945 +kubernetes/client/models/v1_cluster_role.py,sha256=CpGE_1oDmw3JRR_EtGre2LyBy-tsBZRvEz7X2WtQEro,7592 +kubernetes/client/models/v1_cluster_role_binding.py,sha256=TNEwlYNYnI71hnQzTFxo4sSx1YusbftnSj3DcaZLa6Y,7815 +kubernetes/client/models/v1_cluster_role_binding_list.py,sha256=T2eZ38Hhkn6pssveMcI6_D3eVd8PrsBFx10a5U4hq0g,7095 +kubernetes/client/models/v1_cluster_role_list.py,sha256=v48UOWID32w2Qpbt69ja1-BrepWmGm-RgEn4MyolKfI,6920 +kubernetes/client/models/v1_cluster_trust_bundle_projection.py,sha256=pWTL7NPwlWs_lK0VHZDryywtuzWoaR8RBydGVf5hKeA,8041 +kubernetes/client/models/v1_component_condition.py,sha256=jQnysqTwLiEbeBYNSsoOgTWcxi0c0_AXLMckLu5S3cA,6441 +kubernetes/client/models/v1_component_status.py,sha256=WvY81pSE3D09WKaNJ9WTb2kdzHXLoOWfIgKwMYDOTeg,6904 +kubernetes/client/models/v1_component_status_list.py,sha256=-Y0ATFAIyepYV4_9V2cyHr0IGEbzlitCr-U28LqNzU0,7014 +kubernetes/client/models/v1_condition.py,sha256=wwcMYYuuVINYKPBDEazFy_1AR4WoNdAnsmqloULU4yE,10070 +kubernetes/client/models/v1_config_map.py,sha256=7eps3s0vtFbd724d_SZaBExBENlju2_d5msaL1fJfOU,9779 +kubernetes/client/models/v1_config_map_env_source.py,sha256=oZddxF5Ab7k9ujmcHU0p3oI4M_wby5YDkMhnTU8pUQ8,4770 +kubernetes/client/models/v1_config_map_key_selector.py,sha256=LzoKSNaJHXgYSiV_4YHCMpfXr7ahM-9BJWgFOQP46NE,5648 +kubernetes/client/models/v1_config_map_list.py,sha256=8-9eXqLJ2WgyQt4SqEuMe5gcxYtfj7WE9zPG6SIffcQ,6876 +kubernetes/client/models/v1_config_map_node_config_source.py,sha256=XEKZFeA2wmLYet33l7-EvPrbEPYRXV8wM63mJe10u60,8452 +kubernetes/client/models/v1_config_map_projection.py,sha256=avWKgZ08FmdrsdgQnWvoayogAqlmu2BEO_JkcwQ1hM8,6521 +kubernetes/client/models/v1_config_map_volume_source.py,sha256=SegSNAwFcExyKCYiYqkbXW4189vdbY1aWH3TotzY-j8,8313 +kubernetes/client/models/v1_container.py,sha256=UXrb1qiLUpx9f3NmCvlw3Ks0Fla9sLSIK3plfM_IjRM,35210 +kubernetes/client/models/v1_container_extended_resource_request.py,sha256=9Ylti367HnGm9bLKk1slkkLvAtO6-crBgSewleOdO4g,6378 +kubernetes/client/models/v1_container_image.py,sha256=3-eFHNqTKdK-byztig9hC2uumBRq37Jp2RpBtxVloXE,4498 +kubernetes/client/models/v1_container_port.py,sha256=Gb50HLIMQ_xgSWqb1c5zb1hVHGJOF_wx9mK-5jDvVRY,7629 +kubernetes/client/models/v1_container_resize_policy.py,sha256=A-MmBw4BYyQWXX1Q5ezKKMo2C74yDROEcToiRPx-lQc,5178 +kubernetes/client/models/v1_container_restart_rule.py,sha256=YuUrYqCjb_TEyINl4H__M-gzC_fAP2eFNFLOGMqEGgg,4708 +kubernetes/client/models/v1_container_restart_rule_on_exit_codes.py,sha256=5xiJkaTUwaaX8ghd2v6c3wJs0KdpNi0LYQ5w54ylC5w,5305 +kubernetes/client/models/v1_container_state.py,sha256=nWLOM2pj5W7wZBLD6T5jBiS90rcDasslCYnutWrvxrg,4915 +kubernetes/client/models/v1_container_state_running.py,sha256=VwUJTj2aDQvR7jH6oQwpwjGSqAd55MvfQ0rBUm2inhU,3634 +kubernetes/client/models/v1_container_state_terminated.py,sha256=oPVkWak9DMheSHIu1RLVBCkc9JR0BcRTKa_YyJL8WTw,9083 +kubernetes/client/models/v1_container_state_waiting.py,sha256=_3z63R-xpNWXWSWTegdCJHa0PPmr_SeXIC7R9A_O6hk,4375 +kubernetes/client/models/v1_container_status.py,sha256=7O5_EGbv5Ss--p2ZpLHyj3R_dH0wcsVlzEC2KhskKsM,19659 +kubernetes/client/models/v1_container_user.py,sha256=J5Prd5oo5xqaJpTHSdFHxWU4hXR5-qXc_vUGIERj6Og,3363 +kubernetes/client/models/v1_controller_revision.py,sha256=OdYxWgpu0JSCXVg-euXQMzxER-B-Xb1aucu9ZEBHcGo,7835 +kubernetes/client/models/v1_controller_revision_list.py,sha256=fXC__iFDcG-KiMY_C99tyC9wTGVSt33RvpboUI5_2Tw,7099 +kubernetes/client/models/v1_counter.py,sha256=H9Bz-DeL_JR1ReByz8402pOg--54aq5JVTQYCaNDWxk,3593 +kubernetes/client/models/v1_counter_set.py,sha256=cwAI_xrucpndp6R4RGQ8xlJevMmDEYOEb1GsCuobcuY,4854 +kubernetes/client/models/v1_cron_job.py,sha256=ngDagVj4K__4Vvu4l33bk8zhRQvgfm_o9bLSq1UnTig,7106 +kubernetes/client/models/v1_cron_job_list.py,sha256=2hKATg8UE_M6SnEscQseYkA8CHDerzF4WnfVzuAEdFA,6826 +kubernetes/client/models/v1_cron_job_spec.py,sha256=TbA5TaIm73MnKqXH-gfyJyhZh5X6ASP5nsLLrT8_4FQ,13409 +kubernetes/client/models/v1_cron_job_status.py,sha256=bckN2FYCCSVIVa7USc-KMo6Zo39XuuqswFd3XtZSXMY,5696 +kubernetes/client/models/v1_cross_version_object_reference.py,sha256=C7Yt_7o_bV4y8M0QZYlTDLsNk_hUPRG3pHFd0wHQbYI,5895 +kubernetes/client/models/v1_csi_driver.py,sha256=hAfLssmmYyy7QFje97SvuB27dh_uwlEvpeaQGE0tOm4,6665 +kubernetes/client/models/v1_csi_driver_list.py,sha256=SGvIKnlP6--C9UgLorSrMKHdAV3MmRa_VeXFBdBjet8,6872 +kubernetes/client/models/v1_csi_driver_spec.py,sha256=n86VOmnh1AKn5eoFvivIJQ-zDcFaNfd5wpWugOe6EW8,27776 +kubernetes/client/models/v1_csi_node.py,sha256=eGTxf4qK-qlq7uT-8GwjP-Z_TQ-77K7RlnVRTOYb5II,6619 +kubernetes/client/models/v1_csi_node_driver.py,sha256=Gia72_qwB4Ec9LbXcSITYay7-fp4oavuMbdJcjvDIY0,8698 +kubernetes/client/models/v1_csi_node_list.py,sha256=cf3OzWLyGTELVeCitSLJ38ql5L9yB-Mco8Ow0iMsbX4,6822 +kubernetes/client/models/v1_csi_node_spec.py,sha256=DKLBZHYJ0KWtVUiF4kzLVls0PExaAVqpwBxAbehSWG8,3869 +kubernetes/client/models/v1_csi_persistent_volume_source.py,sha256=z9LurCfVwN7EA4afUVLm1I49tYvc_StpFlEFLhJTij0,13515 +kubernetes/client/models/v1_csi_storage_capacity.py,sha256=QAUfPGtOjH-GZ62Z-lbfek8icpYoirZEzRO_OG2oIKk,12001 +kubernetes/client/models/v1_csi_storage_capacity_list.py,sha256=NAzv1MC6FuxzmqyjTfP6d2lfOpLuzbYXOh-HOaUewCs,7115 +kubernetes/client/models/v1_csi_volume_source.py,sha256=TCnuD0sHu1wkUQgC6eY2VgqVqXvpSk78HXHddSV7TCY,8057 +kubernetes/client/models/v1_custom_resource_column_definition.py,sha256=vt4uKTrN00vRsQGcNaG_3rms6__Q0nGCtFNQ6VM1spk,9655 +kubernetes/client/models/v1_custom_resource_conversion.py,sha256=Lp0qJe869J8YgBJx2g_yIKJX4O0FgU5hz4Zn8hqhj6U,5273 +kubernetes/client/models/v1_custom_resource_definition.py,sha256=to2qsAizaIgk8y1u-dvY3EXcDAYteLqA-JdH75xxVMI,7770 +kubernetes/client/models/v1_custom_resource_definition_condition.py,sha256=LOfupIHqc0jRag9vBjKuosWOCq6U0tkbZr89dmbn0fs,9525 +kubernetes/client/models/v1_custom_resource_definition_list.py,sha256=Xu0WhXiTcFQMZeZV2iW1f_Cfre5H1o5tMBDS-3o9T6Q,7265 +kubernetes/client/models/v1_custom_resource_definition_names.py,sha256=Pfut4PIu2FFmLnODSY_sIpKsqRpau5wiWSlq49RHeWg,9755 +kubernetes/client/models/v1_custom_resource_definition_spec.py,sha256=NKvupjYCJRjj10Ccjcd4xT_txfySTqns4QSjyIFzueU,11520 +kubernetes/client/models/v1_custom_resource_definition_status.py,sha256=V3sM_1YzyR_XtCnYaDw3tYBnABNosSToNKGVShCVOp8,7694 +kubernetes/client/models/v1_custom_resource_definition_version.py,sha256=eyv5uST26ivFT8RKor7zeSuup-8PWqLrI9n2V0-sH0I,13925 +kubernetes/client/models/v1_custom_resource_subresource_scale.py,sha256=mEhSSO46p7Gj3-SMJMtC_LHBB8flv4kkhhYeeH7ZKOg,8848 +kubernetes/client/models/v1_custom_resource_subresources.py,sha256=DiGObQKtCjb795xbAc67buWHLIP0te617ciiF6K7NJE,4885 +kubernetes/client/models/v1_custom_resource_validation.py,sha256=PgHRmWoNke6UfsyLjQz2BYzbnxKgeiu2qezL-dTwPE8,3680 +kubernetes/client/models/v1_daemon_endpoint.py,sha256=jCaTSO1dNxPoQ9BHWAisBrwluopkvQEnJ-SB0PU94uk,3568 +kubernetes/client/models/v1_daemon_set.py,sha256=iLG56pFsCdzgWLPhhDQKtB_MX-C0PG-eIZZf2c6Du3M,7166 +kubernetes/client/models/v1_daemon_set_condition.py,sha256=cy_8DSCVCdsk0_e-2gl6ddzLzapqCcPRLWFAnegYtn4,7295 +kubernetes/client/models/v1_daemon_set_list.py,sha256=YRDjZWzWv_CDYHETHEKQfBPm6_LNN5KDxs3kjjTtT-0,6856 +kubernetes/client/models/v1_daemon_set_spec.py,sha256=lXi5Wj8t8OTKTbTF_7AvXbpasuw1y0FCWB41ok8_38g,7947 +kubernetes/client/models/v1_daemon_set_status.py,sha256=RXPAg2RGnfH-_naGCZeO5ArO0DhqSxxGDsvqV3lHu3w,15485 +kubernetes/client/models/v1_daemon_set_update_strategy.py,sha256=k4HLHZJ1fC7Q1iLHv9xPzoRlwpx9lOOonnfqE1e7GrA,4497 +kubernetes/client/models/v1_delete_options.py,sha256=2mnhR2jJxxnp47byrLPksMhCMsvt-c-SlMA--MZCAg4,15286 +kubernetes/client/models/v1_deployment.py,sha256=8IHbP4pdNNAIUHTxJ-5mVjsnhIyw0KwgyqE9eX8Ap5M,7196 +kubernetes/client/models/v1_deployment_condition.py,sha256=UJNPaUTnW_Cvyl8DwdaZcXDctNAHbRDyrsTZp2_Zx8M,8315 +kubernetes/client/models/v1_deployment_list.py,sha256=5qQcWaAmNkFzZ1qP-b6HM02Tzk7Cym2gWbKnmQq5X9Q,6901 +kubernetes/client/models/v1_deployment_spec.py,sha256=gEzQ4k1oBd5ZgcR1XTs-0m7T6Sd-cMUNKNyIWZNBlgs,11289 +kubernetes/client/models/v1_deployment_status.py,sha256=4W9I3W_NT3ZeYmSVfUtCHc-YkSnm3Ynl4gnzl39hcFA,13255 +kubernetes/client/models/v1_deployment_strategy.py,sha256=2KTDcvVWGwp_0Jlgmm4eD_DFWZuLI5CJO7aP6JnRQiA,4426 +kubernetes/client/models/v1_device.py,sha256=W4VBWCI4lFtTbCJ8ofLrc1hF7tMcEIwY1pzdEhRgE8U,18574 +kubernetes/client/models/v1_device_allocation_configuration.py,sha256=MNsbNnhi2EPijVY_u0rEPluK390vn-IHsOVu2w-XVr8,6196 +kubernetes/client/models/v1_device_allocation_result.py,sha256=KdPmL89YtgQmrZMlgobUO4dv4230dfMk5LZqloVwMEg,5195 +kubernetes/client/models/v1_device_attribute.py,sha256=VqD_tJu9CM-BY3I93yzex8POFcTND77RBdQ3XKXj42w,5816 +kubernetes/client/models/v1_device_capacity.py,sha256=n69O2-vluoFqGaqSZqOJuOZTnjWEWhGBz1ffz5G7mFM,4803 +kubernetes/client/models/v1_device_claim.py,sha256=XtEhEwDLDNvyPAgrW3OeAYLXSrA1iYh6kXAuswrR8MQ,5774 +kubernetes/client/models/v1_device_claim_configuration.py,sha256=YB_TpNfMcq9E-iU4Fgc7VWbtKkytW98V4AplfjjzEgw,4941 +kubernetes/client/models/v1_device_class.py,sha256=A9qJTSivQdbTQ2pPKzXVBchYHiQUCunFNcOwx4HTpuk,6711 +kubernetes/client/models/v1_device_class_configuration.py,sha256=rvddUyOlBAod7_GbQdzdmye0G-lhGX-ydFh8NRsW7CY,3492 +kubernetes/client/models/v1_device_class_list.py,sha256=nTjS_8lSS8Gey9EqS6M9nbOonkytQ10XBWdWMm2fqEU,6934 +kubernetes/client/models/v1_device_class_spec.py,sha256=qcca3FtxS09R4LpHUojG9MAvfz57k--gnpHfqepbm-o,7192 +kubernetes/client/models/v1_device_constraint.py,sha256=T3LVE1b_4MXP-GTYPFgQsq96o9NqgOdF7sxfnsCJ2Cg,8400 +kubernetes/client/models/v1_device_counter_consumption.py,sha256=9rY4YKZwp3AqCIEVpcozRidL0ioNLEd7eCd_UmlzLzA,5070 +kubernetes/client/models/v1_device_request.py,sha256=DjCrgjTG6dcGzj9duaTwNGT_GP8_uHOyWJaXJSj-0L0,7333 +kubernetes/client/models/v1_device_request_allocation_result.py,sha256=hx7zRL7H1_W8T46XMxj1xPJzubDZWyx-OhGG7gIioiM,17565 +kubernetes/client/models/v1_device_selector.py,sha256=vmY2EfJK0PlBmZS2y7PrFfIcW1LzepRnAX79kPjx73g,3328 +kubernetes/client/models/v1_device_sub_request.py,sha256=B-pRw-bE6eLjJB19CHzbCrEDZRxXIqQ13vm6zBQBiTs,13339 +kubernetes/client/models/v1_device_taint.py,sha256=3WM4Bvx6PEVQEiBjxkBu3FH-uvl26D_P9mxx2i7Ybj8,6794 +kubernetes/client/models/v1_device_toleration.py,sha256=eZGADfunHMXq7Ff9p0kujn4cMPa5cOjEo471NxQtY80,8723 +kubernetes/client/models/v1_downward_api_projection.py,sha256=X9nXEF-_uFr2NGLgpyt5FkfJHDj7ALHI_pKUc-3BwWA,3582 +kubernetes/client/models/v1_downward_api_volume_file.py,sha256=KXXHIY17c4tk5rWFdZDB1QKN_iFrRNgZ5nnCpyoEVzQ,7178 +kubernetes/client/models/v1_downward_api_volume_source.py,sha256=OXUQX6Hc5Nb32KninbCq7y3P7ZEiX4T89UiJ-ItTiZE,5472 +kubernetes/client/models/v1_empty_dir_volume_source.py,sha256=iMBjvtk6aZ2piFUbOQcN29ncdrnHdDy9xpu0jR5m1r4,5590 +kubernetes/client/models/v1_endpoint.py,sha256=c8tFvl_DJPQLsb0tKS4sm_kioDXkeN31oj4LZTtku48,11307 +kubernetes/client/models/v1_endpoint_address.py,sha256=y5CW2f6nHsJWMfWlZEHfAvJ6jc7WPMuwcnXJO4WiC2U,6257 +kubernetes/client/models/v1_endpoint_conditions.py,sha256=UpI7Y3wjC_1kMdKBvpx_kMWU6bqayqD9BVchYwsfwtM,6467 +kubernetes/client/models/v1_endpoint_hints.py,sha256=EGzGP2I1-ZYdqFQFPNzlUtB-9LGka8OwnqOgplz67Gk,4791 +kubernetes/client/models/v1_endpoint_slice.py,sha256=JOFPIKuQI79i6xtYwqVboGJDB9IXdC3dv8oWXhoCQjg,10586 +kubernetes/client/models/v1_endpoint_slice_list.py,sha256=mKDsy8YXENioIzzIwquA5RDibRJK36LllKhHinxxHGA,6976 +kubernetes/client/models/v1_endpoint_subset.py,sha256=hcBEkrFEyMHBA1451BK8Y2V-7zmavY66NdQv4Bltre8,6047 +kubernetes/client/models/v1_endpoints.py,sha256=IrGiUlFQp_wPejx8lyTxXq3U8JmvTIefZyeKDbDq3Fo,7596 +kubernetes/client/models/v1_endpoints_list.py,sha256=VKee6DgMUDk0bRWkU6U7c6EpiMdorvN1GqfEM20SIVs,6848 +kubernetes/client/models/v1_env_from_source.py,sha256=DCJeS0x4N4qoIZzynd91_muqtMK9N4y5Q1K5d0U5s9E,5214 +kubernetes/client/models/v1_env_var.py,sha256=tXMk-jkNxS_0Lj4Lwomr_Sz1GZ_OwDJ26eJLhxvyZq0,5972 +kubernetes/client/models/v1_env_var_source.py,sha256=r6UD9FSKxoU66RNY3LLzQCvcw07lv625xbAyLpj5yfg,6895 +kubernetes/client/models/v1_ephemeral_container.py,sha256=zyRH_3jNdgoy2vPuzi-WblB0TLBqZplyutcIY10nQU8,34371 +kubernetes/client/models/v1_ephemeral_volume_source.py,sha256=VEL2XVxDWj-M7n4IfWU6O060b_LYoUMReMbaPn4vliY,3778 +kubernetes/client/models/v1_event_source.py,sha256=SBZweui2Eh-d8BG_zPRXGfjm-hWn_kDcvLTgiA3Qy74,4221 +kubernetes/client/models/v1_eviction.py,sha256=2qqHxe84fIJVfVMUuCTjC6c3LHWJHNSOFt9Da7Ks5-4,6690 +kubernetes/client/models/v1_exact_device_request.py,sha256=MRITl_4mhAf77GIjbA28vSpE-xlB-_e_j2WqFlLofbE,13985 +kubernetes/client/models/v1_exec_action.py,sha256=GCxodASx446S1f9Oejszt-1-SecgNmKHmJwXVdg8GJk,4182 +kubernetes/client/models/v1_exempt_priority_level_configuration.py,sha256=JZw6iwi8TgDnpd7k2Jma0REsHlObXlP9Hmu4OCqzpmA,7084 +kubernetes/client/models/v1_expression_warning.py,sha256=hJGeUN7oejCKUo5Cm34G2drnljrvpOvE0mWbTXQxU94,5228 +kubernetes/client/models/v1_external_documentation.py,sha256=Mh68LWdQSKD9XgDCFzT_toyDPs26tIbK_S5Z8qCokOU,4097 +kubernetes/client/models/v1_fc_volume_source.py,sha256=rS3MNTae22WhZr94JOMS3z0ZBgOJbf4tvvb76BjUovo,7349 +kubernetes/client/models/v1_field_selector_attributes.py,sha256=sBSBkHQ3No05Q4KPaV_5z8PU8-EeEaRBM9yVuwEMhgw,5779 +kubernetes/client/models/v1_field_selector_requirement.py,sha256=rqF7rOle42ai2n3FTSlwQUR9XCel80o7IkAfpLqmKuk,6013 +kubernetes/client/models/v1_file_key_selector.py,sha256=Ig6jSB4GSfn5ZQ0o48TJ6EVCnhcaSCyFryYlFTUq1G8,7573 +kubernetes/client/models/v1_flex_persistent_volume_source.py,sha256=gl2tZca71co0_Ax2DcS6_4ef2YCA0-djOac3xjqnagQ,7615 +kubernetes/client/models/v1_flex_volume_source.py,sha256=VNipsdNVc0Z9YoBycTPCjgmS8TVUBB_GKr1daj08otc,7390 +kubernetes/client/models/v1_flocker_volume_source.py,sha256=IeDz2XBgm11Cvp0U40AhRQCG6JxBhsOrnNiP987GCOo,4781 +kubernetes/client/models/v1_flow_distinguisher_method.py,sha256=dyuV7Nr1E2tYbNL7pDFRksD-lkycca3ZlwXsg3V4Qyo,3798 +kubernetes/client/models/v1_flow_schema.py,sha256=hmmq_oySfG4l6NAYdKwWsFhCJZjdF9awBdjFYHj2t9M,7196 +kubernetes/client/models/v1_flow_schema_condition.py,sha256=eWlRFoIfU-KRR8EXg33dVKB1F4v7kBx68I0P0fNVFgY,7257 +kubernetes/client/models/v1_flow_schema_list.py,sha256=mwsE6NaGy5ti82GAHviCr-VPwlsrGvScN6rj_w20pew,6901 +kubernetes/client/models/v1_flow_schema_spec.py,sha256=kBgpSXrYJsb8OODdbXndbDU4xh0IpBHarrekBbtF0ho,7897 +kubernetes/client/models/v1_flow_schema_status.py,sha256=TCCQYoIMzdWrUl2gZFhyPccUvN8FqjW3nq-dKl0ROKI,3672 +kubernetes/client/models/v1_for_node.py,sha256=gpppUAVscFsVhBU_YASGgNAGKHfv3peW7lGNBhL93FQ,3518 +kubernetes/client/models/v1_for_zone.py,sha256=hlp7Fi8Vs1tMEkfiF6qLBal6QNdyOAN0EFzmQICnkmQ,3518 +kubernetes/client/models/v1_gce_persistent_disk_volume_source.py,sha256=iUH-smTKlS3comT309LBGZNB7pQ-zs1FteyjmQvj4Z4,8034 +kubernetes/client/models/v1_git_repo_volume_source.py,sha256=TOvrljXUPAch7m3sZqX1mIKFVM-jvvCan8WMwtL3Om0,5828 +kubernetes/client/models/v1_glusterfs_persistent_volume_source.py,sha256=8o5hY59_S0s9cIoNeHkE6XMOU4eMIJD_nFWPhoAk5AY,7759 +kubernetes/client/models/v1_glusterfs_volume_source.py,sha256=sXbUGEqcQub_Hkr36SovE9OxYMo155-RWJqWykeRYmk,5961 +kubernetes/client/models/v1_group_resource.py,sha256=hmzuHCarapioMwdI_p7cujjBe01VK_KeXLjAwtdcI4A,4294 +kubernetes/client/models/v1_group_subject.py,sha256=0lgzTKM9clutBwGi76qRkJzMIZ-UomoGm8Cm3kcR_Uo,3888 +kubernetes/client/models/v1_group_version_for_discovery.py,sha256=B-SscpbdXOyfgRcnK_QbfXXEp5ygYLjmce5IQ-hTtdU,5076 +kubernetes/client/models/v1_grpc_action.py,sha256=FxZmPfqt77lq_QDpaR9epS-OguujZgcBjZXvclUNA-Y,4721 +kubernetes/client/models/v1_horizontal_pod_autoscaler.py,sha256=GbgBViNqiIUHugKzMOweGsbEpwWq9f88lZyB2aj4_pE,7586 +kubernetes/client/models/v1_horizontal_pod_autoscaler_list.py,sha256=bC0cM1jN5I6HUnNY0K7phkp71tyouAfBuykuuazf76s,7244 +kubernetes/client/models/v1_horizontal_pod_autoscaler_spec.py,sha256=Zqa32zltIM-Uez6uujcXb08PYuoG2NvEbS7Xgolqn4Y,8320 +kubernetes/client/models/v1_horizontal_pod_autoscaler_status.py,sha256=RPd72_HekW9UTNSSfqElvxM-_jCj-Rss7cWDZQk9vlE,9425 +kubernetes/client/models/v1_host_alias.py,sha256=Hsqm9ZhG_nNUT181971Y8RQXEyklKRYz8g05ntOlOaQ,4293 +kubernetes/client/models/v1_host_ip.py,sha256=P7cvEqSRtEbaIWnx7CseAlBEzC1LTT5NPK2yDNLljZk,3476 +kubernetes/client/models/v1_host_path_volume_source.py,sha256=NZb736UBfSTKQP1HisrwiUybkv392c8evLapIK-_nTw,4785 +kubernetes/client/models/v1_http_get_action.py,sha256=1CC5aHYKzPw4eFJ0g5Zy6WaM5U5M1GvACim38GM81MA,7067 +kubernetes/client/models/v1_http_header.py,sha256=XtkUEsDSv4Xt1aJLerzeohfa1tY6W6WjSps-t3rUoJ8,4556 +kubernetes/client/models/v1_http_ingress_path.py,sha256=UW1yGyJN4ivJND8wTyFmAEIPoDiJ_V_-xiu3xjpPlMo,7434 +kubernetes/client/models/v1_http_ingress_rule_value.py,sha256=y2OSJjUB2mGwSlnlWzrtJDry_wh7ilFXhvMGYFGmu0k,3751 +kubernetes/client/models/v1_image_volume_source.py,sha256=ILMGa0I18X3pRWS_dqNIjGJJfo9uu7M45qM89dLjdx0,6332 +kubernetes/client/models/v1_ingress.py,sha256=aw5IZf413bdHgfrJrCGBfip-IABQ8po0lmDnU_NDEbY,7106 +kubernetes/client/models/v1_ingress_backend.py,sha256=G0C9QbjPoKEP_O6zormmVvhRZo5hEj0r7araFUJdSLE,4165 +kubernetes/client/models/v1_ingress_class.py,sha256=rpxQqS9lCzxMHrYI4UXCNXgPP4tChoDIgajzt8104E8,6580 +kubernetes/client/models/v1_ingress_class_list.py,sha256=WRSflW1PZv5alaa-vMC4-wDsiwFhue_xRJh0toIkwaA,6953 +kubernetes/client/models/v1_ingress_class_parameters_reference.py,sha256=GiGjUJ4i5FXBk2F2KjbGZRVCWw7ybHGDRKGyuq4XFKg,8009 +kubernetes/client/models/v1_ingress_class_spec.py,sha256=pAbC0pUjRu07LXppeVu_aPgkxTIP5jcVyv75l1l8G-o,5087 +kubernetes/client/models/v1_ingress_list.py,sha256=wnKFHgCJ2sEjfRdJa3UxkdlV-BDXX5KNJVXrOh0Z90s,6824 +kubernetes/client/models/v1_ingress_load_balancer_ingress.py,sha256=qCgvtJhpixfFBDG3AbzNFyThTMBMOHBr4_UppWKRUuU,5344 +kubernetes/client/models/v1_ingress_load_balancer_status.py,sha256=bb48HMW2uC_Ybvi5tR_wLv5ia623DZWJrnbpwfQfkAU,3719 +kubernetes/client/models/v1_ingress_port_status.py,sha256=_IrRifkEEjqwXZH96MktZ7cLS-Z_06A1a_Mv8UDCS8g,6010 +kubernetes/client/models/v1_ingress_rule.py,sha256=cBrNIf11j3S0CJzBc4GPAzGTF1H6LYkEXGYoxid2ozA,6694 +kubernetes/client/models/v1_ingress_service_backend.py,sha256=lKoSlN28nhhXL9nd0odI5lVsfYAY6TW_TLHJC_WSXKA,4426 +kubernetes/client/models/v1_ingress_spec.py,sha256=0nYdfcxJ2rd2WXm470I9K9EjAWSFOXnF2DUyf39b3nU,8144 +kubernetes/client/models/v1_ingress_status.py,sha256=3Jkga54khCE0A24ACI-jSQ_Jy29csC7peQ4fLQv-awY,3543 +kubernetes/client/models/v1_ingress_tls.py,sha256=5un1_bub0ToIXCYlHuCj6p1AhvYoC1upFPMx8OlSHYA,5274 +kubernetes/client/models/v1_ip_address.py,sha256=7wWMRRbDGPZ1YC5Ed7ZR-ze_oU3Xia28zQTbrUVUxY4,6511 +kubernetes/client/models/v1_ip_address_list.py,sha256=GKMlvkmvYcOg-OV04QsdIoePteD78Y54rnmG62phTcQ,6878 +kubernetes/client/models/v1_ip_address_spec.py,sha256=r44qcRAfpcbd-prUgAXU_93_KMdErVSzW6ohvNcnl5I,3613 +kubernetes/client/models/v1_ip_block.py,sha256=Q8Wzj4oiN-67Uk8FUpS3r2FE2HT4eE1Kx8EUnW39WvA,4726 +kubernetes/client/models/v1_iscsi_persistent_volume_source.py,sha256=a7DLColz62FEH5bWBWu3FipYPMMNTZMWaHFSncFBVag,14704 +kubernetes/client/models/v1_iscsi_volume_source.py,sha256=dg5NF7hvYOEe6GobBOUY3LtjEr1AcM0RJ8CfaqpeucI,14263 +kubernetes/client/models/v1_job.py,sha256=qA0Ek_3UlFqZuytEoCjoUl4EThQX4cV-NfdpOS6roRU,6986 +kubernetes/client/models/v1_job_condition.py,sha256=2s3nMAZAa-PmhqkOJKeaZUVuSp8JABMHvzHsWSchPF4,8111 +kubernetes/client/models/v1_job_list.py,sha256=kXNqlIPgH_-35MdRsjQaokvdTZEv3Q0W5vPLwxHhA8Q,6726 +kubernetes/client/models/v1_job_spec.py,sha256=fdA5s3a0QnviAEMc25YM4CEHPAeDXpow2QL5ZXZror8,28103 +kubernetes/client/models/v1_job_status.py,sha256=QrNlD2YdaRt6xlbPeZDJ81DTB1ZN2ZiQ6zRO5dRF6x0,18043 +kubernetes/client/models/v1_job_template_spec.py,sha256=KdEO_fXBTKaFFyW_lR2vBuJyMJySm2XkCKk-RSQ_SHc,4030 +kubernetes/client/models/v1_json_schema_props.py,sha256=fYJvpwrmNL40lVhW--2Zb9AAdeYJ6c2N6-j73c_tnOU,49318 +kubernetes/client/models/v1_key_to_path.py,sha256=-T03spIWAhkKQl0Er4Qljl3O0bEuVK3Eqjvz4QUTUD0,6043 +kubernetes/client/models/v1_label_selector.py,sha256=lQYyKDUqy5sJ-4zLXO4k9r9LKcWZ6iXm22PRMn5dr88,5205 +kubernetes/client/models/v1_label_selector_attributes.py,sha256=hFOAm3cNd2kzRqZ16mcVH0u3ltUHZfye2UZpcSTjGoo,5779 +kubernetes/client/models/v1_label_selector_requirement.py,sha256=1G2VQGeH-eB6tc_3Wk29MjOQ_XlO2OERjHio7QFC6Lg,6013 +kubernetes/client/models/v1_lease.py,sha256=eWdGrZhEizk9LxyoZnbPm2XNVik-hAaxPpPfPeFqIv0,6419 +kubernetes/client/models/v1_lease_list.py,sha256=J4DYd2__AWdsy2meI-4aCNHDfUblMR7CSatF2AOe-SU,6788 +kubernetes/client/models/v1_lease_spec.py,sha256=hykw_DesjX6QhtnDuToGLOuPBXf7_Vq81mF7HDjd5Bg,10447 +kubernetes/client/models/v1_lifecycle.py,sha256=dl_n3A5MdUrhaGkhYM1_RrOeNlIZVWOYobSZM_j-nBE,5331 +kubernetes/client/models/v1_lifecycle_handler.py,sha256=rXg8mx5Ep72PkBJjwjrhDWUiAFxnwQUgk8W8IviPhhI,5491 +kubernetes/client/models/v1_limit_range.py,sha256=x_V3nCxRBTuZ46ddBZdF6TM_nnn_zAoE3ALQflJKPgc,6534 +kubernetes/client/models/v1_limit_range_item.py,sha256=FVgAzZ4XSAQto2defKEOaVg4y_FOz-BAsi8WqwipOKc,8648 +kubernetes/client/models/v1_limit_range_list.py,sha256=tLxgn177NXhywoYMAE0KZB_-z-wIfzXX6tluQjcB6Hg,7091 +kubernetes/client/models/v1_limit_range_spec.py,sha256=lLPW0ol2PaJyMXFiqfgONik2PjsfZglxfWjDWtDe5Fg,3725 +kubernetes/client/models/v1_limit_response.py,sha256=rJubPZBotfq06j4OH8RNT1GkEw6F11g0zYirnnrnVvQ,4744 +kubernetes/client/models/v1_limited_priority_level_configuration.py,sha256=J51vJ2SjtEMk5MzSaObuHeGz6mGkqy1fnlAqMimqOwM,11019 +kubernetes/client/models/v1_linux_container_user.py,sha256=zkJQWoqZYt7XSn6YvANkpCUywWjOXatYlFhVt9BNXOU,5793 +kubernetes/client/models/v1_list_meta.py,sha256=JqTIcSpQbL7418dAHJ44wpkQXehDzFJpXHEJQeZTAJ8,9404 +kubernetes/client/models/v1_load_balancer_ingress.py,sha256=WgY5dyHpRoAVZHZuhHw2KhUZ-JFbBHT0fImrbzqKjiE,7117 +kubernetes/client/models/v1_load_balancer_status.py,sha256=yQ6XTur99psc9EgNXd4MtjFG-y2ZodRakngO0X61QNo,3788 +kubernetes/client/models/v1_local_object_reference.py,sha256=X0EOcIe5wjsqdRazdbiSwWol1Ih742B2gLP7zrUeuKk,3958 +kubernetes/client/models/v1_local_subject_access_review.py,sha256=g5VKsqV6P3Tu90XP-2gtIGiMPReOlYV8xBKHl6lscQ8,7740 +kubernetes/client/models/v1_local_volume_source.py,sha256=r20b3_WjNX52i_EqIxnbePNsbAZJtqj5yUI8E4OgDBQ,4972 +kubernetes/client/models/v1_managed_fields_entry.py,sha256=cLgHQjol6b5DoMjQKrcSErYNB3_rM7stb2oPBvf-wxM,10901 +kubernetes/client/models/v1_match_condition.py,sha256=Q4PyEsD4qIl3BrVjYiPupOtOM-og9NeAS8n2bvGMn0s,7295 +kubernetes/client/models/v1_match_resources.py,sha256=FUeWtkfMTwQXsh-RbT8GIv65E2eMD9coFNUqYXTRsaQ,9988 +kubernetes/client/models/v1_modify_volume_status.py,sha256=nL2K4-8Nea-UOrC-WxrQ9LVV4f8WX9Dd1V4uP-ZlLyc,6333 +kubernetes/client/models/v1_mutating_webhook.py,sha256=jN9gj_islePvgwHWuIcm3WyfSHmAbTSvHXQx6uRuPb0,23045 +kubernetes/client/models/v1_mutating_webhook_configuration.py,sha256=HdMS9ZEMNAtMwMHz9IXAW852hP7oxY7rXlJGCQaWxAo,7187 +kubernetes/client/models/v1_mutating_webhook_configuration_list.py,sha256=vnvKsOlamE4JT5XgOlt0a8T_ZS8x9JlkwUVYiKiUYfg,7323 +kubernetes/client/models/v1_named_rule_with_operations.py,sha256=Y_POUMkmq6nN0Ugy4adJy2cxI86EDwOGrlTSebJfl74,10692 +kubernetes/client/models/v1_namespace.py,sha256=aD-WloAHO6pQwhzAjasEAyTrB8OM-HoxoZZKDIFBEAc,7166 +kubernetes/client/models/v1_namespace_condition.py,sha256=CLQqO8BncRnOUdO0TCWi-kll9arU0k544lXrUgFn4Uo,7363 +kubernetes/client/models/v1_namespace_list.py,sha256=f-amU5bHbUAKQn2YLYgLZ6BY4hQROrXIthNciS8q63Y,7092 +kubernetes/client/models/v1_namespace_spec.py,sha256=aV5jgfGKQ_mxi4bLzffCwbqg__7u8M9yTj7HjbFYCsw,3826 +kubernetes/client/models/v1_namespace_status.py,sha256=dM_faBNtgDetYEdieHu0rugqyneBE4nfIGue0hseK40,4616 +kubernetes/client/models/v1_network_device_data.py,sha256=eGaMinlCTOIg95bn_R-8XLLqTrCuKZmscsQRIk_Z-6M,6424 +kubernetes/client/models/v1_network_policy.py,sha256=wkvD0V4KR2MFCpvcXAwT8uxPkQOCXVqxP2f0IfE3vQY,6603 +kubernetes/client/models/v1_network_policy_egress_rule.py,sha256=v9oPtkxT-9ts929kz1CUxEYEluG0pf8nPBtYRaJyV38,5713 +kubernetes/client/models/v1_network_policy_ingress_rule.py,sha256=7iMSeSn5dy4owEMMjEKv45CZUMIYQt-_pL8VWjBW690,5852 +kubernetes/client/models/v1_network_policy_list.py,sha256=AVm44KRXu5q82A8ZBwu0OLIS9yGtFIlwJEGVUUUNiOg,6972 +kubernetes/client/models/v1_network_policy_peer.py,sha256=2EFIu-HT9h2PknaVyftJTAsoF8_PCkuoc1oCrUXfcDc,5141 +kubernetes/client/models/v1_network_policy_port.py,sha256=ozjSoiz9GFN_jyH2i1BRnCLm0VeNoj1mO7ZJkG93syY,6154 +kubernetes/client/models/v1_network_policy_spec.py,sha256=fpuhb-X3PjDxm8B2EvFx0b9WA6Zwr0mAeO_0xeC-6aA,9596 +kubernetes/client/models/v1_nfs_volume_source.py,sha256=H5mv8tDPpgkTD77UGaYAwmdYqb6SflJmjsnkEW_riWY,5884 +kubernetes/client/models/v1_node.py,sha256=j8SFQoK_c_l8fGyoR03BQMdpMmNlJpzI8nnpfeW9P-w,7016 +kubernetes/client/models/v1_node_address.py,sha256=3P3bhfUPH7BJv0Oh_u8ulwkuUh8nMdsKt8C1cR65Cxs,4476 +kubernetes/client/models/v1_node_affinity.py,sha256=0fhVPiv5MMVLmRty4BjOp6zztOEU8rfcUh4hOrYhvM0,7138 +kubernetes/client/models/v1_node_condition.py,sha256=_-Pe6iT99bf-wUJrH-XtLaNs7eIno4lZQvcMUYuLDSI,8205 +kubernetes/client/models/v1_node_config_source.py,sha256=XF1zb9wXOPU1aywHE2IDPqN-WnaZbX_Igrc8t098dx8,3507 +kubernetes/client/models/v1_node_config_status.py,sha256=7XKKX9Vun4YRc8fQoAippIXoswbL-77u9teQRxWI5GE,7722 +kubernetes/client/models/v1_node_daemon_endpoints.py,sha256=MVlj-AbE_gNw3Whu39ZmYsHf82MJIAfEmalENm7A0aE,3618 +kubernetes/client/models/v1_node_features.py,sha256=Js43yJC7lpdaqgth6mvAxtD6yyFPSJoGlXvJMSf926M,3985 +kubernetes/client/models/v1_node_list.py,sha256=H17I8y1JWkQt6n0QGCMBMGsoV5pw5kGVvnFP5KR0mXw,6723 +kubernetes/client/models/v1_node_runtime_handler.py,sha256=P8a_m5ShbkWTl3fw1Yt6A4zEE0IYzf6knvcPOGk7hI4,4262 +kubernetes/client/models/v1_node_runtime_handler_features.py,sha256=GA7e97yX3GGS9QTxS_m6S0curXmgJH17xoRBzFUh9LI,5181 +kubernetes/client/models/v1_node_selector.py,sha256=nm-4eo6bvfCFVYKdRldPYJOg4y4EK92E8M4DbyvIISQ,3980 +kubernetes/client/models/v1_node_selector_requirement.py,sha256=AqCJLlOde_jVo6yQ4MlIwO0Yu7ll4LkSypYKx8UBQOo,6193 +kubernetes/client/models/v1_node_selector_term.py,sha256=P8oVjZ3zGREJO9y0zmV1kCI5FX4G-G53E9JSNcesPwc,4811 +kubernetes/client/models/v1_node_spec.py,sha256=62sDCTc2UMyLgvWdZeFeNyOFjk9Zuu8OiCrd8v2G6nQ,9288 +kubernetes/client/models/v1_node_status.py,sha256=cXyHeMOd4_0u11QzPDwPjzQGXeD-jGUyFj7slZ9940k,16610 +kubernetes/client/models/v1_node_swap_status.py,sha256=slORgHGvffyiEQGLFgcbHwcXy4qu3y3XMXaQubx19Mc,3500 +kubernetes/client/models/v1_node_system_info.py,sha256=C-bWBPRWLStIcw8DrDxuba-62bGyRLpHhif2tveBeK4,15034 +kubernetes/client/models/v1_non_resource_attributes.py,sha256=Kodr-LXYqgQWkrP02tihIgkqNPwsBnVZOoRUk7f_S7A,4199 +kubernetes/client/models/v1_non_resource_policy_rule.py,sha256=LAevrWn3tZG67gtLtGqNNmemMI7LCUysoRbWVyyTRvk,5783 +kubernetes/client/models/v1_non_resource_rule.py,sha256=1-Fa1bw4lJe5wfMC0zjEY4hn64mDWGnGlJkt5E7xuBg,5041 +kubernetes/client/models/v1_object_field_selector.py,sha256=NbDGXZBcBoecDTRK8sbf7w52gakEm_2c7d9r5FI7Ufs,4735 +kubernetes/client/models/v1_object_meta.py,sha256=kcTfZHbMHrxmMyrUBUePFki1mpMGmPzgy5gbEPtNAfo,28280 +kubernetes/client/models/v1_object_reference.py,sha256=E4adrfEEyhfcdk21C1htnu-goHhQnwSrlbFKzRl361k,10311 +kubernetes/client/models/v1_opaque_device_configuration.py,sha256=oGkghRDeWb0IieUWQbxcCL9ftlW7bScE0_9ujVy-b_s,5976 +kubernetes/client/models/v1_overhead.py,sha256=Q_AyXDmclCYXttlvpMd0mRKHNvXB-k1mVPv1Z_hO3Dg,3586 +kubernetes/client/models/v1_owner_reference.py,sha256=pGetcetlYiSekgbpy66kJjCmLKHCL7GCyJ83HxtX0G0,9564 +kubernetes/client/models/v1_param_kind.py,sha256=fMWTJWZLLZTn7HNCL-IHVKN9c0vlhXmNM7ZVQqtxWs0,4378 +kubernetes/client/models/v1_param_ref.py,sha256=8kz31xlogJpqh5Yvkcsk3neAoc9bFul3lWy0mgCiXv4,8716 +kubernetes/client/models/v1_parent_reference.py,sha256=BRhIFMt9O81ENWEiU3eEjfobqisHsQwQpaWVZiUxsJQ,6219 +kubernetes/client/models/v1_persistent_volume.py,sha256=_llZn3RKuJqPBsL8265M1Uo4ygLaXojulaHddJZski0,7376 +kubernetes/client/models/v1_persistent_volume_claim.py,sha256=9MSoIeYcCPjv3oYUqutgiv9ChMKh1-8XL5omUKqt1PQ,7526 +kubernetes/client/models/v1_persistent_volume_claim_condition.py,sha256=2PKMBnGNCyKSUEuiKYQKfVidwVbQ6DhpIkjxgbQA8Fc,9885 +kubernetes/client/models/v1_persistent_volume_claim_list.py,sha256=bJRT9uSkb4P_B94GNzbSCNb_1liYqiMVzYMqUjfhx5M,7370 +kubernetes/client/models/v1_persistent_volume_claim_spec.py,sha256=lPOBeNfErdEy88lC0dNhf0Y8ALzDF1x_OOq5pW9GqJE,13431 +kubernetes/client/models/v1_persistent_volume_claim_status.py,sha256=79nzQEhNVOZodMw0my9fgv1QSBq7kmf3cWYyvB4Fsxg,18454 +kubernetes/client/models/v1_persistent_volume_claim_template.py,sha256=FPQfJFTzZGzbKJB5Bv7L5v1aBc0HPRemGPccNoeHn8g,4406 +kubernetes/client/models/v1_persistent_volume_claim_volume_source.py,sha256=3KstmeL27zZZBhooR4YeSzFvTfXgJdhrJ7BA-Z87J-I,5132 +kubernetes/client/models/v1_persistent_volume_list.py,sha256=da_SQzQdoMO78Nd-oQAZV-6AgU0vA-wqnr5mzy_a2ks,7197 +kubernetes/client/models/v1_persistent_volume_spec.py,sha256=MPuU82NwTXFa41lcGo_sQjP-DgDNfKKGDKCtInmfPX4,31908 +kubernetes/client/models/v1_persistent_volume_status.py,sha256=yCNG8t5LTcGioa3uZ4PoW0dz0LD23MfD339nflU17z0,7067 +kubernetes/client/models/v1_photon_persistent_disk_volume_source.py,sha256=q0-RgnxQ2AUhiltyYW3m4l-nUPDhVqJaW3plRS-3cOc,4940 +kubernetes/client/models/v1_pod.py,sha256=70UngGJ9nt86w0mYMbQ-NDpJiR6uxQuS2M-2MVRiPb8,6986 +kubernetes/client/models/v1_pod_affinity.py,sha256=2xA6HyEPSYi2PXIWv1awffi9Zb5tzOKBrMo0zvXapII,8191 +kubernetes/client/models/v1_pod_affinity_term.py,sha256=HXcfQ3uRtYkGj7fSbQ4R0vF1yrxXp4bXP2CnHmdFtE4,11726 +kubernetes/client/models/v1_pod_anti_affinity.py,sha256=oo6UFe9lP20S7SDUlUV-MIbpRzIMNilIucHuGSVrD88,8293 +kubernetes/client/models/v1_pod_certificate_projection.py,sha256=FWQUVWTkVwRYvJ5qvXuKShiMZ6RzetASEmeiG_1J3fk,14956 +kubernetes/client/models/v1_pod_condition.py,sha256=V_SbC_zB3DHlks15guGm1knq-wDQG2i6OQkYs7TOaN8,9809 +kubernetes/client/models/v1_pod_disruption_budget.py,sha256=LnCrk-gjy4-MLZK7iYZCZziqAhiF7SXXf-A2hzirHpo,7466 +kubernetes/client/models/v1_pod_disruption_budget_list.py,sha256=bLUZLOz0WIrhvhRvuLdCL6dCsPv2qNtRmg1xBW9jCnk,7120 +kubernetes/client/models/v1_pod_disruption_budget_spec.py,sha256=Rg4WKIQgL4tmUTLQT7cXSH651eA9Mbhgd_PjGWn7YZ4,9924 +kubernetes/client/models/v1_pod_disruption_budget_status.py,sha256=tZ8HcSKXEB9vXrGujv5bNQM1wkXZmT-2M32NnsiX20c,13928 +kubernetes/client/models/v1_pod_dns_config.py,sha256=gnpAtNT5EJXgeq5dUgo5-En73Q712koR8i0FEV7D2fc,6059 +kubernetes/client/models/v1_pod_dns_config_option.py,sha256=2-PMCpmsE8DxuNYigP8kf3EZNobtbk0ZpEySlZoMTaI,4237 +kubernetes/client/models/v1_pod_extended_resource_claim_status.py,sha256=4UH0fD-b6ijLHtT62ZeIzKbsoXB7M_XWSMNvd7Zm9Wg,5654 +kubernetes/client/models/v1_pod_failure_policy.py,sha256=fsm_iyzi3SXVTJWI3xMCLuYcgSg-sy5aTiyrcmpCC1U,4278 +kubernetes/client/models/v1_pod_failure_policy_on_exit_codes_requirement.py,sha256=uBR26DVdzKJeQfJ9PDIWrXHU-lyGqCCjDtP5tAx-a7M,8359 +kubernetes/client/models/v1_pod_failure_policy_on_pod_conditions_pattern.py,sha256=pI1kEdfz_CFGix0iJdXO81KogP9Ov8nLpvhKcVL4AX4,5055 +kubernetes/client/models/v1_pod_failure_policy_rule.py,sha256=nsiGoWUyVG3YBFldfVV6Q_btmUeW2yKtXt6HEvwWWak,7330 +kubernetes/client/models/v1_pod_ip.py,sha256=pJX99qy1_j3NZwfjttAqJAZoJLuRML0Bc16CmZ5HCwk,3466 +kubernetes/client/models/v1_pod_list.py,sha256=X4mvxErUNJzCYNSbQZ4oR7t_RKk_kooUlkX2UD2Mspw,6890 +kubernetes/client/models/v1_pod_os.py,sha256=htdkpoI-uU2a_4KscqckHQnhPyEsJ_iMqQe7x4xitHw,4154 +kubernetes/client/models/v1_pod_readiness_gate.py,sha256=sMFX0BKMrAr-p1YDZj5Tho6hlbFea0uJTqohy7YBtjs,3891 +kubernetes/client/models/v1_pod_resource_claim.py,sha256=p-ro1oRn2__DHlLfta22LowPdw97_O0e9H6b_DdOw54,7425 +kubernetes/client/models/v1_pod_resource_claim_status.py,sha256=3bE3eRGWT7Y1VJJteNx2yQXZtaBevwpgu6rqybjaRV0,5369 +kubernetes/client/models/v1_pod_scheduling_gate.py,sha256=pt0yXMs4pXRSqXbwb9lTKX8ZFvDjmOIYCv2tVOyPYvE,3684 +kubernetes/client/models/v1_pod_security_context.py,sha256=al_A7Pjga_cxPzHRKHh9Dg-oAeCfNlOxptM0WCDGSuE,23939 +kubernetes/client/models/v1_pod_spec.py,sha256=e0zeF7TQNyTSnxbXc401Qb9WDp_iRJEvXpl0iZTUgtk,59094 +kubernetes/client/models/v1_pod_status.py,sha256=9jOlQX_L1tVVo49-nZyW2PjtZvckHi271qJ64w75cqM,31232 +kubernetes/client/models/v1_pod_template.py,sha256=WJ-qdHJVXSi8HuItySbWOkz4sz8FX2lYjPi4R0ths64,6637 +kubernetes/client/models/v1_pod_template_list.py,sha256=wrto09sLMsj92-twnKFRoXngSgCF97AFxxljungCmyk,6900 +kubernetes/client/models/v1_pod_template_spec.py,sha256=AQFFpWm6Dp_RD81bGtE79YXdwYrfFvBsluDhMtaH--M,4030 +kubernetes/client/models/v1_policy_rule.py,sha256=plMLKiuCm1eK-C5njIGdUSPkLDx6jptqp2FTulCnirY,8744 +kubernetes/client/models/v1_policy_rules_with_subjects.py,sha256=vGW9hkYFyrL5yICuWpGXTCV32U4ltX61k4M4ybH4BzU,6921 +kubernetes/client/models/v1_port_status.py,sha256=ZLLnJNZty3k0LPoeDhEp38YzcET9Lx9I0j5d_oq9BSk,6026 +kubernetes/client/models/v1_portworx_volume_source.py,sha256=y1aPxJl6T6dREvcL6g-ux2mmlAGBkRICLn3DNCmHRm4,5809 +kubernetes/client/models/v1_preconditions.py,sha256=uWT-wnr_nn3sIKaW3JZs2lEbOwy7uH5KXAOmMaHepdQ,4314 +kubernetes/client/models/v1_preferred_scheduling_term.py,sha256=JTvv6szgRIxT_UZoI-uT-VSeYdpWTUVBHzgUBzgObF8,4742 +kubernetes/client/models/v1_priority_class.py,sha256=kZs0b45VEu6MbMJMZiic5sAFRrMXOH6rdUhrC7r1lec,10904 +kubernetes/client/models/v1_priority_class_list.py,sha256=dhJ0jQZV2jA13rqGGFabbTV_xuMjeGV1pWvLUYe4xLs,6976 +kubernetes/client/models/v1_priority_level_configuration.py,sha256=8S9PUx_UqDyNLIKMlBt9UngRGwt1NfDGBUapF_YwjUQ,7676 +kubernetes/client/models/v1_priority_level_configuration_condition.py,sha256=Awv6Xp5LKvyXyyEtujRM3Hh0DXwnEMxA0BA8u-lfG3I,7641 +kubernetes/client/models/v1_priority_level_configuration_list.py,sha256=Td0mEJzLnq-QLobfEdTPyq4lxg-pxAGj8qz_sQzbplE,7283 +kubernetes/client/models/v1_priority_level_configuration_reference.py,sha256=1blFqvjrDx233_UDlxCJFMsBzHsJ4M15iWzf670ZXKg,3830 +kubernetes/client/models/v1_priority_level_configuration_spec.py,sha256=zTNsXkTcdqTiZmZlU6jr946U-0bHkiNqaLASw6s6Ess,6229 +kubernetes/client/models/v1_priority_level_configuration_status.py,sha256=5cZ7pVMCHNiaK9NwIJYhXnB4jT0nAvamwbK9E4lvxs4,3846 +kubernetes/client/models/v1_probe.py,sha256=alkMgDrQppX3dY9crjn8-G9l6m6X2uDxjbWqcQAfSy8,13723 +kubernetes/client/models/v1_projected_volume_source.py,sha256=OEZ5i3C4RXXcIIC87e3xPMw41VA5817vwG9Sgue3pXs,5411 +kubernetes/client/models/v1_queuing_configuration.py,sha256=bRNMUipcKsk3zeDXECKaCxhyesgIqaOIIVaJIvFWVmc,7495 +kubernetes/client/models/v1_quobyte_volume_source.py,sha256=hr_7jTGu_Jo_q5bg7TVlpMMWflBTT2_5XTFaEz2-NnM,8515 +kubernetes/client/models/v1_rbd_persistent_volume_source.py,sha256=s9KXo4xYZtuNniykCVC4L0Zj3tWrheAZOxmc__S1LG0,11076 +kubernetes/client/models/v1_rbd_volume_source.py,sha256=RcvkH4TKNhn1xq39kv9K--DGTnnqdDLFNf9rVCIczdc,10731 +kubernetes/client/models/v1_replica_set.py,sha256=LQWJaNjRXWJPi4k_CZ0qAMC4d_KQKVyIrmatuYm4Khw,7196 +kubernetes/client/models/v1_replica_set_condition.py,sha256=j0szkNrHmRqpm8HL17DymhUf2QcH6mUPu9k8lAHa680,7331 +kubernetes/client/models/v1_replica_set_list.py,sha256=_HiQ6uxiIXD15kKySl0AJUsIO6CVjBe6W6SJNf0fwak,7035 +kubernetes/client/models/v1_replica_set_spec.py,sha256=0OSgz9l8UdvuKRbpWTNugkljiksty0r516_wYKibB3c,6751 +kubernetes/client/models/v1_replica_set_status.py,sha256=HXiyeHoKuRRutdFhfAkjWlCC_wp54DWyMmmccWc_u3g,10932 +kubernetes/client/models/v1_replication_controller.py,sha256=KBCuwFAfqNPEU3JXSFjlBCHTxYUhKSTJM2oW9RNRhXk,7526 +kubernetes/client/models/v1_replication_controller_condition.py,sha256=V1T1YkMvPX0EPdJfgFaca1NfC1Il3lHQLFeht-OHmZ4,7617 +kubernetes/client/models/v1_replication_controller_list.py,sha256=fi3XFWqlZi7OnZ8XyWYbOvdnXncrxrIDiPAaSEkh360,7334 +kubernetes/client/models/v1_replication_controller_spec.py,sha256=fmdzxH5a0ZMHXzze39mdhSMl3_sBbknDz09Le_DVECs,7744 +kubernetes/client/models/v1_replication_controller_status.py,sha256=huVtSNu2t_3mQCGMABejy7ypnriHUVqM_BXMIknCqsc,9773 +kubernetes/client/models/v1_resource_attributes.py,sha256=Ic0s6e1B1KJLYNTUyoqh13PlCsXANcd-W88s2U2z7-w,11116 +kubernetes/client/models/v1_resource_claim_consumer_reference.py,sha256=EIocfdGN_vJDbQR0hieW5ca9-HuSEv-A-OK1w603RcI,6891 +kubernetes/client/models/v1_resource_claim_list.py,sha256=SdUarw-xs5daqlb0whjY3Qer2G3EAiszWNmKQfEa6Oo,7002 +kubernetes/client/models/v1_resource_claim_spec.py,sha256=7dMnWJmnK26k1bgCUytU2FM1p-pSdjziX3Ah6An_UdU,3414 +kubernetes/client/models/v1_resource_claim_status.py,sha256=v3-HuUfyRSpKavWl1ni-jYC3q8cJ9vgUJ1dC0nBWj1E,7471 +kubernetes/client/models/v1_resource_claim_template.py,sha256=7p1u632s2V4dmjQwnMiZgmFq_DLbhcTWojIdg4hA5kg,6941 +kubernetes/client/models/v1_resource_claim_template_list.py,sha256=IJDyiJeM2b5rqt0m4NdJ57GQz3ymLusojPO7rO5KFsk,7180 +kubernetes/client/models/v1_resource_claim_template_spec.py,sha256=42uQg9r1N_tR3gTAIZhYyyuFF2i4k264Sv71JkRnWYU,4334 +kubernetes/client/models/v1_resource_field_selector.py,sha256=kfHQu_t9lrHjyYzqKBhiOF8ncZPc8nS_PPs6ppOPCPY,5549 +kubernetes/client/models/v1_resource_health.py,sha256=jxXtXlpr0ztlF-8zfQbm5oTPqXaog1qVxUPOC1P3etY,5453 +kubernetes/client/models/v1_resource_policy_rule.py,sha256=xfFTsxcacmsO6kGHZKrCHqW6SDAnvyzU81Q5xubl91Y,9571 +kubernetes/client/models/v1_resource_pool.py,sha256=br1SOPDXXw-XC8WF62hVmZkG5Y9dRz8PWCJhYtSbZ74,7738 +kubernetes/client/models/v1_resource_quota.py,sha256=NVobMpZ8sIDqvtasfPspEZwiAHo6bTpFePMryzmTWhk,7286 +kubernetes/client/models/v1_resource_quota_list.py,sha256=A-_ikJc5VlSE26U01bxU164S7hmexCvXWBUbJKvYTXA,7128 +kubernetes/client/models/v1_resource_quota_spec.py,sha256=vARHBq7WruwJQcA5rL5JxoSvMElakkTTGzh3A3eycMs,5460 +kubernetes/client/models/v1_resource_quota_status.py,sha256=EmquDwHKsaRprJ-yROwO17NbRnIkbNFZmeSGHpI7TOw,4529 +kubernetes/client/models/v1_resource_requirements.py,sha256=M8pkWb9m9ySWUi8I1v0JB8PrUZzYKLab_j4JCDaf6SI,6440 +kubernetes/client/models/v1_resource_rule.py,sha256=KI3ONP2F4nwb1n0obMILYAMiWHbVjI3Wx_yZv7qOeOc,7224 +kubernetes/client/models/v1_resource_slice.py,sha256=ITPHx7OKc00VjL7anG9YCYgyykq5V0u8EzHsaTwI6EU,6757 +kubernetes/client/models/v1_resource_slice_list.py,sha256=_FFpbAusNd6tC1d-hJ3HZBsaoO5t39vC8DgD84nYGO8,6994 +kubernetes/client/models/v1_resource_slice_spec.py,sha256=4HCNdvaqF-KrCR6mWUrsW3ZWop7gO-AKNYjsgQFdnCo,13050 +kubernetes/client/models/v1_resource_status.py,sha256=gIksF2hcsRxIrC-zJ5LVTAvn-vl0T9eRLmyu8ILMXJI,5812 +kubernetes/client/models/v1_role.py,sha256=3rH9ZYokYdSI6RZodPincftrtKnEVsGGoMZvZKlBOrU,6576 +kubernetes/client/models/v1_role_binding.py,sha256=xYbiGaCt_l1sJhlUsEU5rM-rzT2KiY0-gB9FLLGxquw,7647 +kubernetes/client/models/v1_role_binding_list.py,sha256=rVl23nNxs3mvgFZ2hWxRRJk_YGZ_eU2CsWWfbCxdSvA,6920 +kubernetes/client/models/v1_role_list.py,sha256=TSRJNPiiu_HYW8fZut393IXQ-yiIISGa-KoRHTfKHA8,6745 +kubernetes/client/models/v1_role_ref.py,sha256=jvIYi-HgVwGfJjz8uFRNoOnVEtQTjs41LwqL97X7N80,5368 +kubernetes/client/models/v1_rolling_update_daemon_set.py,sha256=SdFnmGqY5ToTj3EmTtuQpfX_G7yFrK4HH4J_ZAIj6dg,8523 +kubernetes/client/models/v1_rolling_update_deployment.py,sha256=iUx-lDk6QQEsdNdoDiwci_2pIX6860dLZpl7sm_xRfQ,7017 +kubernetes/client/models/v1_rolling_update_stateful_set_strategy.py,sha256=KNSnf3DJaiY6wE6Wfjn6c_5wpac-ksK9gLICakNKSG4,6413 +kubernetes/client/models/v1_rule_with_operations.py,sha256=k8_Uzq0QnppzUjYoCOm0fm2JUVFv-qR4wLilr2fJCYQ,9436 +kubernetes/client/models/v1_runtime_class.py,sha256=GYIDe69-ZoUync8q-uaFFE-BSg-YwwxGNVN6iqeB0Uo,9352 +kubernetes/client/models/v1_runtime_class_list.py,sha256=DX6CtYGJsdb3t_c1N1Fi3A-Vr01ZpkPMqnB2UBs4Iz8,6949 +kubernetes/client/models/v1_scale.py,sha256=x8ZVVVQOLdwCve_Vw0o6wgW8EDs-eN-Db5o1lfrtLhk,7046 +kubernetes/client/models/v1_scale_io_persistent_volume_source.py,sha256=3vcjgKIN6SYmaYXmxpVN8ep6l2QEHQMx14JZzk6Z2oQ,13222 +kubernetes/client/models/v1_scale_io_volume_source.py,sha256=HB7aawu51XatGvAGJcU9WfGosGD-OklWKh6uTjN8Vio,12779 +kubernetes/client/models/v1_scale_spec.py,sha256=umAo8ZZ3UWypgFtK--Knu7BVp0JqsGDH1Bac58z_wLo,3518 +kubernetes/client/models/v1_scale_status.py,sha256=enMcmi_eJAyap5TjY9t5k9Q4bekdURNdVIFoV8enVKs,5097 +kubernetes/client/models/v1_scheduling.py,sha256=ifBn_8tjbJIdMV1suTn1_I1owTOgW3JUGwNNLsICcB4,5328 +kubernetes/client/models/v1_scope_selector.py,sha256=nPOM79Ql48EtvfgmKaee7Vr4LyTDmkvhdC6tPzHEPUU,3839 +kubernetes/client/models/v1_scoped_resource_selector_requirement.py,sha256=OPTsx1ZypZ1VkpYSq0oNmTix6HfB1oJM0SqXtAKjpes,6265 +kubernetes/client/models/v1_se_linux_options.py,sha256=2nUI4acChzCku_8pTvF7VFvKxt2zrOsbC9HP_INGYDI,5755 +kubernetes/client/models/v1_seccomp_profile.py,sha256=jCHb9WXtBL7qPNRLee-LPIMUA95_XZUweMBAM7H5yfY,5526 +kubernetes/client/models/v1_secret.py,sha256=93MwlYQLOjqkvtYoa4hlJLXueIHdzz9mIIll_mqGLeM,10414 +kubernetes/client/models/v1_secret_env_source.py,sha256=hHtNt5oTiHinesndnQ5U1mYCFoEQ8bDoyrNQvSlU80E,4728 +kubernetes/client/models/v1_secret_key_selector.py,sha256=WYWtXPyoFdIrVmtR6Zqoxzr0G4DbrSEj9cbxn3UvCXk,5690 +kubernetes/client/models/v1_secret_list.py,sha256=nG6is96Z7Bv5-AkoFYMfOeUph6jWxVBEKk9y9mY4i40,6947 +kubernetes/client/models/v1_secret_projection.py,sha256=iWoJdb3woBmK9si6xH0U5-zAYztYnC-hhvpnlslJgkw,6465 +kubernetes/client/models/v1_secret_reference.py,sha256=TI2D69jYCiSa8kWGFudMmqL2P9OlzogIjjDOMU_xz3I,4371 +kubernetes/client/models/v1_secret_volume_source.py,sha256=gOcSk7H5XRHbYL54F6skuUmuv2vgPrVZ8VIsu--oqEA,8096 +kubernetes/client/models/v1_security_context.py,sha256=l7KNqMFDXZXtQkLisCi3JAYKfkNuvhmGsbptlnnmehQ,17245 +kubernetes/client/models/v1_selectable_field.py,sha256=_-4UGE6cOQcoAW0ZQmkFest-N8yuIBrlzJFxoWPnDig,4462 +kubernetes/client/models/v1_self_subject_access_review.py,sha256=pJbt7RaeUvojF6fuq3b6CYkWYqzlBIQCvwC9Wj1IUm0,7728 +kubernetes/client/models/v1_self_subject_access_review_spec.py,sha256=SivJcwsdOYPLFOsRxnUiisi13E7RjCq9nZvVHnHv-fo,4837 +kubernetes/client/models/v1_self_subject_review.py,sha256=7XZx1TPWlOd504vQgVzk82RvXAkT6SSsdo6h08W5-To,6741 +kubernetes/client/models/v1_self_subject_review_status.py,sha256=4RQd2n058QKKfZiJY_d69pBsGhCcdXHR3lW0IHvkTs0,3492 +kubernetes/client/models/v1_self_subject_rules_review.py,sha256=5ullCOJl4KgCo7NsUoIlztO5T5UTWuKoV8_L_hr7MR4,7698 +kubernetes/client/models/v1_self_subject_rules_review_spec.py,sha256=zo-XKHQMpe68vxf854IxUbMu6AlfNByW1cU_F3dnauQ,3626 +kubernetes/client/models/v1_server_address_by_client_cidr.py,sha256=OQQsNoSAcXWB-URKD7Joy-Dwg-UQ3gTjX4Ua6JM-m0I,5238 +kubernetes/client/models/v1_service.py,sha256=cGlmahUX9FnvtlJLtt4msSidJjGd6GGcjDTXzLDxf4c,7106 +kubernetes/client/models/v1_service_account.py,sha256=AEj6R52ilTk6k2HCeptZiETG-Ow9h88OcQLT2k3iI4g,11448 +kubernetes/client/models/v1_service_account_list.py,sha256=-_pEMKEuc4PHBqgDf9XIMhmsRC8Db8Fn7BlbXXYRgsQ,7165 +kubernetes/client/models/v1_service_account_subject.py,sha256=mZGcwmiT3C7muP7ZJ0lZAYK5JEdkeufOCp3Ta78K8zQ,4834 +kubernetes/client/models/v1_service_account_token_projection.py,sha256=oCAaWiXgSxAj9JM57KntcO627Z1wQi_r96jTpryLNSw,6831 +kubernetes/client/models/v1_service_backend_port.py,sha256=tF7uH-UuPSXjCyYo5Y8GHhx15yBpodXUXTCloLg7NXQ,4495 +kubernetes/client/models/v1_service_cidr.py,sha256=jMabjE9zUohhjIaqWEjw1kpO8HKVcu7WPmB4e-gcDbc,7226 +kubernetes/client/models/v1_service_cidr_list.py,sha256=Edv5sKSyGyIdZD3SupmovnPClKp2amil2GFidbGQb1o,6926 +kubernetes/client/models/v1_service_cidr_spec.py,sha256=lx5Mk9hIvoQbreZlMQ6DHmnmrEfciAw7KCUbBpvHqD0,3812 +kubernetes/client/models/v1_service_cidr_status.py,sha256=iXulGIqJTUaMwmLBneVC1YPqeWS7wP9e8EqrJUax3jQ,3754 +kubernetes/client/models/v1_service_list.py,sha256=tpUc-eGrwKtfYKoj8d0JaxPKkHLzMOIeP_WZrxaVsv0,6798 +kubernetes/client/models/v1_service_port.py,sha256=uCg4O7lf686z39Q2iE2yQjFoUJd2K1c7ybK39ZVmuZ4,11951 +kubernetes/client/models/v1_service_spec.py,sha256=bghQ0HUypg824e1GYX_uXVAWbmA0wkCM_LjGMgU9_ng,44516 +kubernetes/client/models/v1_service_status.py,sha256=cUO5R-CGYyjYm-8RRf3Adbuv-3ZlVvkI-HamGnXi4CE,4361 +kubernetes/client/models/v1_session_affinity_config.py,sha256=jRjZp4N0N9m6S7OT0biZFoTKz_XslCVTczNX6bwW-Xc,3494 +kubernetes/client/models/v1_sleep_action.py,sha256=LZcYpC4oYJ63tZ3h5CWwRgxIZNn8ige42ZgM93rHDhU,3623 +kubernetes/client/models/v1_stateful_set.py,sha256=B4A19yqBDIKaJgYSfcp6LNCjFR_q3J8ZKWwh2ZmXSQE,7226 +kubernetes/client/models/v1_stateful_set_condition.py,sha256=7Dq2lU20a2uClcJ3FrBXuFemLBvtLsXcdJYYd9yH_2o,7347 +kubernetes/client/models/v1_stateful_set_list.py,sha256=qMNwwntGfAEsk6usH6ubtpTQYWy8aUmKnEdgQpmi6rc,6928 +kubernetes/client/models/v1_stateful_set_ordinals.py,sha256=zwQffOXOEd1GQnun9YQa6v0XEXpN-woFPjTP1-Ys2Ks,4302 +kubernetes/client/models/v1_stateful_set_persistent_volume_claim_retention_policy.py,sha256=3kWCdTL_FdM5mSVuyTqAEB_WzOlcRq4z7Fmb-gx0ki8,5817 +kubernetes/client/models/v1_stateful_set_spec.py,sha256=SvwuI4DbETZ8Uiwk6Ps_HJ4RqOK8Rt1ax-63jHnmIbA,17014 +kubernetes/client/models/v1_stateful_set_status.py,sha256=YoDuDRRHSU7lWicZskHtIdGKclKEKtXVPbdZMla1w9I,14116 +kubernetes/client/models/v1_stateful_set_update_strategy.py,sha256=RkpwxGWV-U1Op6w4XgPw0hdmQ6kQ75eSA6VCUsLhLBI,4529 +kubernetes/client/models/v1_status.py,sha256=zmZKuQJt70XqI7Ek2rthJ20QbTxP-QLUziC3SHRShQk,10061 +kubernetes/client/models/v1_status_cause.py,sha256=rbr_vM1Fil-eZ08OpuYwaa1wo_YRDc4fXbGP0xFmN_g,5980 +kubernetes/client/models/v1_status_details.py,sha256=OznSjcLo1lnrcW3T6LPnCr5v3E46On_4nBulpwHe_t8,8863 +kubernetes/client/models/v1_storage_class.py,sha256=oMD1eljQKlVNRLNCDwiKvZ2jnZJfZR1FPuJJox5aBqk,14396 +kubernetes/client/models/v1_storage_class_list.py,sha256=wuP5WO-fyw5Ag8XufRQZGLrHHbkursz49p9XIIvk1X0,6951 +kubernetes/client/models/v1_storage_os_persistent_volume_source.py,sha256=k2rpxHF7LOSPQdgNIF1KaNiztthpNpRL8uH62YvJn2A,8636 +kubernetes/client/models/v1_storage_os_volume_source.py,sha256=WD3AY8-qq6t4LbbVf6AXP8LljfPT3cwxCpWRqc6VeQI,8411 +kubernetes/client/models/v1_subject_access_review.py,sha256=uyK2qk66z5gc1d1tbWY1j8deiI2Rhn8U3TYTku_n61A,7620 +kubernetes/client/models/v1_subject_access_review_spec.py,sha256=G9xtpnYs4BWaelXoP6dy50MGzN6Pmt--L1qn86ZUWaY,8354 +kubernetes/client/models/v1_subject_access_review_status.py,sha256=2hxBEJfI40_VdxsukJJ5J5mTI0C_tPPnzlv6Y8u9NTU,7409 +kubernetes/client/models/v1_subject_rules_review_status.py,sha256=azZfoQ0gP-v37KmQ6QyeiMAmPI0jRDz1TYVlO8zipA8,8461 +kubernetes/client/models/v1_success_policy.py,sha256=G-v8GkJW9aBk8fEu9v53CYOVYCkq6erw7Nt81DLgiag,4501 +kubernetes/client/models/v1_success_policy_rule.py,sha256=Xil0XjLeRs9VbRNKcfQ1cRgcJiKA41_m08wGmvFNC1M,7177 +kubernetes/client/models/v1_sysctl.py,sha256=0y-oGF6juhleNcUMHvoiUMLoPqjX2mparJOoGOJaLRo,4320 +kubernetes/client/models/v1_taint.py,sha256=Jv_PATHXM0xygqAvSXgHHwn1BREw278rlowU-Di0BIg,6144 +kubernetes/client/models/v1_tcp_socket_action.py,sha256=CNcs2blMvpGv29DILXORF7LohTfZUnj3Y7Dty_oHXc0,4526 +kubernetes/client/models/v1_token_request_spec.py,sha256=6WKy9t7vIS0iJXAJK-YJutUfsX0n0NejSEx_b1k6bRA,6597 +kubernetes/client/models/v1_token_request_status.py,sha256=ta6wrSyJ25ULP0WQvOMXlECIFKBg88LZTgpgQTD-rsI,4914 +kubernetes/client/models/v1_token_review.py,sha256=HaUUuzQe5STIGahY-lclmmfqX5GsFh6FALGsojPh3Hk,7380 +kubernetes/client/models/v1_token_review_spec.py,sha256=uedtzb58B2z6Ew-BO_b1HosnFpNfynW1YIsnWQIUYUc,4857 +kubernetes/client/models/v1_token_review_status.py,sha256=2aL3CR68HlFme7L4gKjOGb_hWEkiOoO6ewXlq8aCsMM,7097 +kubernetes/client/models/v1_toleration.py,sha256=8FSH-90_oQs-Xm1C31r1gO8xATEgPnEs55fh-Ec2KXc,8459 +kubernetes/client/models/v1_topology_selector_label_requirement.py,sha256=-PYnY-UKmgeeIe5_MhvFnBdGP_U4tCvRXkSknvhTBUs,4840 +kubernetes/client/models/v1_topology_selector_term.py,sha256=LRx-P1viBXxjoPHJJoVb6lAR2z0CCzFBdtin_o9fV1Y,3985 +kubernetes/client/models/v1_topology_spread_constraint.py,sha256=ANoTO-l9zg0lOzTEWrjfJXOjqFfJD0_qyxVdi05RGJ8,20758 +kubernetes/client/models/v1_type_checking.py,sha256=G70iklTzS6RMhlAFHBsQZMv2XDL4g9tciJVJ6tTJkvs,3789 +kubernetes/client/models/v1_typed_local_object_reference.py,sha256=nO68XaRjUauCVpmSPN5vjalai_kb_-EnFMGPxgYaqwI,5769 +kubernetes/client/models/v1_typed_object_reference.py,sha256=aHAI7iei71fCjQWD-aDp5pPleFDFJn-XFvBA1k3YU3M,7216 +kubernetes/client/models/v1_uncounted_terminated_pods.py,sha256=OQrDp0iKbaoJj0yoD7Lp-Cafqf3CXgdbYm5m7KQBk3c,4413 +kubernetes/client/models/v1_user_info.py,sha256=rdakII9bhFwjh6MwgXKGQKZgFmNNlpwvDrgU6b-91po,5970 +kubernetes/client/models/v1_user_subject.py,sha256=u5_cRKa4knmGXzbrrkmJ-8pSpTuMcRE_y5oxlnVtTFw,3634 +kubernetes/client/models/v1_validating_admission_policy.py,sha256=Sxt1raTpLkuc-QXxFJxkNOuJhJJ1ATwNgQ74sKRY5rc,7646 +kubernetes/client/models/v1_validating_admission_policy_binding.py,sha256=ySd2UcvgTm871uoAs1RsweGGLKuXymFIUISw0UCDDMw,7040 +kubernetes/client/models/v1_validating_admission_policy_binding_list.py,sha256=LXImHArXvAP54WNqtPY83L0JYX9nu_8k1mKrlA14TyM,7385 +kubernetes/client/models/v1_validating_admission_policy_binding_spec.py,sha256=7RVkhDd9Zd21PUq_mqmX_U4NqLMsq27_v2YK6ucGl_M,11243 +kubernetes/client/models/v1_validating_admission_policy_list.py,sha256=K3m9j1DH42aWivk11sTBIE-SWwT7dYacyoZtJ2Ml8j4,7248 +kubernetes/client/models/v1_validating_admission_policy_spec.py,sha256=nWNhb8mySQmMsODvcPj9jxJPkhTAjMenMthFG9y8ZhM,13893 +kubernetes/client/models/v1_validating_admission_policy_status.py,sha256=vYBv_ibGLa6yYtW7XsW1UpA047vJkzqh1Uu0m2d_2qQ,5781 +kubernetes/client/models/v1_validating_webhook.py,sha256=ogQUojZ8BYhwVi458vrGhYMeKhRNJ8JAkMmAZwfAUHc,20181 +kubernetes/client/models/v1_validating_webhook_configuration.py,sha256=ohFUqTxuxNsv78yZEIEcAPpVAMpGnibT1JQ95pdYLLM,7233 +kubernetes/client/models/v1_validating_webhook_configuration_list.py,sha256=gjJhFKFCxxFxpjDeEpUCzX6EpPbm_z3C_nM0EZvDtn8,7373 +kubernetes/client/models/v1_validation.py,sha256=ls1drkDelmpolhjbNdoAFC0sI8AxrKsOqkfhAEizX9Y,15762 +kubernetes/client/models/v1_validation_rule.py,sha256=CYihI_kAgxxU2rc5OAH6STcBpANFRBQctwVpyjBE3C0,22970 +kubernetes/client/models/v1_variable.py,sha256=krIWxy7M5QcOqvNTZiRKJbg8Bb6Zqf7RfovW0hSY1R4,5209 +kubernetes/client/models/v1_volume.py,sha256=Uw_xbZPRrKhTbfP7dgI6YOEVk8C4uWDx10W7zaKeGk0,25783 +kubernetes/client/models/v1_volume_attachment.py,sha256=y197ADRiwoRQY51GlCsVYBJofzMGbrdsB7CI9RDJqUk,7530 +kubernetes/client/models/v1_volume_attachment_list.py,sha256=A_WFzKcnJ0RUQyIFp1a0Z46Y8s8RDXpOEjZFfWgzDzo,7049 +kubernetes/client/models/v1_volume_attachment_source.py,sha256=hSfo_G6LnyTvH2EMr2ee7XEcXXl9ViPKVFgGARxqJ7s,4880 +kubernetes/client/models/v1_volume_attachment_spec.py,sha256=A1RzCXYvpYWCM2PLHvQPt5sNI0q72X6t7b1CaiW65us,5813 +kubernetes/client/models/v1_volume_attachment_status.py,sha256=r0dV93SqKPeHV5WqrVdzWHhvS2FdQ45vk35fo7rS94Q,7156 +kubernetes/client/models/v1_volume_attributes_class.py,sha256=CKp1SWI3_RTaFyMt2uu4a1L3kqcEmzsQENoRA_IDbbQ,9573 +kubernetes/client/models/v1_volume_attributes_class_list.py,sha256=VIe7WO3pYoyruXciQ_G8vwlWk6QyWDnn1UrVl8yk8Lo,7190 +kubernetes/client/models/v1_volume_device.py,sha256=03TqSUKajDFZbMEFa9Fz7xuVfGQ8NCuqInpEGrScgv4,4701 +kubernetes/client/models/v1_volume_error.py,sha256=m_QI8qDbxjJcC4zBvW9S-nrsqlFeRxoqAxKmmSUC9zE,5618 +kubernetes/client/models/v1_volume_mount.py,sha256=9YeuIN1FdTiHJ7kM37lmkBsUrXcjG59J_FMKie0TQnE,11879 +kubernetes/client/models/v1_volume_mount_status.py,sha256=QfMa8Rr2z9fZ4t3YimO1eo4z4ThnMMWP9XN2gUx8Roc,6898 +kubernetes/client/models/v1_volume_node_affinity.py,sha256=PU-8aYKnr1lixkbHpkU_tO4P9Nss0EflMGmBMfCudWI,3445 +kubernetes/client/models/v1_volume_node_resources.py,sha256=Vb1mNygZjg_2oGudo_a5ZJwXFmMmd3NlqKCUqskXmCc,4190 +kubernetes/client/models/v1_volume_projection.py,sha256=hlzdwBDRjZM1PUlM_n4hSjCgvTiH-lsvmnQZ2mLX8Qo,7907 +kubernetes/client/models/v1_volume_resource_requirements.py,sha256=2U60mbcjdeQ5x0WiPKpgXTgbcdIDTdvD9fwadVc2QD8,5285 +kubernetes/client/models/v1_vsphere_virtual_disk_volume_source.py,sha256=Zy_E2epvLIVUk1IrAKFjWoIGI3dD8WQ04LjN0KCy_AY,7360 +kubernetes/client/models/v1_watch_event.py,sha256=OSvbb4ST88JacbkZGwVCxKgRa45jA5HK9WSArgD3vmY,4740 +kubernetes/client/models/v1_webhook_conversion.py,sha256=yYOmAOVrgS_qSMkfXJ1-o_juVCBp5sg-8Ht8V3zLFLk,5789 +kubernetes/client/models/v1_weighted_pod_affinity_term.py,sha256=hmPW-H0keD0u7Sms3gsO2SOvMl7_CUC_i2FN-dIHQ6U,4882 +kubernetes/client/models/v1_windows_security_context_options.py,sha256=evu1PZw1e47yqs0WKNgjVoQRlWEWIm93JMuMSJcsYfI,8455 +kubernetes/client/models/v1_workload_reference.py,sha256=FHFL0slxTyRTcfYr7rcKNH7l4R89ZnDx0N0eFKkbxJY,7095 +kubernetes/client/models/v1alpha1_apply_configuration.py,sha256=k9FsgTVxMQHxtdcgQO1MIV7lFWWWfAzZLfsHqPb168E,8020 +kubernetes/client/models/v1alpha1_cluster_trust_bundle.py,sha256=Oubttjr06Z4xGh8p5ubWG5XGj7OPlCjIt6BOjLfjeKg,7010 +kubernetes/client/models/v1alpha1_cluster_trust_bundle_list.py,sha256=OV7pUlEI4cv7RLwbz2lQIRjB_OEAM3qEEKDX9dlAMpw,7259 +kubernetes/client/models/v1alpha1_cluster_trust_bundle_spec.py,sha256=KA7lj9y8q8EXcjmTAwrm5HOyxB636F1ImOFJizJEz18,7397 +kubernetes/client/models/v1alpha1_gang_scheduling_policy.py,sha256=oRXSH_IhXZ3u4GukVkwVMmho8ts42utgAzER7UHR5ss,4038 +kubernetes/client/models/v1alpha1_json_patch.py,sha256=BZxkWpXRx9AeAd2beoWcJ58Mx29uciQQelXiHOOpMzw,10024 +kubernetes/client/models/v1alpha1_match_condition.py,sha256=la126US2zhcG0m2YLhJkt7GF_YvRy9jC31cJTIQqgrg,7367 +kubernetes/client/models/v1alpha1_match_resources.py,sha256=jsmtyv8FXy2IeA0YCFEVuNXXiKPPc_5zZnhYnbYBI7k,10228 +kubernetes/client/models/v1alpha1_mutating_admission_policy.py,sha256=9gmX1NZ9tJKZtNavt47w8fN6RQaPWLCzlk-k5ps1cHo,6971 +kubernetes/client/models/v1alpha1_mutating_admission_policy_binding.py,sha256=wJ0QDi1zmbrl9XB4GSWXOZyZ2ejBZoG7KPFkvlk08XE,7132 +kubernetes/client/models/v1alpha1_mutating_admission_policy_binding_list.py,sha256=JUSrXkEBkrSDL9xFuuecYBvfnJsVy8jEk7H95-xukPU,7477 +kubernetes/client/models/v1alpha1_mutating_admission_policy_binding_spec.py,sha256=1G5JO68cAuw8qsQkT4Um0TUs9EXt-GcvRveQLuZTqpY,5923 +kubernetes/client/models/v1alpha1_mutating_admission_policy_list.py,sha256=EFdPUi4ERBqdeK3H3zBgNwrC2Umsy9UNi2I_rixMV5Q,7340 +kubernetes/client/models/v1alpha1_mutating_admission_policy_spec.py,sha256=PrMQFkWOdhCxw5Oiw_OP4yPFNODEldyNEL9FOrAlaNg,14859 +kubernetes/client/models/v1alpha1_mutation.py,sha256=Bg1Zert5lAygNzb7m_OMPdAZbufdZ-TIuv618bvHDbE,5570 +kubernetes/client/models/v1alpha1_named_rule_with_operations.py,sha256=mNzTY7vhZiM5cfaQ4k47bPznyZMdA-3RNn6SRkJ3_wk,10860 +kubernetes/client/models/v1alpha1_param_kind.py,sha256=CM4U7uMAwOdwP6N8P79vUSk0crtEufqjhWmtXHXFRhY,4450 +kubernetes/client/models/v1alpha1_param_ref.py,sha256=orYSmfq80n2zd0yS_DIVzphY79ilqmVZJyQKZM4Fj28,8400 +kubernetes/client/models/v1alpha1_pod_group.py,sha256=MMwHoiV37HqLQIzuE65l8UT_Wo8YoDAB4Yrx-OAsPQA,4574 +kubernetes/client/models/v1alpha1_pod_group_policy.py,sha256=JAaAKV4xMx40SWKQsv5CDH9HzW9UJRF1JfrmlOWI33I,4335 +kubernetes/client/models/v1alpha1_server_storage_version.py,sha256=wcv1R5Hfsoqw6RKslSXgWegVs6c5srjne7Xu6_tkG3o,7146 +kubernetes/client/models/v1alpha1_storage_version.py,sha256=Ut5SDHrAg1XvHAZBmisZnws-AjXXfiT5aOWUVATqtQk,7932 +kubernetes/client/models/v1alpha1_storage_version_condition.py,sha256=vDMp2uRTFNo4RpYeu5mEIcxadQHir6eYYHdYRrr4Mx0,9032 +kubernetes/client/models/v1alpha1_storage_version_list.py,sha256=gs8RTTymYiBDQjWKFqHdNQv3gKYmBSSizdoaM1r-Y7c,7137 +kubernetes/client/models/v1alpha1_storage_version_status.py,sha256=LvYri18tLPXblpKh2ve4bCq4LPO2gdEsw5zGdI9_GqU,6566 +kubernetes/client/models/v1alpha1_typed_local_object_reference.py,sha256=P1NRnv1cx1RYB70QX0RS796l00mbTEJkhRZDeXnhVvk,6053 +kubernetes/client/models/v1alpha1_variable.py,sha256=-ZM4YwVNc3oRp-0UH5vxvjqZLl8E4u8U9RM4Dx2jXWE,5281 +kubernetes/client/models/v1alpha1_workload.py,sha256=I9xriiYbLIaAItyc00EFzqtBDnribefo4soDjgR9Em4,6780 +kubernetes/client/models/v1alpha1_workload_list.py,sha256=vGLsCp5OgTemViJiksa2EDiupD8pOoz4njvvAaBVSV4,6989 +kubernetes/client/models/v1alpha1_workload_spec.py,sha256=c9zZsGvz_2SaQLs-zIBmgM5pA9mio9RRNj_cD2Y6QOc,4864 +kubernetes/client/models/v1alpha2_lease_candidate.py,sha256=HIsm5Sd5M5dMTI5VufdOklbr4SFRVFAi1qtZjx6C6Pk,6764 +kubernetes/client/models/v1alpha2_lease_candidate_list.py,sha256=UFRO1TKvponBSCts2YcL5N31sbGqRipFl9SDaj6aDvE,7133 +kubernetes/client/models/v1alpha2_lease_candidate_spec.py,sha256=foKzk3UNeBa4rDuJ-F9EVGlyg3J64ET-OstCpe8o650,11150 +kubernetes/client/models/v1alpha3_device_taint.py,sha256=h7mZz7jNNA3P3reTyv-mhAWOA0ZeVnYBqSrstJC9XJc,6914 +kubernetes/client/models/v1alpha3_device_taint_rule.py,sha256=oz4LkjkcQFQHflx0_8zUMeEzU5ftsHJrF61K_Q8pmMI,7680 +kubernetes/client/models/v1alpha3_device_taint_rule_list.py,sha256=wykgL2KnrYtBpolNxW1Q_054JkexVd6yeYUFkRsg4sc,7164 +kubernetes/client/models/v1alpha3_device_taint_rule_spec.py,sha256=MLtI4Za8g_bnUA0FBsX_HXYVFVDIlhxpjluprFF3xBI,4539 +kubernetes/client/models/v1alpha3_device_taint_rule_status.py,sha256=V2r9tgEXLEQGaud5oSTPJgup90Dq3C6PNG8QYfX7iXk,5566 +kubernetes/client/models/v1alpha3_device_taint_selector.py,sha256=0OF7PmW7BMPBtc7w5ako5JUP1cZ7OWmVMwc6G-ajDGM,6180 +kubernetes/client/models/v1beta1_allocated_device_status.py,sha256=9YMv1T-mL7GVBcRsbychZY1oVsWESo4PtHfJgC4wLV8,10626 +kubernetes/client/models/v1beta1_allocation_result.py,sha256=mJp00159Xcx82fiJhXq56uycNAjdBpa8_GFw4ci4SsU,5868 +kubernetes/client/models/v1beta1_apply_configuration.py,sha256=6wKfxSb3QCaQ0sIlw46xAFTp19DhCY-JhHe4z-VcgyI,8012 +kubernetes/client/models/v1beta1_basic_device.py,sha256=9hBqMwGwsCVagJy4p-TtoASCU7Hn-GhQJpYjdKwdac0,18127 +kubernetes/client/models/v1beta1_capacity_request_policy.py,sha256=eQyTTKGFrqhW9Vy0k0o6ls2EmCmJSf1RxoOZrP085dw,6804 +kubernetes/client/models/v1beta1_capacity_request_policy_range.py,sha256=MeKTpEgtcbAqzv1_hy1E1qJ3xlX-Cnx4GBQuqfPmFdA,6247 +kubernetes/client/models/v1beta1_capacity_requirements.py,sha256=-p8jPhyANDmNLqOVH9eklnBpNziCW66z40EYQobQTO0,6181 +kubernetes/client/models/v1beta1_cel_device_selector.py,sha256=0-oX-vNKmenIOPakBK7R3KLTz88BEbtSseQI4xs0oyU,8630 +kubernetes/client/models/v1beta1_cluster_trust_bundle.py,sha256=qAkAypxV4XOlmKJQeJaWXb9J7q87p_iZYDTetdMNQQ8,6987 +kubernetes/client/models/v1beta1_cluster_trust_bundle_list.py,sha256=wKz7hf4ghYZ4HXwnbAgX1aEfbXQCxPaNigiaD8VVLRY,7236 +kubernetes/client/models/v1beta1_cluster_trust_bundle_spec.py,sha256=ql76Ob25KHK6SOQgWpzq1Y9cWboDUMziuyPab5IZg7I,7385 +kubernetes/client/models/v1beta1_counter.py,sha256=K1d4P5C9Rn6xgiGmsu6k_RyOHvoKn66AHuRD0ddrBPc,3633 +kubernetes/client/models/v1beta1_counter_set.py,sha256=uOr7ws-bUZpJzpYBD4GvydZIYGgSRkM-uvpbY95ndjw,4929 +kubernetes/client/models/v1beta1_device.py,sha256=hgdRIbRUoUkj8uBNyE6rY3HTsTx9p1eW5bekZfz3zkg,4326 +kubernetes/client/models/v1beta1_device_allocation_configuration.py,sha256=d3xbkGJQBr1vfYlwQ-67MpGybtmpBMpEYxWb79rBtGA,6291 +kubernetes/client/models/v1beta1_device_allocation_result.py,sha256=eThmtlT1v1TGhJBhEekQZo0r7E1vcRrU3zmbA0fs0G0,5285 +kubernetes/client/models/v1beta1_device_attribute.py,sha256=IQg4jgdFTyEVWHP-UDFOGGuMLB57Bz9nMLG-2KEHCLM,5916 +kubernetes/client/models/v1beta1_device_capacity.py,sha256=XPIz4gfoXRtPmIrItrJHBD_vcogjCrzEMkHfag4Joz8,4878 +kubernetes/client/models/v1beta1_device_claim.py,sha256=0Sg9ONU9aKv6XdCWjuZd6PRTrztiQkgCsGAI1U5yWQw,5899 +kubernetes/client/models/v1beta1_device_claim_configuration.py,sha256=mLBwBe0OShQKrIJI4CwxrMuhNm2m45E33custTXLMhc,5016 +kubernetes/client/models/v1beta1_device_class.py,sha256=C9-PMgMzWr6ECBi3eEi9dXBe87Vai7VSg4vMhdQuQ04,6826 +kubernetes/client/models/v1beta1_device_class_configuration.py,sha256=Kjo0BkJ7R4tUoILUJz8kUYvQlNlr3nUE0xR8d--m9XQ,3547 +kubernetes/client/models/v1beta1_device_class_list.py,sha256=xPD6hZWNfd24r7UTSceneCnPhEU8UjC6PGFKX2aXlMI,7049 +kubernetes/client/models/v1beta1_device_class_spec.py,sha256=4oAXiwv3-bu1bnUjY2b5cDYs6yQldrzCqCW5s2fDWrw,7302 +kubernetes/client/models/v1beta1_device_constraint.py,sha256=wcSGCy0kwwrNVuGY6U55XzyXwl6yQcYPa26Ob_Iyr0w,8480 +kubernetes/client/models/v1beta1_device_counter_consumption.py,sha256=TljjNOcjg2HGFVdk2qCo4Lg0XhEKZF50rcm-nC96Te0,5145 +kubernetes/client/models/v1beta1_device_request.py,sha256=bjrHJxRJwVsgxFlGLPW8GhkYA8dihenOLcoZLSj-bRM,19166 +kubernetes/client/models/v1beta1_device_request_allocation_result.py,sha256=GTuwWpmT1GOjYMnCZHjiqZ_Thexc30mD7of_js5cnlY,17800 +kubernetes/client/models/v1beta1_device_selector.py,sha256=633jt0D1kT8XqI-Xeqb5x4jo2CUrN6VMg3rigyQoA1o,3383 +kubernetes/client/models/v1beta1_device_sub_request.py,sha256=up5KqYj6vqbEX9OMPH2JKOW671a90YsMPpPC96FMHFc,13544 +kubernetes/client/models/v1beta1_device_taint.py,sha256=FCTB8EztqnGSLxZUfe0ZjeP9JfwxrZcmN5eaIPsYsFs,6894 +kubernetes/client/models/v1beta1_device_toleration.py,sha256=KIZ6H2op7MnlQJAGo4x2YSlogcBi7uSUkKjxlpoBGgM,8843 +kubernetes/client/models/v1beta1_ip_address.py,sha256=CsBj5rKTDqLiNQa2I-Xbuh5VPA_jGmt1HtBrbUF4hGM,6626 +kubernetes/client/models/v1beta1_ip_address_list.py,sha256=9AjYkfN_VzbsVQwASrxSm4kpqlyVOdHuuBGfULZ3_Ek,6993 +kubernetes/client/models/v1beta1_ip_address_spec.py,sha256=QgZtNW-DAAc5s69RQvSPrEzotIfPD0DCoKJuKP_pOQ0,3668 +kubernetes/client/models/v1beta1_json_patch.py,sha256=la_wYUQNDbUPKjJDCH8D3vs163UuXUpeQ5bB-AFmdVI,10016 +kubernetes/client/models/v1beta1_lease_candidate.py,sha256=rYo_0qeiBr-2BSyYiTIdcD09kotcdSvCRA4_Kjqpgvw,6741 +kubernetes/client/models/v1beta1_lease_candidate_list.py,sha256=6Ypx3QfuaDAxGRDf5W_QDz3Zn-eXGjZmWpyNWmVjeGQ,7110 +kubernetes/client/models/v1beta1_lease_candidate_spec.py,sha256=fcm5EG8IlU0U0yUOxyB_lNWGq6mPlj8cXy2lg_qpjx8,11356 +kubernetes/client/models/v1beta1_match_condition.py,sha256=6Yb_X_IRdCYt1ID1QRTh-Vbq9ZV49GLjDBeyOASyEgE,7355 +kubernetes/client/models/v1beta1_match_resources.py,sha256=E_WCq4WcQFUdAX3a3Gzu84vgRwJJC6-1cJ7sDVl84f4,10138 +kubernetes/client/models/v1beta1_mutating_admission_policy.py,sha256=SywAIAc2yMeaeOGu9WejnpS-MjJVWLfkRKXdLX738Cc,6948 +kubernetes/client/models/v1beta1_mutating_admission_policy_binding.py,sha256=GeuWPqscsgoh-e5FXHW-So4fzC_aIqoHP43b4VlfqRw,7109 +kubernetes/client/models/v1beta1_mutating_admission_policy_binding_list.py,sha256=duAbMJWyy_9SJ1luj-I0BVJmAIW2ytcUK2TZB9k0UvQ,7454 +kubernetes/client/models/v1beta1_mutating_admission_policy_binding_spec.py,sha256=ed4OZIqzI3cDH7Yl6Z9DCwL8ra1WTQad8UBKFvWVSlE,5901 +kubernetes/client/models/v1beta1_mutating_admission_policy_list.py,sha256=9dFeJz-3sLgA1kPclC4uESrXtviXU3yO2fJrjFAhgYI,7317 +kubernetes/client/models/v1beta1_mutating_admission_policy_spec.py,sha256=YqBPgV5O2JKjsJjp2lotnCYF_t9WfyW8QZ_K6Z-Op4M,14812 +kubernetes/client/models/v1beta1_mutation.py,sha256=X6D5i49DRudCwRUtUBQ4ek7o4BJ_Rw_QWP1C4oFUXbc,5548 +kubernetes/client/models/v1beta1_named_rule_with_operations.py,sha256=WfbjsvkzNcoULB2CrdO6Z-N1cLXksKidrbS0PRhfsDk,10832 +kubernetes/client/models/v1beta1_network_device_data.py,sha256=E6MEnKvUjNIsks-LsbwYeIvNyIyFt5zSCfbvWb2RbxI,6584 +kubernetes/client/models/v1beta1_opaque_device_configuration.py,sha256=V16c0JRI3aqHhvbLMpVozC3Hgquv7s3yErc5BjF4Gvs,6036 +kubernetes/client/models/v1beta1_param_kind.py,sha256=bw7StRcH7f1Ky-Mm02TtYZ6TlShK3OoRposhBdOMK2c,4438 +kubernetes/client/models/v1beta1_param_ref.py,sha256=gQAvGuryx3uNpYGMbrDGHBRoz1ocX-RBTZUxtGSvxlA,8816 +kubernetes/client/models/v1beta1_parent_reference.py,sha256=zm-OUt-QmgEIul6DEKJIMIUa0Wydg9l8H7dUW9uC8I8,6319 +kubernetes/client/models/v1beta1_pod_certificate_request.py,sha256=EYTnFBHYM1oi30NR1qprKH97XYK_SQ_GzRat9Tpjpww,7830 +kubernetes/client/models/v1beta1_pod_certificate_request_list.py,sha256=4Lw-U3lvBuQM33_jqCL3z2l0SThrW3mTft540wSV1MA,7311 +kubernetes/client/models/v1beta1_pod_certificate_request_spec.py,sha256=DasdaJTh7cxcCyQC5iCJ06O5hq2jgTs0rUBgwEhYdig,21904 +kubernetes/client/models/v1beta1_pod_certificate_request_status.py,sha256=PeXg17PASxfw589Sf7jbyVtO1Lz4rVARk2ldRqUvULw,11824 +kubernetes/client/models/v1beta1_resource_claim.py,sha256=Gllj-mprTdYgIFR-FoXjkYbfR3jMYQpGwPsJN8w2qvE,7590 +kubernetes/client/models/v1beta1_resource_claim_consumer_reference.py,sha256=dCqu0pt0GDlII9nITBtarlYmfM4eYrpSvLil_AV7ncw,6991 +kubernetes/client/models/v1beta1_resource_claim_list.py,sha256=KSovCCVCV1xyR6DprofkA10IMwN0RXtePi0GU1SWU3Q,7093 +kubernetes/client/models/v1beta1_resource_claim_spec.py,sha256=9ikbrX6KCp-2HzhxZHX_45hQr0UqVoTnzdApivMxjdY,3469 +kubernetes/client/models/v1beta1_resource_claim_status.py,sha256=hyIsB2Pbn8OKSXjhgV-yPVG2mbXCvjLDyuGbU2Wh3Xg,7596 +kubernetes/client/models/v1beta1_resource_claim_template.py,sha256=lumM0AHB713ei2Na7Tm3009oaZ7rFTln_72slIbRj2U,7056 +kubernetes/client/models/v1beta1_resource_claim_template_list.py,sha256=bAwblg5a8Ver7XwAvFHp0ZAuaCwe1Up2BDOOpTm68Go,7295 +kubernetes/client/models/v1beta1_resource_claim_template_spec.py,sha256=YR4E6zp4YH9EBmVd_XFmNx1gcpUEAu67S5zegzhFq74,4409 +kubernetes/client/models/v1beta1_resource_pool.py,sha256=nIdo4O0Gow9nOZmweTF7DfhOX4achaUBja4Utv-7waA,7818 +kubernetes/client/models/v1beta1_resource_slice.py,sha256=qu5pYmdZSbsYCH-Tw7fSHJROSTtk7YK-yA1MPaieMgg,6872 +kubernetes/client/models/v1beta1_resource_slice_list.py,sha256=z5uwuMtoxoFLH8E08JUP90CQU2uWuj5wWnbcYVMqpNA,7109 +kubernetes/client/models/v1beta1_resource_slice_spec.py,sha256=Spl9A18YyLPRbrlwpVS0rqX33ma-7Qwbns9S7-bOiT4,13275 +kubernetes/client/models/v1beta1_service_cidr.py,sha256=Zj2qMKnVb12P9oAksjHApMqQbub_a2R6pOSGxsIwIZc,7376 +kubernetes/client/models/v1beta1_service_cidr_list.py,sha256=jYZpaJGdzX7tGmEPlitqroSivrHBT-sUTxjhISEjSKE,7041 +kubernetes/client/models/v1beta1_service_cidr_spec.py,sha256=iM1MpT13iufbw1Uo8gmj1MM9LCWVtyhvtOspLEhLICE,3852 +kubernetes/client/models/v1beta1_service_cidr_status.py,sha256=V8X2YdtAjlQGf3e4HV0nZmtiXO8i8mJQFX_4pV5-Pqs,3794 +kubernetes/client/models/v1beta1_storage_version_migration.py,sha256=FBSfRr-bElgZFEoeDHldIJY9PKZJyOHqefT--qowzj4,7736 +kubernetes/client/models/v1beta1_storage_version_migration_list.py,sha256=J9-cVDHkXVIzIdIOks0RYXFxgyyQERzC3zkHhMMn2mo,7337 +kubernetes/client/models/v1beta1_storage_version_migration_spec.py,sha256=GDGdu6e8wWH7ogVmhsP_b-qDq9xAS6Z2B2tccAodbu8,3718 +kubernetes/client/models/v1beta1_storage_version_migration_status.py,sha256=rgXVbO9VwUTMfUon5rGaF0iAPwu74AwWSH5njTjhBac,5222 +kubernetes/client/models/v1beta1_variable.py,sha256=gKyhsgRizukXWDuOfRELx7olfY41hZSYGSkL_xxeUHQ,5269 +kubernetes/client/models/v1beta1_volume_attributes_class.py,sha256=sr6O2onbqLwEF8mWm_IFQd1ZexXBkYqJOLcqOL_sxhc,9693 +kubernetes/client/models/v1beta1_volume_attributes_class_list.py,sha256=lK7-846ZBxOdk5M_RFFu2_GRTx7Fm3IkJ0_j3CYYyY0,7305 +kubernetes/client/models/v1beta2_allocated_device_status.py,sha256=whdlRy-bLfJKfS23e4inwnX3ivUCdd5qWfxO4ZIUxZk,10626 +kubernetes/client/models/v1beta2_allocation_result.py,sha256=wt7uyqXFYs7piytMvcLjNqvV9S81-MxXr4YDI1JmXMM,5868 +kubernetes/client/models/v1beta2_capacity_request_policy.py,sha256=Z-nQgjk4hBdiaHojevDX7t1VPpr_oh4OPCUJXmaZuJc,6804 +kubernetes/client/models/v1beta2_capacity_request_policy_range.py,sha256=6kpXV8--hhp4U4Lwd2zJPYaY2Zh3VSCELnaVmMbsT0w,6247 +kubernetes/client/models/v1beta2_capacity_requirements.py,sha256=p200DeD9RKaZI77eGvIC4ljeYQrvL_XdLmagOYqUJ3E,6181 +kubernetes/client/models/v1beta2_cel_device_selector.py,sha256=vKLv9CyB59EXKrgwhfaMcFLRXJgnenheLd43lDNb42Y,8630 +kubernetes/client/models/v1beta2_counter.py,sha256=vwt_dGp7bzMBV3ieYftDwfqhuRYYH80-kyidWD4drzs,3633 +kubernetes/client/models/v1beta2_counter_set.py,sha256=_wG51ZOde9X8f8ZdMk1ZBGrjFbg9nGhxqIVC3S0BrQw,4929 +kubernetes/client/models/v1beta2_device.py,sha256=sWSIoJoWKeKAr-V8215VYLU-5ijfydLGhYp63SH88SA,18894 +kubernetes/client/models/v1beta2_device_allocation_configuration.py,sha256=sVIZXvdNKShOLzkn25_-IFQz2ffYNcL6avjpiDNnt4I,6291 +kubernetes/client/models/v1beta2_device_allocation_result.py,sha256=NrfEZi9gudvwceR3UCIETG7Sdox6w_i6l8qX2gb6nkI,5285 +kubernetes/client/models/v1beta2_device_attribute.py,sha256=W0lVT0179XCIBnlXy_bH9AnXaAhrZp5MXmsbyJrpHPs,5916 +kubernetes/client/models/v1beta2_device_capacity.py,sha256=vmyNiNCCTjO87PBUPOaUTap8Is5ftIZ5ed1nPS_Hs_Y,4878 +kubernetes/client/models/v1beta2_device_claim.py,sha256=XNR_RldwsMEjfk43cgmZv391_BSZWr-1aghbPNc4ylY,5899 +kubernetes/client/models/v1beta2_device_claim_configuration.py,sha256=ZyXHF7bRbYjpXD3-hnUUVROrYGFM7F0fj3RMZf2fRy4,5016 +kubernetes/client/models/v1beta2_device_class.py,sha256=MI0rps1vGlI03cm162rNne6afZgLpMLh4uz0XLkcHgg,6826 +kubernetes/client/models/v1beta2_device_class_configuration.py,sha256=pZ18YuhHAcyqAgs-2Na7YgCuiIHuA4QOL7IJGKK9FXc,3547 +kubernetes/client/models/v1beta2_device_class_list.py,sha256=0MlhNCOQHvir0oe0dhsBZLaqwxr-i4mHwfksNWG0EPE,7049 +kubernetes/client/models/v1beta2_device_class_spec.py,sha256=oXuFOOuGGcqrq3NTPB72_j8Esn77qZWaPlhaVL4hU5E,7302 +kubernetes/client/models/v1beta2_device_constraint.py,sha256=Kk9gAJrgyy7UJLzutajPhzSHTh_fscH3vFRd7k1zag0,8480 +kubernetes/client/models/v1beta2_device_counter_consumption.py,sha256=8mFlETTZJlLudeljaAlOxQncrwi8IGt-BGA3t9He8Ns,5145 +kubernetes/client/models/v1beta2_device_request.py,sha256=Da1peovK1fC_LKTZmH_-OzrqNgCoA9F4f4p46w2NqAg,7443 +kubernetes/client/models/v1beta2_device_request_allocation_result.py,sha256=iNdB2v6WCSULzjX8PR_gHeIy65Kr7gXLSvUA_y9gQ58,17800 +kubernetes/client/models/v1beta2_device_selector.py,sha256=F3DrIFowIL6jpenVy-eClppCH1n83-FMkvUBGa-ilpU,3383 +kubernetes/client/models/v1beta2_device_sub_request.py,sha256=GBEOJtWGpLvYLU5nqs7bMISuN9SINJXLT_ReXft_xrk,13544 +kubernetes/client/models/v1beta2_device_taint.py,sha256=qk5N_O44dXmDuO4VYNWOW80rFSApBXMXkEq6Qwcc7nA,6894 +kubernetes/client/models/v1beta2_device_toleration.py,sha256=iJaFcShhl-yytLPZr5pP6dtHQkoi0d9x21HBDM0k4YI,8843 +kubernetes/client/models/v1beta2_exact_device_request.py,sha256=uVWSR1r-EfMeuZJASi65SlhF_A-BlLkvhQFhafPnYjA,14190 +kubernetes/client/models/v1beta2_network_device_data.py,sha256=sJ4zdnxd9hY_hauRMb7_Wet6mn8yrNDAaudTB9PdAu8,6504 +kubernetes/client/models/v1beta2_opaque_device_configuration.py,sha256=uuv2AFLlBUEGqkukqOCcsflAI_-1TF0Hffmrg1c38yI,6036 +kubernetes/client/models/v1beta2_resource_claim.py,sha256=N00apEt5suEJRe4Z2KmWDFeTRz2MvcfCdXRm0d7FPa0,7590 +kubernetes/client/models/v1beta2_resource_claim_consumer_reference.py,sha256=HICnZHGtw4Tx8bzviBRAzGBtwlvjpEMScZBx2jsR0aU,6991 +kubernetes/client/models/v1beta2_resource_claim_list.py,sha256=0lshOrOQBIPTZQ2GXtsZUSOAUFhdGRxycybQiHOK1lc,7093 +kubernetes/client/models/v1beta2_resource_claim_spec.py,sha256=HUWQt8kvZ0D2O49rUpiyEj3ajRSiUK6HhfFA_VMoL8k,3469 +kubernetes/client/models/v1beta2_resource_claim_status.py,sha256=XBZyLT_Jk0xybT2bxNFEsQ5sf320dEKHTzKL1G1tDa8,7596 +kubernetes/client/models/v1beta2_resource_claim_template.py,sha256=4xFlfuVM-N84i19__oUH87q89mXNgf1x8KeDNUUwwpg,7056 +kubernetes/client/models/v1beta2_resource_claim_template_list.py,sha256=Ejs680z0k7dXvZpIKYnxXEwtcqflx8NJux3BQ7SI0KQ,7295 +kubernetes/client/models/v1beta2_resource_claim_template_spec.py,sha256=zycqqfyPTFKDsaXUqTVSd6E7HGEn8ei-fWSLPB5G1wI,4409 +kubernetes/client/models/v1beta2_resource_pool.py,sha256=UK8idY3p6ipaHd5VPGByMpcV_xK9IGYfKWau047TA08,7818 +kubernetes/client/models/v1beta2_resource_slice.py,sha256=Oe9NckpQumActjPml5RNp-Qi2EcG_g9v2zgSHJm7BS0,6872 +kubernetes/client/models/v1beta2_resource_slice_list.py,sha256=v7TgAyfqUHlcWytMDm1nWqyxA26d7w_5UjpqQq0uaas,7109 +kubernetes/client/models/v1beta2_resource_slice_spec.py,sha256=4iEwRixtyt-sY7DNZtSmeOJcPLPOkCRrdEKIfAlEOxg,13275 +kubernetes/client/models/v2_container_resource_metric_source.py,sha256=uo6sy08Rn3iepwBL6azExn4ufW2L5VrDUXCW11b1Y6w,5694 +kubernetes/client/models/v2_container_resource_metric_status.py,sha256=PqII3uwWchBgThSnlO09kK2uwrJgKRFMZW9xqzaC_Hk,5730 +kubernetes/client/models/v2_cross_version_object_reference.py,sha256=D1BIgsdj39sWezMZbvUdKLUGvLKPZlSXUa3zW_oE9T8,5895 +kubernetes/client/models/v2_external_metric_source.py,sha256=Ro7snlMbUYBZ1k_oHEzfeD0whAsNwoamDur-pYnpR3w,4435 +kubernetes/client/models/v2_external_metric_status.py,sha256=u3PNGL-Q8HZN8lRJPeLjo1J47c33S8eZTwRjMALQ2Ds,4471 +kubernetes/client/models/v2_horizontal_pod_autoscaler.py,sha256=3MxvkcnyZjncNSRyJCGFiykLAtzPNluXhh8t-GHj-Nw,7586 +kubernetes/client/models/v2_horizontal_pod_autoscaler_behavior.py,sha256=XIp80sGlSB3vzRlUr_FVr5aYijjfX-azXbmD6hGYJmc,4379 +kubernetes/client/models/v2_horizontal_pod_autoscaler_condition.py,sha256=lJbgcyU4NS6IBZ4REBl0DDJzDZV8p2vlj7Dzeonmz9E,7759 +kubernetes/client/models/v2_horizontal_pod_autoscaler_list.py,sha256=BzaiaPn0cQukm54tXdpLME29O4CLg7iUAKFU3dkigGk,7244 +kubernetes/client/models/v2_horizontal_pod_autoscaler_spec.py,sha256=eIEVs7VdWSj9J1fSRQlClDCFB4eJ0wGfMzXBppq5E1M,9393 +kubernetes/client/models/v2_horizontal_pod_autoscaler_status.py,sha256=2stkHc03khOlIceIqb_6J43xoQWi8tTQ0IvxHd1NN44,10018 +kubernetes/client/models/v2_hpa_scaling_policy.py,sha256=4uijVLO5cDcjUbtYAptQpGIDGDIV68EAKtdGRm543hA,5954 +kubernetes/client/models/v2_hpa_scaling_rules.py,sha256=Kg0DhtzTBvrQCl0YRVeOpf8rpY_AO8a1gZHXovF9Ab4,9003 +kubernetes/client/models/v2_metric_identifier.py,sha256=kz4ROYcqgeZD7LGhdd1PsOWiEvPlh6Mqajq5ohP3eAQ,4305 +kubernetes/client/models/v2_metric_spec.py,sha256=nXd_SN9632HJWC2Zrpq8lYXWuyr0Gxo12Ak7x6MXIjA,7482 +kubernetes/client/models/v2_metric_status.py,sha256=2y2wXQrRujytawf9JuhLtl1HW3RYXebwvUrJs871Tr8,7542 +kubernetes/client/models/v2_metric_target.py,sha256=KWRrU34sjK50sAgweg60RJHI22PfHX-FF0N0aqSVDsA,6819 +kubernetes/client/models/v2_metric_value_status.py,sha256=8aHleTnIUcvJUbZoUE1KX9KyMM0EIQV8VQmi46fknxo,5872 +kubernetes/client/models/v2_object_metric_source.py,sha256=uoetBx54W1YbleyV3Pjmuhiuyp7u-wcew8EZh_uuTeo,5503 +kubernetes/client/models/v2_object_metric_status.py,sha256=4qgzuUibTN_pJQ0G1GRkMOA70PpzaDW0KljAUTeg27g,5539 +kubernetes/client/models/v2_pods_metric_source.py,sha256=YT0PPG1krFNqD2ZxW6IQhmIuSX-YBHyVv-kZ6yiGhDw,4387 +kubernetes/client/models/v2_pods_metric_status.py,sha256=29mSUVxwoYtdx0mFTPR-lhG53Yj5PjpbrN_n5W-uY9I,4423 +kubernetes/client/models/v2_resource_metric_source.py,sha256=07Okfio9kT_5RC8vGK11WrJKs9ESHVfAIWbzRtsKaws,4484 +kubernetes/client/models/v2_resource_metric_status.py,sha256=xJtaKshf1hy9J0o6FYhtYKts2KqsMLYQUgrlmqGxFsY,4520 +kubernetes/client/models/version_info.py,sha256=dmVGahhSV28u_pvjCZRjuQo8l8tJYwGddnlZSBjov4g,14679 +kubernetes/client/rest.py,sha256=3vnmSfWfe0SJjtpaWT4OsNc6ebu-cUCYq07lMbOK3Pc,13121 +kubernetes/config/__init__.py,sha256=jDlgnwBP8CnTOuYzcQk4xgpwxesVy6oXqaCngbZGPls,2023 +kubernetes/config/__pycache__/__init__.cpython-311.pyc,, +kubernetes/config/__pycache__/config_exception.cpython-311.pyc,, +kubernetes/config/__pycache__/dateutil.cpython-311.pyc,, +kubernetes/config/__pycache__/dateutil_test.cpython-311.pyc,, +kubernetes/config/__pycache__/exec_provider.cpython-311.pyc,, +kubernetes/config/__pycache__/exec_provider_test.cpython-311.pyc,, +kubernetes/config/__pycache__/incluster_config.cpython-311.pyc,, +kubernetes/config/__pycache__/incluster_config_test.cpython-311.pyc,, +kubernetes/config/__pycache__/kube_config.cpython-311.pyc,, +kubernetes/config/__pycache__/kube_config_test.cpython-311.pyc,, +kubernetes/config/config_exception.py,sha256=mh46I33-L7-kQgJe6IoHrAEd5yB960CgNJWO-qW8SOM,632 +kubernetes/config/dateutil.py,sha256=vr5tzHX6lGhZgVRgrJWjkLFBxccATfjEbv43n6kaC10,3057 +kubernetes/config/dateutil_test.py,sha256=Ly6Pp0OZyr22EVst9eteEZ74t8KyolReVaBLwHTt86M,4621 +kubernetes/config/exec_provider.py,sha256=L452CagBlMQ-48E0KmgBY6ghBRak7QQe0grPeWzLRWc,4723 +kubernetes/config/exec_provider_test.py,sha256=AT0Y8vaaK1ltuqN-nshLfNEoPJ5DxohG4y6xhEBlZ3I,8142 +kubernetes/config/incluster_config.py,sha256=BzFoaIdTvDUMT6uhmdJvVvec-S8vLFPZcKcCLvRFOxU,4676 +kubernetes/config/incluster_config_test.py,sha256=74OyzgyC5J50e36_J7fhYMOfXL8uIKtO-QoWNS0hNlo,5971 +kubernetes/config/kube_config.py,sha256=LoPoAfrLa1unGJ2sbdvF1yYFOcPdpXoyKT9AlDTgGxY,34423 +kubernetes/config/kube_config_test.py,sha256=sIZgkEkdFii6er89PybNBxt-YhSAcOZtxhXECB-NGvs,72659 +kubernetes/dynamic/__init__.py,sha256=Wju9Fz6BaobrPkp0ZF9ijUYg4XjaWG3eRu5LIE1pfj8,618 +kubernetes/dynamic/__pycache__/__init__.cpython-311.pyc,, +kubernetes/dynamic/__pycache__/client.cpython-311.pyc,, +kubernetes/dynamic/__pycache__/discovery.cpython-311.pyc,, +kubernetes/dynamic/__pycache__/exceptions.cpython-311.pyc,, +kubernetes/dynamic/__pycache__/resource.cpython-311.pyc,, +kubernetes/dynamic/__pycache__/test_client.cpython-311.pyc,, +kubernetes/dynamic/__pycache__/test_discovery.cpython-311.pyc,, +kubernetes/dynamic/client.py,sha256=-O4R6nNMnfht8i6merOSv8B6kOjT0lO9HTgmc_ywyFU,14416 +kubernetes/dynamic/discovery.py,sha256=pFOM27TCH8ij-kbDOgDt83fIHfogCA7qnlh5HK3IUF0,17620 +kubernetes/dynamic/exceptions.py,sha256=iOApp7sSAHE_9w7y_CEZFv3pgo3Nf4hGpu2PiHSdbB8,3843 +kubernetes/dynamic/resource.py,sha256=xg-F8Q19aJ1E7NaZImjk2OG0wtMhG0n6bghJKyiiykU,14775 +kubernetes/dynamic/test_client.py,sha256=3fYgZqHB7oyw24bgCJnOlJwe30ZdFenQrWjLRUIbhzM,20213 +kubernetes/dynamic/test_discovery.py,sha256=GsQC3JRSsZrtZV7zO2-uZ_9HyR34Pn4lDtETleKcfnk,2324 +kubernetes/leaderelection/__init__.py,sha256=0_vUk1kIpYwVAQAaVqQQxttZwlYihfLQW4MLxPpQdjc,587 +kubernetes/leaderelection/__pycache__/__init__.cpython-311.pyc,, +kubernetes/leaderelection/__pycache__/electionconfig.cpython-311.pyc,, +kubernetes/leaderelection/__pycache__/example.cpython-311.pyc,, +kubernetes/leaderelection/__pycache__/leaderelection.cpython-311.pyc,, +kubernetes/leaderelection/__pycache__/leaderelection_test.cpython-311.pyc,, +kubernetes/leaderelection/__pycache__/leaderelectionrecord.cpython-311.pyc,, +kubernetes/leaderelection/electionconfig.py,sha256=dc4xiI8mfgErx-KQc5wYw0IolbQVTY9J1tXYSgvzX1E,2180 +kubernetes/leaderelection/example.py,sha256=EWG2vFxCKLu9237-5qf7FCLwjGaBdQLTOLKPF6RO3aE,1871 +kubernetes/leaderelection/leaderelection.py,sha256=pL0mU_Zfft52nbbQFKhMG-E-6mfLpwno_QEI1lRdkbY,8371 +kubernetes/leaderelection/leaderelection_test.py,sha256=WjyGMOpANO-Fv36WKgPhPh5UKELdbcvYcQm_6Y6cE5Q,9900 +kubernetes/leaderelection/leaderelectionrecord.py,sha256=fLkWsFGiFMiS6z7aDMpHrIsU4T4e7ijhjs3tXSLhsLA,911 +kubernetes/leaderelection/resourcelock/__init__.py,sha256=0_vUk1kIpYwVAQAaVqQQxttZwlYihfLQW4MLxPpQdjc,587 +kubernetes/leaderelection/resourcelock/__pycache__/__init__.cpython-311.pyc,, +kubernetes/leaderelection/resourcelock/__pycache__/configmaplock.cpython-311.pyc,, +kubernetes/leaderelection/resourcelock/configmaplock.py,sha256=2yBYTplKR1iNt2qtDAcz-dLqIWVu4DbP9hy9SiBTdL4,5860 +kubernetes/stream/__init__.py,sha256=1fGSZdJImNU8V5Ct_lLLqXCBEtZC4QaSsSdGxYtDyDo,628 +kubernetes/stream/__pycache__/__init__.cpython-311.pyc,, +kubernetes/stream/__pycache__/stream.cpython-311.pyc,, +kubernetes/stream/__pycache__/ws_client.cpython-311.pyc,, +kubernetes/stream/__pycache__/ws_client_test.cpython-311.pyc,, +kubernetes/stream/stream.py,sha256=p8Al0RbPyeaz6MDJIyjW_ULUhlT4m-hld5cEGLowRA4,2307 +kubernetes/stream/ws_client.py,sha256=a92fJRrKEsXpb_1cBPqIjQpQRmrBlAcb2cMQ5wZaZos,23595 +kubernetes/stream/ws_client_test.py,sha256=Kl82WJiwXyjY3xmQQmzEEPi9S_ns1boL3LgnWE-fJw8,7177 +kubernetes/utils/__init__.py,sha256=MJsOvwRzvP3J5GpBNXRbVF-erhW6S16t933stNwYB8M,842 +kubernetes/utils/__pycache__/__init__.cpython-311.pyc,, +kubernetes/utils/__pycache__/create_from_yaml.cpython-311.pyc,, +kubernetes/utils/__pycache__/duration.cpython-311.pyc,, +kubernetes/utils/__pycache__/quantity.cpython-311.pyc,, +kubernetes/utils/create_from_yaml.py,sha256=VW2mWYDjvS3SB46HqFHIF3xQnK9q9lXq9aG7SDQaE58,11796 +kubernetes/utils/duration.py,sha256=6hRMLhr4NsMDts8oNJz-xIqgXWgxQ8cx3QNGMBfuiq4,5456 +kubernetes/utils/quantity.py,sha256=PFaOcQMuFEVoKAyyGvZNeNwjxSb3pOBdLj9TzdAxWl0,4414 +kubernetes/watch/__init__.py,sha256=jHa7RNecyK7P6J7nBggnwEWCiu4TR_v69mN4DDz8WGo,613 +kubernetes/watch/__pycache__/__init__.cpython-311.pyc,, +kubernetes/watch/__pycache__/watch.cpython-311.pyc,, +kubernetes/watch/__pycache__/watch_test.cpython-311.pyc,, +kubernetes/watch/watch.py,sha256=jZj3WWWnhp-vmd6Wl9P5villwfcd0-XgdvmgbUfvRNA,9449 +kubernetes/watch/watch_test.py,sha256=oUGUF_gin6yEi4GX1SGy8H1lW_gbRvTZQ00h80HOrqg,25708 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..5f133dbb5cfac001f2e84cda817210c03ce6484e --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/top_level.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..807e21be4c0163e326c2abfb891cf34408fdbfb2 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes-35.0.0.dist-info/top_level.txt @@ -0,0 +1 @@ +kubernetes diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..664c5d2f7db922ee42c7c28c10cf016ffa370051 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/kubernetes/__init__.py @@ -0,0 +1,25 @@ +# Copyright 2022 The Kubernetes Authors. +# +# 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. + +__project__ = 'kubernetes' +# The version is auto-updated. Please do not edit. +__version__ = "35.0.0" + +from . import client +from . import config +from . import dynamic +from . import watch +from . import stream +from . import utils +from . import leaderelection diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5e18269540371c3e30478b48e2dbaabc00f652ca --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/METADATA @@ -0,0 +1,106 @@ +Metadata-Version: 2.4 +Name: langchain-classic +Version: 1.0.7 +Summary: Building applications with LLMs through composability +Project-URL: Homepage, https://docs.langchain.com/ +Project-URL: Documentation, https://reference.langchain.com/python/langchain_classic/ +Project-URL: Repository, https://github.com/langchain-ai/langchain +Project-URL: Issues, https://github.com/langchain-ai/langchain/issues +Project-URL: Changelog, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-classic%3D%3D1%22 +Project-URL: Twitter, https://x.com/langchain_oss +Project-URL: Slack, https://www.langchain.com/join-community +Project-URL: Reddit, https://www.reddit.com/r/LangChain/ +License: MIT +License-File: LICENSE +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +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: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: <4.0.0,>=3.10.0 +Requires-Dist: async-timeout<5.0.0,>=4.0.0; python_version < '3.11' +Requires-Dist: langchain-core<2.0.0,>=1.3.3 +Requires-Dist: langchain-text-splitters<2.0.0,>=1.1.2 +Requires-Dist: langsmith<1.0.0,>=0.1.17 +Requires-Dist: pydantic<3.0.0,>=2.7.4 +Requires-Dist: pyyaml<7.0.0,>=5.3.0 +Requires-Dist: requests<3.0.0,>=2.0.0 +Requires-Dist: sqlalchemy<3.0.0,>=1.4.0 +Provides-Extra: anthropic +Requires-Dist: langchain-anthropic; extra == 'anthropic' +Provides-Extra: aws +Requires-Dist: langchain-aws; extra == 'aws' +Provides-Extra: azure-ai +Requires-Dist: langchain-azure-ai; extra == 'azure-ai' +Provides-Extra: cohere +Requires-Dist: langchain-cohere; extra == 'cohere' +Provides-Extra: community +Requires-Dist: langchain-community; extra == 'community' +Provides-Extra: deepseek +Requires-Dist: langchain-deepseek; extra == 'deepseek' +Provides-Extra: fireworks +Requires-Dist: langchain-fireworks; extra == 'fireworks' +Provides-Extra: google-genai +Requires-Dist: langchain-google-genai; extra == 'google-genai' +Provides-Extra: google-vertexai +Requires-Dist: langchain-google-vertexai; extra == 'google-vertexai' +Provides-Extra: groq +Requires-Dist: langchain-groq; extra == 'groq' +Provides-Extra: huggingface +Requires-Dist: langchain-huggingface; extra == 'huggingface' +Provides-Extra: mistralai +Requires-Dist: langchain-mistralai; extra == 'mistralai' +Provides-Extra: ollama +Requires-Dist: langchain-ollama; extra == 'ollama' +Provides-Extra: openai +Requires-Dist: langchain-openai; extra == 'openai' +Provides-Extra: perplexity +Requires-Dist: langchain-perplexity; extra == 'perplexity' +Provides-Extra: together +Requires-Dist: langchain-together; extra == 'together' +Provides-Extra: xai +Requires-Dist: langchain-xai; extra == 'xai' +Description-Content-Type: text/markdown + +# 🦜️🔗 LangChain Classic + +[![PyPI - Version](https://img.shields.io/pypi/v/langchain-classic?label=%20)](https://pypi.org/project/langchain-classic/#history) +[![PyPI - License](https://img.shields.io/pypi/l/langchain-classic)](https://opensource.org/licenses/MIT) +[![PyPI - Downloads](https://img.shields.io/pepy/dt/langchain-classic)](https://pypistats.org/packages/langchain-classic) +[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss) + +Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs). + +To help you ship LangChain apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith). +[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications. + +## Quick Install + +```bash +pip install langchain-classic +``` + +## 🤔 What is this? + +Legacy chains, `langchain-community` re-exports, indexing API, deprecated functionality, and more. + +In most cases, you should be using the main [`langchain`](https://pypi.org/project/langchain/) package. + +## 📖 Documentation + +For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_classic). For conceptual guides, tutorials, and examples on using LangChain, see the [LangChain Docs](https://docs.langchain.com/oss/python/langchain/overview). + +## 📕 Releases & Versioning + +See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies. + +## 💁 Contributing + +As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation. + +For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview). diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..0cb84f502fe6bcf6563019a7bc7a578068a1be50 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/RECORD @@ -0,0 +1,2655 @@ +langchain_classic-1.0.7.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +langchain_classic-1.0.7.dist-info/METADATA,sha256=NnWgTtFIjMRs4XJi_3Ln_IpqbylRQDbIyMakMJHvhj4,5063 +langchain_classic-1.0.7.dist-info/RECORD,, +langchain_classic-1.0.7.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +langchain_classic-1.0.7.dist-info/licenses/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067 +langchain_classic/__init__.py,sha256=kpV7CWhYMEqgHo9Uu3G3V_kkdoeMLQ-6mLMrNG0gNf4,13208 +langchain_classic/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/__pycache__/base_language.cpython-311.pyc,, +langchain_classic/__pycache__/base_memory.cpython-311.pyc,, +langchain_classic/__pycache__/cache.cpython-311.pyc,, +langchain_classic/__pycache__/env.cpython-311.pyc,, +langchain_classic/__pycache__/example_generator.cpython-311.pyc,, +langchain_classic/__pycache__/formatting.cpython-311.pyc,, +langchain_classic/__pycache__/globals.cpython-311.pyc,, +langchain_classic/__pycache__/hub.cpython-311.pyc,, +langchain_classic/__pycache__/input.cpython-311.pyc,, +langchain_classic/__pycache__/model_laboratory.cpython-311.pyc,, +langchain_classic/__pycache__/python.cpython-311.pyc,, +langchain_classic/__pycache__/requests.cpython-311.pyc,, +langchain_classic/__pycache__/serpapi.cpython-311.pyc,, +langchain_classic/__pycache__/sql_database.cpython-311.pyc,, +langchain_classic/__pycache__/text_splitter.cpython-311.pyc,, +langchain_classic/_api/__init__.py,sha256=4Fqp5PT3SHriGmgGWVmswWZP4SqNFj5oG6pRBG8CM0A,775 +langchain_classic/_api/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/_api/__pycache__/deprecation.cpython-311.pyc,, +langchain_classic/_api/__pycache__/interactive_env.cpython-311.pyc,, +langchain_classic/_api/__pycache__/module_import.cpython-311.pyc,, +langchain_classic/_api/__pycache__/path.cpython-311.pyc,, +langchain_classic/_api/deprecation.py,sha256=yvfHvmqh7OpZHl1rPaHasJacccMA9rlVsHiG9ycHOBI,884 +langchain_classic/_api/interactive_env.py,sha256=NlnXizhm1TG3l_qKNI0qHJiHkh9q2jRjt5zGJsg_BCA,139 +langchain_classic/_api/module_import.py,sha256=ZE5J1hCVByy7DNYi5dZ9zAP6zwQfY22i7upA8VtpEVI,6417 +langchain_classic/_api/path.py,sha256=Y6nJjaQ3-WGbv8S1U4RypSp-QXryxiJzPjynnzGP8BE,122 +langchain_classic/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/adapters/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/adapters/__pycache__/openai.cpython-311.pyc,, +langchain_classic/adapters/openai.py,sha256=zl7GEsCwmzJIAYTVU4XQxqQaEjnFL-9irICdAD114Kk,2004 +langchain_classic/agents/__init__.py,sha256=TxrlEJjeU4Lx8WjnxUR3zvHg3IjSn_bTHkhQzIJiGj8,6020 +langchain_classic/agents/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/__pycache__/agent.cpython-311.pyc,, +langchain_classic/agents/__pycache__/agent_iterator.cpython-311.pyc,, +langchain_classic/agents/__pycache__/agent_types.cpython-311.pyc,, +langchain_classic/agents/__pycache__/initialize.cpython-311.pyc,, +langchain_classic/agents/__pycache__/load_tools.cpython-311.pyc,, +langchain_classic/agents/__pycache__/loading.cpython-311.pyc,, +langchain_classic/agents/__pycache__/schema.cpython-311.pyc,, +langchain_classic/agents/__pycache__/tools.cpython-311.pyc,, +langchain_classic/agents/__pycache__/types.cpython-311.pyc,, +langchain_classic/agents/__pycache__/utils.cpython-311.pyc,, +langchain_classic/agents/agent.py,sha256=1OF0YizyLKWBhqUMb4NvYWAJnyMuWKFcrwRvuX3sTUo,62133 +langchain_classic/agents/agent_iterator.py,sha256=BKf03G10Li1x6H7entYGTf57zTpE6Q59uJMDQVQdYxE,16938 +langchain_classic/agents/agent_toolkits/__init__.py,sha256=ne1fFglmmXwXtRIsp99ZRcp2pZ0kaej6bPRF6y4xrFw,7443 +langchain_classic/agents/agent_toolkits/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/__pycache__/azure_cognitive_services.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/ainetwork/__init__.py,sha256=henfKntuAEjG1KoN-Hk1IHy3fFGCYPWLEuZtF2bIdZI,25 +langchain_classic/agents/agent_toolkits/ainetwork/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/ainetwork/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/ainetwork/toolkit.py,sha256=eyXqUrfC38l91ycefqH66QIBNvR6hy30MQ9YT2ZJW2A,694 +langchain_classic/agents/agent_toolkits/amadeus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/agent_toolkits/amadeus/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/amadeus/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/amadeus/toolkit.py,sha256=UXX8-bh5t1TpbJXnNP-R_xq8NSmSlp2TUOPtxEDPHY4,677 +langchain_classic/agents/agent_toolkits/azure_cognitive_services.py,sha256=1R1ouHDSRYgJgqzeib0K5IutDHpLfyJqHRdMFgZTVmk,780 +langchain_classic/agents/agent_toolkits/base.py,sha256=X0zLdn_efEvDW5pCTB_hu2crw3E3vqFRm7GDxWk74Sk,72 +langchain_classic/agents/agent_toolkits/clickup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/agent_toolkits/clickup/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/clickup/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/clickup/toolkit.py,sha256=roQDBxO6E8iaiyT8r5nv8LqP3Z_--n_bJa-SQmbDvOY,684 +langchain_classic/agents/agent_toolkits/conversational_retrieval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/agent_toolkits/conversational_retrieval/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/conversational_retrieval/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/conversational_retrieval/__pycache__/tool.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/conversational_retrieval/openai_functions.py,sha256=su-3UiGUVXpC-Xr6jbAqJndzbw3rECwZVpRKXV3nSlA,3333 +langchain_classic/agents/agent_toolkits/conversational_retrieval/tool.py,sha256=e57Dzp2KEW7-vgPBJRwCjTYDunajSF_v3tZQa8n2W6A,105 +langchain_classic/agents/agent_toolkits/csv/__init__.py,sha256=FxseTFeDmHzEOSxJlEMcldfTPuoTy9Dsqj7WZRugmKs,885 +langchain_classic/agents/agent_toolkits/csv/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/file_management/__init__.py,sha256=_DBf9jOXS56c1hu3K94b2C1Qi905-m3pgLnBNXjjgQc,792 +langchain_classic/agents/agent_toolkits/file_management/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/file_management/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/file_management/toolkit.py,sha256=NAtglMHDmqSFT6vlxUVUMBwk1Pxk4a2_R-QcyHTIJtc,754 +langchain_classic/agents/agent_toolkits/github/__init__.py,sha256=FBxQxsk8O9n4TXCZXHQW_-011pdVK3_3dN-yeLGPQjE,22 +langchain_classic/agents/agent_toolkits/github/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/github/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/github/toolkit.py,sha256=baraxwGoUCmpJ4D0BShMVj7k01qMx2tPawa2JUHbd9M,2252 +langchain_classic/agents/agent_toolkits/gitlab/__init__.py,sha256=x1DYZ-uaP3BvHsoZs21RxdktQ9292mYBP-tR3tG0h3U,22 +langchain_classic/agents/agent_toolkits/gitlab/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/gitlab/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/gitlab/toolkit.py,sha256=ftNWEN4z5IywC3RDMnaVYwTpn0NqU5avGxf65e6szlc,679 +langchain_classic/agents/agent_toolkits/gmail/__init__.py,sha256=0Y2P1d5UFysfWDxwUmb98JLCYNHoQBs1GnxynWGSRz8,21 +langchain_classic/agents/agent_toolkits/gmail/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/gmail/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/gmail/toolkit.py,sha256=n0e0TpEKNIk_Z5UT6TYocq1CYPTY26dZoHNgq9NzMuo,667 +langchain_classic/agents/agent_toolkits/jira/__init__.py,sha256=g7l8EPCXUddP-_AiO9huERcC_x2kD-dfroYmUe8O8I0,20 +langchain_classic/agents/agent_toolkits/jira/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/jira/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/jira/toolkit.py,sha256=TONtWVxlPDJ_umsPg1SadWLftRo_0KHQMl8S6rsuCDk,662 +langchain_classic/agents/agent_toolkits/json/__init__.py,sha256=T7Z9zw9_awf5-r0kExvry2aybzxEnpDb5SyLOpBC2d0,18 +langchain_classic/agents/agent_toolkits/json/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/json/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/json/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/json/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/json/base.py,sha256=_6fIlPEhHYw5aBkJrVSCAgB3eZf8LyiBEW8nV9pfWP0,681 +langchain_classic/agents/agent_toolkits/json/prompt.py,sha256=3uV2hk-xaMDWHZoEjW5LnsbLVteyaZfsNuhvo4kH4tQ,757 +langchain_classic/agents/agent_toolkits/json/toolkit.py,sha256=FRfkVeOK96bVAtlVu9nhmA83U68vb4--bkMxVz6IS1M,662 +langchain_classic/agents/agent_toolkits/multion/__init__.py,sha256=hc75Ek8tmBDf4f34RGwQ447AzE5qHR-HZACB7Di3YAA,23 +langchain_classic/agents/agent_toolkits/multion/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/multion/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/multion/toolkit.py,sha256=kr1RlukK_3vLJOi41c2lAH4czmQxcRkIlhV2psKpxEM,684 +langchain_classic/agents/agent_toolkits/nasa/__init__.py,sha256=IJBPbpHUXPFFl2-pYvRCaDgz6NKSfpKEeTezrhW-SQE,20 +langchain_classic/agents/agent_toolkits/nasa/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/nasa/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/nasa/toolkit.py,sha256=m5Q0uJIR-ShKaUKj4zQKIRTDB3HMmRWbgnIzjpJkfMg,662 +langchain_classic/agents/agent_toolkits/nla/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/agent_toolkits/nla/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/nla/__pycache__/tool.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/nla/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/nla/tool.py,sha256=GjlLq5olZZozhz_ReltiKGNXr_VcFSh73FkYDQiZmak,642 +langchain_classic/agents/agent_toolkits/nla/toolkit.py,sha256=fI1PAb1ZKamJQcwoV_IMDPZzjEL2chbAtjvaMsnmuf4,657 +langchain_classic/agents/agent_toolkits/office365/__init__.py,sha256=wdPaHFsDOXYsITlWPe2RtHIxFRP2CdbQHIOG1GeEcLs,25 +langchain_classic/agents/agent_toolkits/office365/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/office365/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/office365/toolkit.py,sha256=ulmSZW9mTyO9TbN0mKWRiuiPa2mIB4249C2R_MCVkIE,679 +langchain_classic/agents/agent_toolkits/openapi/__init__.py,sha256=b7ELUVFz_v756WQLXBUtR1mbaXGrKr3tdAroWCsWGm4,26 +langchain_classic/agents/agent_toolkits/openapi/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/__pycache__/planner.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/__pycache__/planner_prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/__pycache__/spec.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/openapi/base.py,sha256=YSkUwcyB7hOfrrQujcFoQu3P_0iq7e1zJFZP7mL_sYk,696 +langchain_classic/agents/agent_toolkits/openapi/planner.py,sha256=ksYkth8HJ9JOwVDbkYPeC0ynKXOfxVUnoc-43K33I-k,1607 +langchain_classic/agents/agent_toolkits/openapi/planner_prompt.py,sha256=JsSre9o27IL8Xu6KKwxVM9OYHINvWxpQ3SczJCm70qI,3534 +langchain_classic/agents/agent_toolkits/openapi/prompt.py,sha256=7gX9l3gMlqqOG43LVXwRFb7UehbVweQJIQAtEMIMJxg,917 +langchain_classic/agents/agent_toolkits/openapi/spec.py,sha256=WzHvz5zvLSpVjPQ9AZ_vMU6FP6SVq4SFt7ZlL069K6k,841 +langchain_classic/agents/agent_toolkits/openapi/toolkit.py,sha256=sGFKgyD5X8GJyAoqDtZOb00FGjVGySrH7GXDSeWLFkk,826 +langchain_classic/agents/agent_toolkits/pandas/__init__.py,sha256=acnqqAkFByFjZ4VSFIAdf8JYe8j-IGDDkHQB6Fr8Ang,900 +langchain_classic/agents/agent_toolkits/pandas/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/playwright/__init__.py,sha256=a2d4VqBUv__DB9FyicM4vMHvOo1QqezTCaFmFGP8quY,772 +langchain_classic/agents/agent_toolkits/playwright/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/playwright/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/playwright/toolkit.py,sha256=n2oY6y7R0gtk6hpBSa1WBSaRUxD-UIJExwSwq0YwZtg,737 +langchain_classic/agents/agent_toolkits/powerbi/__init__.py,sha256=9KrYrWCcuVyxlBBLCke09XngnFsFodfInQSW7XVXys4,22 +langchain_classic/agents/agent_toolkits/powerbi/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/powerbi/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/powerbi/__pycache__/chat_base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/powerbi/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/powerbi/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/powerbi/base.py,sha256=nLguCPAsGFgctmPHB8cMI0pYVmD7-Esr1IRtbWKBg4Q,684 +langchain_classic/agents/agent_toolkits/powerbi/chat_base.py,sha256=sRlAe6seLwuOvNboGJmn09KTosYWyEm8jC6wyT0imvc,726 +langchain_classic/agents/agent_toolkits/powerbi/prompt.py,sha256=lcm4vzMLC6Md1dVd-R8RDmoMFKVVtHspHv3_wFlpOjc,1092 +langchain_classic/agents/agent_toolkits/powerbi/toolkit.py,sha256=dryV_SukyRXpKZHTYsFxv_OgZb_l9McqmGzAbglqiMc,684 +langchain_classic/agents/agent_toolkits/python/__init__.py,sha256=vV_RrxGqStKQ8k7qFzDxcrDGce7HsMAY28J8Bda-ipQ,890 +langchain_classic/agents/agent_toolkits/python/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/slack/__init__.py,sha256=6Z7GpcJD6FwuFKdcvKJvIfhFvJiiy9I7Gc1MSEKJlcw,21 +langchain_classic/agents/agent_toolkits/slack/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/slack/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/slack/toolkit.py,sha256=-xn774bmtg3tRyqPPj9WheVvNe-xSp5tIsgGXfXr8IE,667 +langchain_classic/agents/agent_toolkits/spark/__init__.py,sha256=b0dbd3YIxKZEC-cho8q7B-IabBE9_Df2mZWAvTmwPfM,898 +langchain_classic/agents/agent_toolkits/spark/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/spark_sql/__init__.py,sha256=3IVQbSsdtLKybKYDE0VSq-SCTNFSAJNgCzaJWnSWJbg,23 +langchain_classic/agents/agent_toolkits/spark_sql/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/spark_sql/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/spark_sql/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/spark_sql/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/spark_sql/base.py,sha256=yqGlMAQ-W_uG8SpAhcES7fEIYDJ3T944ckBTRQT_bJI,706 +langchain_classic/agents/agent_toolkits/spark_sql/prompt.py,sha256=5qZGYhChJhhqEQoAuo8X7sEd_M38yiTsh-R__GTIstc,791 +langchain_classic/agents/agent_toolkits/spark_sql/toolkit.py,sha256=OORKCp-L0xNrcjfHttHlZD-pdVq7qaeL52OrlB1J5eA,691 +langchain_classic/agents/agent_toolkits/sql/__init__.py,sha256=eqqu9Hd5KiY9-04X2_9acILI2bShgSqNxJFsQ7cm9Dw,17 +langchain_classic/agents/agent_toolkits/sql/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/sql/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/sql/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/sql/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/sql/base.py,sha256=PQ_Z3-4qll9BfBoqTiEbR69ah1tsTiybGFu5n023wSs,669 +langchain_classic/agents/agent_toolkits/sql/prompt.py,sha256=HttQbzDQehtE0A-XFbIQ_6YE3GpE5MeDqVXpJD9wato,904 +langchain_classic/agents/agent_toolkits/sql/toolkit.py,sha256=PKWzW748DdsoFznurHWcxAUPbXII-cWzI9kk3meumtU,688 +langchain_classic/agents/agent_toolkits/steam/__init__.py,sha256=iOMgxWCt0FTNLMNq0wScgSN_YdBBq-56VM6j0Ud8GpI,21 +langchain_classic/agents/agent_toolkits/steam/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/steam/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/steam/toolkit.py,sha256=waSvCdJi-kxMaqCfKtnh4A8zuAMyxJKh8-YKcasshMY,667 +langchain_classic/agents/agent_toolkits/vectorstore/__init__.py,sha256=uT5qVHjIcx3yFkWfxOzbRKL5xwWcMuFGQ-es9O7b2NQ,56 +langchain_classic/agents/agent_toolkits/vectorstore/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/vectorstore/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/vectorstore/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/vectorstore/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/vectorstore/base.py,sha256=RxTowqd_VFLiwd9Y0ryGfiY0X2ZQXbDJ4z1pO6JvAPA,7483 +langchain_classic/agents/agent_toolkits/vectorstore/prompt.py,sha256=ODxV3iuCzs7eb8gi4PDRnsC2-o8HAACnNREe0dfVHYY,846 +langchain_classic/agents/agent_toolkits/vectorstore/toolkit.py,sha256=NQUmmMuYdj051tQ93tgdGQpKyTFZuJZ1PWSUkJZY0FE,3239 +langchain_classic/agents/agent_toolkits/xorbits/__init__.py,sha256=2sARdRHjPeutxkkWV7yTuPkgwARHugqv2Sh64_uJpJ0,892 +langchain_classic/agents/agent_toolkits/xorbits/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/zapier/__init__.py,sha256=19Hc7HG8DzQfg83qqEbYiXA5FklLoRAEOfIs9JqTjX8,22 +langchain_classic/agents/agent_toolkits/zapier/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/zapier/__pycache__/toolkit.cpython-311.pyc,, +langchain_classic/agents/agent_toolkits/zapier/toolkit.py,sha256=mlnSUs1oFh7blJMV9oIFW4v1nAhfKF7FwotVrXC_kEI,679 +langchain_classic/agents/agent_types.py,sha256=6_eWPbi_NuN2a4R5zgNoquRZ66ZiCZWCit89XpdKFdo,1794 +langchain_classic/agents/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/chat/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/chat/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/chat/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/chat/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/chat/base.py,sha256=8xfSKwXF6ei53-eNAd150sG5LFsns-ClzowIaWFOnRQ,6246 +langchain_classic/agents/chat/output_parser.py,sha256=WOnQBgRgVc_JRlLmMpjYacTNKOGNH9ouaqy54ZrxI3U,2445 +langchain_classic/agents/chat/prompt.py,sha256=46XtmRiMLp0RhRRcStU1YKmtNCJ7BNIRyITn8NBrrC0,1185 +langchain_classic/agents/conversational/__init__.py,sha256=TnMfDzoRzR-xCiR6ph3tn3H7OPbBPpuTsFuqkLMzjiA,75 +langchain_classic/agents/conversational/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/conversational/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/conversational/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/conversational/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/conversational/base.py,sha256=p2XBzlAujvLobksvO_XljCbqe1kwZHpyh9x8a0YFNTE,6138 +langchain_classic/agents/conversational/output_parser.py,sha256=silJxKKRhbTW0r8sNkIgrzXqG6k6u606eaH5gxVt224,1638 +langchain_classic/agents/conversational/prompt.py,sha256=jlX855lLvOqc9P0iY8rijHESZ0ZjB7UqpbjkF9Tzl8o,1872 +langchain_classic/agents/conversational_chat/__init__.py,sha256=TnMfDzoRzR-xCiR6ph3tn3H7OPbBPpuTsFuqkLMzjiA,75 +langchain_classic/agents/conversational_chat/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/conversational_chat/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/conversational_chat/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/conversational_chat/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/conversational_chat/base.py,sha256=yZYv89JUd8j101M4-pu_l1Zv3pCYpMjnf5zxDl0MvKY,6327 +langchain_classic/agents/conversational_chat/output_parser.py,sha256=PTbspelrdMRrOSvwwAL-6Ijmh--1df0HolsDJ55moGE,2320 +langchain_classic/agents/conversational_chat/prompt.py,sha256=Zeugnvp0EpQp4zwmDCL681lxaxRBPrvly9J6BK93-UA,2803 +langchain_classic/agents/format_scratchpad/__init__.py,sha256=SzMzhwmBp2rCibdoCT7Eou8RSc4_eam6abkBQmgb27o,1005 +langchain_classic/agents/format_scratchpad/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/__pycache__/log.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/__pycache__/log_to_messages.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/__pycache__/openai_tools.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/__pycache__/tools.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/__pycache__/xml.cpython-311.pyc,, +langchain_classic/agents/format_scratchpad/log.py,sha256=WGpiLXGmhDc-suAQwf0HvDxoz1xmYMoc6jFlOhn0wt4,756 +langchain_classic/agents/format_scratchpad/log_to_messages.py,sha256=v7Li4ahPe-xN9ZmhLKVg7gz_PQBrfAp1bu5GKSTP64Y,943 +langchain_classic/agents/format_scratchpad/openai_functions.py,sha256=VzlMsf5TM4VqbOCa1wmPckgBUeqgW5bs5WQlw7pxsck,2722 +langchain_classic/agents/format_scratchpad/openai_tools.py,sha256=m3v4en8IvpMt4GZx1N72w40oYMaycUZw3hDAMIOqtiQ,174 +langchain_classic/agents/format_scratchpad/tools.py,sha256=AeCMQShRmUiGWYv0GICkZKYHnhECyQyMTmdOWxL6ucs,2194 +langchain_classic/agents/format_scratchpad/xml.py,sha256=KqrDBuw_78Y6Xu_LpYJEK7n6QVOlo9Ol7u1bzuiahz0,1664 +langchain_classic/agents/initialize.py,sha256=5KisjMInooV6KagEnaqjAuo1OlvzbmGYnibpAzYxeZ0,4234 +langchain_classic/agents/json_chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/json_chat/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/json_chat/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/json_chat/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/json_chat/base.py,sha256=rZpk8eI0s1JAj_aOyUG03l6Af3-0CrHyiWIKNlAbYQ8,7566 +langchain_classic/agents/json_chat/prompt.py,sha256=gOkKMMG93CiOlNjtn2XRawfa-QVrID4zR05J4xZipfU,549 +langchain_classic/agents/load_tools.py,sha256=zVI9isSq1tkApermqeqdrosCsBG3aMmvqg4fAO7uYgY,299 +langchain_classic/agents/loading.py,sha256=fbLHezmBP7r7_SySUtx13UDVsFU-ojObaTzAyuCqdDI,4887 +langchain_classic/agents/mrkl/__init__.py,sha256=Gpz8w88wAF4GSXoGnuYOwZY5rhjFL5WGZvTVQa-YJas,86 +langchain_classic/agents/mrkl/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/mrkl/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/mrkl/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/mrkl/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/mrkl/base.py,sha256=UIUAvSTF2mOvRHPZ5oMM6lbDSKapgi8fYsRr8dtW738,7099 +langchain_classic/agents/mrkl/output_parser.py,sha256=9LXdEk9kbmsYPapuc0QQ7rNQWDrbTSDhiW34mp7-dpM,3746 +langchain_classic/agents/mrkl/prompt.py,sha256=F2UShApLh_E7JOXhvHXES4YGY_Sv4dG1fNDYbK0aHjM,640 +langchain_classic/agents/openai_assistant/__init__.py,sha256=TFIaiGS-JwZrejeYzqVdNxsCXZb7PEW9LK0s43_dxUU,122 +langchain_classic/agents/openai_assistant/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/openai_assistant/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/openai_assistant/base.py,sha256=dEfVnpzK34H6sDBeNhH12vmz1TwtDTIjUqDEtEbBemM,31016 +langchain_classic/agents/openai_functions_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/openai_functions_agent/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/openai_functions_agent/__pycache__/agent_token_buffer_memory.cpython-311.pyc,, +langchain_classic/agents/openai_functions_agent/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/openai_functions_agent/agent_token_buffer_memory.py,sha256=NnPdzxTZ4pD_WVvy_K67FOR0h0cohXNv4KXHnnpxb-s,3650 +langchain_classic/agents/openai_functions_agent/base.py,sha256=FBKNbMNM65KOaNs2ekaEsR2zBZRUOMlfyNgrlgnmLf0,13448 +langchain_classic/agents/openai_functions_multi_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/openai_functions_multi_agent/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/openai_functions_multi_agent/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/openai_functions_multi_agent/base.py,sha256=x3MhqsNLoy7ZcTnshqOjsA1crWaDbM3-lntUGS6nLpk,12844 +langchain_classic/agents/openai_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/openai_tools/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/openai_tools/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/openai_tools/base.py,sha256=XjJGPw9TMKwO7gsfleXJuBzbXRmBkH4Ag1L_OCvahuw,3622 +langchain_classic/agents/output_parsers/__init__.py,sha256=z1RKMlc8mQQiMgSi1c2HQUHCJSoY3eR1tws2xWAe1Ro,1430 +langchain_classic/agents/output_parsers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/json.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/openai_tools.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/react_json_single_input.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/react_single_input.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/self_ask.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/tools.cpython-311.pyc,, +langchain_classic/agents/output_parsers/__pycache__/xml.cpython-311.pyc,, +langchain_classic/agents/output_parsers/json.py,sha256=JfQslv_4_nsO2jRRWgXyXbrJtzs2_NBvER-zdwShcCM,1904 +langchain_classic/agents/output_parsers/openai_functions.py,sha256=Qxwrh7vXxTPiXR_ZomPSmdu98mkfjWMuqhBzCiYtph0,3644 +langchain_classic/agents/output_parsers/openai_tools.py,sha256=zPKWVqRV1abRBSQBtfsJMbjKfgY4qMLLW7OpROsVRAY,2432 +langchain_classic/agents/output_parsers/react_json_single_input.py,sha256=ARySXzi1rNlbjETVQcNrNjaOWEmkWfnp4BeTQ-DbHpM,2677 +langchain_classic/agents/output_parsers/react_single_input.py,sha256=dFE52z_gWjBQpTefMn5sdDhIvu9VyriVXl27PRDNDkI,3325 +langchain_classic/agents/output_parsers/self_ask.py,sha256=CPpH_rl4E68sApQVk2pXp5qYAicnmLJ2xctv9tFzO_k,1652 +langchain_classic/agents/output_parsers/tools.py,sha256=TcwLK3snK0Uf5eWJLlUUg42FjxwAfCf-0VrqNOKc6c8,4034 +langchain_classic/agents/output_parsers/xml.py,sha256=xH91KFz12xkMM2WcuM_JXxxO8_4f_ep9TPtzpK1or2Y,4834 +langchain_classic/agents/react/__init__.py,sha256=9RIjjaUDfWnoMEMpV57JQ0CwZZC5Soh357QdKpVIM-4,76 +langchain_classic/agents/react/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/react/__pycache__/agent.cpython-311.pyc,, +langchain_classic/agents/react/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/react/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/react/__pycache__/textworld_prompt.cpython-311.pyc,, +langchain_classic/agents/react/__pycache__/wiki_prompt.cpython-311.pyc,, +langchain_classic/agents/react/agent.py,sha256=JQBL3hyvVNxCxRMiPUm7hkonSNBmz_ZP4e9uZ-Qn05k,5363 +langchain_classic/agents/react/base.py,sha256=LA9yGPEVh316JzNJXhG8YSAGbIEoUx2tasR60gsBh7M,6329 +langchain_classic/agents/react/output_parser.py,sha256=CGZ1vCL9DaA0odQsXy8v-TbRTzvOGqBvc--oSV1sGXs,1257 +langchain_classic/agents/react/textworld_prompt.py,sha256=aUG1xgTfd4oVOfdR8YPAZcc4DNuk2kxFcjkiCcyt2_Y,1891 +langchain_classic/agents/react/wiki_prompt.py,sha256=ABY_j_l063mKy43FVdxf8BpDtNzVfybUNlzDEwv1Ttk,6150 +langchain_classic/agents/schema.py,sha256=WVjsuB3W3o-R4mJgPIamuMOxc-xRNOpepNYz1yCnzts,1219 +langchain_classic/agents/self_ask_with_search/__init__.py,sha256=gtk3yKsQVBrtX2esW3480KtNXSi7Qim-LXddQFNlS24,106 +langchain_classic/agents/self_ask_with_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/self_ask_with_search/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/self_ask_with_search/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/self_ask_with_search/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/self_ask_with_search/base.py,sha256=PY3NQR9nm7SfoKC0NqVls1WdS4e9b1y1se4lnhsFCv8,8224 +langchain_classic/agents/self_ask_with_search/output_parser.py,sha256=3ublUMcwOMa-foyhpJRGsrnWZvJcjaMRi5wmI48s_5M,146 +langchain_classic/agents/self_ask_with_search/prompt.py,sha256=G1sy7LLvkZbYSMUJbTjlWGgxaTgwxrZH6EQ7JOuVKSc,1911 +langchain_classic/agents/structured_chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/structured_chat/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/structured_chat/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/structured_chat/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/agents/structured_chat/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/structured_chat/base.py,sha256=kM3JvOf6O0sf0i2N5k2FurtWYcFy93N4aDG3OtruP_0,10785 +langchain_classic/agents/structured_chat/output_parser.py,sha256=eLImo8o6mtngGlM1yRK36313KYyf5-odDABHFh4MGtc,4075 +langchain_classic/agents/structured_chat/prompt.py,sha256=UMFml08fWODBKSQSv8ngqbDejtG_fTbuWS1Qy8R5rh0,1019 +langchain_classic/agents/tool_calling_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/tool_calling_agent/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/tool_calling_agent/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/tool_calling_agent/base.py,sha256=o_DhqQ56OX1iv1QOK4ITSatZCTcv3krAMSILekS7jz0,4119 +langchain_classic/agents/tools.py,sha256=6ElMVkjRkLWr9eTMxxNJvsaxzq5ufY3v2u6G_mo9T34,1447 +langchain_classic/agents/types.py,sha256=l0WYO7k9pO0F4wWHUlcFd_p_DPHD5Qb_zCyBwPBkNdE,1528 +langchain_classic/agents/utils.py,sha256=EAUDV9ZdnjFK2e-9wEpRwKFnM6CG5iAe5EbqpQntV1U,556 +langchain_classic/agents/xml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/agents/xml/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/agents/xml/__pycache__/base.cpython-311.pyc,, +langchain_classic/agents/xml/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/agents/xml/base.py,sha256=D--tvqhWQtVw_O6OULHehVMnnwxhwwJQVCiPpu8idLM,8167 +langchain_classic/agents/xml/prompt.py,sha256=eGxplfm1jleHEEIsZYwFYZ1h_SaEQHhVnwtl8GoJcMo,766 +langchain_classic/base_language.py,sha256=SN3vhbLbZwevAoddtq3xZeEqbaDWrRVCoNZYLgGmVA4,218 +langchain_classic/base_memory.py,sha256=W5ISnipZo4aY6SVZytHf65rqlrRqhqhUrZ78aQr6rLY,3825 +langchain_classic/cache.py,sha256=xow7Ud_ZOY7BqHh_cHADpgHFaSh9eVGgygDbFveVyI0,2163 +langchain_classic/callbacks/__init__.py,sha256=KTpUU5qh8lNmaJAJ71S08Tn6GVSZ4CvFwoE2hG9wUXY,5819 +langchain_classic/callbacks/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/aim_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/argilla_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/arize_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/arthur_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/base.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/clearml_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/comet_ml_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/confident_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/context_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/file.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/flyte_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/human.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/infino_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/labelstudio_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/llmonitor_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/manager.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/mlflow_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/openai_info.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/promptlayer_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/sagemaker_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/stdout.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/streaming_aiter.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/streaming_aiter_final_only.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/streaming_stdout.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/streaming_stdout_final_only.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/trubrics_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/utils.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/wandb_callback.cpython-311.pyc,, +langchain_classic/callbacks/__pycache__/whylabs_callback.cpython-311.pyc,, +langchain_classic/callbacks/aim_callback.py,sha256=APUIjH3yLb5pUKOyR-G5bx_5uTJCCbKNqYKxsavt0d8,949 +langchain_classic/callbacks/argilla_callback.py,sha256=qqUQKNpEhEDNzq8ATRnPEcMI0u_dKzgDKwbiHC4g_34,697 +langchain_classic/callbacks/arize_callback.py,sha256=Ew8N3b6-NP0H5mlJ3Hkaiz7TOwGLy1GrtdZZVrp0Ax4,687 +langchain_classic/callbacks/arthur_callback.py,sha256=tdaqnrNcMhwrSR1uOzip566D-8k8uHOK8bVV6M1wD20,692 +langchain_classic/callbacks/base.py,sha256=7660fgS9YelYe2GmmBF1O275b36mUS0gZU9OfA29daw,654 +langchain_classic/callbacks/clearml_callback.py,sha256=sZxA_tKKD0C93ga7OIWo3w_FyBjMyQFiMRXGmJBslo8,697 +langchain_classic/callbacks/comet_ml_callback.py,sha256=dq2_-S7XjjBYN0mFygagpn6hcMLlnaS2_osXEAM8Pdw,693 +langchain_classic/callbacks/confident_callback.py,sha256=4vTPsBKmJ_q3RXMvguH7nhoooni9IkrTfyVJlC5x1yc,704 +langchain_classic/callbacks/context_callback.py,sha256=sDr4yCNJAyjx_TpY97ZqpHMEI4irUsmMVAmO9zkIyNY,697 +langchain_classic/callbacks/file.py,sha256=nTWUsbfG_CYE4ZD0uozJwYbErld9VQmrlwRfYXQpzx8,97 +langchain_classic/callbacks/flyte_callback.py,sha256=nrW8Y-iMSEWKSzfxwshf5THXnDkoEIKfv51TcOXo_bQ,687 +langchain_classic/callbacks/human.py,sha256=rbzTKYjwllpvNhTunCJTTiCvuhBw4_wzfGArgTJbIqk,1005 +langchain_classic/callbacks/infino_callback.py,sha256=OeN99Gnm9_CugYkHExH0Mwa1yBjsYAcH_Fp98jOZ56Y,692 +langchain_classic/callbacks/labelstudio_callback.py,sha256=Unp9hBR_JhiysHZzagaEN_dl2gxhLGTWGLs_B31jwmY,1014 +langchain_classic/callbacks/llmonitor_callback.py,sha256=rMKgDSWG-nODDAEy3cl2S5CfcyvRAmINeWw48E01n2o,724 +langchain_classic/callbacks/manager.py,sha256=yjYS3wqErQVLebv1DLQka8wU5GwF0skEV1mgZ16cEGY,2406 +langchain_classic/callbacks/mlflow_callback.py,sha256=RuDnei75zYapTTlo99E150sHLhibb93vuEBWv-zL-Ac,1145 +langchain_classic/callbacks/openai_info.py,sha256=sOs4RmjORD3owasHKyVB4BvHYKevkHWErd0X-C7VoTo,684 +langchain_classic/callbacks/promptlayer_callback.py,sha256=wZwF1c4AzurE9A2nXNoOv8AHUUUOjAamKuXyXpnEDfk,734 +langchain_classic/callbacks/sagemaker_callback.py,sha256=UehNSCnIuNBEmEYRWbjngRbxJNPOsjsLwQv-Mfs33PY,724 +langchain_classic/callbacks/stdout.py,sha256=9weMjKUjKSTcWmeb3Sb2KKblj7C0-QTa1SzUzRMbjw0,103 +langchain_classic/callbacks/streaming_aiter.py,sha256=EMF8GgM4aI5QzNkrNq1JFPl17nzHyNXnjanux393smw,2667 +langchain_classic/callbacks/streaming_aiter_final_only.py,sha256=EPMGnCKvJlpX_fE5q15X6tC5EKbl1S4cTS_p783eK9Y,3542 +langchain_classic/callbacks/streaming_stdout.py,sha256=l-SVRCjBTOWSPwXzjzsF0GkuAxE8eOZxnwUqC2LUPfM,174 +langchain_classic/callbacks/streaming_stdout_final_only.py,sha256=Co1WIXlWMM2yL573qKsy432P9vgvoy1QWbqh9A9sZiU,3506 +langchain_classic/callbacks/streamlit/__init__.py,sha256=uCj-fDOcOOF2Gju-rjBwnqp4kvPJS_Faq6brMpQN3J0,3370 +langchain_classic/callbacks/streamlit/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/callbacks/streamlit/__pycache__/mutable_expander.cpython-311.pyc,, +langchain_classic/callbacks/streamlit/__pycache__/streamlit_callback_handler.cpython-311.pyc,, +langchain_classic/callbacks/streamlit/mutable_expander.py,sha256=_tYffNWYcfs5wixydE_-vnVXzcnqzCtIOYdp4GYBgis,945 +langchain_classic/callbacks/streamlit/streamlit_callback_handler.py,sha256=ZETtJfpAv5q_pXJ-aAuBLnvNRuFDm24WtZTXwIbB1AM,1380 +langchain_classic/callbacks/tracers/__init__.py,sha256=S1g5TfZWmgf6CF4xD2nbl7xWuaQ8sTsfMH5KVqJJr_8,1065 +langchain_classic/callbacks/tracers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/base.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/comet.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/evaluation.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/langchain.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/log_stream.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/logging.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/root_listeners.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/run_collector.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/schemas.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/stdout.cpython-311.pyc,, +langchain_classic/callbacks/tracers/__pycache__/wandb.cpython-311.pyc,, +langchain_classic/callbacks/tracers/base.py,sha256=DtvdGR9-kJt1KwVQp9hiyGJWDZkOqf9djI3K6cYAVGg,191 +langchain_classic/callbacks/tracers/comet.py,sha256=qMDLutuI_oL2wCg6qZ6qg8ZL5OIBrkE9gUUowfTAyDw,808 +langchain_classic/callbacks/tracers/evaluation.py,sha256=AkSlPInNoeGs_NaQKhrQ-3KC-jWDqxO9MJyMbTh_NYc,234 +langchain_classic/callbacks/tracers/langchain.py,sha256=KS1qe0UMdmQzoESWw696yWtQyg4_ZSXj4kNOtLfWFlU,218 +langchain_classic/callbacks/tracers/log_stream.py,sha256=TOMibZ6NzWqv-hz8FeLoGlU36ElaxrVKvIA7jn-rlIs,226 +langchain_classic/callbacks/tracers/logging.py,sha256=55TU1C10gB3fsu_ic7MqJm_3zv3DfM1bswV8EJFJNK0,1694 +langchain_classic/callbacks/tracers/root_listeners.py,sha256=z4sMzTA35qnAd5S5K19Fu-8rySYOIDnEgYf0SjoQhk0,105 +langchain_classic/callbacks/tracers/run_collector.py,sha256=xDu5e45bJW8PyGaFul9tenkbjZ__MtfR1FoqpqM-BsA,120 +langchain_classic/callbacks/tracers/schemas.py,sha256=zB2CQ1soOShy_HBKBGaDAs2naOyFqBkyG0ho_zH2GUo,73 +langchain_classic/callbacks/tracers/stdout.py,sha256=imlqtilpEu0A4Falyaf0CoLebk6O8RHnLEG6RZ7jLdM,168 +langchain_classic/callbacks/tracers/wandb.py,sha256=C44ZJMXi3UdSe37XAJ9E8SXLHC9i5r1Iov6nTL__r-8,759 +langchain_classic/callbacks/trubrics_callback.py,sha256=br6BS2LOlq89QBNV2g7tsYKwql3EOHtiou9u9Iw_g4I,702 +langchain_classic/callbacks/utils.py,sha256=A7cGkhWj_FJKkVJA-tIusLzkNcFiDsPrduvq1gVZUWs,1417 +langchain_classic/callbacks/wandb_callback.py,sha256=qes7J1cChY_NAABUUlePEwKc4uWsyJCLjcCJSyMjvJo,687 +langchain_classic/callbacks/whylabs_callback.py,sha256=_FOncE9u-DmWpMjcy6gpLeWB_J0pmhV5jWaKM-sDtR0,697 +langchain_classic/chains/__init__.py,sha256=getPcCu9nyJZEMDsge6caCmeNuK9S9NPzaVl1hPUzko,5425 +langchain_classic/chains/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/__pycache__/example_generator.cpython-311.pyc,, +langchain_classic/chains/__pycache__/history_aware_retriever.cpython-311.pyc,, +langchain_classic/chains/__pycache__/llm.cpython-311.pyc,, +langchain_classic/chains/__pycache__/llm_requests.cpython-311.pyc,, +langchain_classic/chains/__pycache__/loading.cpython-311.pyc,, +langchain_classic/chains/__pycache__/mapreduce.cpython-311.pyc,, +langchain_classic/chains/__pycache__/moderation.cpython-311.pyc,, +langchain_classic/chains/__pycache__/prompt_selector.cpython-311.pyc,, +langchain_classic/chains/__pycache__/retrieval.cpython-311.pyc,, +langchain_classic/chains/__pycache__/sequential.cpython-311.pyc,, +langchain_classic/chains/__pycache__/transform.cpython-311.pyc,, +langchain_classic/chains/api/__init__.py,sha256=d8xBEQqFVNOMTm4qXNz5YiYkvA827Ayyd4XCG1KP-z4,84 +langchain_classic/chains/api/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/api/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/api/__pycache__/news_docs.cpython-311.pyc,, +langchain_classic/chains/api/__pycache__/open_meteo_docs.cpython-311.pyc,, +langchain_classic/chains/api/__pycache__/podcast_docs.cpython-311.pyc,, +langchain_classic/chains/api/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/api/__pycache__/tmdb_docs.cpython-311.pyc,, +langchain_classic/chains/api/base.py,sha256=26sEZ8eOitttQyHLD2lCS7orPdWnUxIG2pEgXeZ4-es,15261 +langchain_classic/chains/api/news_docs.py,sha256=oKAf6d328f9F9O30c4GwaaV8qF6SQwt5R6UEvd50XvA,2451 +langchain_classic/chains/api/open_meteo_docs.py,sha256=i-MaPd3zm89Bj0HMQXbrLuP9PV4FCsVgTYENprkxhzM,3398 +langchain_classic/chains/api/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/chains/api/openapi/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/api/openapi/__pycache__/chain.cpython-311.pyc,, +langchain_classic/chains/api/openapi/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/api/openapi/__pycache__/requests_chain.cpython-311.pyc,, +langchain_classic/chains/api/openapi/__pycache__/response_chain.cpython-311.pyc,, +langchain_classic/chains/api/openapi/chain.py,sha256=3hvuSoNWokFEcXGbGYb5eCzRwbEicCF7MjuB2GkkCY4,675 +langchain_classic/chains/api/openapi/prompts.py,sha256=3ZDLHDqvNUPVqWXEfoA8yXSru9bw9PGaJ6TWT5Y48gU,803 +langchain_classic/chains/api/openapi/requests_chain.py,sha256=U7M1ScajGVCZBR0_7cMICclcQW2xcvvM1qJ15zRd2ig,971 +langchain_classic/chains/api/openapi/response_chain.py,sha256=U48_bhjK1_OlSzlWvfCxizQyZu3KEoQ5e0fCp-piUZI,974 +langchain_classic/chains/api/podcast_docs.py,sha256=W7qeK2byhvjOefPxlyxJ7kUA9wOI4RtIEo71HQyCVCQ,1919 +langchain_classic/chains/api/prompt.py,sha256=7WsLJkeEWoi7phBgS-wT_bYQmG9xy3RWTy2IjTDl_Cs,1030 +langchain_classic/chains/api/tmdb_docs.py,sha256=D9CP8louoNcO2QupBbWhYCkPkaAEm7FtBoCrV2PWAFA,1536 +langchain_classic/chains/base.py,sha256=Hkc-riabNwS-0pJqgteMyhStMwljmjkU9ctr6r9D6q0,31356 +langchain_classic/chains/chat_vector_db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/chains/chat_vector_db/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/chat_vector_db/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/chat_vector_db/prompts.py,sha256=7QjPJJaKXb861G93Qq-cUjf--8cIv53BSnVbzpuwtwY,707 +langchain_classic/chains/combine_documents/__init__.py,sha256=g0EsXX-eSQ9yhyKJQbAxLHvq6feIGDU4NO12vcg1IVc,392 +langchain_classic/chains/combine_documents/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/combine_documents/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/combine_documents/__pycache__/map_reduce.cpython-311.pyc,, +langchain_classic/chains/combine_documents/__pycache__/map_rerank.cpython-311.pyc,, +langchain_classic/chains/combine_documents/__pycache__/reduce.cpython-311.pyc,, +langchain_classic/chains/combine_documents/__pycache__/refine.cpython-311.pyc,, +langchain_classic/chains/combine_documents/__pycache__/stuff.cpython-311.pyc,, +langchain_classic/chains/combine_documents/base.py,sha256=BI9od5L9VFkKzWihOsWcH4KI9rrCl4kSplaOZ1eyQMg,10152 +langchain_classic/chains/combine_documents/map_reduce.py,sha256=MMWRYbcQiyQCQfsiz0rzdqz9jvj-DLtrxOPVgyyhP-U,11846 +langchain_classic/chains/combine_documents/map_rerank.py,sha256=Lilte3JPK2HsO1yEkbJai0S-vWHr83pAji4k_IYRhGQ,9379 +langchain_classic/chains/combine_documents/reduce.py,sha256=QlOouf4s-oX5fYBWHhBjiIhJ_mzN8tQmHFFNSILSs5I,14274 +langchain_classic/chains/combine_documents/refine.py,sha256=QfYA1cuTM82NGY51g-1lb_0JUPwdWTpIRM-j5RUO80w,9309 +langchain_classic/chains/combine_documents/stuff.py,sha256=MpL7sM6s_adZ4gJmaRTyheDQNAs869fX1jN8yj1F9Lw,11548 +langchain_classic/chains/constitutional_ai/__init__.py,sha256=G3NVjS4P9CKS5vHBNCsf2KlmzVageDpLfDtJd0YDLmA,126 +langchain_classic/chains/constitutional_ai/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/constitutional_ai/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/constitutional_ai/__pycache__/models.cpython-311.pyc,, +langchain_classic/chains/constitutional_ai/__pycache__/principles.cpython-311.pyc,, +langchain_classic/chains/constitutional_ai/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/constitutional_ai/base.py,sha256=ktnjH3am7y5rL__3igQ3XBt9faKcRbqTnGKN0mFSh2U,12460 +langchain_classic/chains/constitutional_ai/models.py,sha256=D_p--Zt-ut32VuU5nHdqmPv5vFZEbO0f9pInVmG8NqU,266 +langchain_classic/chains/constitutional_ai/principles.py,sha256=D85MxKvsnFoWodn5fIjDfAN_P7GnS6BlmH07gh4k6dQ,21686 +langchain_classic/chains/constitutional_ai/prompts.py,sha256=ymhAvZ0PYXwKfomZv3k2pMOrcC88YMjNsoK1YS0kgSI,9917 +langchain_classic/chains/conversation/__init__.py,sha256=hpIiQSoUe0bGkqAGKxG_CEYRFsjHRL4l5uBEpCBetFc,71 +langchain_classic/chains/conversation/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/conversation/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/conversation/__pycache__/memory.cpython-311.pyc,, +langchain_classic/chains/conversation/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/conversation/base.py,sha256=1UwzWOq3oLCpffNIxU3KKd863nDXb0pZnmjT0cFbbJM,5432 +langchain_classic/chains/conversation/memory.py,sha256=_qgiI5nv_-vLBnlGPv0PZG8fWV6FCW3TIXsFaU5Hz7c,1452 +langchain_classic/chains/conversation/prompt.py,sha256=MszxR2dk-hgL1APoqQVUg-ct7ls-V_G0SuiXmYm6FoQ,921 +langchain_classic/chains/conversational_retrieval/__init__.py,sha256=hq7jx-kmg3s8qLYnV7gPmzVIPcGqW69H6cXIjklvGjY,49 +langchain_classic/chains/conversational_retrieval/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/conversational_retrieval/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/conversational_retrieval/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/conversational_retrieval/base.py,sha256=nSIMxfiZ6OotenRGncCFIR_tSa2xmqefvaBczar_kLo,21130 +langchain_classic/chains/conversational_retrieval/prompts.py,sha256=LZSFpO9s7e5aXB8WWsgqt5G2bdubSIcXkDZuru7k71E,733 +langchain_classic/chains/elasticsearch_database/__init__.py,sha256=4BdFJk_-KM5OrS66IGlNyDmJigkHve90syLbmKVKFaA,143 +langchain_classic/chains/elasticsearch_database/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/elasticsearch_database/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/elasticsearch_database/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/elasticsearch_database/base.py,sha256=5cj3pEF52vNqGwuFUkpTJlRNHXxSFbl001DVlc05MVw,8097 +langchain_classic/chains/elasticsearch_database/prompts.py,sha256=SBXLBlaT1gOgfPxt-8Q1LovIky7vuzkUI39rHwrvlrM,1434 +langchain_classic/chains/ernie_functions/__init__.py,sha256=WKstXnld16tdUBlBy6OhEk9W0pP_2YZRndxavrcg2jk,1522 +langchain_classic/chains/ernie_functions/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/ernie_functions/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/ernie_functions/base.py,sha256=mhPEPKh2JqicgsAU_B8OUuwnN4NcKhhnUI-_3-vtbqw,1738 +langchain_classic/chains/example_generator.py,sha256=GuVssAeqcDhoGGO_EsdYkK2WOrkf_H0yzJgzWnQSRq0,741 +langchain_classic/chains/flare/__init__.py,sha256=4_3onLqg8kG6PyUdQEkgPX_TbowLVxUw6rDTXl259Cw,52 +langchain_classic/chains/flare/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/flare/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/flare/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/flare/base.py,sha256=33HVypRpnnSQmckabFm4v4kmJ446fYQX2Rv--tyEA1M,10725 +langchain_classic/chains/flare/prompts.py,sha256=118JjzdbI7x7Il-7iIacPZexMyamHoiaYKFUP3BtpWE,1498 +langchain_classic/chains/graph_qa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/chains/graph_qa/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/arangodb.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/cypher.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/cypher_utils.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/falkordb.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/gremlin.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/hugegraph.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/kuzu.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/nebulagraph.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/neptune_cypher.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/neptune_sparql.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/ontotext_graphdb.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/graph_qa/__pycache__/sparql.cpython-311.pyc,, +langchain_classic/chains/graph_qa/arangodb.py,sha256=wVNGvJqkNFBZeIoz2mZZTWYDcxaav8j9a6Hwzb2ze60,677 +langchain_classic/chains/graph_qa/base.py,sha256=oAp6tKOMcj0DfV3ZUOdiypOHozpUAGKq9GfZ4qEzEKc,651 +langchain_classic/chains/graph_qa/cypher.py,sha256=j3yx8doMyKjcISUGn4k06uR0nHpNpSvHZiYuQwdc-Ns,1213 +langchain_classic/chains/graph_qa/cypher_utils.py,sha256=KngovutJUt42Y7kSKTLg-gHcMomYtDLm8vmVjTdI6vg,800 +langchain_classic/chains/graph_qa/falkordb.py,sha256=GEFAJ5duKRj_DYICd23pyLWh0PWcD7bdtCbIRKXt8wg,933 +langchain_classic/chains/graph_qa/gremlin.py,sha256=AgIBIYGi1vE9EEI_JYoCea_qzFXKG0eJL2jrrjyHgdA,1098 +langchain_classic/chains/graph_qa/hugegraph.py,sha256=KDT30hiTq-2OBdSzMzEanw8YDRqZ9waugyoJXaQeo74,673 +langchain_classic/chains/graph_qa/kuzu.py,sha256=x4Jdb7HvcdEImkK0sOBmpu9bEFBYgMGIMlcr3iS3qoE,878 +langchain_classic/chains/graph_qa/nebulagraph.py,sha256=DYGmZs0VgZlEkH1vfzTBagixSn06YO21tTRE6Mrn6KI,683 +langchain_classic/chains/graph_qa/neptune_cypher.py,sha256=an_nIvWzImx3O8OaTS8xjcagvdnsgCYvkylfAAmkgAk,1240 +langchain_classic/chains/graph_qa/neptune_sparql.py,sha256=ZsidsLUX0bzxDDQsM7HHoz5YMlOUM0eTixsWvyFyAJ0,1145 +langchain_classic/chains/graph_qa/ontotext_graphdb.py,sha256=UMgs5Z-qJVZn-xPkrpvyU6y_UVOVOPcOCAwpkJwVEKs,722 +langchain_classic/chains/graph_qa/prompts.py,sha256=fwBNAOhqQ4MzdBy5VLbISWKVz9ymdOc-kUk4SpHgHJw,3942 +langchain_classic/chains/graph_qa/sparql.py,sha256=hquw1vKVqoUfTlKZ6v_Dalc5cfZwHaWXwMG3TAg9JYY,673 +langchain_classic/chains/history_aware_retriever.py,sha256=jBSMiUD_pKlm5c1H0w4ZEh3tVODETk2DJsfHw-VJ3X0,2663 +langchain_classic/chains/hyde/__init__.py,sha256=mZ-cb7slBdlK5aG2R_NegBzNCXToHR-tdmfIIA6lKvQ,75 +langchain_classic/chains/hyde/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/hyde/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/hyde/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/chains/hyde/base.py,sha256=WOKEFDkcGU47_VW6VYSKkdw-DNz6at3RYn5zDjstQgU,4423 +langchain_classic/chains/hyde/prompts.py,sha256=vtvESY6ol1G7VbAGttEzvxen5XNA59KBsNd7ZRR3I5g,1923 +langchain_classic/chains/llm.py,sha256=QmaeVdruWMgi7QQxkBSh-ug2mzpjqu44etGs9s-Am_U,15355 +langchain_classic/chains/llm_bash/__init__.py,sha256=6pt0eyqivTdrNC5UsXk-MvDd94K5XNblPgx6CNSZy0U,466 +langchain_classic/chains/llm_bash/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/llm_checker/__init__.py,sha256=2IHg5XUQTQEoEMutGa66_tzOStNskQnDDXdN9VzJCSo,139 +langchain_classic/chains/llm_checker/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/llm_checker/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/llm_checker/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/llm_checker/base.py,sha256=B96VdMCbmXkWso8Nqwp0RT8RRxjl8QKCX2WTkdLOnj0,6794 +langchain_classic/chains/llm_checker/prompt.py,sha256=NSl_8Q9aSWqGdvF7c2NySvOx-Cp2ZiqV9bpxaR1dGmU,1152 +langchain_classic/chains/llm_math/__init__.py,sha256=V-js2H13eXegQztkkM6joc2lRmD6XJJkj6k5RAnIWX8,143 +langchain_classic/chains/llm_math/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/llm_math/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/llm_math/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/llm_math/base.py,sha256=NfexVBpYoASQBZLMPKoX63Ql_zQ1oVjZsJjQYB6eYRA,11367 +langchain_classic/chains/llm_math/prompt.py,sha256=EnVw7m3XeGYvL-8290cOHx_Vy_wxRYoc50z-xJtsluo,867 +langchain_classic/chains/llm_requests.py,sha256=V2Qhe8B7UL3aQ3Kpez-TVnyurHlcY2IqFQpOiKBUbeA,661 +langchain_classic/chains/llm_summarization_checker/__init__.py,sha256=ulW6u6g3AmEiLDbYPdJAAXjuT06_uGyj_Vmo5-JN5HQ,350 +langchain_classic/chains/llm_summarization_checker/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/llm_summarization_checker/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/llm_summarization_checker/base.py,sha256=wmWpHoralFDYHsqMuRvdKXNzDV0vdDzGY1xND0gJoc4,7405 +langchain_classic/chains/llm_summarization_checker/prompts/are_all_true_prompt.txt,sha256=yWZxXJTyYtao73asx_tE-qUU5eZZJ8iu20WW3vMmLF8,654 +langchain_classic/chains/llm_summarization_checker/prompts/check_facts.txt,sha256=Du-gC9bXGSdXfxa643sjTr2FtWuLBWkBA9dOUzRucZs,377 +langchain_classic/chains/llm_summarization_checker/prompts/create_facts.txt,sha256=hM2_EVxM_8iL3rm7ui17NAUKoHCjpqhYjdXO6NQ6lEI,128 +langchain_classic/chains/llm_summarization_checker/prompts/revise_summary.txt,sha256=nSSq5UQMx6gvjMKIs2t_ituuEQzu2nni1wdnywAe-5U,416 +langchain_classic/chains/llm_symbolic_math/__init__.py,sha256=pF8fwRcH2RQIPUaR8ViOwIOZ9Q1AUshs0wrRSVqSPAE,483 +langchain_classic/chains/llm_symbolic_math/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/loading.py,sha256=DKYSBY2jNTwgQ-DVw1zLBLaufbu0yfZMwC6zNSFFr0I,27754 +langchain_classic/chains/mapreduce.py,sha256=KysXzDWgPSa6TqPVrlckF3skQlMyKNF0ds8wonrZvRE,3940 +langchain_classic/chains/moderation.py,sha256=85mwYNvhh24086owDmaAxT2RYtM5hDFNnQ09HPlIf2g,4386 +langchain_classic/chains/natbot/__init__.py,sha256=ACF2TYNK_CTfvmdLlG5Ry0_j9D6ZfjgfQxmeKe1BAIg,96 +langchain_classic/chains/natbot/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/natbot/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/natbot/__pycache__/crawler.cpython-311.pyc,, +langchain_classic/chains/natbot/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/natbot/base.py,sha256=q8uw4taB636pZN8aKR2y2sZPfSmZFppNQ0whiD8Sj6c,4979 +langchain_classic/chains/natbot/crawler.py,sha256=njZx3PAA2-idJ-nMhE2-79Qqn-pPfqdQ9l42MZCWJlo,16883 +langchain_classic/chains/natbot/prompt.py,sha256=B43S6WueRV08AdhrHMKl4ZNJL-oLh3vOY4D3LeK-7q8,4986 +langchain_classic/chains/openai_functions/__init__.py,sha256=mUO4nRuZxiT75axR4nSLDjgzvp5wWKXAUm70wkNZHpE,1537 +langchain_classic/chains/openai_functions/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/citation_fuzzy_match.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/extraction.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/openapi.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/qa_with_structure.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/tagging.cpython-311.pyc,, +langchain_classic/chains/openai_functions/__pycache__/utils.cpython-311.pyc,, +langchain_classic/chains/openai_functions/base.py,sha256=kPIM3Rzm7F7QnF0vUuE9JihdLysvTtmj2R3Q6cSKj1c,9797 +langchain_classic/chains/openai_functions/citation_fuzzy_match.py,sha256=BxURlnIFW-xNE8H8DH6T74adzvv7IH0J1ixzk6rSYQg,5617 +langchain_classic/chains/openai_functions/extraction.py,sha256=AzwzBAzZK7OtHgXPtgG3-lNcB5hown98l4IeUnG-Rn0,4658 +langchain_classic/chains/openai_functions/openapi.py,sha256=_P7s5pG_9JeI3_knSwIe6X_e47miacN-_kmpTBt8hSs,13233 +langchain_classic/chains/openai_functions/qa_with_structure.py,sha256=LiAc6yoZQY8NCdr-vsMkIYUH8XnTXyq27OqKTdTyiVk,5102 +langchain_classic/chains/openai_functions/tagging.py,sha256=1RHkdE2ZhqBV6Pzd-hGkdU1Ey_ittUS7dXtq8c669qo,5682 +langchain_classic/chains/openai_functions/utils.py,sha256=wIqzwJvCn89YM4i7Yxyz3Amkd0wLs-e76GDKcFUdXDQ,1239 +langchain_classic/chains/openai_tools/__init__.py,sha256=sY6peysMng5aSTlW8P8g_aWKJAaUIWGC7stmEkGSs5o,151 +langchain_classic/chains/openai_tools/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/openai_tools/__pycache__/extraction.cpython-311.pyc,, +langchain_classic/chains/openai_tools/extraction.py,sha256=-v6Di-reJMt5hVFU1Ce4Jt9-WulQdfch-kwNPzmmo1E,2104 +langchain_classic/chains/prompt_selector.py,sha256=bW6hdEY_qBeLiBu9lmbE37d5YieY6OVGpV1tMhmLxuI,2001 +langchain_classic/chains/qa_generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/chains/qa_generation/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/qa_generation/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/qa_generation/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/qa_generation/base.py,sha256=tuTrbuSkt3O6-r0QAJY5lX0nWgFMc24f-4S842ZNmZc,4181 +langchain_classic/chains/qa_generation/prompt.py,sha256=r1LB44cMYyseGCXiNCSIH3fqDnVie4GhSE838S6YBR0,1924 +langchain_classic/chains/qa_with_sources/__init__.py,sha256=UanXQvR4l-ZEYi7mLxUJu2VapoP-V7Rdxa-bn-_XwMg,182 +langchain_classic/chains/qa_with_sources/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/loading.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/map_reduce_prompt.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/refine_prompts.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/retrieval.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/stuff_prompt.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/__pycache__/vector_db.cpython-311.pyc,, +langchain_classic/chains/qa_with_sources/base.py,sha256=0TkDtXweYZrsIRMRlng9dfuVRw3AO9DXxF6yL3r__cQ,8536 +langchain_classic/chains/qa_with_sources/loading.py,sha256=LQNxnCcu5WKqUFg-zRf3X9eNdxA8b743zMWdNtD0feM,7339 +langchain_classic/chains/qa_with_sources/map_reduce_prompt.py,sha256=IDAmJKOF_g9ZDUZUzDv04ged74KVTsyfWo7Mgh3GFUQ,6954 +langchain_classic/chains/qa_with_sources/refine_prompts.py,sha256=UeMFE3cbDBR0dxOwr8jvKGkirwPy2M95lJpGyK_Pl8M,1303 +langchain_classic/chains/qa_with_sources/retrieval.py,sha256=CxsmFyS-PBFQkLcgHDUUEO-nSpIFnraBiuxO9Rvwciw,2542 +langchain_classic/chains/qa_with_sources/stuff_prompt.py,sha256=0tK2lyVPPj8bn7GPiuWygbi-IODIeKrfwAP_Lzbf2-A,6551 +langchain_classic/chains/qa_with_sources/vector_db.py,sha256=dHDSh__r0dWB9o0Y_jHl0l1ie__vbloCX0_VzxC-nP8,3013 +langchain_classic/chains/query_constructor/__init__.py,sha256=eK_rHp-CYN-eiGZ3sC3q85ngKPqy-NQSkqc0uli-xHA,148 +langchain_classic/chains/query_constructor/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/query_constructor/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/query_constructor/__pycache__/ir.cpython-311.pyc,, +langchain_classic/chains/query_constructor/__pycache__/parser.cpython-311.pyc,, +langchain_classic/chains/query_constructor/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/query_constructor/__pycache__/schema.cpython-311.pyc,, +langchain_classic/chains/query_constructor/base.py,sha256=9wKyE9-Cb-2GylYFXx2mvqSJ_NAflARY07PC7cysHE0,13979 +langchain_classic/chains/query_constructor/ir.py,sha256=YLMaIy_JUQ4CDioBke-hS99UVPvclEuIGFVqf3YJprs,394 +langchain_classic/chains/query_constructor/parser.py,sha256=-KB8QsLSHyogw7S_q5M4jSxiYSoa6BSa8A4b3W6XfGA,8560 +langchain_classic/chains/query_constructor/prompt.py,sha256=j17uK3k_j4CYWA95xFYAXHQ6UPl7WfwnkoDNq_p_bkw,6929 +langchain_classic/chains/query_constructor/schema.py,sha256=FRn_cpTRXuP9N1PprndGqkm-AfV5f-mihX1YAlAZUGE,277 +langchain_classic/chains/question_answering/__init__.py,sha256=tYsl3lw391MVOLItXUcCTO8aeJnlHzQSPJYFO-FVnSI,165 +langchain_classic/chains/question_answering/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/question_answering/__pycache__/chain.cpython-311.pyc,, +langchain_classic/chains/question_answering/__pycache__/map_reduce_prompt.cpython-311.pyc,, +langchain_classic/chains/question_answering/__pycache__/map_rerank_prompt.cpython-311.pyc,, +langchain_classic/chains/question_answering/__pycache__/refine_prompts.cpython-311.pyc,, +langchain_classic/chains/question_answering/__pycache__/stuff_prompt.cpython-311.pyc,, +langchain_classic/chains/question_answering/chain.py,sha256=DKlSu6LjO9BsLza2nTBBGK833yCAmSPYOwWEdRkiLPQ,9045 +langchain_classic/chains/question_answering/map_reduce_prompt.py,sha256=isTkxs18ACwFJrhNDaQeakcDuYp_Q_hnQ-1d93BT-_4,8044 +langchain_classic/chains/question_answering/map_rerank_prompt.py,sha256=Cm_ACSCwh0R-WSW-lDLlSUF7iGaJayfsmHHBpKuq8ME,1630 +langchain_classic/chains/question_answering/refine_prompts.py,sha256=c0IvO9JPr60Mv1RXZqSe2SIWWyePZ6t4KFexdOAmRV8,2345 +langchain_classic/chains/question_answering/stuff_prompt.py,sha256=7NnmVYqk60mfRLymXJinW2RU1JvGdcKMyfB4-zx-6Y8,1180 +langchain_classic/chains/retrieval.py,sha256=MCgVIMcxtBcp9y8tHShdj1_gNfc0G1l-1uXL_g7edtE,2674 +langchain_classic/chains/retrieval_qa/__init__.py,sha256=MGGNuZ-HVZDyk551hUjGexK3U9q-2Yi_VJkpi7MV2DE,62 +langchain_classic/chains/retrieval_qa/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/retrieval_qa/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/retrieval_qa/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/retrieval_qa/base.py,sha256=72w5wi0FwsWBA_Y13wxjgesrVuFq_VutwEaizKwpHB4,11796 +langchain_classic/chains/retrieval_qa/prompt.py,sha256=clXu99zckxFU9ON9HMbj7zonUpurLoWvgqjEAFr9_jQ,398 +langchain_classic/chains/router/__init__.py,sha256=mZwtt5bWSyUIoEzEGzKRiKwkZgeKL7apgV76orppsMM,439 +langchain_classic/chains/router/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/embedding_router.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/llm_router.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/multi_prompt.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/multi_prompt_prompt.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/multi_retrieval_prompt.cpython-311.pyc,, +langchain_classic/chains/router/__pycache__/multi_retrieval_qa.cpython-311.pyc,, +langchain_classic/chains/router/base.py,sha256=JwFqULuk3bsqPKNgnBUxBZOOe0-fHtDJsPngx-OtosA,4777 +langchain_classic/chains/router/embedding_router.py,sha256=nh9_uKyYQyRhVWSM5ZblZ3k7FeIOEHl-wZtQDjEtPww,3150 +langchain_classic/chains/router/llm_router.py,sha256=d2D3NKUaaC2dLmthONa7fh2Fq6QmNG8j9wV790RJ0uE,6815 +langchain_classic/chains/router/multi_prompt.py,sha256=xayC2GmKUvKAqTfsiVgwZNP6sxUSrArI9SpLRUOipJE,6835 +langchain_classic/chains/router/multi_prompt_prompt.py,sha256=T8UbIuxblnI6Byhw-BMAzwQcbB5ww3N6BiMqMJxS6Jc,1156 +langchain_classic/chains/router/multi_retrieval_prompt.py,sha256=VUYGLWbwGiv03aSMW5sjdGNwsEa9FKgq0RcK5o3lkH4,1079 +langchain_classic/chains/router/multi_retrieval_qa.py,sha256=6jLXA_dvgvSQ0THmZVetxd68vHQhYQa2lp8P2QiV_rg,5326 +langchain_classic/chains/sequential.py,sha256=dGoPAX1F9qD1XUSfZ6Hbq8gP_LOcQbP2j2Oa4olk-kM,7535 +langchain_classic/chains/sql_database/__init__.py,sha256=jQotWN4EWMD98Jk-f7rqh5YtbXbP9XXA0ypLGq8NgrM,47 +langchain_classic/chains/sql_database/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/sql_database/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/chains/sql_database/__pycache__/query.cpython-311.pyc,, +langchain_classic/chains/sql_database/prompt.py,sha256=GoGKZ-3Kq9YCo_xEOigJqBx-yWemEgv0LXtE-yugJhE,15619 +langchain_classic/chains/sql_database/query.py,sha256=Zzg4896uEl2auYLZ7UeDqRUTRihsGM1RHqVkiD-zKus,5934 +langchain_classic/chains/structured_output/__init__.py,sha256=k1Nx-p3qTERep7KU_yBFAiAQwYv5--9Ao22UxpuKBF4,212 +langchain_classic/chains/structured_output/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/structured_output/__pycache__/base.cpython-311.pyc,, +langchain_classic/chains/structured_output/base.py,sha256=ukUQoSOSQ21A3zKwKMS7y1ifm438sTtAbVLyCIejEeQ,21717 +langchain_classic/chains/summarize/__init__.py,sha256=B1hk6VNzxO-THzmPi9kUxm2haEWQlTLdEB7W0Yau0lY,159 +langchain_classic/chains/summarize/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chains/summarize/__pycache__/chain.cpython-311.pyc,, +langchain_classic/chains/summarize/__pycache__/map_reduce_prompt.cpython-311.pyc,, +langchain_classic/chains/summarize/__pycache__/refine_prompts.cpython-311.pyc,, +langchain_classic/chains/summarize/__pycache__/stuff_prompt.cpython-311.pyc,, +langchain_classic/chains/summarize/chain.py,sha256=UwISFI8nPaY7KuOwiL19whPJziSHM6yX8hnyOga2-ro,8361 +langchain_classic/chains/summarize/map_reduce_prompt.py,sha256=RH9_ubEX6Mb6kV_fPlXsUqEPDvoGHHgGqDxsP1493uI,223 +langchain_classic/chains/summarize/refine_prompts.py,sha256=CDXZDJWOV0jg-CwvQv5g1P86Xqd0aLFmUx7LLFiW_Qg,677 +langchain_classic/chains/summarize/stuff_prompt.py,sha256=RH9_ubEX6Mb6kV_fPlXsUqEPDvoGHHgGqDxsP1493uI,223 +langchain_classic/chains/transform.py,sha256=r8wWu4e0HV8oAIm_0iM09rKgp71lJr_V6Rc7ZGOLCs0,2286 +langchain_classic/chat_loaders/__init__.py,sha256=qzZSy1HuQFTJ90A6mOl2PacLEBC0cyS0hiSsHzd9mGc,252 +langchain_classic/chat_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/base.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/facebook_messenger.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/gmail.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/imessage.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/langsmith.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/slack.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/telegram.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/utils.cpython-311.pyc,, +langchain_classic/chat_loaders/__pycache__/whatsapp.cpython-311.pyc,, +langchain_classic/chat_loaders/base.py,sha256=vTi948QJLHp8kjKFcycT0PX9sS1bNpSsPkDmk6WYRsI,85 +langchain_classic/chat_loaders/facebook_messenger.py,sha256=z4Rz6dURE_8AY2NLMvVCPcKhI_z4d_OgPwd0olSkofc,892 +langchain_classic/chat_loaders/gmail.py,sha256=Whh_seZn_jS55TSQC7eh6VZMmLs1OUy9qXIjX7s2mTc,644 +langchain_classic/chat_loaders/imessage.py,sha256=bfbxS89OL_jewuE8zot1dLQ-2UoQ997K3Z_DX4ettWE,671 +langchain_classic/chat_loaders/langsmith.py,sha256=jMjwgcsivuFjtwAdASaCaD3ZV4l4vLIG3DdZ7qspEXg,859 +langchain_classic/chat_loaders/slack.py,sha256=DL6WL7bO4AJbp7W71hACpnzKFwxpWXPwfemliBtcHlk,656 +langchain_classic/chat_loaders/telegram.py,sha256=xuViVT1ioglEvRp5BK5L8u3LuiLFF_aI-UfmAcwFfp8,671 +langchain_classic/chat_loaders/utils.py,sha256=zHBevt6UTIs3S4fgkZwm8Skw-TgCTmGXXk6V129Z4EI,1085 +langchain_classic/chat_loaders/whatsapp.py,sha256=cPlOZvVNsOC-2dzilMq6e-cg5n1UetzR4alRis7BlUE,671 +langchain_classic/chat_models/__init__.py,sha256=BzIWvtX_dxuB23JhKuw2-9oG16UrJYBfmw6_Yb-RP5Y,1876 +langchain_classic/chat_models/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/anthropic.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/anyscale.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/azure_openai.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/azureml_endpoint.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/baichuan.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/baidu_qianfan_endpoint.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/base.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/bedrock.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/cohere.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/databricks.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/ernie.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/everlyai.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/fake.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/fireworks.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/gigachat.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/google_palm.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/human.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/hunyuan.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/javelin_ai_gateway.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/jinachat.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/konko.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/litellm.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/meta.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/minimax.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/mlflow.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/mlflow_ai_gateway.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/ollama.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/openai.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/pai_eas_endpoint.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/promptlayer_openai.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/tongyi.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/vertexai.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/volcengine_maas.cpython-311.pyc,, +langchain_classic/chat_models/__pycache__/yandex.cpython-311.pyc,, +langchain_classic/chat_models/anthropic.py,sha256=aRK4qZ-0Nzlk1n1jA-bZ4_4YaS9pNyTSgo3zM_yRU-0,859 +langchain_classic/chat_models/anyscale.py,sha256=tzw0I2ItPv1U_fZ6hqIA-_0wMfW5IlbRtWXTC2Qi7DA,651 +langchain_classic/chat_models/azure_openai.py,sha256=Wv3DIBg4k9-NKyI2johTR3kz8VQz2k2JB3Gkevzw62I,668 +langchain_classic/chat_models/azureml_endpoint.py,sha256=hwfjf4zHMk81qStoMLv_1BurYvADMPwoqm_XRG6zSo8,871 +langchain_classic/chat_models/baichuan.py,sha256=D1k-Z0ka-8oWP85lWseiNc8RAmwJEtVEp90OCjaFRLg,651 +langchain_classic/chat_models/baidu_qianfan_endpoint.py,sha256=8ycaAbOteqkWD6_-gHgiEkQSTV1_jSUoyKLvKUddlBI,724 +langchain_classic/chat_models/base.py,sha256=_FdgppfGbQ0ZL2mfVdUguwvDHFeSbHnmehesgWBmnXs,40737 +langchain_classic/chat_models/bedrock.py,sha256=EtfMujJr6WizW0_ntggPlr2tvA7A2exfx-LwpW07hxY,765 +langchain_classic/chat_models/cohere.py,sha256=puz4nDLDv2biIuj5lSUJNrruSeHRiLIpG9u5AS_K6k8,641 +langchain_classic/chat_models/databricks.py,sha256=3nYpb_-6OMjCXcNbRXtnIKBd9xanYHCz0rsgqROZGzs,661 +langchain_classic/chat_models/ernie.py,sha256=Oev6iflToug6-Pfx6jPNg_GJkLT1HTFH7fwHkTmOfiw,645 +langchain_classic/chat_models/everlyai.py,sha256=s669m0ga5epkwm2dc55-IjVHUC93xPCPuFENDKFdBfU,651 +langchain_classic/chat_models/fake.py,sha256=fNVi3ow4TYHVpIlwzdsQ0qUHA1dTNX_rmlZHe2kgL1I,823 +langchain_classic/chat_models/fireworks.py,sha256=YQ07whhrK7VujUznEq2YzX3I7ilnOP99w9mt5GlRZu8,656 +langchain_classic/chat_models/gigachat.py,sha256=C3KEAC0lkW4yF1u1un2Gqyhl95dDQ1jCfRKUaaGHv-c,639 +langchain_classic/chat_models/google_palm.py,sha256=LVqnjrF6ubPiZZSHeVHNRx5HCLKDsMz9KyG10czgvjE,817 +langchain_classic/chat_models/human.py,sha256=ko4PmZAIXNIbcBADg2eO-LdUqgKz0H2jz0dXMMiLbuQ,666 +langchain_classic/chat_models/hunyuan.py,sha256=NTTqZWSAoLl5eWi8WaMDc_ivlHfonccj80DzXyESHIc,646 +langchain_classic/chat_models/javelin_ai_gateway.py,sha256=rAXGyWUEgVJpYSaB4NPR7VATXbkycT_J78-aee-Tzzg,829 +langchain_classic/chat_models/jinachat.py,sha256=MTW_Fexzogtrvd-FjzvL5pH4lRsgscxKUktSkyQW1EA,639 +langchain_classic/chat_models/konko.py,sha256=9vugLprUahWwMcQouX-YvJtKNkTExSn0ASjQq4X0vEs,636 +langchain_classic/chat_models/litellm.py,sha256=bR5S1pLfBBjeh-lT8U65GyzKBKqYQWw-nGb4E0g-7Ck,799 +langchain_classic/chat_models/meta.py,sha256=mX8SpfbFHxJdE3F5-xG_J1m5XtNTrVFQcaXLOk9-Wkk,710 +langchain_classic/chat_models/minimax.py,sha256=HrvtfuCxNQ0vufDDib9Lxix-KXn7xqOGXy-PnOgTZFQ,646 +langchain_classic/chat_models/mlflow.py,sha256=AD2FSDoz9F9CYRjBojSmf8C8rH1Juw_haPm1JdxWR5c,641 +langchain_classic/chat_models/mlflow_ai_gateway.py,sha256=9sd3k02N0vENUk58YLPHgpCiaTCM73e8NJVz10XyDkE,823 +langchain_classic/chat_models/ollama.py,sha256=fv8DKcdBP35jns8b80OHIiGsrj0JiLZ40PAiKOApBRo,641 +langchain_classic/chat_models/openai.py,sha256=BMfygAsxgIU84826Mi9ASh6pUF7tJ31Wf56kNlZlOTU,641 +langchain_classic/chat_models/pai_eas_endpoint.py,sha256=rWjbBboSckFcgC_Ir_T9nuNw1ASOD7vNsGWPrnUhIGg,692 +langchain_classic/chat_models/promptlayer_openai.py,sha256=mmhCyEFFI6msilR-J7yxQleYjnT5OTKFQxBYztNeDco,705 +langchain_classic/chat_models/tongyi.py,sha256=43vA7gnYNKgUPQA5TwGzES2yOLHfiie3r6EcAPIXD8k,641 +langchain_classic/chat_models/vertexai.py,sha256=x6nYzOfqqpHHUGZdF2yRNO7sF0B3pDzhOD6VB8AFG_U,651 +langchain_classic/chat_models/volcengine_maas.py,sha256=91SNuIR6eKn6CcxnyxYP1WKwvFy1-sFdQpU2sUTC1bE,853 +langchain_classic/chat_models/yandex.py,sha256=B0qmnIv9f1gj0rQhVg1B7Xyn-mXiarYVX6vwwiqFd9c,650 +langchain_classic/docstore/__init__.py,sha256=53hFuEN38u4KieMlKlXueKFWH8SD9KtL_RT-fE1JWfI,1086 +langchain_classic/docstore/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/docstore/__pycache__/arbitrary_fn.cpython-311.pyc,, +langchain_classic/docstore/__pycache__/base.cpython-311.pyc,, +langchain_classic/docstore/__pycache__/document.cpython-311.pyc,, +langchain_classic/docstore/__pycache__/in_memory.cpython-311.pyc,, +langchain_classic/docstore/__pycache__/wikipedia.cpython-311.pyc,, +langchain_classic/docstore/arbitrary_fn.py,sha256=pq-XHUZd9q75uYn4t991Pd6kA6DTVFEpEQxdhJXlqO8,647 +langchain_classic/docstore/base.py,sha256=9T4itoCM5Y2PZLvH5Cr9xZymrJ6t0SMVC-4U_mE-JOo,723 +langchain_classic/docstore/document.py,sha256=oNDzAxnJM3S8h2Pn13b_z5Q6kllet0wXi11nEMDi7X4,70 +langchain_classic/docstore/in_memory.py,sha256=DQq1pCII5MhRdx-TlSCr4DSIdCyStqMTIQY9qDZi82M,659 +langchain_classic/docstore/wikipedia.py,sha256=xa5W5dxYlMhxVoF1o8Ji0AIzQug3ZtiIrFxJzQvbkGI,638 +langchain_classic/document_loaders/__init__.py,sha256=NxquYrRBSdNQy8x1qny7IgU2R-QcfKjznMocLL929qg,20518 +langchain_classic/document_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/acreom.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/airbyte.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/airbyte_json.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/airtable.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/apify_dataset.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/arcgis_loader.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/arxiv.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/assemblyai.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/async_html.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/azlyrics.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/azure_ai_data.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/azure_blob_storage_container.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/azure_blob_storage_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/baiducloud_bos_directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/baiducloud_bos_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/base.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/base_o365.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/bibtex.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/bigquery.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/bilibili.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/blackboard.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/blockchain.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/brave_search.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/browserless.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/chatgpt.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/chromium.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/college_confidential.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/concurrent.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/confluence.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/conllu.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/couchbase.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/csv_loader.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/cube_semantic.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/datadog_logs.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/dataframe.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/diffbot.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/discord.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/docugami.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/docusaurus.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/dropbox.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/duckdb_loader.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/email.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/epub.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/etherscan.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/evernote.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/excel.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/facebook_chat.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/fauna.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/figma.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/gcs_directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/gcs_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/generic.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/geodataframe.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/git.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/gitbook.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/github.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/google_speech_to_text.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/googledrive.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/gutenberg.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/helpers.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/hn.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/html.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/html_bs.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/hugging_face_dataset.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/ifixit.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/image.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/image_captions.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/imsdb.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/iugu.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/joplin.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/json_loader.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/lakefs.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/larksuite.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/markdown.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/mastodon.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/max_compute.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/mediawikidump.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/merge.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/mhtml.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/modern_treasury.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/mongodb.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/news.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/notebook.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/notion.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/notiondb.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/nuclia.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/obs_directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/obs_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/obsidian.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/odt.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/onedrive.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/onedrive_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/onenote.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/open_city_data.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/org_mode.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/pdf.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/polars_dataframe.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/powerpoint.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/psychic.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/pubmed.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/pyspark_dataframe.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/python.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/quip.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/readthedocs.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/recursive_url_loader.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/reddit.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/roam.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/rocksetdb.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/rspace.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/rss.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/rst.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/rtf.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/s3_directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/s3_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/sharepoint.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/sitemap.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/slack_directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/snowflake_loader.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/spreedly.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/srt.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/stripe.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/telegram.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/tencent_cos_directory.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/tencent_cos_file.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/tensorflow_datasets.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/text.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/tomarkdown.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/toml.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/trello.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/tsv.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/twitter.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/unstructured.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/url.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/url_playwright.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/url_selenium.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/weather.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/web_base.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/whatsapp_chat.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/wikipedia.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/word_document.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/xml.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/xorbits.cpython-311.pyc,, +langchain_classic/document_loaders/__pycache__/youtube.cpython-311.pyc,, +langchain_classic/document_loaders/acreom.py,sha256=CXGRwOPjzQcjorXuFREk6YsjEptYKgiR6KoLsop2OGE,643 +langchain_classic/document_loaders/airbyte.py,sha256=dqXKERHbMKcCsO6G-DkRKvL5hWVI2ETkDK9ySFOjp78,1582 +langchain_classic/document_loaders/airbyte_json.py,sha256=Ei4ubqe-9tUxeWMEVw8KBr23CV2eE93UhUZQMci9Uqw,658 +langchain_classic/document_loaders/airtable.py,sha256=6dGl7WJc7Al3vs5EstVTZDn9dNf0WTkZ_er9lARovMI,649 +langchain_classic/document_loaders/apify_dataset.py,sha256=3_5ZZIhe6yj1F2zm4QNlqyY7m7Gv7ClAW5ilTx5WwvY,661 +langchain_classic/document_loaders/arcgis_loader.py,sha256=fEFISCsBQ3xxHiN7QGQ6YNvjWstQ9PKO9qpmoOxmLpo,643 +langchain_classic/document_loaders/arxiv.py,sha256=ov2omfYnyE3_1OdSLWIpoCu3OKzBueVpfaVYB4NFAU4,640 +langchain_classic/document_loaders/assemblyai.py,sha256=tQ7OKs3d-4Jzz5hwO9QFuE5H1oFH5oWM0c9vJPM-vTU,887 +langchain_classic/document_loaders/async_html.py,sha256=in_ocwp_SWc1tnINiTQBACi3LOIbhDcDrF1BsaLu55o,652 +langchain_classic/document_loaders/azlyrics.py,sha256=-HbWNLiKDdv-OWxCj-yylptJvo3OjmaNcvioLKyA3aU,649 +langchain_classic/document_loaders/azure_ai_data.py,sha256=-L98HmcdMNUlZFhmmnpOnxqeto2P_yrUHd0xsdiAmo4,658 +langchain_classic/document_loaders/azure_blob_storage_container.py,sha256=5Oy8sVl-fDSfzR6SEyaYYNR5OvA6JQXZU78Dy4RtCTY,707 +langchain_classic/document_loaders/azure_blob_storage_file.py,sha256=DU6vfOGBUN1tW25m4FlT7lswnTHB7l1McOdDNQ0Mrq8,692 +langchain_classic/document_loaders/baiducloud_bos_directory.py,sha256=oKjhXBEIJJXXCkXJMd6RJZBP__Qd6dnskZK--SysXaY,766 +langchain_classic/document_loaders/baiducloud_bos_file.py,sha256=8scVzm_X1JvKLSYFDrgpXm1fIghZYYmFo8hDiRZKrqU,725 +langchain_classic/document_loaders/base.py,sha256=cdkDOvAEIsO2UJeq8152dut8toPjEUMgsoSP6N9xvOc,115 +langchain_classic/document_loaders/base_o365.py,sha256=5J-P8rMOqMTnLy7tmIzvx_e87kpH1z_YvRNHdwteWC4,669 +langchain_classic/document_loaders/bibtex.py,sha256=6pGuyKFm4Nb4LFMrdQtDVCeQAbT_BtdDVoN9I8yIL8w,643 +langchain_classic/document_loaders/bigquery.py,sha256=bDz0A6U_HWrLWX6-DgPZp2GwAgJrQyHI5igPFywkgxw,649 +langchain_classic/document_loaders/bilibili.py,sha256=_PpquI7D3iC-ygJH74NTaVbQb8vVAKiczT0sbyuucg0,649 +langchain_classic/document_loaders/blackboard.py,sha256=GVckm8K9AGXnDZ-0xYzz1ZC9ujpQIWgrPDAdh70zxH0,655 +langchain_classic/document_loaders/blob_loaders/__init__.py,sha256=uSqWPg2aXgSB2ezreMOSvEtPfj1K6NQ9e8KOgEP-wyI,1013 +langchain_classic/document_loaders/blob_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/document_loaders/blob_loaders/__pycache__/file_system.cpython-311.pyc,, +langchain_classic/document_loaders/blob_loaders/__pycache__/schema.cpython-311.pyc,, +langchain_classic/document_loaders/blob_loaders/__pycache__/youtube_audio.cpython-311.pyc,, +langchain_classic/document_loaders/blob_loaders/file_system.py,sha256=SLOsnPE0HNycLpk6h1jajsSbnKs--o2C293NwYI_adI,667 +langchain_classic/document_loaders/blob_loaders/schema.py,sha256=CNSgc90FtHtEQxyLpcYEGzg0WqACkPY07UXqFnQWWPI,672 +langchain_classic/document_loaders/blob_loaders/youtube_audio.py,sha256=ilTlMi-6__TPBVt-UkYWNchV5XKekP1CvRjren91zgo,661 +langchain_classic/document_loaders/blockchain.py,sha256=OKzz1fJHyau79xr-d1QbnxkLwEaiHLZ4wn1s01J9NAo,860 +langchain_classic/document_loaders/brave_search.py,sha256=Mt0pZTA8kA23ub6Tus3uWVL1AlrHnkPYp3Z0lRDJpRo,658 +langchain_classic/document_loaders/browserless.py,sha256=GH7omt6hjX4YZEPCliwe7JRZvyCsQFFfzNwnT3u0Txo,658 +langchain_classic/document_loaders/chatgpt.py,sha256=LODcfk5Zz2ia42jP0JWrnir1UTqZD_XEObd-6X3JE4Y,827 +langchain_classic/document_loaders/chromium.py,sha256=cTS1JodrEoe2G0Exle6_A6ajhm-8Ebml57TDP3CKhyQ,664 +langchain_classic/document_loaders/college_confidential.py,sha256=6wQJbgnWPHeP8gFh2jBGUmS9-m1ssDt3elGmPc4DFi4,689 +langchain_classic/document_loaders/concurrent.py,sha256=8yJGWuwo_UZvyOCyEJIbF24A_27tb3WuGRO56IF123c,655 +langchain_classic/document_loaders/confluence.py,sha256=YBSvF0wGkPY1BV8OaPEJ9nEL0DfCKnvA5rpiRrutWSs,833 +langchain_classic/document_loaders/conllu.py,sha256=2bObT4dwdOlBpQ00b01batCgS8929wufFs0JCoUxBRw,643 +langchain_classic/document_loaders/couchbase.py,sha256=CTeQMBuKuEhZlvxCyVUzmn-0fyOVWXVyQQW4yp5U12I,652 +langchain_classic/document_loaders/csv_loader.py,sha256=6EkZMIHvJC9LCdJ4vmIrQclDRsDgtnAEHQv0O7v4oas,762 +langchain_classic/document_loaders/cube_semantic.py,sha256=d1VmGTVjQ_8C4SC7tSZFBRh122VP_91PEkLZZE6KM8E,661 +langchain_classic/document_loaders/datadog_logs.py,sha256=-6VaCpMsTMjps8c1teIep7072wWhlj_Mo7Gvbjcxu5U,658 +langchain_classic/document_loaders/dataframe.py,sha256=4VZTYL6hvLOMeMnnva3i5XSPkXsH7Bf5U7CqqLpuBt0,846 +langchain_classic/document_loaders/diffbot.py,sha256=oGSmg2GumxwbFS2d8q9-lpcY8fG5XNw98OU0JlmuGeg,646 +langchain_classic/document_loaders/directory.py,sha256=GnRh22qNJiTX8MxnQaPh5OUiWIuksqt9ApH5Z7vfFI4,652 +langchain_classic/document_loaders/discord.py,sha256=VX50Zca0MFHZQuBeaUlMN6XNojB9VYB0HGsaJoJ6hbs,658 +langchain_classic/document_loaders/docugami.py,sha256=LhCgZR4UW-jMB4tJWvEbBsJAJDc2TMuWEMtccKf99HE,649 +langchain_classic/document_loaders/docusaurus.py,sha256=rhDwDcDjD-2ZsMyI9H0aTdHZTE-Z-pgMM2M17YADbT4,655 +langchain_classic/document_loaders/dropbox.py,sha256=DVTICAcFym12c4kmlcLzbu6FPwXNs9cxASU3JjENLqA,646 +langchain_classic/document_loaders/duckdb_loader.py,sha256=AQB64GqfAl_6-OuST3lMJVfVTdVxVWeLRf33R2hAiPE,643 +langchain_classic/document_loaders/email.py,sha256=spktAPtASQ9fE4wz6kLQbTaEE9f6-HTAVaT12SrP2N0,826 +langchain_classic/document_loaders/epub.py,sha256=uMmpFpNXDQ8UySriN_S6vNzNtGyH1vkGeuvVk9dxR5o,673 +langchain_classic/document_loaders/etherscan.py,sha256=bNGvfCEFOaceyvZNDJsk8PtuL1QvrX6NX2u_CiwF7fo,652 +langchain_classic/document_loaders/evernote.py,sha256=ydqe9Pz5T7VAdDiQG4okMd1-OQlBLL5fLuWph33SLkY,649 +langchain_classic/document_loaders/excel.py,sha256=iXniZ63GmJCuKn4TK3a-slLCmYdo6S1BHCgZnHqznfw,676 +langchain_classic/document_loaders/facebook_chat.py,sha256=F4AP2ueYKrravaQ1v1RlewTIg_SPlfwdv7w5bByaIjA,854 +langchain_classic/document_loaders/fauna.py,sha256=ZLUumlplUxH86y9QaoT9XxA1dBWdOFolshTxYomn3H4,640 +langchain_classic/document_loaders/figma.py,sha256=M1Nbci8B7uwqL1UrrCsKv93BN6DOXD_Ba_QJMIFZMZU,652 +langchain_classic/document_loaders/gcs_directory.py,sha256=lql7_yDX1_s84WPuf288IVuB0cj3RQJjxMY659Hr3Jc,661 +langchain_classic/document_loaders/gcs_file.py,sha256=hZP1MIyMMaTVgpFlhQkghJJCMBqjUaTelkP74cd5bVk,646 +langchain_classic/document_loaders/generic.py,sha256=BZkp7VYl2Oza9mH36i-IesThdXUjrLoNDI8yB530wLc,662 +langchain_classic/document_loaders/geodataframe.py,sha256=VnAVIItIhcwaR6WPZZDTRH6z_-9TT6zqqwyVejspnhM,661 +langchain_classic/document_loaders/git.py,sha256=zh6BjbuqMT-RMYh6NQYAdyVBg2luG7E1-7H2ya3FsHw,634 +langchain_classic/document_loaders/gitbook.py,sha256=lBgkfHRST4VB62EttCX5yMogVLw6G_V0vd5Ku9jytJ4,646 +langchain_classic/document_loaders/github.py,sha256=Of4NpoIa2iSn32TOrTKPkRL9uroBP_bhf8X9G0RAyEI,840 +langchain_classic/document_loaders/google_speech_to_text.py,sha256=A1EcDcf-AjKqQMjbZuOfgRFW_BbghpAOkN3Ekup82-g,679 +langchain_classic/document_loaders/googledrive.py,sha256=TWF4YS4fGTjMb29fpDEZU1TCwMMcm9GTSLTMQT432z8,658 +langchain_classic/document_loaders/gutenberg.py,sha256=_t2ZQ8eot_TG2e2-F7DxmY-W4UR22HWCTq_QG90qzxc,652 +langchain_classic/document_loaders/helpers.py,sha256=R6T6J5ZLeb0dVC7SQ0oUAsg6C5qwHikVjKZwOhBHbpo,820 +langchain_classic/document_loaders/hn.py,sha256=3Y5L_ilm5UMoGc2EBFYa6yrCpDR-Z4e5M76dl7Lws0g,631 +langchain_classic/document_loaders/html.py,sha256=vumdFl5ejzj_zpsUlYXeIqA2DDTDVKN1jVT45BV5QjY,673 +langchain_classic/document_loaders/html_bs.py,sha256=HfLY1sLbvQufLb5OwKUXYeZvis4QHSo0-IpCdMhQc3A,643 +langchain_classic/document_loaders/hugging_face_dataset.py,sha256=4kOOZObclh4yhCrRbTaI7OUq02d8lGDh7joZ7jRKWwQ,679 +langchain_classic/document_loaders/ifixit.py,sha256=4VriEVZbuZrWD_tQjzYZ2Slnomd9kKro6YrVmqyaZf4,643 +langchain_classic/document_loaders/image.py,sha256=LNdCH2IjzvKOeSE5Jd9OzgYghQJfhNYxScQxDhtoXvs,676 +langchain_classic/document_loaders/image_captions.py,sha256=UtfMVlG8MWYWZWJS_i2lMVbnVPJxFTVGL1fTFLO14fk,661 +langchain_classic/document_loaders/imsdb.py,sha256=Dee6K2tdUQZrSI3ApOosADr-RxZiRqMXxS2yJWX9DmQ,640 +langchain_classic/document_loaders/iugu.py,sha256=XsVA2id4WfPIuB_rNXn0ueE8tl509TPvAh7sjP__ez8,637 +langchain_classic/document_loaders/joplin.py,sha256=0ilAkF4jpPxej5i8LqJIVW8i3Z-4lSNZ7uRCFuDqqmM,643 +langchain_classic/document_loaders/json_loader.py,sha256=TR-sze_VdNv3lWdp2zqDE2_08EEjAMW99EsGjyM8sac,637 +langchain_classic/document_loaders/lakefs.py,sha256=yA7aDofWOT0_rirgEzTOI8OQczX6dMpOO38sN98MZ0I,972 +langchain_classic/document_loaders/larksuite.py,sha256=b4TN9sFZyuXDYk9Cx3ooIvE7-s1MmD4Znin2_5R68bM,661 +langchain_classic/document_loaders/markdown.py,sha256=HZP_9PqCaAsH-TeBEsBIFGUXNjMsx95CXDN1r-zC0dc,692 +langchain_classic/document_loaders/mastodon.py,sha256=jEajdq_o767vnlwjrJsbqltzeKRSwKFKXKfayts1kCg,664 +langchain_classic/document_loaders/max_compute.py,sha256=IyAapJY-zm22llnHH7GwlL3nfbEdcSUKkF8O4v6dFDI,655 +langchain_classic/document_loaders/mediawikidump.py,sha256=xgead1GDCBd4fUMg6qf-taxCmt1qgxNZGdd3InzEr_8,643 +langchain_classic/document_loaders/merge.py,sha256=W7G6dkHC3unM7xnIoK5OtkT-hebt0n1GjHaxGgJN5t0,655 +langchain_classic/document_loaders/mhtml.py,sha256=XE6TivsFBfjflF3wycWXnMIS0L-pxY4RErowpZFtIC8,640 +langchain_classic/document_loaders/modern_treasury.py,sha256=7AQ-xkWBmejN18b8nY-PzHzmfpyWxGiV9SxY24Vcwmc,667 +langchain_classic/document_loaders/mongodb.py,sha256=0LtFX1-Xp02CBJflRDCAj2u-YskCj1gJLZmZEDUyshM,646 +langchain_classic/document_loaders/news.py,sha256=T36du8xkiRVbU_xgpFfetbmomIuMC46WlNjFRjUXERs,646 +langchain_classic/document_loaders/notebook.py,sha256=XqMpx4WCxAOJJmhm4EDlbnztyytOV0lFKXSgribX3Z8,972 +langchain_classic/document_loaders/notion.py,sha256=R6wLO2ilc5xpsW0O4Lph9sKqnDVgvPGJYLsVr9yMKwk,670 +langchain_classic/document_loaders/notiondb.py,sha256=I88VkGLa4ZP73Qs8A8X5hxIMHV9pdN3llVji9Svqkw8,649 +langchain_classic/document_loaders/nuclia.py,sha256=XrzoT3aNPUnF-uSVOlmteRgekmUZgyaHTmTxRNsIq68,657 +langchain_classic/document_loaders/obs_directory.py,sha256=K3Aza7_90oMm09WvdkaAGGzD30vLm6rh0zKUKVBE7Jg,661 +langchain_classic/document_loaders/obs_file.py,sha256=IwldENPfVznRpi0kysKjf0TxRI6B2YnvPNzJusF55G8,646 +langchain_classic/document_loaders/obsidian.py,sha256=2oJmAXMjeBoAxpfV3HN7hbaTEuHQKFVA_1rxtGwm6_w,649 +langchain_classic/document_loaders/odt.py,sha256=XHDfGSduA1SOowblLzWjL6-1UmRBYk89pIJlb8GSqh4,670 +langchain_classic/document_loaders/onedrive.py,sha256=cV8SwXxh3QoIDpv-r8qs67b8SJlHjKS6zcCBUsoQubY,649 +langchain_classic/document_loaders/onedrive_file.py,sha256=aGq797ChST2rvtRMbXqH53Z4IcLg15CTUuDP_4AYtbY,661 +langchain_classic/document_loaders/onenote.py,sha256=I3lnaHXNt8BDbHxAcHiuDNqZMWaU6vAtXo73J21TAOk,662 +langchain_classic/document_loaders/open_city_data.py,sha256=IU94VI-Mgp2TAslaWj56cRemaDtkwAQ9ep5VxZxhxoc,661 +langchain_classic/document_loaders/org_mode.py,sha256=nu8nqqA36M7ITEjjdEYjrwyIqtL2942Z5A0N0Wy4jmo,689 +langchain_classic/document_loaders/parsers/__init__.py,sha256=5rwD8gk0qvRCJLUU09T6K_RHVy1pNGvMRmJYKdYEgFE,2150 +langchain_classic/document_loaders/parsers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/audio.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/docai.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/generic.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/grobid.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/msword.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/pdf.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/registry.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/__pycache__/txt.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/audio.py,sha256=n4raYaV_Ve7reefOuVfKjJ8UCWHS2hS40BJ2CsgYxSE,993 +langchain_classic/document_loaders/parsers/docai.py,sha256=xvihNnXfB02EsV4eI0Xolf206r5l6i0gWS8EcQp8uok,829 +langchain_classic/document_loaders/parsers/generic.py,sha256=hAdKOiOkKu2lQn8lcOYOgf29F2tAn5z2nBnvpI87PLY,703 +langchain_classic/document_loaders/parsers/grobid.py,sha256=-6NGDq7pwmdRLRqVPzyBSHYFzrtXRlG8mgcAOCHmE_o,856 +langchain_classic/document_loaders/parsers/html/__init__.py,sha256=9no36DVTOOF0z8Xbm-rUYN8GQTLLzj20eLn1oZLnBZc,687 +langchain_classic/document_loaders/parsers/html/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/html/__pycache__/bs4.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/html/bs4.py,sha256=9no36DVTOOF0z8Xbm-rUYN8GQTLLzj20eLn1oZLnBZc,687 +langchain_classic/document_loaders/parsers/language/__init__.py,sha256=7U-PUb4oTCpq28G5GChty4ytLHbNN3tJA_H8iSU87kI,755 +langchain_classic/document_loaders/parsers/language/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/language/__pycache__/cobol.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/language/__pycache__/code_segmenter.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/language/__pycache__/javascript.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/language/__pycache__/language_parser.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/language/__pycache__/python.cpython-311.pyc,, +langchain_classic/document_loaders/parsers/language/cobol.py,sha256=mbRBUZJyuWyOyEEl0b9PGA9mjHAGzeMNsmyPxyxrGe4,719 +langchain_classic/document_loaders/parsers/language/code_segmenter.py,sha256=esSKmadJWfQTl79HOfQ2orNk4gcxHKH-nQFVHlAlKu4,750 +langchain_classic/document_loaders/parsers/language/javascript.py,sha256=EPJvhYx0tYS1dlv5MBbWj5cdhVQcqnbpkl8XPdMg_54,760 +langchain_classic/document_loaders/parsers/language/language_parser.py,sha256=7U-PUb4oTCpq28G5GChty4ytLHbNN3tJA_H8iSU87kI,755 +langchain_classic/document_loaders/parsers/language/python.py,sha256=RtHes6hy79hOIT0-dNqeWULTfVYuY_e0zDdbxw_TK9I,724 +langchain_classic/document_loaders/parsers/msword.py,sha256=sjIpSLr7P-oUwHbyspCgP_TiZkGnD1rPJiW7Ch_SVN0,680 +langchain_classic/document_loaders/parsers/pdf.py,sha256=s2twOjg3TIdTYpoAtWpLPiJ8TRWgklXxGfJEimslUtg,1670 +langchain_classic/document_loaders/parsers/registry.py,sha256=aA1VFXQ8I-HmChDEOAMctye1gtT2Wr7dEzdCMb8ixxw,678 +langchain_classic/document_loaders/parsers/txt.py,sha256=F2HwuBTYP2GwB60g4aagjtUie4ltR_BD5AyYXxfhv4U,661 +langchain_classic/document_loaders/pdf.py,sha256=PoHvXvZaaU7M7kQW00s3jItwrRMdLGXp1xMUTbg3m1k,2189 +langchain_classic/document_loaders/polars_dataframe.py,sha256=qn5GEyLyVm4AEuIa7vn82vrbSW6hvjS1UPnKZ_Z-lf8,670 +langchain_classic/document_loaders/powerpoint.py,sha256=0lq0v-Eoi6Jo98WoBF5b7A3rXw3fb2irSmHJunfu1ow,698 +langchain_classic/document_loaders/psychic.py,sha256=3chU5PmwVsAlPcOb_OIff_H_3E0h9uTtrEajjckyfYQ,646 +langchain_classic/document_loaders/pubmed.py,sha256=drsK1HFw1jtg3GLmHAbcErlDf6sHZH_MarohDMMbHqs,643 +langchain_classic/document_loaders/pyspark_dataframe.py,sha256=yeABTFV9SDw0B1HabyxZuult6FCXGKsfKzjlsnQxE44,727 +langchain_classic/document_loaders/python.py,sha256=t6xuXBg2EqCMB0Pj_sJqD-FmdcXQumzd_228bILAY94,651 +langchain_classic/document_loaders/quip.py,sha256=b_Pjd0R5pu8rVeA4onMe_-eDU9YPUK9aIorOyXf9sm0,647 +langchain_classic/document_loaders/readthedocs.py,sha256=U2VnKdsbnijuiYYCqn9PCvQpq0rVcbMR0H6oCReIvUU,658 +langchain_classic/document_loaders/recursive_url_loader.py,sha256=hBezOMmz1V8aR5st8OWKv7q8T4qR5kxJJoUmoj5vtqs,661 +langchain_classic/document_loaders/reddit.py,sha256=2EI1DO1DCuzS0OBh4w7X9Al18TQE4b6EPrAXbmTkVvk,658 +langchain_classic/document_loaders/roam.py,sha256=KqaAEtO-HrQ8Ri_lm3F8HX3kpzhFSJZr7kIBf1Iw5SQ,637 +langchain_classic/document_loaders/rocksetdb.py,sha256=M-Vr3iXWliA383MO_YnJkiQPdQGE6N14QvFn01X8kbo,646 +langchain_classic/document_loaders/rspace.py,sha256=RPNmp5-G3H8qUYBdgerfw_yNnH0KtsYHGmeQFjhZFFo,657 +langchain_classic/document_loaders/rss.py,sha256=YGxQwy1Zgr4qc8sH5IGqidFRKq_Zr_uQciK27S8fdgg,646 +langchain_classic/document_loaders/rst.py,sha256=LumNarWz5kFD6zKLBvVFjSnV1CkV_udm5V31-csviHE,670 +langchain_classic/document_loaders/rtf.py,sha256=C9qGtKQOuRaS3ZuJTYTKzXrtWZkVGfMl7RidXHzkzsQ,670 +langchain_classic/document_loaders/s3_directory.py,sha256=59xPNdhLt9yUM2jDY-hS-OwcjjaNMltJhMQ0Ba5nkOs,658 +langchain_classic/document_loaders/s3_file.py,sha256=WcojQUzJVBllhF9hpAmYfaKKxPVLeYSooYLD3lNnBfk,643 +langchain_classic/document_loaders/sharepoint.py,sha256=SEb_q1T4yMRo9vIx6ZggEdm_HeCRz4OihPxCOEawPb8,655 +langchain_classic/document_loaders/sitemap.py,sha256=I_bmBev4JYKL3-vZoWo-JWGfyu0X9H-OdY7RMasFdrI,646 +langchain_classic/document_loaders/slack_directory.py,sha256=MreugyuxvHPmW6rC02D23bg_NBcjzHNdEsAugJ15BkQ,667 +langchain_classic/document_loaders/snowflake_loader.py,sha256=mJm2jETkNEC8rVmTlqQMCaMNBElL_WlRVBSKevdDCtQ,652 +langchain_classic/document_loaders/spreedly.py,sha256=Ul0lDLBn4zqV_WWJlFLKnXoS5Kcybm7jbN6vQqfNkB4,649 +langchain_classic/document_loaders/srt.py,sha256=xLOUCvGKxPNLuIm1ic2uF-n5i72uD9f_Y-Xdu3XFpNc,634 +langchain_classic/document_loaders/stripe.py,sha256=FtchcspYupcFgFEjk9R2RJufRwqbx_JQBW8VAWfrOXA,643 +langchain_classic/document_loaders/telegram.py,sha256=6fjVHsPL1XGtDVRBr6TwqvG9rlRUfcshmWecs0w_xiA,1130 +langchain_classic/document_loaders/tencent_cos_directory.py,sha256=f1ysJn2MCDxq8YvGNvup65-9jBv-l1a56QDv_f5wZHs,689 +langchain_classic/document_loaders/tencent_cos_file.py,sha256=Iew-g685PgjlOw3Wuh9ukVWJE6_TpnprNi2XFCD2Qss,667 +langchain_classic/document_loaders/tensorflow_datasets.py,sha256=3bWXmgLMhARUfUsaikwxzSd-H_zRxkMwrTwNxjyKSAw,676 +langchain_classic/document_loaders/text.py,sha256=cWWWHkOIDOyu7qq_lqLiAQHhlaVoam8_8ggXj0hdc2I,637 +langchain_classic/document_loaders/tomarkdown.py,sha256=xAZbMyZgSfPwM9aDCLv9PzP4iWJ3kK_h4sh0A6EAsqU,655 +langchain_classic/document_loaders/toml.py,sha256=WX398lcBm3xkXaykcCKGlSbyl35BwjYUtAObqsUd0Q4,637 +langchain_classic/document_loaders/trello.py,sha256=IsfjuwdmpmC_8nyaxGnz2IGPDE_HZqr3t6jZ4Tr1zRQ,643 +langchain_classic/document_loaders/tsv.py,sha256=uLMJWZTRnfUYHXpj0zgGHvw8S30IuJ6N7uu986ODLvo,670 +langchain_classic/document_loaders/twitter.py,sha256=wqGKIWywK_Nd-3sQlcemoZXSx3v28_7iFJegh5EhjlY,661 +langchain_classic/document_loaders/unstructured.py,sha256=MRECEA1hTpgsS_-dM0aCZhwrbDqCxX5x2kNd3xs8ty4,1863 +langchain_classic/document_loaders/url.py,sha256=exfYB3AVWvs3SBdBdH3ObYt-67vABMGXRHkKNxkNQWQ,670 +langchain_classic/document_loaders/url_playwright.py,sha256=pjfyAbgsUXX2NpsDnsoAi1CHFNZFXAut_n-oT-VdqPc,1041 +langchain_classic/document_loaders/url_selenium.py,sha256=rWhIOQjyprCTBVX42-U4uLtae1aoM-nPtOrWh5HuTYc,658 +langchain_classic/document_loaders/weather.py,sha256=Ty3qdvEu9hWaXbaokYIDAFXbSWfqEa5rPuT9RNUqmII,658 +langchain_classic/document_loaders/web_base.py,sha256=pr1-DUkPzFMmv0S2tC2DjwUR6xq5a4UxvSlhBkidflI,646 +langchain_classic/document_loaders/whatsapp_chat.py,sha256=xR6rMgYkDnJXp6PyENBrYzFL7lQLgcwC_Kfi_-cnlbc,854 +langchain_classic/document_loaders/wikipedia.py,sha256=YXBDMyjJJl57LuXrZMjbs1uEJyUd0M64BdbAp-BOPzU,652 +langchain_classic/document_loaders/word_document.py,sha256=-el_C4FVUeYyCwHpRceUz8iW66lgr8EYgubdMZV2bkY,829 +langchain_classic/document_loaders/xml.py,sha256=AWflt4OQsuCIRlxwUr1E4Lyut3c_OrNS88kPWlHkKCs,670 +langchain_classic/document_loaders/xorbits.py,sha256=ijlwWQLNEXKaLMLUbkxCWXV749--o_e_dJY0JvS_5Nc,646 +langchain_classic/document_loaders/youtube.py,sha256=80uCveo6aXsXS-hDmUdVJpo4bOSCRK1Oxt62Bwm135U,913 +langchain_classic/document_transformers/__init__.py,sha256=f9VvZETU8zxv04jp8NIxkcGqT-Ml7JihGdRYLERoxXE,2382 +langchain_classic/document_transformers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/beautiful_soup_transformer.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/doctran_text_extract.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/doctran_text_qa.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/doctran_text_translate.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/embeddings_redundant_filter.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/google_translate.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/html2text.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/long_context_reorder.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/nuclia_text_transform.cpython-311.pyc,, +langchain_classic/document_transformers/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/document_transformers/beautiful_soup_transformer.py,sha256=iUSpwd2-kWZdCWuDAkkevhCopzc9tJTLCiiyb_3Lojk,696 +langchain_classic/document_transformers/doctran_text_extract.py,sha256=I8EUpZAqdlrYb8ybzwF0zPhWCBcXpcTaksQwptYGTZ0,696 +langchain_classic/document_transformers/doctran_text_qa.py,sha256=nmOSWbX6pgCP4hY1cQbrEa9xeTQ880qsytqmUB3FgU4,684 +langchain_classic/document_transformers/doctran_text_translate.py,sha256=kWTCspR0Oc5jOmnoeXVUhjZ7DznwAx9LH9lOIiYQRpc,687 +langchain_classic/document_transformers/embeddings_redundant_filter.py,sha256=77SMUVfSALqrljeEQefimXHH5HqdgdXxlNdj6nuQMxA,1675 +langchain_classic/document_transformers/google_translate.py,sha256=E0rv9T_4LGvaOL5mzx8X4pFx6zlo3W4cAoJsevygzcE,702 +langchain_classic/document_transformers/html2text.py,sha256=2fniDM5hSg3ARlNn_ubTjJ4V8xs68wSDboWNzyNHLUI,684 +langchain_classic/document_transformers/long_context_reorder.py,sha256=bWb0YzwPxEa5HF57dcuqtvFpTcayAsLEgchRq3hFuM0,671 +langchain_classic/document_transformers/nuclia_text_transform.py,sha256=pN4AdZI_R--LtV272gnqA1GEGYRGhmLbhhFbzsWVpQU,687 +langchain_classic/document_transformers/openai_functions.py,sha256=Be0LR5hG7yPSyBDOPei75Pw49nQMkATmNmW7PdfaebY,937 +langchain_classic/document_transformers/xsl/html_chunks_with_headers.xslt,sha256=ti9sT_zWqZQf0aaeX5zT6tfHT1CuUpAVCvzoZWutE0o,6033 +langchain_classic/embeddings/__init__.py,sha256=1gLNQYbr2I8nkL6q18hmkHGAfp9wxtNatFVc1Wd7q54,7678 +langchain_classic/embeddings/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/aleph_alpha.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/awa.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/azure_openai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/baidu_qianfan_endpoint.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/base.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/bedrock.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/bookend.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/cache.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/clarifai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/cloudflare_workersai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/cohere.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/dashscope.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/databricks.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/deepinfra.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/edenai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/embaas.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/ernie.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/fake.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/fastembed.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/google_palm.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/gpt4all.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/gradient_ai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/huggingface.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/huggingface_hub.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/infinity.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/javelin_ai_gateway.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/jina.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/johnsnowlabs.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/llamacpp.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/llm_rails.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/localai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/minimax.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/mlflow.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/mlflow_gateway.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/modelscope_hub.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/mosaicml.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/nlpcloud.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/octoai_embeddings.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/ollama.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/openai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/sagemaker_endpoint.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/self_hosted.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/self_hosted_hugging_face.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/sentence_transformer.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/spacy_embeddings.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/tensorflow_hub.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/vertexai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/voyageai.cpython-311.pyc,, +langchain_classic/embeddings/__pycache__/xinference.cpython-311.pyc,, +langchain_classic/embeddings/aleph_alpha.py,sha256=tsOeYZ52vUQdgoFpj5TR-HMdovRPEwYYXTN6TmNwJa8,898 +langchain_classic/embeddings/awa.py,sha256=1PPB5dVPYzzkUJdfA_5sn603aowWmeRjLNc1reH8BT0,634 +langchain_classic/embeddings/azure_openai.py,sha256=rugNaMa4O0vAX62HoVGfCCL7ZA22NSohoqWv1sVwmx0,658 +langchain_classic/embeddings/baidu_qianfan_endpoint.py,sha256=Zzep_ebRkr7MJpluJrlWR4fYsM3cRQUzPgbu5PRe0Vw,670 +langchain_classic/embeddings/base.py,sha256=yphy1qnQ_dv3bfFXdWOF1npGzqyzQVNqIoRAOdjf3oE,9703 +langchain_classic/embeddings/bedrock.py,sha256=yjIGFJSNj_CV3s4PDygTJF00s_WkNo5IYokxdgJlTRY,646 +langchain_classic/embeddings/bookend.py,sha256=_aNOt-CTkKLcrQVz5Vo8qKmfmjeC7RgxTugu3U4M69o,646 +langchain_classic/embeddings/cache.py,sha256=hsb6MvxSut6V7uVmcKuyOAoj6t3oad8h4GWo8jjE3jA,14412 +langchain_classic/embeddings/clarifai.py,sha256=2WmPw3wfG3MXorrnoIgC4btWynJXhmh2HAWKpx7-C5s,649 +langchain_classic/embeddings/cloudflare_workersai.py,sha256=96Q0S8Fax84o2lSIndNpOkW7R3TwELXhNpe5XCcxu5o,764 +langchain_classic/embeddings/cohere.py,sha256=RIDW0INe05eqzvSYkDvSvW_b2kPXedm7-7udeFq2RqA,643 +langchain_classic/embeddings/dashscope.py,sha256=q9C_4jEhV3qnwOBlii8JmnuVP1GKpfNANhE4Jvk8UQ8,652 +langchain_classic/embeddings/databricks.py,sha256=9XiXAVyglfRKow-MrtpNq6s1q-TJ5BxoG5c5tMGpgGk,655 +langchain_classic/embeddings/deepinfra.py,sha256=YeLZkfk3lpEnsuf1IlqmzY9g56kcutbdTt1ptdr_1gw,652 +langchain_classic/embeddings/edenai.py,sha256=YaVqgvclhFbiH2zmuAmusdm0Ov8-0DRVXv-1_Dicbwo,643 +langchain_classic/embeddings/elasticsearch.py,sha256=zRA3LewIcMMaiMrZSknRWbRfLtMPKum0D9nP4nrH8tk,664 +langchain_classic/embeddings/embaas.py,sha256=z3wJsrFGtDFvY189cGd7HKyHtyCHank0WZ2DeRrl81w,643 +langchain_classic/embeddings/ernie.py,sha256=7SNSkHwfkjTCjgxIiQhdb9SvlM9452WWpwTel6Quhdg,640 +langchain_classic/embeddings/fake.py,sha256=v9uxUECZlKDnwUjMO4bU4ndvqZXgHK_KTH9xqwu5FMs,799 +langchain_classic/embeddings/fastembed.py,sha256=KJ_oXzm48r_eDH_qRw57Pq6HVelxIl4rhe72BQMRQy0,652 +langchain_classic/embeddings/google_palm.py,sha256=Z9J6w_IJHexe8PClGDvxdA6qoRlUHSbU0l-tM1YPqig,655 +langchain_classic/embeddings/gpt4all.py,sha256=Kda8cZ92prIKigBc6YMSWq0TJvkP4ygxkChbu-sOcVI,646 +langchain_classic/embeddings/gradient_ai.py,sha256=XWbvmBI-U-kv7eHCjMmfl9pxcxNq_NrA7CuQsDNLWGs,649 +langchain_classic/embeddings/huggingface.py,sha256=nFj2KkPIdw8BdWl62l-iNOUT_0IYUdVbsMZ70R_TtNI,1120 +langchain_classic/embeddings/huggingface_hub.py,sha256=OFtSo_0mh7B9u52czFzUeeXhP83TLOq8jkmo1sI7y8I,667 +langchain_classic/embeddings/infinity.py,sha256=WYLs0SXzfi4nUA2UaCaEZ5F4P8iW2oJXcjwGAp8CzdM,903 +langchain_classic/embeddings/javelin_ai_gateway.py,sha256=fqkGAycqW_h5FWP4SKFpJweyiAALeMPMXYZvlEJUPns,673 +langchain_classic/embeddings/jina.py,sha256=3EzxxBGDxQQZA-_J2P6XZFE6XNmmpObPFJljvUJ0a7c,637 +langchain_classic/embeddings/johnsnowlabs.py,sha256=7qGez6O89j6MMVFr0QG1L7S7cGPRpR_EDx8gYDohsPU,661 +langchain_classic/embeddings/llamacpp.py,sha256=89htswmv-pjCnzTqONb-l8vqiyf15IdOgtu8aC0ZMK4,649 +langchain_classic/embeddings/llm_rails.py,sha256=rNDMlyp6Xvjl8xZ6ff8GgqDSNsl1W6BlGhz6cxpSnYw,649 +langchain_classic/embeddings/localai.py,sha256=dAXRtq7B4gMh1CG7NHkz1iAP7Rb9hnHFv2NV5c9TICg,646 +langchain_classic/embeddings/minimax.py,sha256=3dBEqTGfW73rru1yvoGdkOq2x2AF_1ZEgBqn2Vj2yI8,646 +langchain_classic/embeddings/mlflow.py,sha256=k2WDi3ZhK3rJDGzxkdKcRYWsFwUovFd76CizHu8pOz8,643 +langchain_classic/embeddings/mlflow_gateway.py,sha256=t-2-Qf51o2vLOQB-nKVV9i0CwwJVAJTVr3zk210EWvw,670 +langchain_classic/embeddings/modelscope_hub.py,sha256=n9Gn6dYbUNzyZmgSn9RErSYXtSeInCuULtv1clhT9Qg,655 +langchain_classic/embeddings/mosaicml.py,sha256=msWQR7KDcJm6V13QzmKd3K1gGwe4_n2J6xjwCod1-_Q,679 +langchain_classic/embeddings/nlpcloud.py,sha256=9ZV7tTZL6Aa2kXHO8eSKkdI49wcdgQi1_1S6WJTR7f4,649 +langchain_classic/embeddings/octoai_embeddings.py,sha256=9z3XUqtdaxWK3678LLrSOH8VIZ2vTZpLt-7UIIJuUtY,643 +langchain_classic/embeddings/ollama.py,sha256=tjM3R_bKPqqlDv2H1hbLUUgOrmME4M7vUNOOKGLcx6U,643 +langchain_classic/embeddings/openai.py,sha256=ND5Kb_bSLB_3A8oYEegFrp5byST6kBqaSlQfP8clPlk,643 +langchain_classic/embeddings/sagemaker_endpoint.py,sha256=2uebPWKexwyrrOlQtmUovUS2QECEIOtPgDKYJhz9ZdE,908 +langchain_classic/embeddings/self_hosted.py,sha256=j5NOi_P5nV8_z5Kj27T0u3X_i28JOCMV62Q7iM0cXuU,655 +langchain_classic/embeddings/self_hosted_hugging_face.py,sha256=X98YNX3c2XzjtoxC6twJ4QYNfqtR7VW-MPgwygQdTh8,889 +langchain_classic/embeddings/sentence_transformer.py,sha256=ygiLnKCR_cltzrdwsPgE1ai7Dq5uEk7BxNgrs6kgTMs,675 +langchain_classic/embeddings/spacy_embeddings.py,sha256=vKP5_yOnxTKa0ODDh0gSbdDiJ6LsrLB7WlAAEQGO_z8,640 +langchain_classic/embeddings/tensorflow_hub.py,sha256=_dymsBlQ54vhjYJUD3VPc-5Zm7g8jNLbPaKN2NqmzxM,664 +langchain_classic/embeddings/vertexai.py,sha256=nMsuHZR1a4KoyWSe9ohRw2fav0BB3lvVrtJD0tgnrWQ,649 +langchain_classic/embeddings/voyageai.py,sha256=Z19reruhvkjHSi0rGjKRJYZQ0PgHHrkucixiWmGR4gY,643 +langchain_classic/embeddings/xinference.py,sha256=wzMXiussq_1jwEIEqA9BWklyVWsIYC-owS0oBdz9dlc,655 +langchain_classic/env.py,sha256=hSvUMntjl1v5p2rYdLrUR0SVgl0jtD3knuNfHb5I6bM,492 +langchain_classic/evaluation/__init__.py,sha256=gYD5BY2P9R5dSKfcTLpj2tklICt_bM5oyt9LWhmDaFI,5786 +langchain_classic/evaluation/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/__pycache__/loading.cpython-311.pyc,, +langchain_classic/evaluation/__pycache__/schema.cpython-311.pyc,, +langchain_classic/evaluation/agents/__init__.py,sha256=sQU0FhzQ5mWBOapg-XhXJWUpwXUcbez9nm53XtBjneY,183 +langchain_classic/evaluation/agents/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/agents/__pycache__/trajectory_eval_chain.cpython-311.pyc,, +langchain_classic/evaluation/agents/__pycache__/trajectory_eval_prompt.cpython-311.pyc,, +langchain_classic/evaluation/agents/trajectory_eval_chain.py,sha256=_N1RF7OkQSzw4MkNBS0638zacm_SEoRmcYkRijQV0qQ,13673 +langchain_classic/evaluation/agents/trajectory_eval_prompt.py,sha256=OIqp9-PWTq5X2toyg67a_x_JQp18Bx1rgbX5VGjHXt4,5974 +langchain_classic/evaluation/comparison/__init__.py,sha256=z0nedA9iLc4FQcYBuq9XLtzBZg_o1TxKHInlq7CI56Y,1402 +langchain_classic/evaluation/comparison/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/comparison/__pycache__/eval_chain.cpython-311.pyc,, +langchain_classic/evaluation/comparison/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/evaluation/comparison/eval_chain.py,sha256=nROvFxLxnA8etJ8u_74oQIOyqbOz1plkhNwYxJoImPo,15908 +langchain_classic/evaluation/comparison/prompt.py,sha256=axAu95L3J6I82P3ORdc2dhLgq7nm6eQ5u-UbxAdbx_o,2358 +langchain_classic/evaluation/criteria/__init__.py,sha256=qmdRSiaEHcjV-BKh7cZ0vqV88ki-HNlrQzPzUBV-SDk,1664 +langchain_classic/evaluation/criteria/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/criteria/__pycache__/eval_chain.cpython-311.pyc,, +langchain_classic/evaluation/criteria/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/evaluation/criteria/eval_chain.py,sha256=5S8TdaEBJPMYeLScc_1nHT7YdPGoU6iNv3Z85IWKpOs,21524 +langchain_classic/evaluation/criteria/prompt.py,sha256=AS4PHgRfc4XRcoPhB3MP68OfHhu05_XRloDJBzWVONM,1769 +langchain_classic/evaluation/embedding_distance/__init__.py,sha256=sgT28KEouLgN2FEw0IeFzzCCWtxk9sOZf8ib4PyYdV0,332 +langchain_classic/evaluation/embedding_distance/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/embedding_distance/__pycache__/base.cpython-311.pyc,, +langchain_classic/evaluation/embedding_distance/base.py,sha256=rRwOoTrDa6pjQNJnD9k9ZYzgA1H1MxeIN05NqduUp9Q,20683 +langchain_classic/evaluation/exact_match/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/evaluation/exact_match/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/exact_match/__pycache__/base.cpython-311.pyc,, +langchain_classic/evaluation/exact_match/base.py,sha256=fLK-XtZcSEFonEgBCJSR4NjqkFEUVP2qPC7Bc2rFqh4,3058 +langchain_classic/evaluation/loading.py,sha256=B0kYV_nmTn-gawtyIvB7eMJkUl7cKcyh7ifmuoBiyT4,7574 +langchain_classic/evaluation/parsing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/evaluation/parsing/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/parsing/__pycache__/base.cpython-311.pyc,, +langchain_classic/evaluation/parsing/__pycache__/json_distance.cpython-311.pyc,, +langchain_classic/evaluation/parsing/__pycache__/json_schema.cpython-311.pyc,, +langchain_classic/evaluation/parsing/base.py,sha256=y9_gJdixuiNYwvVMhfRfdrGsXJPo4otzhjC1ETz4JlE,5575 +langchain_classic/evaluation/parsing/json_distance.py,sha256=y3-VbH32RNvx9Vut9ycwyv0k57o8gplNxOSuTjfDCio,3943 +langchain_classic/evaluation/parsing/json_schema.py,sha256=KlMsYP7LNSU-ybScWkNfFykjvIiH256OApk55_XIwI4,3261 +langchain_classic/evaluation/qa/__init__.py,sha256=tV3cAgE_lEFFV6cStqu7hn44_Gif76NedtV5C7crEzo,361 +langchain_classic/evaluation/qa/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/qa/__pycache__/eval_chain.cpython-311.pyc,, +langchain_classic/evaluation/qa/__pycache__/eval_prompt.cpython-311.pyc,, +langchain_classic/evaluation/qa/__pycache__/generate_chain.cpython-311.pyc,, +langchain_classic/evaluation/qa/__pycache__/generate_prompt.cpython-311.pyc,, +langchain_classic/evaluation/qa/eval_chain.py,sha256=N9WcscOVrvEzB-GjoSJ1BekXiqKM2TlI7DNNwLcxjHk,10835 +langchain_classic/evaluation/qa/eval_prompt.py,sha256=6UraqcVrmtkJn4MfwCkDupnwwZtgAEdvjUY5yhYuOjo,3949 +langchain_classic/evaluation/qa/generate_chain.py,sha256=y-b-cx3CD2iyXIBAyURlf1GsvGn959F9NgkwAa00JT0,1117 +langchain_classic/evaluation/qa/generate_prompt.py,sha256=4UtoofM1jwp-Tmhr_H7i0Rxz4HrQgzFcyxQBpZYtaOQ,549 +langchain_classic/evaluation/regex_match/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/evaluation/regex_match/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/regex_match/__pycache__/base.cpython-311.pyc,, +langchain_classic/evaluation/regex_match/base.py,sha256=Y0TEztQvGvB_wCxfl2Qm6MxiBrWbZDzNae3LocpXkUI,2551 +langchain_classic/evaluation/schema.py,sha256=rJOxltMSverwJWV-6UbYhhCF543krgKH2nRqf-3GP5I,17745 +langchain_classic/evaluation/scoring/__init__.py,sha256=CkvKbFtfF5arTIWCZjTNid5gS95JqUSNlw7bCQ-9Qvs,1112 +langchain_classic/evaluation/scoring/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/scoring/__pycache__/eval_chain.cpython-311.pyc,, +langchain_classic/evaluation/scoring/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/evaluation/scoring/eval_chain.py,sha256=aedtjkVIeR7-CY7TpRH7tLBrrVvO9cpWDHLWKRUJSJU,15454 +langchain_classic/evaluation/scoring/prompt.py,sha256=IsJ_BXbBEE0kmY2T9MLJFlbdr4uZY7TPY-8JXcrszLU,2115 +langchain_classic/evaluation/string_distance/__init__.py,sha256=4pLqOaZMwAYFt4aY45sGP2WmTIcjnSm_V9kR8FH7vTY,294 +langchain_classic/evaluation/string_distance/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/evaluation/string_distance/__pycache__/base.cpython-311.pyc,, +langchain_classic/evaluation/string_distance/base.py,sha256=fTKumcPX8Wa-gHqDTyNzlyKFJcz668CKYke0e3utnQs,13633 +langchain_classic/example_generator.py,sha256=rHfEGPodDx1s5cxE5mLqdYUWR6qC_mmHedpg5B856jQ,150 +langchain_classic/formatting.py,sha256=4s5AwApo_6t2pVfoFXOgFU9sNNdpVDD44B4ryOwJMJo,168 +langchain_classic/globals.py,sha256=ML0Qm3-7eKxW4LgpoWNujeoQuE4x2SiweFdkqNiN7zU,341 +langchain_classic/graphs/__init__.py,sha256=9dCRhCFMuf62tjTnSlgpYcFkQKNqfFwLq9ptzJ-4QgM,1536 +langchain_classic/graphs/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/arangodb_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/falkordb_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/graph_document.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/graph_store.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/hugegraph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/kuzu_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/memgraph_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/nebula_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/neo4j_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/neptune_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/networkx_graph.cpython-311.pyc,, +langchain_classic/graphs/__pycache__/rdf_graph.cpython-311.pyc,, +langchain_classic/graphs/arangodb_graph.py,sha256=3LKWCqFHgZ5Ldb-PsmQ2afH42h2nPsYdg-x-pFeXV_s,804 +langchain_classic/graphs/falkordb_graph.py,sha256=TxaXyVJ8MTaaInYW1II_PepEFinoC52Bs6EoVLCTWpU,626 +langchain_classic/graphs/graph_document.py,sha256=m_XLbocpdTl2ePtohQlMet6t4Rlw0GZlmsCCtMx0gyA,870 +langchain_classic/graphs/graph_store.py,sha256=1zVJWlkH0-bqgqIzZaTXOqhsCDqiRHVoq2WnauvJh8c,641 +langchain_classic/graphs/hugegraph.py,sha256=E_R3EQ2c7PWdm4iEKaiTTziqqVvDoXnFPhGvuRYP5RU,614 +langchain_classic/graphs/kuzu_graph.py,sha256=jj562f7juBwptPpeJtiaYOTv5WZtpXoxqp867ptxyOI,614 +langchain_classic/graphs/memgraph_graph.py,sha256=9xoSXD2gjjkmkz_NvxhkIvlHgDkiLwccoPzD4EefPKA,626 +langchain_classic/graphs/nebula_graph.py,sha256=O09OCeEQSYznaZGgB_Tr74JpQBDTr8K91MZJq_Ka_no,620 +langchain_classic/graphs/neo4j_graph.py,sha256=IGXVr4WdpfrKFWs8_hYRVhaA5GxaQ-kQZlNmYtjyOUM,617 +langchain_classic/graphs/neptune_graph.py,sha256=5-Jb3CCQS0xCUEuya6iXB0NkRexLpaOAHWvkDywqabQ,623 +langchain_classic/graphs/networkx_graph.py,sha256=ycYRY4ASzWGyYQZexvuTjKveYnsAKzwrSivejzpqlh0,1050 +langchain_classic/graphs/rdf_graph.py,sha256=KKeIQBCr_ViQ42Hd21itzzFeNpc9mOPSrU8CvG75Ceg,611 +langchain_classic/hub.py,sha256=8u04uC144OK6mUJlfI42eXyiPAaZCurfZ7ZVDc-iCI0,4651 +langchain_classic/indexes/__init__.py,sha256=dcpzKbikjJX7U9bKqkHU67gIu-3xwgl_Ft4NrgnaSMc,1519 +langchain_classic/indexes/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/indexes/__pycache__/_api.cpython-311.pyc,, +langchain_classic/indexes/__pycache__/_sql_record_manager.cpython-311.pyc,, +langchain_classic/indexes/__pycache__/graph.cpython-311.pyc,, +langchain_classic/indexes/__pycache__/vectorstore.cpython-311.pyc,, +langchain_classic/indexes/_api.py,sha256=93hOcQ5gNxwmgjV0hqcYHJQ1WkE8tc8JrAQuwKf2X80,252 +langchain_classic/indexes/_sql_record_manager.py,sha256=ZZJnHkb8jLQOPj75wdxdK-SGaQZhfNz97FzaRJppr4o,21158 +langchain_classic/indexes/graph.py,sha256=U7joQZ1YuIZwgadtXe1zFimOzuA_uToV0J7r9fd4YrQ,915 +langchain_classic/indexes/prompts/__init__.py,sha256=5ohFoTxhpsRyltYRwAlmdaShczCPPkyvxbc0SQ5bTCE,358 +langchain_classic/indexes/prompts/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/indexes/prompts/__pycache__/entity_extraction.cpython-311.pyc,, +langchain_classic/indexes/prompts/__pycache__/entity_summarization.cpython-311.pyc,, +langchain_classic/indexes/prompts/__pycache__/knowledge_triplet_extraction.cpython-311.pyc,, +langchain_classic/indexes/prompts/entity_extraction.py,sha256=uLutKmn5SeSgHl2el7yAOYJN_bKDZar-TKWQiT5I134,1951 +langchain_classic/indexes/prompts/entity_summarization.py,sha256=xk5ztqykZJdNBfyymdBiAJPLYet1MH-pxz82Y5balTM,1156 +langchain_classic/indexes/prompts/knowledge_triplet_extraction.py,sha256=HFEwTcs968580v2Uxmo1Eft5N_qosx-Rjc2Ps93ICVc,1552 +langchain_classic/indexes/vectorstore.py,sha256=F9ay9t23oEUtQpPDoudpBq_1lszoCz1Ub74peziWgwY,9788 +langchain_classic/input.py,sha256=9OczJo7x4KQPqxSxihmP8hDsl7j14xosDrid-6hrjRY,283 +langchain_classic/llms/__init__.py,sha256=hiaasyUlqgAaWb4vb89kw61eOJ4LMDSpIafYukLJN9o,16801 +langchain_classic/llms/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/llms/__pycache__/ai21.cpython-311.pyc,, +langchain_classic/llms/__pycache__/aleph_alpha.cpython-311.pyc,, +langchain_classic/llms/__pycache__/amazon_api_gateway.cpython-311.pyc,, +langchain_classic/llms/__pycache__/anthropic.cpython-311.pyc,, +langchain_classic/llms/__pycache__/anyscale.cpython-311.pyc,, +langchain_classic/llms/__pycache__/arcee.cpython-311.pyc,, +langchain_classic/llms/__pycache__/aviary.cpython-311.pyc,, +langchain_classic/llms/__pycache__/azureml_endpoint.cpython-311.pyc,, +langchain_classic/llms/__pycache__/baidu_qianfan_endpoint.cpython-311.pyc,, +langchain_classic/llms/__pycache__/bananadev.cpython-311.pyc,, +langchain_classic/llms/__pycache__/base.cpython-311.pyc,, +langchain_classic/llms/__pycache__/baseten.cpython-311.pyc,, +langchain_classic/llms/__pycache__/beam.cpython-311.pyc,, +langchain_classic/llms/__pycache__/bedrock.cpython-311.pyc,, +langchain_classic/llms/__pycache__/bittensor.cpython-311.pyc,, +langchain_classic/llms/__pycache__/cerebriumai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/chatglm.cpython-311.pyc,, +langchain_classic/llms/__pycache__/clarifai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/cloudflare_workersai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/cohere.cpython-311.pyc,, +langchain_classic/llms/__pycache__/ctransformers.cpython-311.pyc,, +langchain_classic/llms/__pycache__/ctranslate2.cpython-311.pyc,, +langchain_classic/llms/__pycache__/databricks.cpython-311.pyc,, +langchain_classic/llms/__pycache__/deepinfra.cpython-311.pyc,, +langchain_classic/llms/__pycache__/deepsparse.cpython-311.pyc,, +langchain_classic/llms/__pycache__/edenai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/fake.cpython-311.pyc,, +langchain_classic/llms/__pycache__/fireworks.cpython-311.pyc,, +langchain_classic/llms/__pycache__/forefrontai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/gigachat.cpython-311.pyc,, +langchain_classic/llms/__pycache__/google_palm.cpython-311.pyc,, +langchain_classic/llms/__pycache__/gooseai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/gpt4all.cpython-311.pyc,, +langchain_classic/llms/__pycache__/gradient_ai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/huggingface_endpoint.cpython-311.pyc,, +langchain_classic/llms/__pycache__/huggingface_hub.cpython-311.pyc,, +langchain_classic/llms/__pycache__/huggingface_pipeline.cpython-311.pyc,, +langchain_classic/llms/__pycache__/huggingface_text_gen_inference.cpython-311.pyc,, +langchain_classic/llms/__pycache__/human.cpython-311.pyc,, +langchain_classic/llms/__pycache__/javelin_ai_gateway.cpython-311.pyc,, +langchain_classic/llms/__pycache__/koboldai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/llamacpp.cpython-311.pyc,, +langchain_classic/llms/__pycache__/loading.cpython-311.pyc,, +langchain_classic/llms/__pycache__/manifest.cpython-311.pyc,, +langchain_classic/llms/__pycache__/minimax.cpython-311.pyc,, +langchain_classic/llms/__pycache__/mlflow.cpython-311.pyc,, +langchain_classic/llms/__pycache__/mlflow_ai_gateway.cpython-311.pyc,, +langchain_classic/llms/__pycache__/modal.cpython-311.pyc,, +langchain_classic/llms/__pycache__/mosaicml.cpython-311.pyc,, +langchain_classic/llms/__pycache__/nlpcloud.cpython-311.pyc,, +langchain_classic/llms/__pycache__/octoai_endpoint.cpython-311.pyc,, +langchain_classic/llms/__pycache__/ollama.cpython-311.pyc,, +langchain_classic/llms/__pycache__/opaqueprompts.cpython-311.pyc,, +langchain_classic/llms/__pycache__/openai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/openllm.cpython-311.pyc,, +langchain_classic/llms/__pycache__/openlm.cpython-311.pyc,, +langchain_classic/llms/__pycache__/pai_eas_endpoint.cpython-311.pyc,, +langchain_classic/llms/__pycache__/petals.cpython-311.pyc,, +langchain_classic/llms/__pycache__/pipelineai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/predibase.cpython-311.pyc,, +langchain_classic/llms/__pycache__/predictionguard.cpython-311.pyc,, +langchain_classic/llms/__pycache__/promptlayer_openai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/replicate.cpython-311.pyc,, +langchain_classic/llms/__pycache__/rwkv.cpython-311.pyc,, +langchain_classic/llms/__pycache__/sagemaker_endpoint.cpython-311.pyc,, +langchain_classic/llms/__pycache__/self_hosted.cpython-311.pyc,, +langchain_classic/llms/__pycache__/self_hosted_hugging_face.cpython-311.pyc,, +langchain_classic/llms/__pycache__/stochasticai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/symblai_nebula.cpython-311.pyc,, +langchain_classic/llms/__pycache__/textgen.cpython-311.pyc,, +langchain_classic/llms/__pycache__/titan_takeoff.cpython-311.pyc,, +langchain_classic/llms/__pycache__/titan_takeoff_pro.cpython-311.pyc,, +langchain_classic/llms/__pycache__/together.cpython-311.pyc,, +langchain_classic/llms/__pycache__/tongyi.cpython-311.pyc,, +langchain_classic/llms/__pycache__/utils.cpython-311.pyc,, +langchain_classic/llms/__pycache__/vertexai.cpython-311.pyc,, +langchain_classic/llms/__pycache__/vllm.cpython-311.pyc,, +langchain_classic/llms/__pycache__/volcengine_maas.cpython-311.pyc,, +langchain_classic/llms/__pycache__/watsonxllm.cpython-311.pyc,, +langchain_classic/llms/__pycache__/writer.cpython-311.pyc,, +langchain_classic/llms/__pycache__/xinference.cpython-311.pyc,, +langchain_classic/llms/__pycache__/yandex.cpython-311.pyc,, +langchain_classic/llms/ai21.py,sha256=gUIroqmaBNcBkp9oucZlnb6rHAxATdEcPtBVaZdZUlc,743 +langchain_classic/llms/aleph_alpha.py,sha256=XQ89odJfToyIO5TIrxR-zA7aGToe6MYfihzlPyiqz54,613 +langchain_classic/llms/amazon_api_gateway.py,sha256=obSFzwwPndiuWiPbAgIDK6O5kSpmnIChg5wDwxo87SI,631 +langchain_classic/llms/anthropic.py,sha256=-COd7b3Ln4-eFlzbemmvbuAXdKhn94mOgNmeB8zc3So,610 +langchain_classic/llms/anyscale.py,sha256=ta63qijCEHDKFzC3CnAJHkyw_TmAVA4mItNPNuc9tm4,607 +langchain_classic/llms/arcee.py,sha256=fqwDG8tx37dZLYFu7LfAi7WPAZkbtUb8gTWqdKL-zX4,598 +langchain_classic/llms/aviary.py,sha256=-SYPzANV1t5uoLBQ1XiCQ4AA14v6958kPR1P9iuJztQ,601 +langchain_classic/llms/azureml_endpoint.py,sha256=QFXnaKzwPVr3wTlYS0fHkL43u5tAYJkOlDnVilnumtw,1657 +langchain_classic/llms/baidu_qianfan_endpoint.py,sha256=i4pCAjczvhp62y20pv0TJ5qkTlp7XwKA664T29Rhy9Q,637 +langchain_classic/llms/bananadev.py,sha256=4GGz49vLQF3xTa7T6Atl6gNoIJWNJKvD6RG-bU1qJgs,601 +langchain_classic/llms/base.py,sha256=DYynzLXD5kJplOWOaUNc29Ux0JclOlEKlndxVSvH7D4,625 +langchain_classic/llms/baseten.py,sha256=B_VT3YDeoZ23ifhjHWXrptf3URWM925HknkWemGnQf0,604 +langchain_classic/llms/beam.py,sha256=BJq7tHpEcTpAcdheZRYshAcz9KznNR5yfa7AGfHwd_0,595 +langchain_classic/llms/bedrock.py,sha256=9B2gBrbok6dXJF6pn1hDE1dNeAHt3SQ_fFcF3P2LjCo,746 +langchain_classic/llms/bittensor.py,sha256=r2ARDp7WooyPJtGnCy6VLzP_97l6CuM8qQghyDAZdnI,625 +langchain_classic/llms/cerebriumai.py,sha256=AEUTVAY4M1m22wb0ZL0HXuMqJgQmR0DgIjVpBJjsPcE,616 +langchain_classic/llms/chatglm.py,sha256=cpuECmkUNXp_fzTjRnQUEm8R-80v1AACF0gX_seFawY,604 +langchain_classic/llms/clarifai.py,sha256=lpj0py3IhqlD4ALOiCZ4ZbehmGGvuRVJEAwdRWjwLys,607 +langchain_classic/llms/cloudflare_workersai.py,sha256=ube9Ocffb2onPTU_3gHgI9biK4SagBJX8WowpIYqwS0,689 +langchain_classic/llms/cohere.py,sha256=YoBhTaGa8_YDv2686zQOd_qejxsOZmzLLjaF-BnUSGo,601 +langchain_classic/llms/ctransformers.py,sha256=uceobXlZTyV8FrSv1QqKSj6ok5oQngtls9UnVDK45DE,622 +langchain_classic/llms/ctranslate2.py,sha256=uFxltS1rcg1ow_1mxDz10G4YZmILCrUAhdCnZBiIeS0,616 +langchain_classic/llms/databricks.py,sha256=roS6niSjqg3kErqv5nNvD_UVsGfdFkvGtR_2R1ZuXMw,613 +langchain_classic/llms/deepinfra.py,sha256=N7JEB-Jc1-2F6bKz3mZAZ2yHgjY5OlPb8LLpCPrbU08,610 +langchain_classic/llms/deepsparse.py,sha256=jD4hsnzI-enFUn5wkqpjf8KHTvWDjo7u-yZ1gydgUB0,613 +langchain_classic/llms/edenai.py,sha256=ns-u0a-ON-kJpruhsSGEj9CoTxk2SvX5JM1YXrMDGWc,601 +langchain_classic/llms/fake.py,sha256=abqw11dTyhjE35Y_OTsZr_9r-4G_jguJwyjCio16lYI,785 +langchain_classic/llms/fireworks.py,sha256=c94mk2YYjo_3pq7y3D3qIjszyoUJFzldUdiuIOuO_s4,610 +langchain_classic/llms/forefrontai.py,sha256=xrpHdR55jK94iGGy-JKqfTH4sLqec_W_JeywF8GumqU,616 +langchain_classic/llms/gigachat.py,sha256=78y3IpwgYeyfacLKUgA0UQjZWYPBbXW_eeCEApJ6iTQ,607 +langchain_classic/llms/google_palm.py,sha256=iDMfXvpn9HZsi1SMvIZknP6mavP_Lu2gviiIjwCXq6M,613 +langchain_classic/llms/gooseai.py,sha256=DsQ6sD3pUMJhSVX4b52jPaZgMEgm2Ke4cE1jwRyg5Y8,604 +langchain_classic/llms/gpt4all.py,sha256=1P1kQfjFUni6BJ9qFPGfW3Zj3-iBA2Ku-BcQfPhiYeA,604 +langchain_classic/llms/gradient_ai.py,sha256=NMR06zL76gjCuN_V4XY21zzB_barbetp7KnZ_e7AQzQ,766 +langchain_classic/llms/grammars/json.gbnf,sha256=htDQy5F1h7Q6K9kuc1j7a_LUw8Dhj-_rhQc28OJqluQ,664 +langchain_classic/llms/grammars/list.gbnf,sha256=9cg8vDmOQ-jZvKSj-hyvTUl05Igbw_416yRQnB2VqcA,167 +langchain_classic/llms/huggingface_endpoint.py,sha256=_GNQdtS505f4fYj-_RWoZn1-lD65vBE-8ZVTLxE7NrY,640 +langchain_classic/llms/huggingface_hub.py,sha256=IzM7rtf7MoF-TqzoFOHJZb5im-xzwgEk0rvdtrcie08,625 +langchain_classic/llms/huggingface_pipeline.py,sha256=J8GZPAs-YBgfVkGVnr-RbhQlNBQvmkys0fa5umK-NHg,640 +langchain_classic/llms/huggingface_text_gen_inference.py,sha256=7kK2tkkMmCu7E_hCjvu2Mf94pZBJYz3HV0rjGNUl11A,664 +langchain_classic/llms/human.py,sha256=37e2xR1tRYqq-cod2ExfBTgf4tAjBqTOt0myYo2nQjk,622 +langchain_classic/llms/javelin_ai_gateway.py,sha256=GO7U2H1gkABbXLCmfw7RaMJ3F6XDYDkF6MdqACLzqWQ,780 +langchain_classic/llms/koboldai.py,sha256=dpYmd6x6NX9hL7y4pkuGiX_2iYN3lcCivY6vkVdOvAM,619 +langchain_classic/llms/llamacpp.py,sha256=nM-OpT7yF1-Yem7kSsewLTS0wT5B0stb6EKb8lvZypg,607 +langchain_classic/llms/loading.py,sha256=1Frp_k0M0IUZVso4LGyUUsrH8CiOvyZg6MfZlTd-cZ0,744 +langchain_classic/llms/manifest.py,sha256=MUriUqVjjyJB3VeiNEdFd28Dl9lriDc-km-Bmo9S91Q,628 +langchain_classic/llms/minimax.py,sha256=kaw95SYL4xW9Dt-41mFckpJewNcnuLXJtR5oM_l1U2M,604 +langchain_classic/llms/mlflow.py,sha256=Yqyfvfxmohr2UfV3erQo_SoeqJx2SjkrdT2KGF3wuVg,601 +langchain_classic/llms/mlflow_ai_gateway.py,sha256=OPFamzFSiYjcmD9tHWEc7CK5IzWJfe7mQglZ0fF-e40,628 +langchain_classic/llms/modal.py,sha256=GmI243w0cKR7IVzgHvfUl7-6pJebw2VUv4xeAhQmZEE,598 +langchain_classic/llms/mosaicml.py,sha256=8QazOIA92kebjxbk-IUGYQRk7IqwVqkOWvfuk_LmIXk,607 +langchain_classic/llms/nlpcloud.py,sha256=_rZFXJ-kT1j7q43uAjF6yBaA3ccNm7bUB3gVyHMWmpQ,607 +langchain_classic/llms/octoai_endpoint.py,sha256=1sBJTZctBsKjcdJYR-X9e3k0r1vPJBScoDITfuJez3s,625 +langchain_classic/llms/ollama.py,sha256=h_G4Qx4jKBQVKLp2yFpyXJgwljueYwG4SiIsN7colxo,601 +langchain_classic/llms/opaqueprompts.py,sha256=qRES8dbaMn0wkBq6u3WZP8tsbVmN1LNJ0_rLdDp4L5Q,622 +langchain_classic/llms/openai.py,sha256=HVtL7fF5g2uUX4z9df6RWRWjQMti8lg1875DNo2BPs0,893 +langchain_classic/llms/openllm.py,sha256=AjdnzmG8xJC5-9QZg07nIPsvveLZ_XcdQZdZOchtIls,604 +langchain_classic/llms/openlm.py,sha256=7MSzeWuBza6nGZCsejJm3MUaB_wEQ9ytQ1I9X3W4oQM,601 +langchain_classic/llms/pai_eas_endpoint.py,sha256=OZMRWBLejXnBNXQ9OlKIKwFccQXZ4s8-VNmvphCcDEk,625 +langchain_classic/llms/petals.py,sha256=CUwFPcdbZjAPODlrGb1y-ijs9sj_zwQsQdpulGEICUU,601 +langchain_classic/llms/pipelineai.py,sha256=OrgE3mIalLCgjfahrVhQrqIkrUaEAjBpb6icNuaEjAo,613 +langchain_classic/llms/predibase.py,sha256=wiclGCedGOzSDjtCDOOWHZsduR9AKC1menJHVpYXsGc,610 +langchain_classic/llms/predictionguard.py,sha256=33Uv8S7ipdp3QeIDOW4y6hvw-u6klFv2h9dr5REl6Uk,628 +langchain_classic/llms/promptlayer_openai.py,sha256=yPiXRbh9omiMYDIGIiTZM8bqCNrD5NOj709_RM1GgKo,750 +langchain_classic/llms/replicate.py,sha256=YWJA9fe5SAtgivdTqT0zJx-hHstqKCvAmSLu-O2Xh4w,610 +langchain_classic/llms/rwkv.py,sha256=uJ688Fgs5XQzzQAbDnZO3wDwYCiqjtEUVyaWPldFlNA,595 +langchain_classic/llms/sagemaker_endpoint.py,sha256=jDdDYBLMaywXUArowq7e5AOP7YidSNppgqV_eYsxBnA,816 +langchain_classic/llms/self_hosted.py,sha256=omJUu0SCzcVN7fIvKwYec8xJenNUvtw8yPmyDZZZYdM,637 +langchain_classic/llms/self_hosted_hugging_face.py,sha256=B87vfsZ1JT6LGjI9BhR41qUpgmX3pyui_hvRTuLSyy8,655 +langchain_classic/llms/stochasticai.py,sha256=z1V8cce8SLIJnvmrsSZSZtTHmdmL9TdgcUeeHKrM4Pw,619 +langchain_classic/llms/symblai_nebula.py,sha256=QN4wx3q01OCi32CcSpaKiqyADAT8_mBNOEjfZalVhko,601 +langchain_classic/llms/textgen.py,sha256=NGPC5EsfDlLSVXawIlS8RTlhSrqzMz6EmzKDWlajnJ8,604 +langchain_classic/llms/titan_takeoff.py,sha256=APlZevxnOFouOPMHq9ZN27Np3TKpJJJKWdN0o9kcwoY,619 +langchain_classic/llms/titan_takeoff_pro.py,sha256=x1rzv1KWeF_gJ5qkqxJScFwXMYY5Zsf_1f09EJD8FBQ,628 +langchain_classic/llms/together.py,sha256=J9RiTb8sXT5ccxJLAFuUsxQZlu8vszinJA-J31qZHOU,607 +langchain_classic/llms/tongyi.py,sha256=kqnf1HeDISErl3tpdzjDC7CzxTVGOJBGHfwWtDy7_RQ,601 +langchain_classic/llms/utils.py,sha256=KOWGyJ6Y7YHVr9UPamg5Az-PypF6dlg0mDurukLBZVs,652 +langchain_classic/llms/vertexai.py,sha256=GC3adP6gEd3uIwgFccNjmTAkqQxW3Z63ryqB30W_iHs,717 +langchain_classic/llms/vllm.py,sha256=CWuLd0ZrcQocj4QoYiUB7PDKS8QovJphSLtXVLN9wH4,678 +langchain_classic/llms/volcengine_maas.py,sha256=lmJby_ENeTcWQsyagdl0vwTggcczI5oZ1ZV-HvB4mUA,813 +langchain_classic/llms/watsonxllm.py,sha256=GQAADjORikbgIRylIwj0ffWGSymmWwmIcWRfT9JlhMM,613 +langchain_classic/llms/writer.py,sha256=MsripKTLyIlRUmIWPc2fK1ZPoe1g4WzPlWQRlYd9SZs,601 +langchain_classic/llms/xinference.py,sha256=S9folNf4moFsW2_ndH1_mFgzR17WmVhmmdKus2FtXoY,613 +langchain_classic/llms/yandex.py,sha256=ZcpnfDDi4jVwg0g5tXOVKrL-mYk80Taul3gkl0BtQeM,610 +langchain_classic/load/__init__.py,sha256=tOEiP80mSLbYtwzqVnSwNBdmP5lq4AGquNmr0nuIfno,207 +langchain_classic/load/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/load/__pycache__/dump.cpython-311.pyc,, +langchain_classic/load/__pycache__/load.cpython-311.pyc,, +langchain_classic/load/__pycache__/serializable.cpython-311.pyc,, +langchain_classic/load/dump.py,sha256=lp0CeYcUwnmrwDo_bH_Bz7b-Wg4skCe8Us_qllL2lCk,100 +langchain_classic/load/load.py,sha256=AnVBlKW0-YleFOOPImZpFzZ3vIjqhxIKgcOE0dqYF-4,98 +langchain_classic/load/serializable.py,sha256=OFZc_XZHitfdqpplM5ZQ_515DUt6ZA-EN5LCUQJA4zY,412 +langchain_classic/memory/__init__.py,sha256=KMsnMwtNtm0SiYcZWnplZReA3z2LufjKey9wiEk51-c,5139 +langchain_classic/memory/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/memory/__pycache__/buffer.cpython-311.pyc,, +langchain_classic/memory/__pycache__/buffer_window.cpython-311.pyc,, +langchain_classic/memory/__pycache__/chat_memory.cpython-311.pyc,, +langchain_classic/memory/__pycache__/combined.cpython-311.pyc,, +langchain_classic/memory/__pycache__/entity.cpython-311.pyc,, +langchain_classic/memory/__pycache__/kg.cpython-311.pyc,, +langchain_classic/memory/__pycache__/motorhead_memory.cpython-311.pyc,, +langchain_classic/memory/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/memory/__pycache__/readonly.cpython-311.pyc,, +langchain_classic/memory/__pycache__/simple.cpython-311.pyc,, +langchain_classic/memory/__pycache__/summary.cpython-311.pyc,, +langchain_classic/memory/__pycache__/summary_buffer.cpython-311.pyc,, +langchain_classic/memory/__pycache__/token_buffer.cpython-311.pyc,, +langchain_classic/memory/__pycache__/utils.cpython-311.pyc,, +langchain_classic/memory/__pycache__/vectorstore.cpython-311.pyc,, +langchain_classic/memory/__pycache__/vectorstore_token_buffer_memory.cpython-311.pyc,, +langchain_classic/memory/__pycache__/zep_memory.cpython-311.pyc,, +langchain_classic/memory/buffer.py,sha256=PrR9e-cMR6U55riY1h0QToXHRRn0NLWw-bPkL5NkL2I,6505 +langchain_classic/memory/buffer_window.py,sha256=9d1YhJzK2DUWiSrP05k7T2u916GPIXZO6SOc6pch4MQ,2196 +langchain_classic/memory/chat_memory.py,sha256=a2fJbT4Ob36sa54RjQmXGdddO3YDC8fRneGiFudRllU,3763 +langchain_classic/memory/chat_message_histories/__init__.py,sha256=3MwQ9VM5ADDaomBlBU5KIt0_aTV-wTSxZPo_2il-iOM,3514 +langchain_classic/memory/chat_message_histories/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/astradb.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/cassandra.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/cosmos_db.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/dynamodb.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/file.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/firestore.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/in_memory.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/momento.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/mongodb.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/neo4j.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/postgres.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/redis.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/rocksetdb.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/singlestoredb.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/sql.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/streamlit.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/upstash_redis.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/xata.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/__pycache__/zep.cpython-311.pyc,, +langchain_classic/memory/chat_message_histories/astradb.py,sha256=jqbZ8hrryZhWAT2shKR_zFVY8m3FFC1fG79uiPPT_T8,701 +langchain_classic/memory/chat_message_histories/cassandra.py,sha256=ddcqQJdZ7R7Ign3uE_rv5GgRbB_0j93Bo3aNWp1hWCA,707 +langchain_classic/memory/chat_message_histories/cosmos_db.py,sha256=Zs_dMH0bTq3qcfYTmr97fivWZd0Gv8F6I1z1xiQScbI,704 +langchain_classic/memory/chat_message_histories/dynamodb.py,sha256=bhkfjaOdJp6AhnNVqAwxF_Hqy9q0tthloOhvlh5-i-U,704 +langchain_classic/memory/chat_message_histories/elasticsearch.py,sha256=2P9--iaQihB2SdFdueFUM0Yp50wjHXwAgPeNqzrY9T4,736 +langchain_classic/memory/chat_message_histories/file.py,sha256=rAmbUdlDjitY6E7yMMVvFWrOc-tq8OzXJ9gf3iw-LTM,692 +langchain_classic/memory/chat_message_histories/firestore.py,sha256=9nHs6PShKf9EoXEq6eGhlFtzlIILstc9MEWlQ7onjGE,707 +langchain_classic/memory/chat_message_histories/in_memory.py,sha256=yEw3IaYUR8CsQFx0IIUPE-OaSdMzRkk4uDSHhUJulvs,130 +langchain_classic/memory/chat_message_histories/momento.py,sha256=9POzYYOAtmWcs0TO3UPKheAYevOjOc_OQwW8NDaVzhc,701 +langchain_classic/memory/chat_message_histories/mongodb.py,sha256=cAPXRjF_VggMWjq21_0TDdOR5G_wM5DESazSYmKgdS4,701 +langchain_classic/memory/chat_message_histories/neo4j.py,sha256=3NEelbMfu5aS__JVQ-DbsYgX0T1Aww5p6DmRyNZDcMI,695 +langchain_classic/memory/chat_message_histories/postgres.py,sha256=bwIUAVvOFy5IA764WF3o9kEJ5ob_O6KGbRuAY6A_0oQ,704 +langchain_classic/memory/chat_message_histories/redis.py,sha256=ueHFBYN1C77JkmovD6m4Q9uLwt-CUG7ssRNO4A71kCk,695 +langchain_classic/memory/chat_message_histories/rocksetdb.py,sha256=3PmlDfAd0wKyDrEUuhOf0OkT6RtvU6CYGxX8K58QMSc,701 +langchain_classic/memory/chat_message_histories/singlestoredb.py,sha256=CXCluQQbTTzb_FAU68U8qqLFNK_Ea7Zlr_adDLvwRZQ,736 +langchain_classic/memory/chat_message_histories/sql.py,sha256=5-pG-0SOKrTMHcUZCWW8dp4V63XhzLwjiQ3kxP4yTqM,1041 +langchain_classic/memory/chat_message_histories/streamlit.py,sha256=TeZaSTZZmgYbnITomsGleA7B1L2jKGwW9QByahLTLkw,707 +langchain_classic/memory/chat_message_histories/upstash_redis.py,sha256=hb7uLFZ9LedFAfO88YYF-f6fYGbvlMlnv5GikU70tws,733 +langchain_classic/memory/chat_message_histories/xata.py,sha256=qcx0NH1Bk1hQuhLAkcCnyrNH8gdN1LtRmJcSCepioEs,692 +langchain_classic/memory/chat_message_histories/zep.py,sha256=07kr3PySEDnY4LwKC-99pkKMsS0pHdNnicWDoZ-xVOc,689 +langchain_classic/memory/combined.py,sha256=X1dhwT5Qnhi2eOaPMnpC6aTywl014hroJlO6YjMSrKY,2966 +langchain_classic/memory/entity.py,sha256=5d8ErvhZY5OX-n50aLcY3sl_oVfVmUvy2BzMvWBOKyw,22146 +langchain_classic/memory/kg.py,sha256=D40EoPL4LxYPSv1054TmZ_J-KztS2CkmmGaWy2iBOv0,653 +langchain_classic/memory/motorhead_memory.py,sha256=duBPTEU9haA_ls7OXjbUmPjUULWSHs0cm4VhZSey6Fc,666 +langchain_classic/memory/prompt.py,sha256=7rsyU8MuDXcjgmfzt2FbBiHze91nFdaM6kViFs3pUMs,8306 +langchain_classic/memory/readonly.py,sha256=EoDglPzOq-jcAYoSyKfukogowXWTHDMzC-ebjHzPEWk,763 +langchain_classic/memory/simple.py,sha256=s0mL7EkstZgKodRznt1ZrX65Mqj0gXMHVv-Sq7m_O9w,815 +langchain_classic/memory/summary.py,sha256=g3w6SqOlgr-AAevrAGhZGqQG3-cSi0AkIydsydRHlKc,5923 +langchain_classic/memory/summary_buffer.py,sha256=IYdwsByanKs-8vuwAIcjO83r0SHIjzu5Umw8TEdTIcw,5904 +langchain_classic/memory/token_buffer.py,sha256=SiMI32OKvn-wWhlOUkfkuP9SSquFqA86P-M9Q1qLh0A,2798 +langchain_classic/memory/utils.py,sha256=q1vsUxmfGBrmpRAyzkGCXPrp2deZMQ88wd9cDcCYCyU,618 +langchain_classic/memory/vectorstore.py,sha256=ve4UK6lmfUdOUVVnGZqBBMTBiILXTZhNU5biaAMG0BI,4473 +langchain_classic/memory/vectorstore_token_buffer_memory.py,sha256=TQGTEVMmnbIpm5hr9jRZ4PJwmGay87TwpPfd3NwcRas,7289 +langchain_classic/memory/zep_memory.py,sha256=6PQfXSa0dGU6cmtvMTJ_6HNCtmC3os_XmkAwiJRX0YQ,636 +langchain_classic/model_laboratory.py,sha256=Q6_0kjQ-S31mBVbUkvk2wVDpRqyOL7_-aclFHdLs76M,4035 +langchain_classic/output_parsers/__init__.py,sha256=kXF7SddEmmWcCw4OMLbm1AAEXk2SkgqwAC1GPn_SlY8,2608 +langchain_classic/output_parsers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/boolean.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/combining.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/datetime.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/enum.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/ernie_functions.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/fix.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/format_instructions.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/json.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/list.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/loading.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/openai_tools.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/pandas_dataframe.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/prompts.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/pydantic.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/rail_parser.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/regex.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/regex_dict.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/retry.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/structured.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/xml.cpython-311.pyc,, +langchain_classic/output_parsers/__pycache__/yaml.cpython-311.pyc,, +langchain_classic/output_parsers/boolean.py,sha256=8FVNBjTeU-N-MqrH8Y2UnpoCkOGJg3CfqI72K6XzvIE,1763 +langchain_classic/output_parsers/combining.py,sha256=k8AduyJ72k6bBuVpq1BTzzIKjO4Sh2RoUKuVmPd0NO8,1980 +langchain_classic/output_parsers/datetime.py,sha256=tUFFflA7bH2t8u8W_eR4qzGs1pTkLtlvMGl1VXSagcs,2132 +langchain_classic/output_parsers/enum.py,sha256=Ll4DBXYnPISou4nHw8x2ccAsmLANRP_6LFofpQKs7n8,1371 +langchain_classic/output_parsers/ernie_functions.py,sha256=3jCZT7sG3uY_5sMv65nRlfX_KXMZgxm2QlxzmSl1CyY,1435 +langchain_classic/output_parsers/fix.py,sha256=SJMSrON-ZVjBQcPrbVi5Bg26EVrv5mw_lbr3Ypsnb20,5557 +langchain_classic/output_parsers/format_instructions.py,sha256=cHyu_xwueTu15TpmLTB3x3KGV_iTGEJ2hCnwk5ut7Q4,3996 +langchain_classic/output_parsers/json.py,sha256=wZXPIlS_6m8GNdU1hqCmnVXZjGNsNQQr5sjguSvDc-A,340 +langchain_classic/output_parsers/list.py,sha256=OrhhWW0tN43hqTVUe0zvoQEbEDUdQNsPr1qIPW0Tu6U,310 +langchain_classic/output_parsers/loading.py,sha256=QUc3OdkACHbAOy-26-jkk-LiEL2jmuLikCh30CaYwKc,696 +langchain_classic/output_parsers/openai_functions.py,sha256=ZG9F2DrQ_PoYO_P_UmM7KXzAl9eQFEGg3q-SThOqKeE,364 +langchain_classic/output_parsers/openai_tools.py,sha256=6g8ENTHRBQLtaFc39a-mkHezyqEymnOJFq06-WOVrmA,229 +langchain_classic/output_parsers/pandas_dataframe.py,sha256=YqGYPAGJW07pS0dSRXSwniHKoEWv395cSF4n9nUGX4I,7031 +langchain_classic/output_parsers/prompts.py,sha256=EBUWM_dFox_67qd6NlnRL0KYWvMWtFhlczkmj_BvHgY,507 +langchain_classic/output_parsers/pydantic.py,sha256=uxbrfdyPnZxfdDvmuDr3QOmBFMwML3SfMDEmAKqmyvA,99 +langchain_classic/output_parsers/rail_parser.py,sha256=5PYtAaChBZEgY2hsPef3fQVTUuKDB-irZBH_vaBJ5cg,700 +langchain_classic/output_parsers/regex.py,sha256=-cnqUU4U-WClpz7pTO5L_NpHr9xznlvUeDjN-poDYWI,1190 +langchain_classic/output_parsers/regex_dict.py,sha256=ag9AqOgFZ1EsCqHEfaD8N94QLO5zLyqcGq85TaOaQJg,1626 +langchain_classic/output_parsers/retry.py,sha256=nwRHnMdTg1ksSZCf-HrLSVgAYBPI0oLlaOnk29aCIFk,10802 +langchain_classic/output_parsers/structured.py,sha256=0woF95ZtHg4qC27NMrhth4UdPxsh-BUL7oK7zDKH_Fg,3465 +langchain_classic/output_parsers/xml.py,sha256=WDHazWjxO-nDAzxkBJrd1tGINVrzo4mH2-Qgqtz9Y2w,93 +langchain_classic/output_parsers/yaml.py,sha256=HEAEcaX5qD_dfg9QYL1hqz03sB9uduPdHI5nCa7huUU,2267 +langchain_classic/prompts/__init__.py,sha256=bIevd5FNIe3W5ZQKwwHmspn_NVfEOUB3f8ixdq7AKvM,2106 +langchain_classic/prompts/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/prompts/__pycache__/base.cpython-311.pyc,, +langchain_classic/prompts/__pycache__/chat.cpython-311.pyc,, +langchain_classic/prompts/__pycache__/few_shot.cpython-311.pyc,, +langchain_classic/prompts/__pycache__/few_shot_with_templates.cpython-311.pyc,, +langchain_classic/prompts/__pycache__/loading.cpython-311.pyc,, +langchain_classic/prompts/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/prompts/base.py,sha256=K5N1Qe3meLJX1Wb_oGMMZqt2g7vhKYYbHcw5oM1E8bg,565 +langchain_classic/prompts/chat.py,sha256=yeCu72VGZxtSB5ywM9SrAWATExSoQ6mrzKjRJlasQA4,1084 +langchain_classic/prompts/example_selector/__init__.py,sha256=zereCfyISnjegzslfpCVHsNfPlQCcrwQFzJaIDNm84g,1178 +langchain_classic/prompts/example_selector/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/prompts/example_selector/__pycache__/base.cpython-311.pyc,, +langchain_classic/prompts/example_selector/__pycache__/length_based.cpython-311.pyc,, +langchain_classic/prompts/example_selector/__pycache__/ngram_overlap.cpython-311.pyc,, +langchain_classic/prompts/example_selector/__pycache__/semantic_similarity.cpython-311.pyc,, +langchain_classic/prompts/example_selector/base.py,sha256=3n6781kzGl-MphxZkad_GvFBgU5r8VuxD2q6FOcZ5fk,105 +langchain_classic/prompts/example_selector/length_based.py,sha256=ZA-o8JtrvRldXlow83arXEPZJL69c2q6-cCclgi85yg,136 +langchain_classic/prompts/example_selector/ngram_overlap.py,sha256=nGTu1vYHWBcAHtUOoMaA6ZwHDoUa7KmXd3Av4i8dwnE,885 +langchain_classic/prompts/example_selector/semantic_similarity.py,sha256=HCfXgJbirtNOnIyAuS5-LWgYtzQM-4IqhMOA7NvpNIk,288 +langchain_classic/prompts/few_shot.py,sha256=4g32Dem_XtKEDykoPMSJJRpL7Z0SlL1HLqCjtJUyZxo,265 +langchain_classic/prompts/few_shot_with_templates.py,sha256=Dr2NQbv46aY44wMLz21Ai1jmvzbIhPYW4yYv6GLlVbI,128 +langchain_classic/prompts/loading.py,sha256=qR4ZeMy6qEpBUg0f33rDMKX9X9FkP0TE-8ihNfF80zA,446 +langchain_classic/prompts/prompt.py,sha256=tbVeJK9PFHQge3YvAyRVu99swhzyWvsyt8TD34l30aI,153 +langchain_classic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/python.py,sha256=h6B2g1Jx1w4UYaD8X5V1x8kvNfu5UbHmQYVQohvhQ8Y,563 +langchain_classic/requests.py,sha256=fDco0mrVGCpFsM0XMi8rV81eJo6GTvcYDtwoWE8T5DM,914 +langchain_classic/retrievers/__init__.py,sha256=beEIBd3QIxRuzqFuzeO3IF3qLT1Q8vnwqPkdvtyI0P4,6488 +langchain_classic/retrievers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/arcee.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/arxiv.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/azure_ai_search.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/bedrock.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/bm25.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/chaindesk.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/chatgpt_plugin_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/cohere_rag_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/contextual_compression.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/databerry.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/docarray.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/elastic_search_bm25.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/embedchain.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/ensemble.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/google_cloud_documentai_warehouse.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/google_vertex_ai_search.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/kay.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/kendra.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/knn.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/llama_index.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/merger_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/metal.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/milvus.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/multi_query.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/multi_vector.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/outline.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/parent_document_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/pinecone_hybrid_search.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/pubmed.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/pupmed.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/re_phraser.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/remote_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/svm.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/tavily_search_api.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/tfidf.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/time_weighted_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/vespa_retriever.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/weaviate_hybrid_search.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/web_research.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/wikipedia.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/you.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/zep.cpython-311.pyc,, +langchain_classic/retrievers/__pycache__/zilliz.cpython-311.pyc,, +langchain_classic/retrievers/arcee.py,sha256=8dDq5TpnKPnGrVVOf5KTFzQwFksCU4D4sUmLDfr9EWs,637 +langchain_classic/retrievers/arxiv.py,sha256=h83GxxCeMF70ATPXKndO52Gy4TW8UwztMlFdyp6CFSQ,637 +langchain_classic/retrievers/azure_ai_search.py,sha256=HwUsykRrf6MA-X3IWGnufHbN-mFoNgdFcLAgMXckCEY,832 +langchain_classic/retrievers/bedrock.py,sha256=YEFwNRuOpbP7UplMDv3evyaByqkeZKawzpaKYpzIgN8,987 +langchain_classic/retrievers/bm25.py,sha256=LILatRV082oiCDJiRz3PkJGhA6DpvIR0VCFtGD8-gak,827 +langchain_classic/retrievers/chaindesk.py,sha256=ALvJdzy4spOLbNFtFF-z63IvPgG1obqrrVMI6wElRG8,649 +langchain_classic/retrievers/chatgpt_plugin_retriever.py,sha256=PeGkY46pNUaZ4OGdmAEoVD3zP7wnP4fm_dQKIefDSis,661 +langchain_classic/retrievers/cohere_rag_retriever.py,sha256=GYRV4m1SAs0ZdghDpyS-iLFb6IyVZESquWhcn2mwOrM,649 +langchain_classic/retrievers/contextual_compression.py,sha256=TYmwkjwOUEVzUUnJEzf9692fwHdmGsoGPPCD5rF1ufo,1993 +langchain_classic/retrievers/databerry.py,sha256=shEGPdbotrKZswQySOiCXB43fCH__5F82phyDdW11rU,669 +langchain_classic/retrievers/docarray.py,sha256=cTcqMkU5MSVwUy605JVG7iWgUHHBl5lqEq2dXSYC-4I,799 +langchain_classic/retrievers/document_compressors/__init__.py,sha256=TYS1KiB3KDK6X2EnVFfFAfimNbzRImOgmNbcM93fEsc,1335 +langchain_classic/retrievers/document_compressors/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/base.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/chain_extract.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/chain_extract_prompt.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/chain_filter.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/chain_filter_prompt.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/cohere_rerank.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/cross_encoder.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/cross_encoder_rerank.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/embeddings_filter.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/flashrank_rerank.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/__pycache__/listwise_rerank.cpython-311.pyc,, +langchain_classic/retrievers/document_compressors/base.py,sha256=7VnQnzY7gSYdnYAcyhfUvQCg7Jtno-Xb7l61tGXAG8M,3145 +langchain_classic/retrievers/document_compressors/chain_extract.py,sha256=vqpVHXGnWWlzo5Zti2rkPnF4tHNOnzfNK3Yjhivrknc,4473 +langchain_classic/retrievers/document_compressors/chain_extract_prompt.py,sha256=jOYxX6xvMUDrJqGsswSP8IP3VYwXQKZcPDpfJs-ULPA,364 +langchain_classic/retrievers/document_compressors/chain_filter.py,sha256=7POuM0Sm_fIaveorfHUNrp1ec5D3oYn01wVq0BB6Y_Y,4716 +langchain_classic/retrievers/document_compressors/chain_filter_prompt.py,sha256=35Mljh3NrWT8GYzcpfDjallsO4DDBQVhvR4Ae52c018,230 +langchain_classic/retrievers/document_compressors/cohere_rerank.py,sha256=i92Xl0pAaEfe1PziuNk8FfZNCFt5lf-UhMxj2a7c4W4,4418 +langchain_classic/retrievers/document_compressors/cross_encoder.py,sha256=dvgdlmt3y6QjckPA60Yztf5k02Wo1XqNsfFvCXN2hkY,91 +langchain_classic/retrievers/document_compressors/cross_encoder_rerank.py,sha256=hy1G-HdXvsYH1h7PDEYyMi0wG3HS6nbQo62_-uQOFns,1613 +langchain_classic/retrievers/document_compressors/embeddings_filter.py,sha256=VDen_GmWHamwKxZZW1WrAmILUF7jVG1c0bs8Wy9HdrQ,5747 +langchain_classic/retrievers/document_compressors/flashrank_rerank.py,sha256=JOIzSpsDIFbBGzq1jwjbenrAgUmKMLOkQ71BFlREfDM,718 +langchain_classic/retrievers/document_compressors/listwise_rerank.py,sha256=ByHGFZjC4OkeUkTj0F1KSIgSPdo0jqm14P_3ruXf4Ns,5224 +langchain_classic/retrievers/elastic_search_bm25.py,sha256=ti8tTgcNiYmKf6w3Fsbc3fcQvr-CWATsZo5LEymMfLw,673 +langchain_classic/retrievers/embedchain.py,sha256=MjMLDYXEVLvbYC33CROz3WAqlc8F5E3Fszc4JO1fqbs,652 +langchain_classic/retrievers/ensemble.py,sha256=IX1h6jUJSX8kFAXgLa_SRjR2pSpH5BXcFJ7fjDh2GiQ,11378 +langchain_classic/retrievers/google_cloud_documentai_warehouse.py,sha256=eIPWXFy0NDPxIJYHZIRD2P8InGFknO__TYbhC-f5jaY,704 +langchain_classic/retrievers/google_vertex_ai_search.py,sha256=JDDjXPr9ZjeCzGDvq9DZkdc9pcTvTaeNF33NOfQ7tGY,1048 +langchain_classic/retrievers/kay.py,sha256=HCmu7Tq0AJkIsXBpSmdMMd-2u6imowAY23HuwEAL3Nk,637 +langchain_classic/retrievers/kendra.py,sha256=7_huRlRL7KyT2Q6h4i3CL1Kc8IDECScIL4zt4M6W8gI,2243 +langchain_classic/retrievers/knn.py,sha256=8DOatRHf_N8uV8pnoT2LZob-lAnNKgwi-Kvo5qKDHc4,631 +langchain_classic/retrievers/llama_index.py,sha256=lq98qndxVUNdbT7gDJ9b7TT31PmI1hsOJVEIh4dZYiM,808 +langchain_classic/retrievers/merger_retriever.py,sha256=0eKbZlVyL79Vh_fcPiNoCDLcdMAQ9uXN2OTNBqAQ4PY,3628 +langchain_classic/retrievers/metal.py,sha256=pwuDO0Z3T42pm7CypD4hNgxQ4pcdmjhazrkh5Vw3Y6I,637 +langchain_classic/retrievers/milvus.py,sha256=4D5RZoY_TopBsqkFPdtw0QwDW3dydJJ6M-MwJAMHzgc,804 +langchain_classic/retrievers/multi_query.py,sha256=cU5XZAYn21hUdKfZB4LwULmzJdrUie74ZpTx--Vg6co,7770 +langchain_classic/retrievers/multi_vector.py,sha256=pe2dwXKw4PmT-wKfmyRpBK5AIPHD9ZR2hWYcDzbNRb4,5548 +langchain_classic/retrievers/outline.py,sha256=k8t80Hhax2KzQ2NaZZuTesZ0Y9BsJo5XmOMc9vavbKQ,643 +langchain_classic/retrievers/parent_document_retriever.py,sha256=lr1RAdAId6qQdK42D0TruVB3zcciivPKtPqvfzKb7nc,7081 +langchain_classic/retrievers/pinecone_hybrid_search.py,sha256=uikbZZhnEPTJM0H6VwCZAgB6NneuN8SDpz3VP5f3ls4,682 +langchain_classic/retrievers/pubmed.py,sha256=lNy7uAxUfVGoKbiZ8RHRjypIZ6Gu7jyISxOxqtRvE6k,640 +langchain_classic/retrievers/pupmed.py,sha256=lNy7uAxUfVGoKbiZ8RHRjypIZ6Gu7jyISxOxqtRvE6k,640 +langchain_classic/retrievers/re_phraser.py,sha256=z0tIr99gyAeSMfg6x8pQVRUqjPI-_1uaonlFWSI6dKE,2807 +langchain_classic/retrievers/remote_retriever.py,sha256=WMUMKOIyKTszQzxtZaTN9wE-CKn7NefebW1nw-CGvJk,667 +langchain_classic/retrievers/self_query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/retrievers/self_query/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/astradb.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/base.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/chroma.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/dashvector.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/databricks_vector_search.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/deeplake.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/dingo.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/milvus.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/mongodb_atlas.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/myscale.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/opensearch.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/pgvector.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/pinecone.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/qdrant.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/redis.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/supabase.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/tencentvectordb.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/timescalevector.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/vectara.cpython-311.pyc,, +langchain_classic/retrievers/self_query/__pycache__/weaviate.cpython-311.pyc,, +langchain_classic/retrievers/self_query/astradb.py,sha256=LZHXkKUSPV_zvIIDvTLZHCn7f1_QtixRl4Uvi3UWXwg,678 +langchain_classic/retrievers/self_query/base.py,sha256=_hPfj_sve0DsOqKRBxg3WJWYSpRgBt-GpgrBH1PxPNo,15019 +langchain_classic/retrievers/self_query/chroma.py,sha256=BBkrnxywxewtUW1CD71XyCZkEi8NaNIreI4jyGb7rA4,673 +langchain_classic/retrievers/self_query/dashvector.py,sha256=4aNgJnGMAPYLdpnpsPw8MZWR9bVBvBl_00Y-l088YcY,693 +langchain_classic/retrievers/self_query/databricks_vector_search.py,sha256=pS8D7zOVap4yMdvOrdAqOi2OlTvc-qhv0vYQNAAhgiQ,790 +langchain_classic/retrievers/self_query/deeplake.py,sha256=5M006fckb9cohUV50huZjrV5kl7RZOUy3lgkVSZIdgs,824 +langchain_classic/retrievers/self_query/dingo.py,sha256=uBruNMF5w1Rp69W4z0arSN4iecaNuZzDIWed143eA3o,674 +langchain_classic/retrievers/self_query/elasticsearch.py,sha256=eMTQDui8CydnV9DHx2wAqZIKj61JohH0yQXIkThijjc,725 +langchain_classic/retrievers/self_query/milvus.py,sha256=EM3B92EDfMC7GlwpBLxIg6HF7WQPrFDX4HvRZroxZ6A,800 +langchain_classic/retrievers/self_query/mongodb_atlas.py,sha256=M4qWkjMbHaQWUGOtHOunm06Is4-XCGFDKNEw25j9XTk,722 +langchain_classic/retrievers/self_query/myscale.py,sha256=-mSpRVI8MRi-3DXEuJ5w_UEKwKqzkI1mcsxGxIzYkS8,678 +langchain_classic/retrievers/self_query/opensearch.py,sha256=7WGrTGLHeRInvVUHI4YWkmPdfM7fNpTkIgrDFbhqJNE,693 +langchain_classic/retrievers/self_query/pgvector.py,sha256=C0zGokuxIBzpWumN-ScL5z-xFS7SDihhZrXbbSHN5RM,683 +langchain_classic/retrievers/self_query/pinecone.py,sha256=hoMmEf2cetQkx6n5MQ14TwVRilG1It81grEP-t32hYA,683 +langchain_classic/retrievers/self_query/qdrant.py,sha256=a2anLDyn9GalYuhxVnGh5JF9PHzdZOBv5cp4Mp3PC0Q,673 +langchain_classic/retrievers/self_query/redis.py,sha256=RFvLZTvuFABvefDPbGqx_oDVcCBCAPMdAEq1tBaEXQg,668 +langchain_classic/retrievers/self_query/supabase.py,sha256=LTznN8kER6JVzJcRHBMYdrXCW3fh-hMR6oi7MgbeBPY,701 +langchain_classic/retrievers/self_query/tencentvectordb.py,sha256=8IQCTWVav0tRfLX-2hICsVhwkYAIc7k8jZ_MV7VqiVg,751 +langchain_classic/retrievers/self_query/timescalevector.py,sha256=sojGyHEme-PaPNs4qWQF0UoxQGtERk-Mhv0ZtWZeU9s,751 +langchain_classic/retrievers/self_query/vectara.py,sha256=KfxZ3SeKx3Gv7tvWgMngMLKPatVKFZoDVskWZX2c3qI,806 +langchain_classic/retrievers/self_query/weaviate.py,sha256=MkJFp_CuGdYnhp9ts8x0GMOZ_F6AaemPSdYIR3sYZJs,683 +langchain_classic/retrievers/svm.py,sha256=tj3fsks1VKyCkTU0aJGdNjR0D1KN2CdpMQ_Tz1i9FPU,631 +langchain_classic/retrievers/tavily_search_api.py,sha256=5b2THCK10LDPOHV_NjsLsy7kZrsUic_GAKhZQty3yC4,841 +langchain_classic/retrievers/tfidf.py,sha256=cnngm7AOptg2pNB_6VWmjL_w-18QBNfsQcjSH72gVEM,637 +langchain_classic/retrievers/time_weighted_retriever.py,sha256=oqTwlgQj94hCQhLfTBtikpRStp9VtMn20SrJaq3n1vY,7806 +langchain_classic/retrievers/vespa_retriever.py,sha256=oYy43j6UZXOiJSlFV9S4kAvYQ-JDwC7BasiJyNvj-Ls,637 +langchain_classic/retrievers/weaviate_hybrid_search.py,sha256=qSdrl7axbLuY1k7KUrFIlChdx3vWztZwKJyFuSyEzyY,682 +langchain_classic/retrievers/web_research.py,sha256=H4uxvDp0u46t82kkiM4X39ySwlrS8AkA1Rh9BWuDVNM,947 +langchain_classic/retrievers/wikipedia.py,sha256=4lSm6cu2uVEYScIF0dNbs9sA5RhSOaM0_bw3-I2zUoc,649 +langchain_classic/retrievers/you.py,sha256=9d1-3-sdoq0_v6KA9CGBSgRtwET0WQltrsbj5nktQg8,631 +langchain_classic/retrievers/zep.py,sha256=_szINwb_m35d0lvDkAsDfWGcISj-vWi376UjNh_L14Q,863 +langchain_classic/retrievers/zilliz.py,sha256=GP2_0ziLfsPiZq9UtgJSHcAwUOaDPiIUwDGj6x8nGPk,804 +langchain_classic/runnables/__init__.py,sha256=_5XwnxKdD038iAev__Q7G36pVxXmIEFTY8y2MvjEDqk,693 +langchain_classic/runnables/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/runnables/__pycache__/hub.cpython-311.pyc,, +langchain_classic/runnables/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/runnables/hub.py,sha256=zaqqE8xM0WeowP-MVudpncxUuWL2JTrM0AkXsNv0gdg,1710 +langchain_classic/runnables/openai_functions.py,sha256=zTj2LrSUkue3Z0jNfhqjtsJZTZAGYWV5A7fi9b57tW8,1965 +langchain_classic/schema/__init__.py,sha256=6qg0QBBemgz5jLe5Ary3ov1Ug3vd9QvhlSXogaT2FrA,2075 +langchain_classic/schema/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/schema/__pycache__/agent.cpython-311.pyc,, +langchain_classic/schema/__pycache__/cache.cpython-311.pyc,, +langchain_classic/schema/__pycache__/chat.cpython-311.pyc,, +langchain_classic/schema/__pycache__/chat_history.cpython-311.pyc,, +langchain_classic/schema/__pycache__/document.cpython-311.pyc,, +langchain_classic/schema/__pycache__/embeddings.cpython-311.pyc,, +langchain_classic/schema/__pycache__/exceptions.cpython-311.pyc,, +langchain_classic/schema/__pycache__/language_model.cpython-311.pyc,, +langchain_classic/schema/__pycache__/memory.cpython-311.pyc,, +langchain_classic/schema/__pycache__/messages.cpython-311.pyc,, +langchain_classic/schema/__pycache__/output.cpython-311.pyc,, +langchain_classic/schema/__pycache__/output_parser.cpython-311.pyc,, +langchain_classic/schema/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/schema/__pycache__/prompt_template.cpython-311.pyc,, +langchain_classic/schema/__pycache__/retriever.cpython-311.pyc,, +langchain_classic/schema/__pycache__/storage.cpython-311.pyc,, +langchain_classic/schema/__pycache__/vectorstore.cpython-311.pyc,, +langchain_classic/schema/agent.py,sha256=ziu7m5uOBKguXx1QwbElIqUEBdMnLQaFTYGw54N5g5U,149 +langchain_classic/schema/cache.py,sha256=87HyixMzSMivOHKJcz9jVkTlcp5SV3JNFq1grCIgENw,105 +langchain_classic/schema/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/schema/callbacks/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/schema/callbacks/__pycache__/base.cpython-311.pyc,, +langchain_classic/schema/callbacks/__pycache__/manager.cpython-311.pyc,, +langchain_classic/schema/callbacks/__pycache__/stdout.cpython-311.pyc,, +langchain_classic/schema/callbacks/__pycache__/streaming_stdout.cpython-311.pyc,, +langchain_classic/schema/callbacks/base.py,sha256=X5Mxf0c74lyjEWMv1V7aeYt8LWAiuwotBSwlsjnCMHU,511 +langchain_classic/schema/callbacks/manager.py,sha256=Xr5qXKrO1Cd0RLbobM9ptlARHVVSoXVx4Feizk7fkIY,1467 +langchain_classic/schema/callbacks/stdout.py,sha256=9weMjKUjKSTcWmeb3Sb2KKblj7C0-QTa1SzUzRMbjw0,103 +langchain_classic/schema/callbacks/streaming_stdout.py,sha256=URkFIyAS4V9HAiPQuiLgi5mGzBdVF5RfaRYQKhyChI0,131 +langchain_classic/schema/callbacks/tracers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/schema/callbacks/tracers/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/base.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/evaluation.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/langchain.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/log_stream.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/root_listeners.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/run_collector.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/schemas.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/__pycache__/stdout.cpython-311.pyc,, +langchain_classic/schema/callbacks/tracers/base.py,sha256=XYXdjXT7JtOeXYkSCC5Egm5-iCG55d7IvVvJ23yApGE,150 +langchain_classic/schema/callbacks/tracers/evaluation.py,sha256=Ta0GyoUUMkOBDFw-WbK4auUomjnQehDxeycJs0L9L10,176 +langchain_classic/schema/callbacks/tracers/langchain.py,sha256=RIOZwaq3WGc7JLJAr9NWxwA1V1R9iztEB3i1jGg3GgQ,219 +langchain_classic/schema/callbacks/tracers/log_stream.py,sha256=TOMibZ6NzWqv-hz8FeLoGlU36ElaxrVKvIA7jn-rlIs,226 +langchain_classic/schema/callbacks/tracers/root_listeners.py,sha256=z4sMzTA35qnAd5S5K19Fu-8rySYOIDnEgYf0SjoQhk0,105 +langchain_classic/schema/callbacks/tracers/run_collector.py,sha256=xDu5e45bJW8PyGaFul9tenkbjZ__MtfR1FoqpqM-BsA,120 +langchain_classic/schema/callbacks/tracers/schemas.py,sha256=zB2CQ1soOShy_HBKBGaDAs2naOyFqBkyG0ho_zH2GUo,73 +langchain_classic/schema/callbacks/tracers/stdout.py,sha256=iS4dl2aBx0-rWS91CQkMTR2pzLLApTt47wjeITE6UFo,257 +langchain_classic/schema/chat.py,sha256=oTl-ap5KvXKSRrYXhZnqzcnR-tA2omq0tbnJXBcnO9k,80 +langchain_classic/schema/chat_history.py,sha256=PApD2cIU2t6UZ5ohOic4fBZwY6HBwDQQbq9fageqkqA,101 +langchain_classic/schema/document.py,sha256=_lrtb51noSZNEKmzbmgv8cRWV53dqiqVIS-jXQcY8Vc,122 +langchain_classic/schema/embeddings.py,sha256=WKl4o-zRuYGbD0AorklFp6ddCwtqRwp9xjpjaoouBRk,75 +langchain_classic/schema/exceptions.py,sha256=ivVZKFnKg4U6LehuoCmZbbbLwDtRNIcrpmg0a0BZoOI,91 +langchain_classic/schema/language_model.py,sha256=q4bXaRz-KG5Zftlyzns1Dp2eNWnt1tWOd4u8-5j035w,367 +langchain_classic/schema/memory.py,sha256=sWG_83wrlS17EOcXMHBDv3m5PBxiBTh7Z_LQ_m4xgCA,79 +langchain_classic/schema/messages.py,sha256=jAirGUVQPqSk2shOARUi9JwSASXjjEUvJ6O5RzyHeIc,1048 +langchain_classic/schema/output.py,sha256=9ewi9kkjJPJ9sHd1D_gZn91j02pqxFJDg4nmWamo_tU,320 +langchain_classic/schema/output_parser.py,sha256=AtqKpYdDvciAq6msAC-M6vjo_q3eQPOlhauiqoQ6oxo,651 +langchain_classic/schema/prompt.py,sha256=L1eCkCkvv4IYcHKyTjU_BCDh1WKcKrNLhsisRG4OWQU,80 +langchain_classic/schema/prompt_template.py,sha256=7xuYKspZuoR4VAIKUUHc10llvjmGoAhYjsusQbUNeJM,124 +langchain_classic/schema/retriever.py,sha256=H5ejH7tVlF8Fq96LOY_dD0XUgXe_KlfcThFvFTL8H1o,81 +langchain_classic/schema/runnable/__init__.py,sha256=a1hPclBlV2urt11K0HmP9SBmAPAUmGcRLPX5RamijcM,1797 +langchain_classic/schema/runnable/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/base.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/branch.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/config.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/configurable.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/fallbacks.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/history.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/passthrough.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/retry.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/router.cpython-311.pyc,, +langchain_classic/schema/runnable/__pycache__/utils.cpython-311.pyc,, +langchain_classic/schema/runnable/base.py,sha256=hlTrHggK9LCHDnAgTcbPTPrusvPyQ_NsEb5kg9LghIE,781 +langchain_classic/schema/runnable/branch.py,sha256=YvrdYOVJgi2bMXiNqiV2BBiuE-ySFVhQN02k9BdHAaM,89 +langchain_classic/schema/runnable/config.py,sha256=9F1ldgAnLWXC8Xy6Ck68OPy-kEns3-fdT40MFLmWYr4,665 +langchain_classic/schema/runnable/configurable.py,sha256=8O7MfMjNvFoaEDTsay0oF3ZV-jkEDJFGC0etMmUI7k0,333 +langchain_classic/schema/runnable/fallbacks.py,sha256=UK0bKO5yqc10zSZ2Cy4MJ8bs3TjHHY6-w7b5C9hPfQk,106 +langchain_classic/schema/runnable/history.py,sha256=z8Jl097YxsfDj5iHi0nZQmC-7cJd-eDwMEONcQPiSqY,260 +langchain_classic/schema/runnable/passthrough.py,sha256=l8h_9y_pUFq2kT8ngpJPv93G0ctHUvuoaKQxlN3a0h0,205 +langchain_classic/schema/runnable/retry.py,sha256=nA5xkzD55UjsoooBmXsbQyq5XwS7Q-HRrZ6CD7SYSk8,94 +langchain_classic/schema/runnable/router.py,sha256=hNTC-suV3N_iqZq1y6Wvo9j0PbDRRoTqfPnUUV0-9_0,117 +langchain_classic/schema/runnable/utils.py,sha256=M36Z8HsgANCTmymsXxzJn9FeFjCId_AirYEc3UFBYik,1118 +langchain_classic/schema/storage.py,sha256=qHjS9oAC68daYtTS-bSzGrJUCin8BO46E92o8aN6c7U,85 +langchain_classic/schema/vectorstore.py,sha256=MnwUxChur0W-QP-jOVMZ462gUNlD4HhlZBdMvgmHROk,137 +langchain_classic/serpapi.py,sha256=NDCym5HkkWsXHAoaE-69Xl3kmHvvXcMFBXetfZ5A2II,671 +langchain_classic/smith/__init__.py,sha256=I5knENsFA6OoYsrUIFezNVAMYHZAe1hgNUqkrl8bX9I,3219 +langchain_classic/smith/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/smith/evaluation/__init__.py,sha256=RBponF7wi5r_ygy6JNqvtcDIkbCPmZjiOMLmLJCeOs4,2116 +langchain_classic/smith/evaluation/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/smith/evaluation/__pycache__/config.cpython-311.pyc,, +langchain_classic/smith/evaluation/__pycache__/name_generation.cpython-311.pyc,, +langchain_classic/smith/evaluation/__pycache__/progress.cpython-311.pyc,, +langchain_classic/smith/evaluation/__pycache__/runner_utils.cpython-311.pyc,, +langchain_classic/smith/evaluation/__pycache__/string_run_evaluator.cpython-311.pyc,, +langchain_classic/smith/evaluation/config.py,sha256=-sFkfn4_JUMwwPiOkvXbHfnDR34248T8snfNDJP7xnY,10158 +langchain_classic/smith/evaluation/name_generation.py,sha256=ll15fGMXJ6noGbijftOqueWFH3eZRSvKITscHDL1W-c,9978 +langchain_classic/smith/evaluation/progress.py,sha256=TcXTmhYNA2OlJKcKMmJ2to5CQvm_1bE3PkziVPaKcPU,3658 +langchain_classic/smith/evaluation/runner_utils.py,sha256=l1TPPoFwL5m7Wb8Z_Tsj5NpmDoNnswi7_9s6ozjUV3U,59722 +langchain_classic/smith/evaluation/string_run_evaluator.py,sha256=rRhYNS9KQ49rjvyApQxzHoMwazx960G_568JIyPSXqc,18479 +langchain_classic/sql_database.py,sha256=x4ym64Qz3aNIni8cEpaBkpACgo6PUYYRpujbnX0pGUA,672 +langchain_classic/storage/__init__.py,sha256=-NmpJm06mAHQQrWBlG1TcM5b8pwxQDLXsh0C7yeN5Tw,1617 +langchain_classic/storage/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/storage/__pycache__/_lc_store.cpython-311.pyc,, +langchain_classic/storage/__pycache__/encoder_backed.cpython-311.pyc,, +langchain_classic/storage/__pycache__/exceptions.cpython-311.pyc,, +langchain_classic/storage/__pycache__/file_system.cpython-311.pyc,, +langchain_classic/storage/__pycache__/in_memory.cpython-311.pyc,, +langchain_classic/storage/__pycache__/redis.cpython-311.pyc,, +langchain_classic/storage/__pycache__/upstash_redis.cpython-311.pyc,, +langchain_classic/storage/_lc_store.py,sha256=jN35K8aeraZjomQkT050ysSyMm2JME0RD68_rft2l6E,4246 +langchain_classic/storage/encoder_backed.py,sha256=mh6lm6r6trEIoTyBdnFp7ZWNoJZu_5nRpl7dr238NoQ,5581 +langchain_classic/storage/exceptions.py,sha256=P5FiMbxsTA0bLbc96i_DgWmQGOUEc1snGBtxn7sOjZk,89 +langchain_classic/storage/file_system.py,sha256=-fy71dZNed7MN5uRmqSEcyZlKlCpX2nQBvYMEJywkXo,5767 +langchain_classic/storage/in_memory.py,sha256=ozrmu0EtaJJVSAzK_u7nzxWpr9OOscWkANHSg-qIVYQ,369 +langchain_classic/storage/redis.py,sha256=XIREcpD3Wmhfz9rvuTh8T-yk76pWTaufqZozdR60Y8c,619 +langchain_classic/storage/upstash_redis.py,sha256=mqnGvWLeGFuv5ACYUbp37ZtPftRH17OjtnaPzU80DVA,759 +langchain_classic/text_splitter.py,sha256=yxWs4secpnkfK6VZDiNJNdlYOrRZ18RQZj1S3xNQ73A,1554 +langchain_classic/tools/__init__.py,sha256=07B0og4LjTgzPWts99ZaN8A0HVh5VRFhB1uQP6vCFM0,5542 +langchain_classic/tools/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/__pycache__/convert_to_openai.cpython-311.pyc,, +langchain_classic/tools/__pycache__/ifttt.cpython-311.pyc,, +langchain_classic/tools/__pycache__/plugin.cpython-311.pyc,, +langchain_classic/tools/__pycache__/render.cpython-311.pyc,, +langchain_classic/tools/__pycache__/retriever.cpython-311.pyc,, +langchain_classic/tools/__pycache__/yahoo_finance_news.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/ainetwork/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__pycache__/app.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__pycache__/owner.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__pycache__/rule.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__pycache__/transfer.cpython-311.pyc,, +langchain_classic/tools/ainetwork/__pycache__/value.cpython-311.pyc,, +langchain_classic/tools/ainetwork/app.py,sha256=0B2p0YF7IC3Nm3pJdBw6L6ifFeeQcPfr77-55F_Dduc,871 +langchain_classic/tools/ainetwork/base.py,sha256=_FQLcpbt1yj7rCjCoja2-FqcWzso3PeQEO8ifAnqmNI,756 +langchain_classic/tools/ainetwork/owner.py,sha256=A3spLXeZNPaeaTgSAv5W57aBIWkJcKZKQL0Oe7z7xoU,775 +langchain_classic/tools/ainetwork/rule.py,sha256=BZoub4CjqlWwv6OJvCOkjDSpoc_MAga_0SWpUdYwl5s,770 +langchain_classic/tools/ainetwork/transfer.py,sha256=PieQLIPcIGJzmmf0Agz9bVIS4LyJWN9Z9uGqPMV3Wfo,793 +langchain_classic/tools/ainetwork/value.py,sha256=NM2_U45eFGhzDMat97IIa0JLGc-QUvNb8HwTa5h32rk,778 +langchain_classic/tools/amadeus/__init__.py,sha256=osvuFsOLZbVDWlZNCfKuAvqMKpjrDUJPzOiH9gS0XNE,914 +langchain_classic/tools/amadeus/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/amadeus/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/amadeus/__pycache__/closest_airport.cpython-311.pyc,, +langchain_classic/tools/amadeus/__pycache__/flight_search.cpython-311.pyc,, +langchain_classic/tools/amadeus/base.py,sha256=8wmHea70Tf-l5qiJS9COwEeNCsOQun2gc7-vsMGFqJM,656 +langchain_classic/tools/amadeus/closest_airport.py,sha256=nzuNYoL_Wb3H1CpfdCszRL60PRDwpGWKBfXx7yCTXjU,859 +langchain_classic/tools/amadeus/flight_search.py,sha256=kItn44lWS_2i5ov5lKCuQkl8VtFzD51gZKY8IBsGpF8,841 +langchain_classic/tools/arxiv/__init__.py,sha256=8i_5wwMXHX1BHQN7cDLCtqjYvN4_AxkAdwhNGgRmHtE,25 +langchain_classic/tools/arxiv/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/arxiv/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/arxiv/tool.py,sha256=pdc2qHfBIPooWSWVAC6jW36_4LOozVdg-5LdmyvV-Pg,771 +langchain_classic/tools/azure_cognitive_services/__init__.py,sha256=Ovq9QCn98Eaj_HTtitYLGtLf9925kEoyARs9OtpMCfQ,1267 +langchain_classic/tools/azure_cognitive_services/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/azure_cognitive_services/__pycache__/form_recognizer.cpython-311.pyc,, +langchain_classic/tools/azure_cognitive_services/__pycache__/image_analysis.cpython-311.pyc,, +langchain_classic/tools/azure_cognitive_services/__pycache__/speech2text.cpython-311.pyc,, +langchain_classic/tools/azure_cognitive_services/__pycache__/text2speech.cpython-311.pyc,, +langchain_classic/tools/azure_cognitive_services/__pycache__/text_analytics_health.cpython-311.pyc,, +langchain_classic/tools/azure_cognitive_services/form_recognizer.py,sha256=wCnjoNDkZvRVkHfdAE_uuiMhMmoo8bcu7G1NHGL-deI,666 +langchain_classic/tools/azure_cognitive_services/image_analysis.py,sha256=z8Ya8hIwUVZtPuh7CImGNotLBSHq2Kt8n6oBf5up4so,663 +langchain_classic/tools/azure_cognitive_services/speech2text.py,sha256=2kMczTmLuk4RXT-HBWBmNrQuXbRL9VJrcFxpIDtBpjo,657 +langchain_classic/tools/azure_cognitive_services/text2speech.py,sha256=LzQsK9HbXEJywicp0XhGPw-wBA2SFP6pwIk-kkrG5jo,657 +langchain_classic/tools/azure_cognitive_services/text_analytics_health.py,sha256=gDp8KSIKR58mRrp4q2EYdZVvzmKz-Zz-mq2OeR9PeQ4,681 +langchain_classic/tools/base.py,sha256=nm3oSeJQTQBkUolJKBMiA2Oj5FUw5paKfAEH8IoAtJE,332 +langchain_classic/tools/bearly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/bearly/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/bearly/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/bearly/tool.py,sha256=NAunUQTGK6Mpo-CsXokaJkCTwXqI5x5hxNC9DYpBB1c,965 +langchain_classic/tools/bing_search/__init__.py,sha256=6R1TJL9kqWax8jxoFqhyfSRbhyyngdh7YGMDkTpR4K0,761 +langchain_classic/tools/bing_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/bing_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/bing_search/tool.py,sha256=VcEQolB-OINQ73VzbdLXO90uEKbSn7-EjKswFd4TEcg,729 +langchain_classic/tools/brave_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/brave_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/brave_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/brave_search/tool.py,sha256=YFroAncGVE5TqXnvsV-sY5W4SWV4hds5AWaxHikWmPo,618 +langchain_classic/tools/clickup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/clickup/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/clickup/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/clickup/tool.py,sha256=67HLYphWKNQvDpdWYUOarojOxhLnZFEGbVLgDHuhksY,650 +langchain_classic/tools/convert_to_openai.py,sha256=dCuQSk9aiSjVMEki20HZeNur2fTOzLXNmPabeRsfuDg,196 +langchain_classic/tools/dataforseo_api_search/__init__.py,sha256=KgjZ5aq3LQBWb40MU6Lw_ayLgB9Map_b-t8TrFBjOOY,936 +langchain_classic/tools/dataforseo_api_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/dataforseo_api_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/dataforseo_api_search/tool.py,sha256=djrTHiDpj3vd3x5fAPBC0l--x7P2Z_8ZPntnYt8L2DM,905 +langchain_classic/tools/ddg_search/__init__.py,sha256=NvS02v-O5AyUDdkma8lEiNm5Z2XToWYMYG3CMnovOk8,680 +langchain_classic/tools/ddg_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/ddg_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/ddg_search/tool.py,sha256=YL_VL1fVfxmLJjtp8_Ghf3MVsRk9QD9nPumVlPwgjwY,1032 +langchain_classic/tools/e2b_data_analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/e2b_data_analysis/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/e2b_data_analysis/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/e2b_data_analysis/tool.py,sha256=5bNMiWytbjqjCpLI8r9Y-5y8BoKiqWC6mwBYQUT2tOU,998 +langchain_classic/tools/edenai/__init__.py,sha256=Y5btBUq-NUvQ6Y76ARRG6RcP5SnyU881FdyZLJ06coY,1522 +langchain_classic/tools/edenai/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/audio_speech_to_text.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/audio_text_to_speech.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/edenai_base_tool.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/image_explicitcontent.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/image_objectdetection.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/ocr_identityparser.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/ocr_invoiceparser.cpython-311.pyc,, +langchain_classic/tools/edenai/__pycache__/text_moderation.cpython-311.pyc,, +langchain_classic/tools/edenai/audio_speech_to_text.py,sha256=wh2sYstRVApvf1_8HV6f-7W1tk6L8_6i5eJyX9T3Su0,651 +langchain_classic/tools/edenai/audio_text_to_speech.py,sha256=ZMhZkrVB54VTnVB2xua_7m1FnMX-rCLgg43YjWaEAc4,651 +langchain_classic/tools/edenai/edenai_base_tool.py,sha256=5WQDfTm1d2GWrkhkIPnYv0zACTVHbeURRvbBXo7w29A,615 +langchain_classic/tools/edenai/image_explicitcontent.py,sha256=5tCN5HSrc2hdrjaWuAKZpl7t-gXixTuqW6way7pfAoU,654 +langchain_classic/tools/edenai/image_objectdetection.py,sha256=_cZPNPyHfyqAilCJEV0prJ97lmubowP3RTq4M6hMCOg,660 +langchain_classic/tools/edenai/ocr_identityparser.py,sha256=riT1M2Sw-tzWJh00ASKug1u37RSOYL25ARpyRzKEONs,642 +langchain_classic/tools/edenai/ocr_invoiceparser.py,sha256=Yow1ps_tQOHH2UEHOLLESSHbi7GgLCSEQ8Z7ZEYqk4g,657 +langchain_classic/tools/edenai/text_moderation.py,sha256=igcqtepr_-IBSfkCSV8c9WkldtUY58uDEKPazJTA_4E,657 +langchain_classic/tools/eleven_labs/__init__.py,sha256=nHiqO9TGpAv0xQD8i7BtKUDHpjsGyfGIA7Q9tFWx90Q,695 +langchain_classic/tools/eleven_labs/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/eleven_labs/__pycache__/models.cpython-311.pyc,, +langchain_classic/tools/eleven_labs/__pycache__/text2speech.cpython-311.pyc,, +langchain_classic/tools/eleven_labs/models.py,sha256=ynaVqyxoh7aJxDOSzVBMwynHeZjhjkd0PdWVh_oW-L4,668 +langchain_classic/tools/eleven_labs/text2speech.py,sha256=Dj1zTL18OCy3IHokqFnIliYaz4jvWlC5EqLsoYOUuMs,660 +langchain_classic/tools/file_management/__init__.py,sha256=zwYajQ3c6BwqRrZf01GdeOxjwvhlp6QlovFWJuWzJJA,1251 +langchain_classic/tools/file_management/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/copy.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/delete.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/file_search.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/list_dir.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/move.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/read.cpython-311.pyc,, +langchain_classic/tools/file_management/__pycache__/write.cpython-311.pyc,, +langchain_classic/tools/file_management/copy.py,sha256=5d2-OAOSxSWIacmyuwGfOnrI6V0dSpFn4--aU48ioDc,797 +langchain_classic/tools/file_management/delete.py,sha256=UTQtrQvsd3D9S2U5vp3XkVoivIMXOgSw5lDKj22CFhg,813 +langchain_classic/tools/file_management/file_search.py,sha256=kAw0pnYOSIEmraisatfFdVv1l-UZN6_ByP9bhZF-URc,823 +langchain_classic/tools/file_management/list_dir.py,sha256=X8HhbqedIlJ64sJEkSNLTxCU1bjqnPvJk_0dfil91TI,844 +langchain_classic/tools/file_management/move.py,sha256=1BkRp4e1W7xDKE_jvGWm3nt9OngqcsOd8EnhnsB2r-Y,797 +langchain_classic/tools/file_management/read.py,sha256=Rjryi3pdo7Kbps1KYRGhv2d7wQY3h8wjO1bWAzpl6b8,797 +langchain_classic/tools/file_management/write.py,sha256=sjqmS4OZeCObmHeqhtHn6qBgun03CtCqdzo_S-pIZpU,805 +langchain_classic/tools/github/__init__.py,sha256=iwkOyXKj_H-PUqgeeJR7Iu3tmOCuy5Dvcbe39BVgOW8,19 +langchain_classic/tools/github/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/github/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/github/tool.py,sha256=-rIitddW38mWrosjTte0nDMxkZ044RNce-XohxgIb54,645 +langchain_classic/tools/gitlab/__init__.py,sha256=6mTWJrnnv0AOI3xp6BwadD1Mkl7f3EO56W5BlT6rAb4,19 +langchain_classic/tools/gitlab/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/gitlab/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/gitlab/tool.py,sha256=0u6FrMovX5cWcch3G-mJrk-CBOafO1RH1etHmv2wp2k,645 +langchain_classic/tools/gmail/__init__.py,sha256=DYp61149sFmxfs2m_DNTVfe965HNSpoN-gjzRpss9CQ,1065 +langchain_classic/tools/gmail/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/gmail/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/gmail/__pycache__/create_draft.cpython-311.pyc,, +langchain_classic/tools/gmail/__pycache__/get_message.cpython-311.pyc,, +langchain_classic/tools/gmail/__pycache__/get_thread.cpython-311.pyc,, +langchain_classic/tools/gmail/__pycache__/search.cpython-311.pyc,, +langchain_classic/tools/gmail/__pycache__/send_message.cpython-311.pyc,, +langchain_classic/tools/gmail/base.py,sha256=h0msbyqMLfB0y4lr2thS-33negFee8L2F1pAoEIPPMw,646 +langchain_classic/tools/gmail/create_draft.py,sha256=9sW7T2SxHEUxiXE0TckxZDsAYwN0ZTVbyzXxqRxycnA,817 +langchain_classic/tools/gmail/get_message.py,sha256=nRma0XhuXlkzr-WOsj-G88Isal1kf1nkvuf5_4cDghI,809 +langchain_classic/tools/gmail/get_thread.py,sha256=LuY3V1Y8zDVC5T8lP3L7n0BoJPl7O58QemBYUDMLu38,801 +langchain_classic/tools/gmail/search.py,sha256=vzPAOaMKqo2WGRulb3XwrOUgbGngZZQd7bkE_30Hl8I,871 +langchain_classic/tools/gmail/send_message.py,sha256=Vlrjl_zSdcAgdG1VsmD2b0mPIshH2R5c0JK_YITGgFk,817 +langchain_classic/tools/golden_query/__init__.py,sha256=CJHLRkgR3kmy8jMkBRbo7MixF_963o9dWA-5WHEvTTY,690 +langchain_classic/tools/golden_query/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/golden_query/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/golden_query/tool.py,sha256=X6GN5GnwB93oQXGRgOlg9BjPlc6P9fE5va64Ifeubok,663 +langchain_classic/tools/google_cloud/__init__.py,sha256=94ar8t9ljz0yMDOxahi3Fr3-vS3lV2RIJU2ocRnyAms,693 +langchain_classic/tools/google_cloud/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_cloud/__pycache__/texttospeech.cpython-311.pyc,, +langchain_classic/tools/google_cloud/texttospeech.py,sha256=sJv3F1dyMJzZyam0VxiUNE0M4IgpFzE9QC5MwVF6OLA,666 +langchain_classic/tools/google_finance/__init__.py,sha256=wupS1xDMHhY7Tx3qoGr_Hz9vhK_LKMcJZ2uBcpAF-UY,730 +langchain_classic/tools/google_finance/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_finance/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_finance/tool.py,sha256=a80IQosOObXIu1FC6yQRyxEAxdEl3OdSJCfooSM0yN4,695 +langchain_classic/tools/google_jobs/__init__.py,sha256=X0LpoTEwct2IQu76l3glxz6qIkV6f-aH0GL-ao3jQQw,705 +langchain_classic/tools/google_jobs/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_jobs/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_jobs/tool.py,sha256=FqXy9NQhTlEvI4lj7z55qmQuQL5cytwMYbUVk5ftGmI,673 +langchain_classic/tools/google_lens/__init__.py,sha256=CnL6IDz8ThoduOsDgSEHAo9Y33wMey-NpdvCm6Fpqtw,705 +langchain_classic/tools/google_lens/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_lens/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_lens/tool.py,sha256=m6w-S2b5lSHUpk-Jtw_Zo4Eka8Wd_Dm55Mj6OA07-UI,673 +langchain_classic/tools/google_places/__init__.py,sha256=z--SAWv6XhP0OuvBVxrFwx4DI71D0uBzI6OpeoLPiC0,667 +langchain_classic/tools/google_places/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_places/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_places/tool.py,sha256=qoa90ef5BsiGZm4CnKVQE_qK17WWq3yV5coh-z8WaDo,820 +langchain_classic/tools/google_scholar/__init__.py,sha256=NOj7qZtfNSzhcZ8u7ZB-6Xb9zEAIUX_ZlYadEiwq3bg,730 +langchain_classic/tools/google_scholar/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_scholar/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_scholar/tool.py,sha256=4s69TX1KclMZPlkDvLOcW5LfMldC_L995uWi0IcRESY,695 +langchain_classic/tools/google_search/__init__.py,sha256=S2yQIsxu6wLWOZj5wNEajMpZLu-9fIOp_F51jrDqZ48,775 +langchain_classic/tools/google_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_search/tool.py,sha256=hEBQEqIjQGa_B2tvu5enDJi4o9QjzWwsJGOcxbPyrP4,741 +langchain_classic/tools/google_serper/__init__.py,sha256=l-6eNDH1u4ZTExudYoH5iz0itk9oHWAyJGfD_U-PyaQ,823 +langchain_classic/tools/google_serper/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_serper/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_serper/tool.py,sha256=gJD1vHFMX5t-OMx_RBQXDl5S9LpBlMj1eq37JPN8T9Y,741 +langchain_classic/tools/google_trends/__init__.py,sha256=L_6oQ2OEfnYNk58Cg-__3gOOlZvWRunDP-gr8CZSexI,724 +langchain_classic/tools/google_trends/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/google_trends/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/google_trends/tool.py,sha256=bbq-V_RQ6fusbf6VU0tQ7vrvvv60iW-etFWIvFPxmj0,690 +langchain_classic/tools/graphql/__init__.py,sha256=KmvGEZm9p7T2u1k7DgjbjpYAyQ0AIHHiAt_5NAb3rmE,48 +langchain_classic/tools/graphql/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/graphql/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/graphql/tool.py,sha256=HDI5IAm9AyWAtEliB5REKjuehZrf097Pl7f6lhbzKiE,630 +langchain_classic/tools/human/__init__.py,sha256=uRYMibSZn4qqVsXPRY6PhNXCxguMXmq_97KFvMHlpog,664 +langchain_classic/tools/human/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/human/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/human/tool.py,sha256=oMRX3WlXoPM_1DqfP6OF7mQhJ53Zu3XoX0wSEEswdIA,624 +langchain_classic/tools/ifttt.py,sha256=F14i2drqokHapMlpGZoicUaodiDfcMBXdEiYSW5L328,621 +langchain_classic/tools/interaction/__init__.py,sha256=RYCJKa2M7CrzMbz59xYFJ_c3hwGJKOPyyP4G_sAt48w,43 +langchain_classic/tools/interaction/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/interaction/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/interaction/tool.py,sha256=vca3hGetmb4unMAK1zSl-lUQGACsnTJQg8Lsd6xw3Dw,633 +langchain_classic/tools/jira/__init__.py,sha256=Zz6Gy5kGFFIfVAnG0a6c4ovi5XM9KZheGKaZ_fFbmGY,17 +langchain_classic/tools/jira/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/jira/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/jira/tool.py,sha256=gv5JP8fsN9uN6f187_27d1X-LaSIOiDlkQCN1hwtC7o,1147 +langchain_classic/tools/json/__init__.py,sha256=ieEWuRmzcehYXhGc-KcC6z1Lhbbn_nBEyMtnE04vyFU,46 +langchain_classic/tools/json/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/json/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/json/tool.py,sha256=XahUXEHxQ24rxvRMwbsfDv0rAGaCZJebwyBu8yhxMw4,1565 +langchain_classic/tools/memorize/__init__.py,sha256=xiSuJB3mHGvqOMizNmWlGCPjdgxEWzg3U4T5tXtoqak,686 +langchain_classic/tools/memorize/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/memorize/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/memorize/tool.py,sha256=Yew3CP6SUrb9b-HsQ4H6ktCOlIGMumDLeoHVSC5Gv2Q,741 +langchain_classic/tools/merriam_webster/__init__.py,sha256=6n0Uz-TRpAh6M7LMI_p6_qa1c-4vT2kEvU3nDgxzr1Q,35 +langchain_classic/tools/merriam_webster/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/merriam_webster/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/merriam_webster/tool.py,sha256=J5J_5V43DtWdRghMGutAntlaM0bXgbC6hNeTCu9LobU,651 +langchain_classic/tools/metaphor_search/__init__.py,sha256=X6DcbuAgX2xnEq3eZR71fymRvOkbZR9AFtLZYKhrwro,684 +langchain_classic/tools/metaphor_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/metaphor_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/metaphor_search/tool.py,sha256=G6ignGIZGfzt42EAfYjj5sFx5pF3vcL8acIUnmfZ_Sc,648 +langchain_classic/tools/multion/__init__.py,sha256=Omal_Fnyjq5d1eNKCPMpG3cMkkR9MzsiF56SEwrSoJQ,1114 +langchain_classic/tools/multion/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/multion/__pycache__/close_session.cpython-311.pyc,, +langchain_classic/tools/multion/__pycache__/create_session.cpython-311.pyc,, +langchain_classic/tools/multion/__pycache__/update_session.cpython-311.pyc,, +langchain_classic/tools/multion/close_session.py,sha256=4TZb69jKxklBh6mdoaNlAXzqa2-PF2zhRrhZcg_dFJA,841 +langchain_classic/tools/multion/create_session.py,sha256=skFESEE0ZWZK--XowVBM9S5mvQ8dDGTWgKUirvwVYj4,850 +langchain_classic/tools/multion/update_session.py,sha256=jRhB7qwL8qRIClGFddJVI5dgHkXUO99zsPEPxeFxmtk,850 +langchain_classic/tools/nasa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/nasa/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/nasa/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/nasa/tool.py,sha256=Er3xnx1xW5i6DnmaVUB2UFXTyZDaVGxSTV3xksatXuQ,615 +langchain_classic/tools/nuclia/__init__.py,sha256=N8_nmAnBMUcNPeo1CD4ap_w1dXm-MaUrGGdQvTws-RY,675 +langchain_classic/tools/nuclia/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/nuclia/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/nuclia/tool.py,sha256=QmYLefF4BYvPFWwFhC6DCrVT0FaQrvnn9oGt59xwnrs,768 +langchain_classic/tools/office365/__init__.py,sha256=eIsscgapUM9gvnEtwt0OGzsN7bsrr78X8vWAg80teY0,1094 +langchain_classic/tools/office365/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/office365/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/office365/__pycache__/create_draft_message.cpython-311.pyc,, +langchain_classic/tools/office365/__pycache__/events_search.cpython-311.pyc,, +langchain_classic/tools/office365/__pycache__/messages_search.cpython-311.pyc,, +langchain_classic/tools/office365/__pycache__/send_event.cpython-311.pyc,, +langchain_classic/tools/office365/__pycache__/send_message.cpython-311.pyc,, +langchain_classic/tools/office365/base.py,sha256=6FXVbpc6EQLLfkikjbqnuqaML6voFpRD5nvsFygRQRo,651 +langchain_classic/tools/office365/create_draft_message.py,sha256=75uo5hGBMwJvmnFF10zgHlN9SVxNW6gu4Y3xi3jBx4c,913 +langchain_classic/tools/office365/events_search.py,sha256=pew1ndJvG_DRytg0duumgPF704O-tCckirda_L-TkNo,827 +langchain_classic/tools/office365/messages_search.py,sha256=arbZ36mTv5Q8AloTbiVHl3oH9HeJMg0PlFm5XqKu3Dw,831 +langchain_classic/tools/office365/send_event.py,sha256=__PgT0YIRrjbmS-YyjookcLedS6jEXnYA0EUZlC5Htk,806 +langchain_classic/tools/office365/send_message.py,sha256=7CVfRZi6puetvHrWrKej6d8lUX9NN1_BYg0xREIaz4g,822 +langchain_classic/tools/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/openapi/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/openapi/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/openapi/utils/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/openapi/utils/__pycache__/api_models.cpython-311.pyc,, +langchain_classic/tools/openapi/utils/__pycache__/openapi_utils.cpython-311.pyc,, +langchain_classic/tools/openapi/utils/api_models.py,sha256=02m04Hg4gKHqBrwOPVj7Q7K0AMEQsBxRQVVdxTslRe8,1867 +langchain_classic/tools/openapi/utils/openapi_utils.py,sha256=8-ZOH2MIWpfMiHOCFmX2cZCoT3-_RNrMB53TOcRtm40,842 +langchain_classic/tools/openweathermap/__init__.py,sha256=L3gaZp2WiUHHrutmGJ8slHqJ6nIRJOVokW2kwHfAsUk,686 +langchain_classic/tools/openweathermap/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/openweathermap/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/openweathermap/tool.py,sha256=3qO7ls15fWqD6JamigmxqVvOD5FdEzAHRXU5gPMZUGo,651 +langchain_classic/tools/playwright/__init__.py,sha256=4JOXGzA8hJNNVZUxKd9b5pj-EgHRMAOp0xcPS3CQNNA,1291 +langchain_classic/tools/playwright/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/click.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/current_page.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/extract_hyperlinks.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/extract_text.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/get_elements.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/navigate.cpython-311.pyc,, +langchain_classic/tools/playwright/__pycache__/navigate_back.cpython-311.pyc,, +langchain_classic/tools/playwright/base.py,sha256=lxYlSMCsMdTRMOanVKHD5iVbhxQOyqDNr9PZjV3V7_M,662 +langchain_classic/tools/playwright/click.py,sha256=gnRLOnkrp7k9sSnHAYjJY0Gq0Gb1GGH3o3VtLuCMOA8,783 +langchain_classic/tools/playwright/current_page.py,sha256=keTvJ3g2WQPCmM6rJdfM9Ds5chE6OgG9-hoa3nFgb5M,639 +langchain_classic/tools/playwright/extract_hyperlinks.py,sha256=2IgS9hPPP22n5My2KVNsy96qxHI-yMeCbsFHveQ9_cc,914 +langchain_classic/tools/playwright/extract_text.py,sha256=Zw-4q9gXME8AIM3p38LrNUi6LvxujNN2r4dTNyChuOc,630 +langchain_classic/tools/playwright/get_elements.py,sha256=1Q4iGLKFIC43ITQlWM0x6qt7hJU0q9RMvMuXwmMNK58,833 +langchain_classic/tools/playwright/navigate.py,sha256=HyhZel952P_NfGEd8zjNVtc_cxx__LUrpySUIaqPy0E,807 +langchain_classic/tools/playwright/navigate_back.py,sha256=nAuxKUrpBemFlxINuRX_KNOnK74GYTYiLg7Nf0oO2vo,633 +langchain_classic/tools/plugin.py,sha256=b9jhO3W9yLOCYSsfOdD-i3Xd8t2e3Uyy8OSi3O1Kqcw,943 +langchain_classic/tools/powerbi/__init__.py,sha256=lFy__65sASd5e8Eac1E1RHN58uTVSOMprb88zClyEZU,52 +langchain_classic/tools/powerbi/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/powerbi/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/powerbi/tool.py,sha256=mMmX-iKeddIg0fmxHpK-38-pk1KjdCU9v8j304wrmFE,857 +langchain_classic/tools/pubmed/__init__.py,sha256=KdYkXaHkUWLyuY35F0HRoZlX6PtTuTCPCYqlkgmBUgY,26 +langchain_classic/tools/pubmed/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/pubmed/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/pubmed/tool.py,sha256=C1JOOGcugCRtyQnWV68aN1rgsp4yhJGc8ceRWadOgVE,627 +langchain_classic/tools/python/__init__.py,sha256=i1g53UyWSLN0QTc3r6NDOgLGZIlIpa47O1OW6TK326s,530 +langchain_classic/tools/python/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/reddit_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/reddit_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/reddit_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/reddit_search/tool.py,sha256=tNmDHqdUltT1DY0dK1x2gxY1924u2TOD3mJer88tyMk,738 +langchain_classic/tools/render.py,sha256=0xRUpDIlXT3F9Xs2Mn_kb2p0VMdJXIuFVW-HnumUSYE,775 +langchain_classic/tools/requests/__init__.py,sha256=oeutQGdlOp3p6PbcAAfjdYpftaXFmJYJgSWw5SGb6IM,52 +langchain_classic/tools/requests/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/requests/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/requests/tool.py,sha256=t53GDFhjqjTSBWm9FelVWyb2Pmex7NG7-0XlXxE2tX8,1175 +langchain_classic/tools/retriever.py,sha256=0VrBXvUq_7XA1CZrsn8uB82-DPJWyTYvRfoP11LOlwE,246 +langchain_classic/tools/scenexplain/__init__.py,sha256=rRP3hoEnMUUHwABFgXFLGCJkoQi4lyg585ONrgWis3k,31 +langchain_classic/tools/scenexplain/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/scenexplain/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/scenexplain/tool.py,sha256=2ggn6SqY7dWf9ki06GPUf2EvSA8WRIPEZNEXSncYq00,807 +langchain_classic/tools/searchapi/__init__.py,sha256=IKGQdTLeTmTK4M3MlalgzLRWqFx5xoOn1n4yi8C0w6A,805 +langchain_classic/tools/searchapi/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/searchapi/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/searchapi/tool.py,sha256=8lrfYQbg-Sj9zdUVv6FGc-LtUjklMyRaY74KoCXKWOI,723 +langchain_classic/tools/searx_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/searx_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/searx_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/searx_search/tool.py,sha256=To8wZAmErR_wVMwzJJJuZQNuDl1k5J8e6qhnrr2okDs,735 +langchain_classic/tools/shell/__init__.py,sha256=UaUImkdLbb5YK_QUTppQUhNfGthySrO0l9WLvT9gO98,631 +langchain_classic/tools/shell/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/shell/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/shell/tool.py,sha256=__voe1VV1VBQQfunfINJZ1I9hczkWwGRIZSpyXZ8LZo,759 +langchain_classic/tools/slack/__init__.py,sha256=BKFbixFwgQgnfitZ0xPniSGo3eRZDIVf3LvoHAQ1JOM,992 +langchain_classic/tools/slack/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/slack/__pycache__/base.cpython-311.pyc,, +langchain_classic/tools/slack/__pycache__/get_channel.cpython-311.pyc,, +langchain_classic/tools/slack/__pycache__/get_message.cpython-311.pyc,, +langchain_classic/tools/slack/__pycache__/schedule_message.cpython-311.pyc,, +langchain_classic/tools/slack/__pycache__/send_message.cpython-311.pyc,, +langchain_classic/tools/slack/base.py,sha256=ovV5KmTXYWFwWMengdOznCS0ZpdDJr0pOwZe-crS_lw,646 +langchain_classic/tools/slack/get_channel.py,sha256=lT2T5cRGfaGWp9lk3o1rdQMLCj0LJLQRkede39WvV1o,630 +langchain_classic/tools/slack/get_message.py,sha256=bxixBcLSqrX4Ok5r3hIZUCT94OHvgXFwYhKkG4-pqT4,824 +langchain_classic/tools/slack/schedule_message.py,sha256=ClYr5A-Fl7unLLWh2VKvR1ay9qjkr6Gla1_Qybxt4do,849 +langchain_classic/tools/slack/send_message.py,sha256=a8B0gaTgYUw_VT76JcUb7KAWFUc0utJwKKSu4wZZUuw,817 +langchain_classic/tools/sleep/__init__.py,sha256=O3fn_ASDE-eDcU3FsBaPTmLHV75hhMS4c6v2qzrak5E,18 +langchain_classic/tools/sleep/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/sleep/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/sleep/tool.py,sha256=00SIPbZ8-Ni2hvWd62X8slesHHp_D9AOgnyL03fFss8,759 +langchain_classic/tools/spark_sql/__init__.py,sha256=HDxRN6dODaOCPByAO48uZz3GbVZd49fE905zLArXCMA,44 +langchain_classic/tools/spark_sql/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/spark_sql/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/spark_sql/tool.py,sha256=dlNtc_5ZveEgIrwot4lv7LAYASTq4ZX-XDp8Q-3JIcw,1072 +langchain_classic/tools/sql_database/__init__.py,sha256=Z7WNXu1y5-DhuoeA_Ync-Zcg3uK1lhdfQOlKBWAifmo,49 +langchain_classic/tools/sql_database/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/sql_database/__pycache__/prompt.cpython-311.pyc,, +langchain_classic/tools/sql_database/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/sql_database/prompt.py,sha256=cYK3XTOMfyHWuvbuy-bKR5626xtVfkxi8JG3fxhu-OY,513 +langchain_classic/tools/sql_database/tool.py,sha256=COtw27f3q_WwKYzW7r4pwYTOdnkJgVWsrA3C75Co430,1117 +langchain_classic/tools/stackexchange/__init__.py,sha256=dLGMnzEmyYZGoPsv215mPeqAU03McJJ_2WGkIioj3yY,33 +langchain_classic/tools/stackexchange/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/stackexchange/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/stackexchange/tool.py,sha256=1cdiWAMAc8eZXD9ie-qsaALtk6kSpcI_GUmaeevGS24,636 +langchain_classic/tools/steam/__init__.py,sha256=I_R7_aZKH9mSXxWuX9RWEyEU3OQq_1VbtvqlPZ8uPtI,25 +langchain_classic/tools/steam/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/steam/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/steam/tool.py,sha256=qTJNc3BQLk1V9F86RXJkTj7ssA4IAdbku2Om2bPk7Ms,642 +langchain_classic/tools/steamship_image_generation/__init__.py,sha256=FvH-PK8p-x9eg7wf9fLxkNhBqiHCkd3HKuane16jNIA,703 +langchain_classic/tools/steamship_image_generation/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/steamship_image_generation/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/steamship_image_generation/tool.py,sha256=f5BgJ2iFkJKz-MxSeMejQ768jLAoym0RFLYNd0B6e7A,855 +langchain_classic/tools/tavily_search/__init__.py,sha256=SZ-j6tOxDwr7y0_IRdd8It0vaOleV2QE1hzJwMQla-0,848 +langchain_classic/tools/tavily_search/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/tavily_search/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/tavily_search/tool.py,sha256=a40uzKj0Y5pcZCFqoLqF-It8uM97mNYRvT4llIn29oI,921 +langchain_classic/tools/vectorstore/__init__.py,sha256=kheVdgDafCJHOhU5D5SBZZg9x_j5_gveZHqVhZ0pSZ8,51 +langchain_classic/tools/vectorstore/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/vectorstore/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/vectorstore/tool.py,sha256=xV_H9J2fq6ZwswLgX8RekNnTRxdNDc2mNAu-FUmAbE0,799 +langchain_classic/tools/wikipedia/__init__.py,sha256=h-dMgHpibxNGwmU14vNzpEMhy7TuFPUP_d4GYXzMZZ4,29 +langchain_classic/tools/wikipedia/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/wikipedia/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/wikipedia/tool.py,sha256=YaJ0NM_lKaK-yS_LXygFb8GZ0cA6MsyfOaJR3boG_GU,636 +langchain_classic/tools/wolfram_alpha/__init__.py,sha256=48WpM8A-IKN3nZbJLGB32DrwhLB51X2P0HoXS-k6GAk,679 +langchain_classic/tools/wolfram_alpha/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/wolfram_alpha/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/wolfram_alpha/tool.py,sha256=2gWrjsmX_dIWZHexEsG3zTE9v9ZhZqMON0SZ-4pV0tk,645 +langchain_classic/tools/yahoo_finance_news.py,sha256=BNKfm3u-Jqk52YF3mtF1r69ATAOup6aS1fgHM2h_EcM,645 +langchain_classic/tools/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_classic/tools/youtube/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/youtube/__pycache__/search.cpython-311.pyc,, +langchain_classic/tools/youtube/search.py,sha256=cqI7qF5VHvHdAUf1Eu5oIZxLwzsrYZnUsUZc9NaJAxo,636 +langchain_classic/tools/zapier/__init__.py,sha256=IM53SyK2ECPauI8ldN5hA3ir5eF9mAejpk6an8YP7Aw,773 +langchain_classic/tools/zapier/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/tools/zapier/__pycache__/tool.cpython-311.pyc,, +langchain_classic/tools/zapier/tool.py,sha256=7rj3J5h0xdrOe0MrFd7EDEVhb5pt_Teu0uhrNj4AupA,1476 +langchain_classic/utilities/__init__.py,sha256=YOrBfnP7cssFx6FquwMJ6Lqti2iutYYnkeT8X3PsnCE,6031 +langchain_classic/utilities/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/alpha_vantage.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/anthropic.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/apify.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/arcee.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/arxiv.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/asyncio.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/awslambda.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/bibtex.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/bing_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/brave_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/clickup.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/dalle_image_generator.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/dataforseo_api_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/duckduckgo_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/github.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/gitlab.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/golden_query.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_finance.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_jobs.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_lens.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_places_api.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_scholar.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_serper.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/google_trends.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/graphql.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/jira.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/max_compute.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/merriam_webster.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/metaphor_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/nasa.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/opaqueprompts.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/openapi.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/openweathermap.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/outline.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/portkey.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/powerbi.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/pubmed.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/python.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/reddit_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/redis.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/requests.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/scenexplain.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/searchapi.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/searx_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/serpapi.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/spark_sql.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/sql_database.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/stackexchange.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/steam.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/tavily_search.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/tensorflow_datasets.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/twilio.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/vertexai.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/wikipedia.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/wolfram_alpha.cpython-311.pyc,, +langchain_classic/utilities/__pycache__/zapier.cpython-311.pyc,, +langchain_classic/utilities/alpha_vantage.py,sha256=zGnXQDKUZKMVTua-yfc4UEq18T2TGSybM8N_zwStdp0,659 +langchain_classic/utilities/anthropic.py,sha256=CsrVIpXoI-dQPOUepo5x_s3E22VT4ewg7mAhxEpj83w,847 +langchain_classic/utilities/apify.py,sha256=QssOsc4eu0mrGAxijFSqguN8B2EVtTfW1gDJOtIsyHI,629 +langchain_classic/utilities/arcee.py,sha256=qL5Z_cPRE4f7xM93Dx-YgfjOPjQkRCD_P35bAJtwEXw,1344 +langchain_classic/utilities/arxiv.py,sha256=pArKpbfIz3hbiqqplVTMZTe7nf1fEBmwNVYoXqd4LYs,638 +langchain_classic/utilities/asyncio.py,sha256=wyav12vd3jPLtzY9HcAI2NE3kg9Sj_ieRBeKyUoxsf0,275 +langchain_classic/utilities/awslambda.py,sha256=h5af4rpB7DM5U-yAepnTNMQhf2sLlJILZJW_HLcR6aA,632 +langchain_classic/utilities/bibtex.py,sha256=N7yv1M89T4iQkdxgp_c0bDaniKPNRnASCQrYBkLQocM,650 +langchain_classic/utilities/bing_search.py,sha256=cBKulEiM_nffUk-E2zOcYnNne-roU7r_j5qN1hqrUuI,653 +langchain_classic/utilities/brave_search.py,sha256=kNyXni56VUTA3PDA-b9DTXIC0OWz7416UYtGCcbSPF4,647 +langchain_classic/utilities/clickup.py,sha256=KMGZ04NSHLAaoyOkQDgI_Szn67lpjzbAMug-EVFZW4Y,1188 +langchain_classic/utilities/dalle_image_generator.py,sha256=eitdP2rwSrEEfK-P_r3lQbnFZybJPFS5LOLtqU92PJQ,689 +langchain_classic/utilities/dataforseo_api_search.py,sha256=LjtsfqNhMofq22HcOAqsUXggaVMZiaG6o2wuR-viZro,704 +langchain_classic/utilities/duckduckgo_search.py,sha256=lErEJC98Ckp3Ya4kteTM95urJVXJinQCM-MD3wNw7Ag,671 +langchain_classic/utilities/github.py,sha256=RcQj2dBaCZkZCfQekw4Hk33OXa8yxlw6TR_BbBi-8fU,655 +langchain_classic/utilities/gitlab.py,sha256=UHy0h79KFPSFr66Tgnb9mTT_FT6WpJYiHiblQ1qXU8g,655 +langchain_classic/utilities/golden_query.py,sha256=0I-JozL22OAQKrM5VLHCTD9AR2DT9g0V1Zj5i1Q9vGM,656 +langchain_classic/utilities/google_finance.py,sha256=K9_L0BeKZrpqB4d-LaeYmBoYyypek2ow36Wk-AIfpE0,662 +langchain_classic/utilities/google_jobs.py,sha256=J3-dVAN-8UjWGzk1V2fMwkug6GfVmEjBQJBseVhDHAU,653 +langchain_classic/utilities/google_lens.py,sha256=KOeg0OCShxp3ATFSbPwkG1xl0TDP44h5aPseBnH4mjo,653 +langchain_classic/utilities/google_places_api.py,sha256=VIRO36-ql8fHchUOgIMjcchSdCTVuUozXj8t0MNL5Cs,659 +langchain_classic/utilities/google_scholar.py,sha256=LTiJ2V9YLhPhgwTuD2ADgX1ZAVvKpqfr02JEaN4MuDo,662 +langchain_classic/utilities/google_search.py,sha256=5N-eiHpqNcF7uvHPj38KoIwyEZeTsFNCrYNSQD64Hxk,659 +langchain_classic/utilities/google_serper.py,sha256=CRBTtNmBXVM7Kzp5ydyc9L8lKfXZm7GfzrhyzGeBzK0,659 +langchain_classic/utilities/google_trends.py,sha256=Wu11-1AuSO_4PlLkojB3eFcUqe3KXZ-RbO7XaOVRktQ,659 +langchain_classic/utilities/graphql.py,sha256=rFXnru9pPgBDdkRapbPvoFquJs7Elw5iAFY6fzVGF4E,644 +langchain_classic/utilities/jira.py,sha256=6oIOwAyd0L5vjBFyMsqF_66Po6mGuKr-fPrMZ_wmvAA,635 +langchain_classic/utilities/max_compute.py,sha256=gIGueHYZWtVMabhkffahJGv8CiWxYLdY4vjH8cU7TrM,653 +langchain_classic/utilities/merriam_webster.py,sha256=YqR2_aRn7W-NXVxSkGJqKlJNhNNO8Gy3boqpfADS-7g,665 +langchain_classic/utilities/metaphor_search.py,sha256=Pfm47NUOAkyX_a4ub5REpq4aCEgZsWf6ViEdsqFVLTo,665 +langchain_classic/utilities/nasa.py,sha256=0IMu8arXbimVUbjArWrKRKe0w6hFBgs5y5_kBXlTPMM,635 +langchain_classic/utilities/opaqueprompts.py,sha256=ut1O4_ELidt23eFkV1tSfAmeNUyewAJKOb7gYREs38U,747 +langchain_classic/utilities/openapi.py,sha256=tKi5W-C90LTunooDxfvUuSRvYNkb0FtZ9L9eHBwdkYc,761 +langchain_classic/utilities/openweathermap.py,sha256=BOZ9yLR--SRWkN1vzFkkIVCRgHKPddP4FUP_AGEwHp0,665 +langchain_classic/utilities/outline.py,sha256=VJkqFVol449m8nLmr5JuXIviDsFectjta9YndMMRK8Q,644 +langchain_classic/utilities/portkey.py,sha256=-1_qpaayb5_HaFusxD__TJs5F__MHVvk4sA3rk_B2Sw,614 +langchain_classic/utilities/powerbi.py,sha256=RphQ1EtU6NgBbp-m3IqiuVwIFjoxjQqD3dJQJ4XdCLo,635 +langchain_classic/utilities/pubmed.py,sha256=LLZbUgPc8S_8k6L46dP4V9KLraW0jVzYjBvZeCY_s6k,641 +langchain_classic/utilities/python.py,sha256=h6B2g1Jx1w4UYaD8X5V1x8kvNfu5UbHmQYVQohvhQ8Y,563 +langchain_classic/utilities/reddit_search.py,sha256=WfWhMOKZLx3yqtoMeDJtOxtY1UHDzSVSzlltwilUcYc,694 +langchain_classic/utilities/redis.py,sha256=gJuE6Vc5iqVH653zaYrDpehS9weK0wnLuRLRmxS4gY0,897 +langchain_classic/utilities/requests.py,sha256=_24afsr6J45Yjy_HIopUqd2ukn_NYzIIIxYAEcf9dbY,720 +langchain_classic/utilities/scenexplain.py,sha256=AFfX_ZLxUEUyRkcPNXK2GdzyE9ui9rfOWrIYu61jdTU,656 +langchain_classic/utilities/searchapi.py,sha256=UrzLKQGk4cCMMQsKOIqH5RMjridBsxyTsWO9BCJW9HA,650 +langchain_classic/utilities/searx_search.py,sha256=jtZjIhm4UKQklgR2cmHjSOrQmC5GiZ-zMxbMh_O3idQ,812 +langchain_classic/utilities/serpapi.py,sha256=LNFlcLlAApaUPHrwfwmIkgGt_VFhV7MHEVcNsaQ_AaU,790 +langchain_classic/utilities/spark_sql.py,sha256=_YQD0MhVD3tNJJVe0n8tvPoPkNfSd8PHxRlP6T-7EsE,617 +langchain_classic/utilities/sql_database.py,sha256=TdAm5Gd3tC8eBBCRu2fi09p5YkCd-jO8I8BQKBsRUKw,794 +langchain_classic/utilities/stackexchange.py,sha256=3Fb4uHBt_821KLTo2EHAJp0S1L_3XrQ7iT4g1dFFBTc,662 +langchain_classic/utilities/steam.py,sha256=RgG3wvmtisY2v0wxn0XGbRgvFC1wzIFFqUjXTRdUljA,647 +langchain_classic/utilities/tavily_search.py,sha256=rjWhX6Ol9VEIxSNCco4CoKGAw3SmqvCTkpSX60tLbJk,694 +langchain_classic/utilities/tensorflow_datasets.py,sha256=DCdVjoWAoubFUNQ9YGCzwCkoXM6bw-Jn8tAtAdFj4LA,647 +langchain_classic/utilities/twilio.py,sha256=GpbBDE2iBzcIpo3RAfv-XKOO1JIycTWFCnhmUO01-X8,641 +langchain_classic/utilities/vertexai.py,sha256=jH6yU02sCstnmI9nAm-_seguwp8ThpTj2HoV6lcmL5g,1064 +langchain_classic/utilities/wikipedia.py,sha256=ENIkMXtQbdW7jb2YUCDCWkKVc4YD0QX1zrAbguBoChE,650 +langchain_classic/utilities/wolfram_alpha.py,sha256=5IvjNBhPdTaKDIyhGFwgXywL9mTsUwLRpO8pTm3uVfA,659 +langchain_classic/utilities/zapier.py,sha256=g3XrjMdypQyREBltwmyCAp3cjIZqArI1rQ80DG4VI1Q,641 +langchain_classic/utils/__init__.py,sha256=or7x08SL4GH_SQ0ZcIctY0GGdMddjezPcgP7tWFFO4o,1849 +langchain_classic/utils/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/utils/__pycache__/aiter.cpython-311.pyc,, +langchain_classic/utils/__pycache__/env.cpython-311.pyc,, +langchain_classic/utils/__pycache__/ernie_functions.cpython-311.pyc,, +langchain_classic/utils/__pycache__/formatting.cpython-311.pyc,, +langchain_classic/utils/__pycache__/html.cpython-311.pyc,, +langchain_classic/utils/__pycache__/input.cpython-311.pyc,, +langchain_classic/utils/__pycache__/iter.cpython-311.pyc,, +langchain_classic/utils/__pycache__/json_schema.cpython-311.pyc,, +langchain_classic/utils/__pycache__/math.cpython-311.pyc,, +langchain_classic/utils/__pycache__/openai.cpython-311.pyc,, +langchain_classic/utils/__pycache__/openai_functions.cpython-311.pyc,, +langchain_classic/utils/__pycache__/pydantic.cpython-311.pyc,, +langchain_classic/utils/__pycache__/strings.cpython-311.pyc,, +langchain_classic/utils/__pycache__/utils.cpython-311.pyc,, +langchain_classic/utils/aiter.py,sha256=fFT6Vu7zvXtyaykm2qM9NYyI0T2-fkLL0STCWYZ2jjE,102 +langchain_classic/utils/env.py,sha256=KfFYCkcpxbeKl6JfpNWZmkxR1suHcpQuapIm-Dv2PlM,124 +langchain_classic/utils/ernie_functions.py,sha256=BsypZfdv2tJrG33bphT1W9bm_h8zPcWOFlPaIslFYYg,1148 +langchain_classic/utils/formatting.py,sha256=zrQEAw_328CgHtFLC1GKnpdobUzQtJ6jHR7ZUp1cBSA,91 +langchain_classic/utils/html.py,sha256=1s9kjAsfwy13bwWHf3YdpAb0UoqV2iI8s6kN_lrTJ8A,421 +langchain_classic/utils/input.py,sha256=EfGTayH4JpQY74Ns9KOY0ZW5JzvdB9JSGyKjqj03p3s,211 +langchain_classic/utils/iter.py,sha256=NrOWIA0EGkizt-73J5WbncvSYCCiBXAQG2McYleG990,133 +langchain_classic/utils/json_schema.py,sha256=rXVUUjiooT9w_AG8sBHQvfXYAKWjETKfyiMLrWtVTCg,212 +langchain_classic/utils/math.py,sha256=5pgnO1dsEBSeMq6sFvOQY_mV0-GqlvL8Vh6GtkOggeM,926 +langchain_classic/utils/openai.py,sha256=JBjyBwVllcfEM1WD-htj9Xw_MmkdnfsoZF6MH4HncKM,635 +langchain_classic/utils/openai_functions.py,sha256=vCXb_E8y6mdFDhrRuWSpC12_xQUupdMfx9NKcKV0Sf0,476 +langchain_classic/utils/pydantic.py,sha256=ES5Akon6dkJy_6nATGNoB5PiwAwrh5lU6sZ4kG8sDj8,282 +langchain_classic/utils/strings.py,sha256=lJxPcS72twpRjmSe8Jfupn0Hxq6ps2Mc_tUDBGKKUdY,148 +langchain_classic/utils/utils.py,sha256=rapSKwWTxHVhanW9liEKOQTHD-O2aQUsVOSf5NTfIYc,446 +langchain_classic/vectorstores/__init__.py,sha256=WJ4-SouklWXoDy18J4ckuwfI1_diTL4S36d6AAG89KY,7731 +langchain_classic/vectorstores/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/alibabacloud_opensearch.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/analyticdb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/annoy.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/astradb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/atlas.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/awadb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/azure_cosmos_db.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/azuresearch.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/bageldb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/baiducloud_vector_search.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/base.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/cassandra.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/chroma.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/clarifai.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/clickhouse.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/dashvector.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/databricks_vector_search.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/deeplake.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/dingo.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/elastic_vector_search.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/epsilla.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/faiss.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/hippo.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/hologres.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/lancedb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/llm_rails.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/marqo.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/matching_engine.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/meilisearch.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/milvus.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/momento_vector_index.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/mongodb_atlas.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/myscale.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/neo4j_vector.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/nucliadb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/opensearch_vector_search.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/pgembedding.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/pgvecto_rs.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/pgvector.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/pinecone.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/qdrant.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/rocksetdb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/scann.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/semadb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/singlestoredb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/sklearn.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/sqlitevss.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/starrocks.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/supabase.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/tair.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/tencentvectordb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/tiledb.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/timescalevector.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/typesense.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/usearch.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/utils.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/vald.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/vearch.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/vectara.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/vespa.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/weaviate.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/xata.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/yellowbrick.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/zep.cpython-311.pyc,, +langchain_classic/vectorstores/__pycache__/zilliz.cpython-311.pyc,, +langchain_classic/vectorstores/alibabacloud_opensearch.py,sha256=LlLSrBcpOTDv8E9Vmhd9yL62w5w3eZLyPvVz6Xtca9Y,841 +langchain_classic/vectorstores/analyticdb.py,sha256=BQBNrtVMx_FwgMCfWGKtqLoTzavcEt11D2stE59VPrs,629 +langchain_classic/vectorstores/annoy.py,sha256=n3AZTHuiogAk5YNlA5dE3-Boy2VDLVOGL3XeIAYQ1uM,614 +langchain_classic/vectorstores/astradb.py,sha256=QxRj8hTb7Y5uf1pPVjUhTTXxIuhemjeXAHQtPGwgm1I,620 +langchain_classic/vectorstores/atlas.py,sha256=Be_cxbjOP__Q0jJRMYQBKrsMw95fZXMYka5sDt5NiRQ,620 +langchain_classic/vectorstores/awadb.py,sha256=BcSgWLVjcX1C5HP539h0cNhCVFiZquhouHf48ceA1_I,614 +langchain_classic/vectorstores/azure_cosmos_db.py,sha256=XAVJ5ne3zOZZ4O0FUwY55tG5XBQuEGzCe7IiTlXGAY8,881 +langchain_classic/vectorstores/azuresearch.py,sha256=OqGKpvSWZ5CHwboTFCjbRRWJ7vLYgEbvsI5bAYuIhYc,875 +langchain_classic/vectorstores/bageldb.py,sha256=QCITLTH92WoKPdYCl0OctKSxpM1G3E6rc0WbhddZ-fU,614 +langchain_classic/vectorstores/baiducloud_vector_search.py,sha256=LeZQKjOaKYWGlfStJYm--DwkaJUQ6_vsOWLfXCr_lWk,641 +langchain_classic/vectorstores/base.py,sha256=264EWH9pnWThSFqVQJi_ySfBbtViGV4d496rcyL96DY,125 +langchain_classic/vectorstores/cassandra.py,sha256=EHUUs7igcC1fMhT1g8tZmkPfNbacVb1v7Rv38P_9Ajk,626 +langchain_classic/vectorstores/chroma.py,sha256=0gFZBW9KjlS--GT-uyFDPxFvBrkf-jSQCZpU59rYH4w,617 +langchain_classic/vectorstores/clarifai.py,sha256=SBejALyuWVVq9CBbOZJGFYKTJTU-DZ2CMJ10PVvQhPU,623 +langchain_classic/vectorstores/clickhouse.py,sha256=gKGeK10Rr40czig7cE7ib8T6E8CygdFEZNBFpbE0q4Y,744 +langchain_classic/vectorstores/dashvector.py,sha256=tnjS7vmEKbM8ZOY6OxdIU3pJCrmebIbaeszOFHaPGK8,629 +langchain_classic/vectorstores/databricks_vector_search.py,sha256=j_GTUezNa4Xn8q5gjiKHe078Ls-AAYckC4Y4KCxcIE8,665 +langchain_classic/vectorstores/deeplake.py,sha256=NbL48zfmCU3sA3tYAbYc1r16y40_-WgkuhlTSumKwdo,623 +langchain_classic/vectorstores/dingo.py,sha256=t2X4m2wXfnE3RB6kiiEsDbxxsmH7h7QegQci24QTjfo,614 +langchain_classic/vectorstores/docarray/__init__.py,sha256=jEH1_h_9A5MnEHQSGsNbcnzNCgL5n4PmpGu6i9Y9ths,805 +langchain_classic/vectorstores/docarray/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/vectorstores/docarray/__pycache__/base.cpython-311.pyc,, +langchain_classic/vectorstores/docarray/__pycache__/hnsw.cpython-311.pyc,, +langchain_classic/vectorstores/docarray/__pycache__/in_memory.cpython-311.pyc,, +langchain_classic/vectorstores/docarray/base.py,sha256=j2Swa1bWxvchanhYy8qgMSQcrwkD3KbUsc-_tRW5nDc,666 +langchain_classic/vectorstores/docarray/hnsw.py,sha256=BlK3Qd9S3O9CUeADCWY5bltp_CdPtaih9qTd60uc0U8,653 +langchain_classic/vectorstores/docarray/in_memory.py,sha256=1EzzNjSaZpNXq96pDuOeyOlJf5lnlfp2A3rEkOieGos,665 +langchain_classic/vectorstores/elastic_vector_search.py,sha256=YX6WuWoFriWTXBvhYVyFqgLPiGmoNcNyQAOfjO1jlAI,765 +langchain_classic/vectorstores/elasticsearch.py,sha256=2Wldqh0znWp5Q736pp0qbWcss2sYpa_4GVsB9WmeFec,1302 +langchain_classic/vectorstores/epsilla.py,sha256=uZNVH7TIJF-bZPCTceLU-fFJnw7sHAOusYGvXZuEie0,620 +langchain_classic/vectorstores/faiss.py,sha256=gjkTSdrUFNFXUBS55xMStSUmfvZqnWAG9djl2bcVyTs,614 +langchain_classic/vectorstores/hippo.py,sha256=0FMNJ1ba4g-ek6_JOP0-0moPSQ7hL1QrWQRJwvPFRSc,626 +langchain_classic/vectorstores/hologres.py,sha256=aE0KKHVx6AZhBcxtA3RPvUknVguQeoVuwNrdfAHz1YY,623 +langchain_classic/vectorstores/lancedb.py,sha256=iYLGTY95qVJQod1v3yjbHnvKbaxJ-h21cIQt_mQaPP0,620 +langchain_classic/vectorstores/llm_rails.py,sha256=FBIvfll-eR6NxXmVaSGrU3-MHZSRxAKB1XiuNCcSnmA,803 +langchain_classic/vectorstores/marqo.py,sha256=aMkOYPSpkhBZcXAwZYMto58IMBiwKh6KVmshcInXizs,614 +langchain_classic/vectorstores/matching_engine.py,sha256=gnQV3rM8gKR26n0hcs085KAkGtAAAxGKkFPmXh4jH08,641 +langchain_classic/vectorstores/meilisearch.py,sha256=EgdgnraGcdm8-zZTxGBFQc2HB4MG7c5yvNA90xEUGPE,632 +langchain_classic/vectorstores/milvus.py,sha256=beXu83-OwlLolyYopC4SqERW6yAWdIbjiG5ZRSqGRhk,617 +langchain_classic/vectorstores/momento_vector_index.py,sha256=LB0vzMddWNDJVcsq6OElHhOJjZvehRY9vAkoCcBRMZ0,653 +langchain_classic/vectorstores/mongodb_atlas.py,sha256=9iakuKvFTH-7IXBRltXUEGzGWjuh6e7Pu2TkiUCmM8s,671 +langchain_classic/vectorstores/myscale.py,sha256=lrMvUooV_M-6TJeXRfZKFTtluq_BHzY-Mfa_-4RBo6U,898 +langchain_classic/vectorstores/neo4j_vector.py,sha256=9g0i92k-trEmWnkl1jHsvfklUmlct2krjgZa0JZAcCA,797 +langchain_classic/vectorstores/nucliadb.py,sha256=PRcHLjtsa2irAJ0TsQsxZXVWu2tB8jRPzZYU3qrho4s,641 +langchain_classic/vectorstores/opensearch_vector_search.py,sha256=ZY7k3fD2w4twF6dt_QXaVUwfcIZF1OJwRh8UAyIEOFI,665 +langchain_classic/vectorstores/pgembedding.py,sha256=c6FowEi_uegxUoLTydV-RUGL4uQaKkA6SBb5RtM84ro,1050 +langchain_classic/vectorstores/pgvecto_rs.py,sha256=GUbLX6R42nTPS9EMav-X7zMGmoSsSJywLnyRi3MR7Xs,651 +langchain_classic/vectorstores/pgvector.py,sha256=fAz8tL0KU1tdGSsZ-QR4A5ru0V3182lBfFZHDaUWsFI,798 +langchain_classic/vectorstores/pinecone.py,sha256=YAh73ALiZSxaQrVcAft51xpQlkzibOxRb-zH3DRZFMY,623 +langchain_classic/vectorstores/qdrant.py,sha256=Fd3dXRVD_Gn7beG1hJ-3PhSzWpWOCdqXfD6knLAWpQc,785 +langchain_classic/vectorstores/redis/__init__.py,sha256=ZDx-xbYafxl9x9CNcZ15p8f1ml_xRxVsAsZvGeV3pKs,1303 +langchain_classic/vectorstores/redis/__pycache__/__init__.cpython-311.pyc,, +langchain_classic/vectorstores/redis/__pycache__/base.cpython-311.pyc,, +langchain_classic/vectorstores/redis/__pycache__/filters.cpython-311.pyc,, +langchain_classic/vectorstores/redis/__pycache__/schema.cpython-311.pyc,, +langchain_classic/vectorstores/redis/base.py,sha256=qHEecZ5HdS66mVmq8Xi8sPvmYfnW5t9lfMRMvlMFnsA,964 +langchain_classic/vectorstores/redis/filters.py,sha256=wglMpjxsjE8Kg0zPnoGGpBkBSqZbKzhHtpQZCishaGY,1522 +langchain_classic/vectorstores/redis/schema.py,sha256=C7VZN_f3P0RGEVIeGSstyjl2mj3kAtqQ4HPmMdRmOHE,1753 +langchain_classic/vectorstores/rocksetdb.py,sha256=ZssNBMuOoKvlmQ2yQvj_64VmRaWE-QsZNSy2v71bjX0,620 +langchain_classic/vectorstores/scann.py,sha256=PyYXryJkcoEvZBg9R1eB3Ac3l7oSIEroqt5wCp0ueTg,614 +langchain_classic/vectorstores/semadb.py,sha256=K-MkHByRfXL5cN-w78JrUOkLqqBkG9D9m5hqqOynBxA,617 +langchain_classic/vectorstores/singlestoredb.py,sha256=DMNsyIKtOinGylBzG2vebUBWqgODmPmOuSmzOMyRWVk,638 +langchain_classic/vectorstores/sklearn.py,sha256=ZXtr63jxyB2IPi1A5lTJO5JmUd8dr8PwqsK48bz3bwU,1333 +langchain_classic/vectorstores/sqlitevss.py,sha256=opxnsnyAHQCTzTvc5NLtZajHBaRIb35aYF9bKdhKt98,626 +langchain_classic/vectorstores/starrocks.py,sha256=E338pjpuISV3cjbYIP3wkX_S-M1pyxF17S9mY6RsO6M,806 +langchain_classic/vectorstores/supabase.py,sha256=UMph7qBr5Pj8I9wqriopnkDc1C-xBoNSeHye3UaD4C4,656 +langchain_classic/vectorstores/tair.py,sha256=tuJcR4ZFMbQP2cFEeggbXUmhsG296-Z2Sfu5Sc0co9w,611 +langchain_classic/vectorstores/tencentvectordb.py,sha256=e288tR4-uIkgG3p8rphgqRFNt7g8rBg7DgvEbGySmB4,961 +langchain_classic/vectorstores/tiledb.py,sha256=dcHOAhbZtLIWEfc1_LSwYwiWhyX0RBgHL3FKove0ENs,617 +langchain_classic/vectorstores/timescalevector.py,sha256=nTRbcJhfk1CcTob3XuxaqGYpvfrDy7OrNTh_rDTYkD8,644 +langchain_classic/vectorstores/typesense.py,sha256=s0KtOxY_y3O1NK8dcMlbeo-9dYTzmS2uBgguljdJ-ks,626 +langchain_classic/vectorstores/usearch.py,sha256=N-Y2K2d_at8eYihXHWv22PoX4SmvIJsKhG_ZAFhqYcM,620 +langchain_classic/vectorstores/utils.py,sha256=ylVSxXvOvXHgoVzDJw8CBW4Q_djeMrg1VpHNC_1x-Ec,966 +langchain_classic/vectorstores/vald.py,sha256=7JbsXCJ_x9HtDAQ1iCJzFORH_SjGTSNwjblaEH3JADM,611 +langchain_classic/vectorstores/vearch.py,sha256=3kMov-k6xMKF_y-U4XRhuSMPuDOHvDmCv6xNYY8Ed70,617 +langchain_classic/vectorstores/vectara.py,sha256=u_OocTQnoWaYUpiads0sBCY1q5KUnMedmTSsETtftj4,793 +langchain_classic/vectorstores/vespa.py,sha256=ZQ6fjBF7sOIFw7F9C0wuq0dKvOZntyutmvlLm1cd14Y,629 +langchain_classic/vectorstores/weaviate.py,sha256=qL7hkCVJWkWTVA6eaO8bFczxLkQmqGq48HpY36_wOCc,623 +langchain_classic/vectorstores/xata.py,sha256=qTh8JYe0Ztp7caqO5axFkQ8CEwByijbTWUgllbdk_6U,654 +langchain_classic/vectorstores/yellowbrick.py,sha256=hvMPwhIz1PZS-Bpi3Lonks1H50P5MeQkfHhpvVIe7UY,632 +langchain_classic/vectorstores/zep.py,sha256=0MZYw4tvyMWvFPKYRBx2MZ8Bm5Al1wzGyir0emDYcHM,806 +langchain_classic/vectorstores/zilliz.py,sha256=xOw0rFZTlhHefEC6lEttbyBo35fhkVvxkUs8I8zZ7Bc,617 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic-1.0.7.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3f404d931ee15addc62b51981d692a212aa97f8b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/__init__.py @@ -0,0 +1,424 @@ +"""Main entrypoint into package.""" + +import warnings +from importlib import metadata +from typing import Any + +from langchain_core._api.deprecation import surface_langchain_deprecation_warnings + +try: + __version__ = metadata.version(__package__) +except metadata.PackageNotFoundError: + # Case where package metadata is not available. + __version__ = "" +del metadata # optional, avoids polluting the results of dir(__package__) + + +def _warn_on_import(name: str, replacement: str | None = None) -> None: + """Warn on import of deprecated module.""" + from langchain_classic._api.interactive_env import is_interactive_env + + if is_interactive_env(): + # No warnings for interactive environments. + # This is done to avoid polluting the output of interactive environments + # where users rely on auto-complete and may trigger this warning + # even if they are not using any deprecated modules + return + + if replacement: + warnings.warn( + f"Importing {name} from langchain root module is no longer supported. " + f"Please use {replacement} instead.", + stacklevel=3, + ) + else: + warnings.warn( + f"Importing {name} from langchain root module is no longer supported.", + stacklevel=3, + ) + + +# Surfaces Deprecation and Pending Deprecation warnings from langchain_classic. +surface_langchain_deprecation_warnings() + + +def __getattr__(name: str) -> Any: + if name == "MRKLChain": + from langchain_classic.agents import MRKLChain + + _warn_on_import(name, replacement="langchain_classic.agents.MRKLChain") + + return MRKLChain + if name == "ReActChain": + from langchain_classic.agents import ReActChain + + _warn_on_import(name, replacement="langchain_classic.agents.ReActChain") + + return ReActChain + if name == "SelfAskWithSearchChain": + from langchain_classic.agents import SelfAskWithSearchChain + + _warn_on_import( + name, replacement="langchain_classic.agents.SelfAskWithSearchChain" + ) + + return SelfAskWithSearchChain + if name == "ConversationChain": + from langchain_classic.chains import ConversationChain + + _warn_on_import(name, replacement="langchain_classic.chains.ConversationChain") + + return ConversationChain + if name == "LLMBashChain": + msg = ( + "This module has been moved to langchain-experimental. " + "For more details: " + "https://github.com/langchain-ai/langchain/discussions/11352." + "To access this code, install it with `pip install langchain-experimental`." + "`from langchain_experimental.llm_bash.base " + "import LLMBashChain`" + ) + raise ImportError(msg) + + if name == "LLMChain": + from langchain_classic.chains import LLMChain + + _warn_on_import(name, replacement="langchain_classic.chains.LLMChain") + + return LLMChain + if name == "LLMCheckerChain": + from langchain_classic.chains import LLMCheckerChain + + _warn_on_import(name, replacement="langchain_classic.chains.LLMCheckerChain") + + return LLMCheckerChain + if name == "LLMMathChain": + from langchain_classic.chains import LLMMathChain + + _warn_on_import(name, replacement="langchain_classic.chains.LLMMathChain") + + return LLMMathChain + if name == "QAWithSourcesChain": + from langchain_classic.chains import QAWithSourcesChain + + _warn_on_import(name, replacement="langchain_classic.chains.QAWithSourcesChain") + + return QAWithSourcesChain + if name == "VectorDBQA": + from langchain_classic.chains import VectorDBQA + + _warn_on_import(name, replacement="langchain_classic.chains.VectorDBQA") + + return VectorDBQA + if name == "VectorDBQAWithSourcesChain": + from langchain_classic.chains import VectorDBQAWithSourcesChain + + _warn_on_import( + name, replacement="langchain_classic.chains.VectorDBQAWithSourcesChain" + ) + + return VectorDBQAWithSourcesChain + if name == "InMemoryDocstore": + from langchain_community.docstore import InMemoryDocstore + + _warn_on_import(name, replacement="langchain_classic.docstore.InMemoryDocstore") + + return InMemoryDocstore + if name == "Wikipedia": + from langchain_community.docstore import Wikipedia + + _warn_on_import(name, replacement="langchain_classic.docstore.Wikipedia") + + return Wikipedia + if name == "Anthropic": + from langchain_community.llms import Anthropic + + _warn_on_import(name, replacement="langchain_community.llms.Anthropic") + + return Anthropic + if name == "Banana": + from langchain_community.llms import Banana + + _warn_on_import(name, replacement="langchain_community.llms.Banana") + + return Banana + if name == "CerebriumAI": + from langchain_community.llms import CerebriumAI + + _warn_on_import(name, replacement="langchain_community.llms.CerebriumAI") + + return CerebriumAI + if name == "Cohere": + from langchain_community.llms import Cohere + + _warn_on_import(name, replacement="langchain_community.llms.Cohere") + + return Cohere + if name == "ForefrontAI": + from langchain_community.llms import ForefrontAI + + _warn_on_import(name, replacement="langchain_community.llms.ForefrontAI") + + return ForefrontAI + if name == "GooseAI": + from langchain_community.llms import GooseAI + + _warn_on_import(name, replacement="langchain_community.llms.GooseAI") + + return GooseAI + if name == "HuggingFaceHub": + from langchain_community.llms import HuggingFaceHub + + _warn_on_import(name, replacement="langchain_community.llms.HuggingFaceHub") + + return HuggingFaceHub + if name == "HuggingFaceTextGenInference": + from langchain_community.llms import HuggingFaceTextGenInference + + _warn_on_import( + name, + replacement="langchain_community.llms.HuggingFaceTextGenInference", + ) + + return HuggingFaceTextGenInference + if name == "LlamaCpp": + from langchain_community.llms import LlamaCpp + + _warn_on_import(name, replacement="langchain_community.llms.LlamaCpp") + + return LlamaCpp + if name == "Modal": + from langchain_community.llms import Modal + + _warn_on_import(name, replacement="langchain_community.llms.Modal") + + return Modal + if name == "OpenAI": + from langchain_community.llms import OpenAI + + _warn_on_import(name, replacement="langchain_community.llms.OpenAI") + + return OpenAI + if name == "Petals": + from langchain_community.llms import Petals + + _warn_on_import(name, replacement="langchain_community.llms.Petals") + + return Petals + if name == "PipelineAI": + from langchain_community.llms import PipelineAI + + _warn_on_import(name, replacement="langchain_community.llms.PipelineAI") + + return PipelineAI + if name == "SagemakerEndpoint": + from langchain_community.llms import SagemakerEndpoint + + _warn_on_import(name, replacement="langchain_community.llms.SagemakerEndpoint") + + return SagemakerEndpoint + if name == "StochasticAI": + from langchain_community.llms import StochasticAI + + _warn_on_import(name, replacement="langchain_community.llms.StochasticAI") + + return StochasticAI + if name == "Writer": + from langchain_community.llms import Writer + + _warn_on_import(name, replacement="langchain_community.llms.Writer") + + return Writer + if name == "HuggingFacePipeline": + from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline + + _warn_on_import( + name, + replacement="langchain_community.llms.huggingface_pipeline.HuggingFacePipeline", + ) + + return HuggingFacePipeline + if name == "FewShotPromptTemplate": + from langchain_core.prompts import FewShotPromptTemplate + + _warn_on_import( + name, + replacement="langchain_core.prompts.FewShotPromptTemplate", + ) + + return FewShotPromptTemplate + if name == "Prompt": + from langchain_core.prompts import PromptTemplate + + _warn_on_import(name, replacement="langchain_core.prompts.PromptTemplate") + + # it's renamed as prompt template anyways + # this is just for backwards compat + return PromptTemplate + if name == "PromptTemplate": + from langchain_core.prompts import PromptTemplate + + _warn_on_import(name, replacement="langchain_core.prompts.PromptTemplate") + + return PromptTemplate + if name == "BasePromptTemplate": + from langchain_core.prompts import BasePromptTemplate + + _warn_on_import(name, replacement="langchain_core.prompts.BasePromptTemplate") + + return BasePromptTemplate + if name == "ArxivAPIWrapper": + from langchain_community.utilities import ArxivAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.ArxivAPIWrapper", + ) + + return ArxivAPIWrapper + if name == "GoldenQueryAPIWrapper": + from langchain_community.utilities import GoldenQueryAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.GoldenQueryAPIWrapper", + ) + + return GoldenQueryAPIWrapper + if name == "GoogleSearchAPIWrapper": + from langchain_community.utilities import GoogleSearchAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.GoogleSearchAPIWrapper", + ) + + return GoogleSearchAPIWrapper + if name == "GoogleSerperAPIWrapper": + from langchain_community.utilities import GoogleSerperAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.GoogleSerperAPIWrapper", + ) + + return GoogleSerperAPIWrapper + if name == "PowerBIDataset": + from langchain_community.utilities import PowerBIDataset + + _warn_on_import( + name, + replacement="langchain_community.utilities.PowerBIDataset", + ) + + return PowerBIDataset + if name == "SearxSearchWrapper": + from langchain_community.utilities import SearxSearchWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.SearxSearchWrapper", + ) + + return SearxSearchWrapper + if name == "WikipediaAPIWrapper": + from langchain_community.utilities import WikipediaAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.WikipediaAPIWrapper", + ) + + return WikipediaAPIWrapper + if name == "WolframAlphaAPIWrapper": + from langchain_community.utilities import WolframAlphaAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.WolframAlphaAPIWrapper", + ) + + return WolframAlphaAPIWrapper + if name == "SQLDatabase": + from langchain_community.utilities import SQLDatabase + + _warn_on_import(name, replacement="langchain_community.utilities.SQLDatabase") + + return SQLDatabase + if name == "FAISS": + from langchain_community.vectorstores import FAISS + + _warn_on_import(name, replacement="langchain_community.vectorstores.FAISS") + + return FAISS + if name == "ElasticVectorSearch": + from langchain_community.vectorstores import ElasticVectorSearch + + _warn_on_import( + name, + replacement="langchain_community.vectorstores.ElasticVectorSearch", + ) + + return ElasticVectorSearch + # For backwards compatibility + if name in {"SerpAPIChain", "SerpAPIWrapper"}: + from langchain_community.utilities import SerpAPIWrapper + + _warn_on_import( + name, + replacement="langchain_community.utilities.SerpAPIWrapper", + ) + + return SerpAPIWrapper + msg = f"Could not find: {name}" + raise AttributeError(msg) + + +__all__ = [ + "FAISS", + "Anthropic", + "ArxivAPIWrapper", + "Banana", + "BasePromptTemplate", + "CerebriumAI", + "Cohere", + "ConversationChain", + "ElasticVectorSearch", + "FewShotPromptTemplate", + "ForefrontAI", + "GoldenQueryAPIWrapper", + "GoogleSearchAPIWrapper", + "GoogleSerperAPIWrapper", + "GooseAI", + "HuggingFaceHub", + "HuggingFacePipeline", + "HuggingFaceTextGenInference", + "InMemoryDocstore", + "LLMChain", + "LLMCheckerChain", + "LLMMathChain", + "LlamaCpp", + "MRKLChain", + "Modal", + "OpenAI", + "Petals", + "PipelineAI", + "PowerBIDataset", + "Prompt", + "PromptTemplate", + "QAWithSourcesChain", + "ReActChain", + "SQLDatabase", + "SagemakerEndpoint", + "SearxSearchWrapper", + "SelfAskWithSearchChain", + "SerpAPIChain", + "SerpAPIWrapper", + "StochasticAI", + "VectorDBQA", + "VectorDBQAWithSourcesChain", + "Wikipedia", + "WikipediaAPIWrapper", + "WolframAlphaAPIWrapper", + "Writer", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/base_language.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/base_language.py new file mode 100644 index 0000000000000000000000000000000000000000..e52c69fd0cf6ee2c4b20f5e0690b1113da72a2ad --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/base_language.py @@ -0,0 +1,7 @@ +"""Deprecated module for BaseLanguageModel class, kept for backwards compatibility.""" + +from __future__ import annotations + +from langchain_core.language_models import BaseLanguageModel + +__all__ = ["BaseLanguageModel"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/base_memory.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/base_memory.py new file mode 100644 index 0000000000000000000000000000000000000000..0c5897557ee7528174d5339ae32938c3043e726c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/base_memory.py @@ -0,0 +1,119 @@ +"""**Memory** maintains Chain state, incorporating context from past runs. + +This module contains memory abstractions from LangChain v0.0.x. + +These abstractions are now deprecated and will be removed in LangChain v1.0.0. +""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import Any + +from langchain_core._api import deprecated +from langchain_core.load.serializable import Serializable +from langchain_core.runnables import run_in_executor +from pydantic import ConfigDict + + +@deprecated( + since="0.3.3", + removal="2.0.0", + alternative="langchain.agents.create_agent", + addendum=( + "For agents that need to remember prior interactions, use " + "`create_agent` with checkpointing or the `Store` API. See " + "https://docs.langchain.com/oss/python/langchain/short-term-memory and " + "https://docs.langchain.com/oss/python/langchain/long-term-memory" + ), +) +class BaseMemory(Serializable, ABC): + """Abstract base class for memory in Chains. + + Memory refers to state in Chains. Memory can be used to store information about + past executions of a Chain and inject that information into the inputs of + future executions of the Chain. For example, for conversational Chains Memory + can be used to store conversations and automatically add them to future model + prompts so that the model has the necessary context to respond coherently to + the latest input. + + Example: + ```python + class SimpleMemory(BaseMemory): + memories: dict[str, Any] = dict() + + @property + def memory_variables(self) -> list[str]: + return list(self.memories.keys()) + + def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, str]: + return self.memories + + def save_context( + self, inputs: dict[str, Any], outputs: dict[str, str] + ) -> None: + pass + + def clear(self) -> None: + pass + ``` + """ + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + @property + @abstractmethod + def memory_variables(self) -> list[str]: + """The string keys this memory class will add to chain inputs.""" + + @abstractmethod + def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, Any]: + """Return key-value pairs given the text input to the chain. + + Args: + inputs: The inputs to the chain. + + Returns: + A dictionary of key-value pairs. + """ + + async def aload_memory_variables(self, inputs: dict[str, Any]) -> dict[str, Any]: + """Async return key-value pairs given the text input to the chain. + + Args: + inputs: The inputs to the chain. + + Returns: + A dictionary of key-value pairs. + """ + return await run_in_executor(None, self.load_memory_variables, inputs) + + @abstractmethod + def save_context(self, inputs: dict[str, Any], outputs: dict[str, str]) -> None: + """Save the context of this chain run to memory. + + Args: + inputs: The inputs to the chain. + outputs: The outputs of the chain. + """ + + async def asave_context( + self, inputs: dict[str, Any], outputs: dict[str, str] + ) -> None: + """Async save the context of this chain run to memory. + + Args: + inputs: The inputs to the chain. + outputs: The outputs of the chain. + """ + await run_in_executor(None, self.save_context, inputs, outputs) + + @abstractmethod + def clear(self) -> None: + """Clear memory contents.""" + + async def aclear(self) -> None: + """Async clear memory contents.""" + await run_in_executor(None, self.clear) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/cache.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/cache.py new file mode 100644 index 0000000000000000000000000000000000000000..477345c39d9977d4848a7a62fe151925aefe904d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/cache.py @@ -0,0 +1,72 @@ +from typing import TYPE_CHECKING, Any + +from langchain_classic._api import create_importer + +if TYPE_CHECKING: + from langchain_community.cache import ( + AstraDBCache, + AstraDBSemanticCache, + AzureCosmosDBSemanticCache, + CassandraCache, + CassandraSemanticCache, + FullLLMCache, + FullMd5LLMCache, + GPTCache, + InMemoryCache, + MomentoCache, + RedisCache, + RedisSemanticCache, + SQLAlchemyCache, + SQLAlchemyMd5Cache, + SQLiteCache, + UpstashRedisCache, + ) + +# Create a way to dynamically look up deprecated imports. +# Used to consolidate logic for raising deprecation warnings and +# handling optional imports. +DEPRECATED_LOOKUP = { + "FullLLMCache": "langchain_community.cache", + "SQLAlchemyCache": "langchain_community.cache", + "SQLiteCache": "langchain_community.cache", + "UpstashRedisCache": "langchain_community.cache", + "RedisCache": "langchain_community.cache", + "RedisSemanticCache": "langchain_community.cache", + "GPTCache": "langchain_community.cache", + "MomentoCache": "langchain_community.cache", + "InMemoryCache": "langchain_community.cache", + "CassandraCache": "langchain_community.cache", + "CassandraSemanticCache": "langchain_community.cache", + "FullMd5LLMCache": "langchain_community.cache", + "SQLAlchemyMd5Cache": "langchain_community.cache", + "AstraDBCache": "langchain_community.cache", + "AstraDBSemanticCache": "langchain_community.cache", + "AzureCosmosDBSemanticCache": "langchain_community.cache", +} + +_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP) + + +def __getattr__(name: str) -> Any: + """Look up attributes dynamically.""" + return _import_attribute(name) + + +__all__ = [ + "AstraDBCache", + "AstraDBSemanticCache", + "AzureCosmosDBSemanticCache", + "CassandraCache", + "CassandraSemanticCache", + "FullLLMCache", + "FullMd5LLMCache", + "GPTCache", + "InMemoryCache", + "MomentoCache", + "RedisCache", + "RedisSemanticCache", + "SQLAlchemyCache", + "SQLAlchemyMd5Cache", + "SQLiteCache", + "UpstashRedisCache", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/env.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/env.py new file mode 100644 index 0000000000000000000000000000000000000000..a413ae23752e9c3c9ab3838efa0b706965cabcd8 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/env.py @@ -0,0 +1,17 @@ +import platform +from functools import lru_cache + + +@lru_cache(maxsize=1) +def get_runtime_environment() -> dict: + """Get information about the LangChain runtime environment.""" + # Lazy import to avoid circular imports + from langchain_classic import __version__ + + return { + "library_version": __version__, + "library": "langchain-classic", + "platform": platform.platform(), + "runtime": "python", + "runtime_version": platform.python_version(), + } diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/example_generator.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/example_generator.py new file mode 100644 index 0000000000000000000000000000000000000000..f4ae9bce4474e2da2b72495037fb83ae8fd8a83a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/example_generator.py @@ -0,0 +1,5 @@ +"""Keep here for backwards compatibility.""" + +from langchain_classic.chains.example_generator import generate_example + +__all__ = ["generate_example"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/formatting.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/formatting.py new file mode 100644 index 0000000000000000000000000000000000000000..158f74d0e1039980269fc5097280cf622c81541a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/formatting.py @@ -0,0 +1,5 @@ +"""DEPRECATED: Kept for backwards compatibility.""" + +from langchain_core.utils.formatting import StrictFormatter, formatter + +__all__ = ["StrictFormatter", "formatter"] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/globals.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/globals.py new file mode 100644 index 0000000000000000000000000000000000000000..df23d53cfaf49a084e5588df2a50524ca09d8713 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/globals.py @@ -0,0 +1,19 @@ +"""Global values and configuration that apply to all of LangChain.""" + +from langchain_core.globals import ( + get_debug, + get_llm_cache, + get_verbose, + set_debug, + set_llm_cache, + set_verbose, +) + +__all__ = [ + "get_debug", + "get_llm_cache", + "get_verbose", + "set_debug", + "set_llm_cache", + "set_verbose", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/hub.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/hub.py new file mode 100644 index 0000000000000000000000000000000000000000..3701a9f3df8057824c2123c05d0a4e90ef875a8b --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/hub.py @@ -0,0 +1,117 @@ +"""Interface with the [LangChain Hub](https://smith.langchain.com/hub).""" + +from __future__ import annotations + +from collections.abc import Sequence +from typing import Any + +from langchain_core._api.deprecation import deprecated +from langsmith import Client as LangSmithClient + + +@deprecated( + since="1.0.6", + removal="2.0.0", + message=( + "langchain_classic.hub.push is deprecated. Use the LangSmith SDK instead." + ), +) +def push( + repo_full_name: str, + object: Any, # noqa: A002 + *, + api_url: str | None = None, + api_key: str | None = None, + parent_commit_hash: str = "latest", + new_repo_is_public: bool = False, + new_repo_description: str | None = None, + readme: str | None = None, + tags: Sequence[str] | None = None, +) -> str: + """Push an object to the hub and returns the URL it can be viewed at in a browser. + + Args: + repo_full_name: The full name of the prompt to push to in the format of + `owner/prompt_name` or `prompt_name`. + object: The LangChain object to serialize and push to the hub. + api_url: The URL of the LangChain Hub API. Defaults to the hosted API service + if you have an API key set, or a localhost instance if not. + api_key: The API key to use to authenticate with the LangChain Hub API. + parent_commit_hash: The commit hash of the parent commit to push to. Defaults + to the latest commit automatically. + new_repo_is_public: Whether the prompt should be public. + new_repo_description: The description of the prompt. + readme: README content for the repository. + tags: Tags to associate with the prompt. + + Returns: + URL where the pushed object can be viewed in a browser. + """ + client = LangSmithClient(api_url, api_key=api_key) + return client.push_prompt( + repo_full_name, + object=object, + parent_commit_hash=parent_commit_hash, + is_public=new_repo_is_public, + description=new_repo_description, + readme=readme, + tags=tags, + ) + + +@deprecated( + since="1.0.6", + removal="2.0.0", + message=( + "langchain_classic.hub.pull is deprecated. Use the LangSmith SDK instead." + ), +) +def pull( + owner_repo_commit: str, + *, + include_model: bool | None = None, + api_url: str | None = None, + api_key: str | None = None, +) -> Any: + """Pull an object from the hub and returns it as a LangChain object. + + !!! danger "Hub manifests are untrusted input" + + Treat every prompt pulled from the hub as untrusted, regardless of + the owner. Public prompts authored by other users are obviously + external content, but prompts from your own account — or your + organization's account — are also unsafe if that account, a + teammate's account, or the upstream prompt has been compromised. + A single malicious commit to a prompt your code pulls is enough to + execute attacker-controlled configuration on every machine that runs + `pull()`. + + `pull()` deserializes the manifest via `load()`, so the + `langchain_core.load.load` threat model applies — a manifest can + intentionally configure a model with a custom base URL, headers, + model name, or other constructor arguments. These are supported + features, but they also mean the prompt contents are executable + configuration rather than plain text: a compromised prompt can + redirect API traffic, inject headers, or trigger arbitrary code paths + in the classes it instantiates. + + Prefer the LangSmith SDK directly. If you must use `pull()`, pin the + commit hash, audit the manifest before deserializing, and never run + it against an account whose access controls you cannot vouch for. + + Args: + owner_repo_commit: The full name of the prompt to pull from in the format of + `owner/prompt_name:commit_hash` or `owner/prompt_name` + or just `prompt_name` if it's your own prompt. + include_model: Whether to include the model configuration in the pulled + prompt. When `True`, the model declared by the prompt is also + deserialized. + api_url: The URL of the LangChain Hub API. Defaults to the hosted API service + if you have an API key set, or a localhost instance if not. + api_key: The API key to use to authenticate with the LangChain Hub API. + + Returns: + The pulled LangChain object. + """ + client = LangSmithClient(api_url, api_key=api_key) + return client.pull_prompt(owner_repo_commit, include_model=include_model) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/input.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/input.py new file mode 100644 index 0000000000000000000000000000000000000000..91c1dbde5ed0abe501054f4e8db8b8b85820123f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/input.py @@ -0,0 +1,15 @@ +"""DEPRECATED: Kept for backwards compatibility.""" + +from langchain_core.utils.input import ( + get_bolded_text, + get_color_mapping, + get_colored_text, + print_text, +) + +__all__ = [ + "get_bolded_text", + "get_color_mapping", + "get_colored_text", + "print_text", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/model_laboratory.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/model_laboratory.py new file mode 100644 index 0000000000000000000000000000000000000000..31700b5bafca720410a7ae94bff27425adc58661 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/model_laboratory.py @@ -0,0 +1,98 @@ +"""Experiment with different models.""" + +from __future__ import annotations + +from collections.abc import Sequence + +from langchain_core.language_models.llms import BaseLLM +from langchain_core.prompts.prompt import PromptTemplate +from langchain_core.utils.input import get_color_mapping, print_text + +from langchain_classic.chains.base import Chain +from langchain_classic.chains.llm import LLMChain + + +class ModelLaboratory: + """A utility to experiment with and compare the performance of different models.""" + + def __init__(self, chains: Sequence[Chain], names: list[str] | None = None): + """Initialize the ModelLaboratory with chains to experiment with. + + Args: + chains: A sequence of chains to experiment with. + Each chain must have exactly one input and one output variable. + names: Optional list of names corresponding to each chain. + If provided, its length must match the number of chains. + + + Raises: + ValueError: If any chain is not an instance of `Chain`. + ValueError: If a chain does not have exactly one input variable. + ValueError: If a chain does not have exactly one output variable. + ValueError: If the length of `names` does not match the number of chains. + """ + for chain in chains: + if not isinstance(chain, Chain): + msg = ( # type: ignore[unreachable] + "ModelLaboratory should now be initialized with Chains. " + "If you want to initialize with LLMs, use the `from_llms` method " + "instead (`ModelLaboratory.from_llms(...)`)" + ) + raise ValueError(msg) # noqa: TRY004 + if len(chain.input_keys) != 1: + msg = ( + "Currently only support chains with one input variable, " + f"got {chain.input_keys}" + ) + raise ValueError(msg) + if len(chain.output_keys) != 1: + msg = ( + "Currently only support chains with one output variable, " + f"got {chain.output_keys}" + ) + if names is not None and len(names) != len(chains): + msg = "Length of chains does not match length of names." + raise ValueError(msg) + self.chains = chains + chain_range = [str(i) for i in range(len(self.chains))] + self.chain_colors = get_color_mapping(chain_range) + self.names = names + + @classmethod + def from_llms( + cls, + llms: list[BaseLLM], + prompt: PromptTemplate | None = None, + ) -> ModelLaboratory: + """Initialize the ModelLaboratory with LLMs and an optional prompt. + + Args: + llms: A list of LLMs to experiment with. + prompt: An optional prompt to use with the LLMs. + If provided, the prompt must contain exactly one input variable. + + Returns: + An instance of `ModelLaboratory` initialized with LLMs. + """ + if prompt is None: + prompt = PromptTemplate(input_variables=["_input"], template="{_input}") + chains = [LLMChain(llm=llm, prompt=prompt) for llm in llms] + names = [str(llm) for llm in llms] + return cls(chains, names=names) + + def compare(self, text: str) -> None: + """Compare model outputs on an input text. + + If a prompt was provided with starting the laboratory, then this text will be + fed into the prompt. If no prompt was provided, then the input text is the + entire prompt. + + Args: + text: input text to run all models on. + """ + print(f"\033[1mInput:\033[0m\n{text}\n") # noqa: T201 + for i, chain in enumerate(self.chains): + name = self.names[i] if self.names is not None else str(chain) + print_text(name, end="\n") + output = chain.run(text) + print_text(output, color=self.chain_colors[str(i)], end="\n\n") diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/python.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/python.py new file mode 100644 index 0000000000000000000000000000000000000000..d28816597abd77ddef7afc874026e3a07ff12207 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/python.py @@ -0,0 +1,19 @@ +"""For backwards compatibility.""" + +from typing import Any + +from langchain_classic._api import create_importer + +# Code has been removed from the community package as well. +# We'll proxy to community package, which will raise an appropriate exception, +# but we'll not include this in __all__, so it won't be listed as importable. + +_importer = create_importer( + __package__, + deprecated_lookups={"PythonREPL": "langchain_community.utilities.python"}, +) + + +def __getattr__(name: str) -> Any: + """Look up attributes dynamically.""" + return _importer(name) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/requests.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/requests.py new file mode 100644 index 0000000000000000000000000000000000000000..6cb1352bfa61ba04b35763531c17471c8b573c86 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/requests.py @@ -0,0 +1,35 @@ +"""DEPRECATED: Kept for backwards compatibility.""" + +from typing import TYPE_CHECKING, Any + +from langchain_classic._api import create_importer + +if TYPE_CHECKING: + from langchain_community.utilities import ( + Requests, + RequestsWrapper, + TextRequestsWrapper, + ) + +# Create a way to dynamically look up deprecated imports. +# Used to consolidate logic for raising deprecation warnings and +# handling optional imports. +DEPRECATED_LOOKUP = { + "Requests": "langchain_community.utilities", + "RequestsWrapper": "langchain_community.utilities", + "TextRequestsWrapper": "langchain_community.utilities", +} + +_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP) + + +def __getattr__(name: str) -> Any: + """Look up attributes dynamically.""" + return _import_attribute(name) + + +__all__ = [ + "Requests", + "RequestsWrapper", + "TextRequestsWrapper", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/serpapi.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/serpapi.py new file mode 100644 index 0000000000000000000000000000000000000000..5f0b0458b5d7b4239ceb0ea175b8c646f9eedd17 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/serpapi.py @@ -0,0 +1,25 @@ +"""For backwards compatibility.""" + +from typing import TYPE_CHECKING, Any + +from langchain_classic._api import create_importer + +if TYPE_CHECKING: + from langchain_community.utilities import SerpAPIWrapper + +# Create a way to dynamically look up deprecated imports. +# Used to consolidate logic for raising deprecation warnings and +# handling optional imports. +DEPRECATED_LOOKUP = {"SerpAPIWrapper": "langchain_community.utilities"} + +_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP) + + +def __getattr__(name: str) -> Any: + """Look up attributes dynamically.""" + return _import_attribute(name) + + +__all__ = [ + "SerpAPIWrapper", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/sql_database.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/sql_database.py new file mode 100644 index 0000000000000000000000000000000000000000..1c9d3281836ffcaf0635258dc005b5c2a038482d --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/sql_database.py @@ -0,0 +1,25 @@ +"""Keep here for backwards compatibility.""" + +from typing import TYPE_CHECKING, Any + +from langchain_classic._api import create_importer + +if TYPE_CHECKING: + from langchain_community.utilities import SQLDatabase + +# Create a way to dynamically look up deprecated imports. +# Used to consolidate logic for raising deprecation warnings and +# handling optional imports. +DEPRECATED_LOOKUP = {"SQLDatabase": "langchain_community.utilities"} + +_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP) + + +def __getattr__(name: str) -> Any: + """Look up attributes dynamically.""" + return _import_attribute(name) + + +__all__ = [ + "SQLDatabase", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/text_splitter.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/text_splitter.py new file mode 100644 index 0000000000000000000000000000000000000000..039140b08d159f0db8d3cb7e26d012675e0560ff --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_classic/text_splitter.py @@ -0,0 +1,50 @@ +"""Kept for backwards compatibility.""" + +from langchain_text_splitters import ( + Language, + RecursiveCharacterTextSplitter, + TextSplitter, + Tokenizer, + TokenTextSplitter, +) +from langchain_text_splitters.base import split_text_on_tokens +from langchain_text_splitters.character import CharacterTextSplitter +from langchain_text_splitters.html import ElementType, HTMLHeaderTextSplitter +from langchain_text_splitters.json import RecursiveJsonSplitter +from langchain_text_splitters.konlpy import KonlpyTextSplitter +from langchain_text_splitters.latex import LatexTextSplitter +from langchain_text_splitters.markdown import ( + HeaderType, + LineType, + MarkdownHeaderTextSplitter, + MarkdownTextSplitter, +) +from langchain_text_splitters.nltk import NLTKTextSplitter +from langchain_text_splitters.python import PythonCodeTextSplitter +from langchain_text_splitters.sentence_transformers import ( + SentenceTransformersTokenTextSplitter, +) +from langchain_text_splitters.spacy import SpacyTextSplitter + +__all__ = [ + "CharacterTextSplitter", + "ElementType", + "HTMLHeaderTextSplitter", + "HeaderType", + "KonlpyTextSplitter", + "Language", + "LatexTextSplitter", + "LineType", + "MarkdownHeaderTextSplitter", + "MarkdownTextSplitter", + "NLTKTextSplitter", + "PythonCodeTextSplitter", + "RecursiveCharacterTextSplitter", + "RecursiveJsonSplitter", + "SentenceTransformersTokenTextSplitter", + "SpacyTextSplitter", + "TextSplitter", + "TokenTextSplitter", + "Tokenizer", + "split_text_on_tokens", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..cbd83a729d6d77b28eee57298e416c54f04a4555 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/METADATA @@ -0,0 +1,62 @@ +Metadata-Version: 2.1 +Name: langchain-community +Version: 0.4.1 +Summary: Community contributed LangChain integrations. +License: MIT +Project-URL: Source Code, https://github.com/langchain-ai/langchain-community/tree/main/libs/community +Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-community%3D%3D0%22&expanded=true +Project-URL: repository, https://github.com/langchain-ai/langchain-community +Requires-Python: <4.0.0,>=3.10.0 +Requires-Dist: langchain-core<2.0.0,>=1.0.1 +Requires-Dist: langchain-classic<2.0.0,>=1.0.0 +Requires-Dist: SQLAlchemy<3.0.0,>=1.4.0 +Requires-Dist: requests<3.0.0,>=2.32.5 +Requires-Dist: PyYAML<7.0.0,>=5.3.0 +Requires-Dist: aiohttp<4.0.0,>=3.8.3 +Requires-Dist: tenacity!=8.4.0,<10.0.0,>=8.1.0 +Requires-Dist: dataclasses-json<0.7.0,>=0.6.7 +Requires-Dist: pydantic-settings<3.0.0,>=2.10.1 +Requires-Dist: langsmith<1.0.0,>=0.1.125 +Requires-Dist: httpx-sse<1.0.0,>=0.4.0 +Requires-Dist: numpy>=1.26.2; python_version < "3.13" +Requires-Dist: numpy>=2.1.0; python_version >= "3.13" +Description-Content-Type: text/markdown + +# 🦜️🧑‍🤝‍🧑 LangChain Community + +[![Downloads](https://static.pepy.tech/badge/langchain_community/month)](https://pepy.tech/project/langchain_community) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +## Quick Install + +```bash +pip install langchain-community +``` + +## What is it? + +LangChain Community contains third-party integrations that implement the base interfaces defined in LangChain Core, making them ready-to-use in any LangChain application. + +For full documentation see the [API reference](https://python.langchain.com/api_reference/community/index.html). + +![Diagram outlining the hierarchical organization of the LangChain framework, displaying the interconnected parts across multiple layers.](https://raw.githubusercontent.com/langchain-ai/langchain/master/docs/static/svg/langchain_stack_112024.svg "LangChain Framework Overview") + +## 📕 Releases & Versioning + +`langchain-community` is currently on version `0.0.x` + +All changes will be accompanied by a patch version increase. + +## 💁 Contributing + +As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation. + +For detailed information on how to contribute, see the [Contributing Guide](https://python.langchain.com/docs/contributing/). + +> [!NOTE] +> Contributing a new integration? LangChain has published a +[guide](https://python.langchain.com/docs/contributing/how_to/integrations/) on +implementing new `langchain-*` [integration packages](https://python.langchain.com/docs/concepts/architecture/#integration-packages) +and is recommending this in most cases to help decouple versioning and support +varied testing infrastructures. See [docs](https://python.langchain.com/docs/contributing/how_to/integrations/) +for details. diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..9380986730fabd50730059a51d8669ec9fe8eb26 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/RECORD @@ -0,0 +1,2502 @@ +langchain_community-0.4.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +langchain_community-0.4.1.dist-info/METADATA,sha256=S0xnnil61u6heXnwFXU4-xj0JLXMVOK0iRMXXffbrlQ,2989 +langchain_community-0.4.1.dist-info/RECORD,, +langchain_community-0.4.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community-0.4.1.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90 +langchain_community-0.4.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34 +langchain_community/__init__.py,sha256=7oakgfTwsJJz0D5Sso_XKXkUzfLdN3fyVwgMTncms-A,308 +langchain_community/__pycache__/__init__.cpython-311.pyc,, +langchain_community/__pycache__/cache.cpython-311.pyc,, +langchain_community/adapters/__init__.py,sha256=-R6nHD5gjBsGkWsN3YYq8KD-t3_B4a6AlajW08BIgzw,336 +langchain_community/adapters/__pycache__/__init__.cpython-311.pyc,, +langchain_community/adapters/__pycache__/openai.cpython-311.pyc,, +langchain_community/adapters/openai.py,sha256=Kbojw0RC6EFcjWaoUBVFzjYIutApMQmRi5fKJj00bew,12922 +langchain_community/agent_toolkits/__init__.py,sha256=VPY2OClA4Dn6i6h71JRmW7C8xfts-3OyrtSPr1kZcU4,6458 +langchain_community/agent_toolkits/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/__pycache__/azure_ai_services.cpython-311.pyc,, +langchain_community/agent_toolkits/__pycache__/azure_cognitive_services.cpython-311.pyc,, +langchain_community/agent_toolkits/__pycache__/base.cpython-311.pyc,, +langchain_community/agent_toolkits/__pycache__/load_tools.cpython-311.pyc,, +langchain_community/agent_toolkits/ainetwork/__init__.py,sha256=henfKntuAEjG1KoN-Hk1IHy3fFGCYPWLEuZtF2bIdZI,25 +langchain_community/agent_toolkits/ainetwork/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/ainetwork/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/ainetwork/toolkit.py,sha256=8G2sf4EQte65kRI4MZoCc3JIiRCNe7b48gjKrpzVkiA,2353 +langchain_community/agent_toolkits/amadeus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/agent_toolkits/amadeus/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/amadeus/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/amadeus/toolkit.py,sha256=5hyI08MBHotyQyLyElb6m0eHd_B3mIy0ogQpebkjmlk,1216 +langchain_community/agent_toolkits/azure_ai_services.py,sha256=4IJ0gcdIfbAP_aAcU-MqDF93nUMs395XELw0wCg3d-M,1017 +langchain_community/agent_toolkits/azure_cognitive_services.py,sha256=GfsWlwt-o_Licrz2m3auKf5DiH-GiyCkoQWcBGZsIrY,1151 +langchain_community/agent_toolkits/base.py,sha256=U1oDa9k0G3AMuxTwn23GCOz7jEkk4RsXqdVSV9Ws168,105 +langchain_community/agent_toolkits/cassandra_database/__init__.py,sha256=mnEWQLxug_Q7-0JkkU7Sb9Ly3u5ilj7irfOSrndLzeA,32 +langchain_community/agent_toolkits/cassandra_database/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/cassandra_database/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/cassandra_database/toolkit.py,sha256=INajyxsPenKYdieGNroAGvIDC8OVSNPdy8eVLUJUqCI,1071 +langchain_community/agent_toolkits/clickup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/agent_toolkits/clickup/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/clickup/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/clickup/toolkit.py,sha256=IekDd2YeZpCJlw9jQ7fvpPmSrzZxsefV_YlcL40DPcQ,3934 +langchain_community/agent_toolkits/cogniswitch/__init__.py,sha256=ecSDIo4zTVOMcOkRfj29tI79F-a-e9bMco9A9S2K9S8,26 +langchain_community/agent_toolkits/cogniswitch/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/cogniswitch/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/cogniswitch/toolkit.py,sha256=Tdiaq3__WFOoR_loVCDXqxKEcwrVhtesJ8R-2I2DR2M,1409 +langchain_community/agent_toolkits/connery/__init__.py,sha256=PQ_pr_sw9X0etlSMcIyN35HG8f4j0egiHpygDeIwSBo,116 +langchain_community/agent_toolkits/connery/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/connery/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/connery/toolkit.py,sha256=xnoF0FTKhUhgwZ9pHCapFA8HtlsHpXGqkuYCPv3BjKg,1600 +langchain_community/agent_toolkits/csv/__init__.py,sha256=nxqqnFzM48gemXmWUZc7mWjuwdiDRzF215ftoGU6qro,1091 +langchain_community/agent_toolkits/csv/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/file_management/__init__.py,sha256=kfHhPFslutoeZEeLXecxpBFmVPvaDleY4mQCwau4pJ4,177 +langchain_community/agent_toolkits/file_management/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/file_management/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/file_management/toolkit.py,sha256=qOK3o8wXR8ZBtYzw6Tz1QpEZFShYpuh6yWgut4wH7fU,3537 +langchain_community/agent_toolkits/financial_datasets/__init__.py,sha256=smx0iD6J7MmZlB_07avEFetrplVaGafadTR1721jcxg,34 +langchain_community/agent_toolkits/financial_datasets/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/financial_datasets/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/financial_datasets/toolkit.py,sha256=-NbvbZ7nOFTb48Hob7R2KWHmOmN919J8KIJVlUm_-jc,1377 +langchain_community/agent_toolkits/github/__init__.py,sha256=FBxQxsk8O9n4TXCZXHQW_-011pdVK3_3dN-yeLGPQjE,22 +langchain_community/agent_toolkits/github/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/github/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/github/toolkit.py,sha256=uePxVIxe7dCVp7nqUz4gCTSvKIGysJq67Fi5YX8QAoI,15557 +langchain_community/agent_toolkits/gitlab/__init__.py,sha256=x1DYZ-uaP3BvHsoZs21RxdktQ9292mYBP-tR3tG0h3U,22 +langchain_community/agent_toolkits/gitlab/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/gitlab/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/gitlab/toolkit.py,sha256=QmEZiSgen5LuII2paKL5vHCgYjOvfKcnr1ag95oCy_E,5331 +langchain_community/agent_toolkits/gmail/__init__.py,sha256=0Y2P1d5UFysfWDxwUmb98JLCYNHoQBs1GnxynWGSRz8,21 +langchain_community/agent_toolkits/gmail/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/gmail/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/gmail/toolkit.py,sha256=2uprrtN2q1MYNVdUpSJlb7QbZvbnDWZrAzBgZghe44M,5015 +langchain_community/agent_toolkits/jira/__init__.py,sha256=g7l8EPCXUddP-_AiO9huERcC_x2kD-dfroYmUe8O8I0,20 +langchain_community/agent_toolkits/jira/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/jira/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/jira/toolkit.py,sha256=ecVMzuxpaUHacOY3s2xHIHoQVQ2McjzQWJXuIEMEunU,2542 +langchain_community/agent_toolkits/json/__init__.py,sha256=T7Z9zw9_awf5-r0kExvry2aybzxEnpDb5SyLOpBC2d0,18 +langchain_community/agent_toolkits/json/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/json/__pycache__/base.cpython-311.pyc,, +langchain_community/agent_toolkits/json/__pycache__/prompt.cpython-311.pyc,, +langchain_community/agent_toolkits/json/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/json/base.py,sha256=pUhkLZuLjNG__CKTXjdMGBB-afB-CwQoLno4e7pc9fo,2605 +langchain_community/agent_toolkits/json/prompt.py,sha256=NS0r8BfnTkdlJpudJOxHRPh618F84L5Sf_LcgpIf53Y,1819 +langchain_community/agent_toolkits/json/toolkit.py,sha256=fMYA7a4S55iVGAahcX1-LHG6O7z1zQ-1eoGZBwFgL08,628 +langchain_community/agent_toolkits/load_tools.py,sha256=kLGb0QPFliEj2-WXy8JD61vGggbM3Un1rYp-CSmJ3f4,30042 +langchain_community/agent_toolkits/multion/__init__.py,sha256=hc75Ek8tmBDf4f34RGwQ447AzE5qHR-HZACB7Di3YAA,23 +langchain_community/agent_toolkits/multion/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/multion/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/multion/toolkit.py,sha256=JeBuCFULvDP1IJ9tgTkMQ-IdAi-2FvtW-O5NyeA3TDk,1191 +langchain_community/agent_toolkits/nasa/__init__.py,sha256=_g1obC4mS4XeMYhkcNw32uIe7mGPChqhOYMj170Pjp0,19 +langchain_community/agent_toolkits/nasa/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/nasa/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/nasa/toolkit.py,sha256=C4NY_4zukBxmPJeTWLvuhHFA4dnc1ZpMhdgaEL6rSv4,2044 +langchain_community/agent_toolkits/nla/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/agent_toolkits/nla/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/nla/__pycache__/tool.cpython-311.pyc,, +langchain_community/agent_toolkits/nla/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/nla/tool.py,sha256=6IRx3Ll5PcafQqRfa_bpV6QPx0Um7ud5u0og_VgmbWA,2683 +langchain_community/agent_toolkits/nla/toolkit.py,sha256=M5mU1GmDhSh9y6Jyi4KHG6MXhzqj8PRLyjrTemaFTKQ,4869 +langchain_community/agent_toolkits/office365/__init__.py,sha256=wdPaHFsDOXYsITlWPe2RtHIxFRP2CdbQHIOG1GeEcLs,25 +langchain_community/agent_toolkits/office365/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/office365/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/office365/toolkit.py,sha256=mgkgP4YnK5PUt_Y5ce_kSsaVCF8AghwdW2Dnho8aITU,1858 +langchain_community/agent_toolkits/openapi/__init__.py,sha256=b7ELUVFz_v756WQLXBUtR1mbaXGrKr3tdAroWCsWGm4,26 +langchain_community/agent_toolkits/openapi/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/__pycache__/base.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/__pycache__/planner.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/__pycache__/planner_prompt.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/__pycache__/prompt.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/__pycache__/spec.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/openapi/base.py,sha256=oi6wEKbSbifg67OPk-deEsan8ZG80_SNPC4luyKhjnE,4054 +langchain_community/agent_toolkits/openapi/planner.py,sha256=HoE3NvNpG79DsS7GdelYF3POU84Cv1drlJlFThbwZKk,16486 +langchain_community/agent_toolkits/openapi/planner_prompt.py,sha256=4QjRM5SOJJIrxzaGZ512m9yFObjPNo7VPB03yM3V38U,11684 +langchain_community/agent_toolkits/openapi/prompt.py,sha256=RPjJhjEBLbKl07NiezJBr8dFSNVFkJBdplRa4rtB4DA,1770 +langchain_community/agent_toolkits/openapi/spec.py,sha256=-BDKZC5CnVCOq__ASh94C7nzCSwfZ7INB4cmoMVGEjI,2739 +langchain_community/agent_toolkits/openapi/toolkit.py,sha256=NG6yNwuNpPucP13frkNplwo69eGeDd9x-Wf1WKNDbZw,9066 +langchain_community/agent_toolkits/playwright/__init__.py,sha256=bflOTbL7cibBE3f0dkune4aCFQMCWy-B0U_sgc9zMJo,175 +langchain_community/agent_toolkits/playwright/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/playwright/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/playwright/toolkit.py,sha256=qoUMkNxIKGF--67VZ4flsE1K4qLRYXIkWWZndH3ZvCQ,4571 +langchain_community/agent_toolkits/polygon/__init__.py,sha256=Xe5unF5fXwGOJSQm0lQ9grdhVU5X2m_2xXZtgCIsJCA,22 +langchain_community/agent_toolkits/polygon/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/polygon/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/polygon/toolkit.py,sha256=nvEPMbcxR50TbzlWFaFe7OlvhNd4OPDiSzkhnPnFe_U,1421 +langchain_community/agent_toolkits/powerbi/__init__.py,sha256=9KrYrWCcuVyxlBBLCke09XngnFsFodfInQSW7XVXys4,22 +langchain_community/agent_toolkits/powerbi/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/powerbi/__pycache__/base.cpython-311.pyc,, +langchain_community/agent_toolkits/powerbi/__pycache__/chat_base.cpython-311.pyc,, +langchain_community/agent_toolkits/powerbi/__pycache__/prompt.cpython-311.pyc,, +langchain_community/agent_toolkits/powerbi/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/powerbi/base.py,sha256=Ikdp0kEgodmb3ZYrhRB8E8yBiuQMR3cQ6NG4efyybT0,3539 +langchain_community/agent_toolkits/powerbi/chat_base.py,sha256=6Dx2OoCd5WVQeRZImXUHc6DVC_OXS2IJvwDFAsbmwYs,3751 +langchain_community/agent_toolkits/powerbi/prompt.py,sha256=IJ-YlqPuOxMIvW5WVuOpQMIICn7MIYZLNt3crV04avk,2772 +langchain_community/agent_toolkits/powerbi/toolkit.py,sha256=YajPaxp16yNIVf66qVumJPSsqrQ6U-W7W8KtVn8mgJk,4190 +langchain_community/agent_toolkits/slack/__init__.py,sha256=6Z7GpcJD6FwuFKdcvKJvIfhFvJiiy9I7Gc1MSEKJlcw,21 +langchain_community/agent_toolkits/slack/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/slack/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/slack/toolkit.py,sha256=7n7n2-_zez4SxWMcwLT7ONhOJO8c9Zv4PR0dIfsR_xY,3655 +langchain_community/agent_toolkits/spark_sql/__init__.py,sha256=3IVQbSsdtLKybKYDE0VSq-SCTNFSAJNgCzaJWnSWJbg,23 +langchain_community/agent_toolkits/spark_sql/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/spark_sql/__pycache__/base.cpython-311.pyc,, +langchain_community/agent_toolkits/spark_sql/__pycache__/prompt.cpython-311.pyc,, +langchain_community/agent_toolkits/spark_sql/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/spark_sql/base.py,sha256=rP9KDVt-S4w3QpTlEPaRHAVmfOGREXHvzs9XgL3BjKo,3541 +langchain_community/agent_toolkits/spark_sql/prompt.py,sha256=YcyzW_RymQ7_kcU-9wTPfF9Iw3DgvzVnDBF-HRGVGYg,1202 +langchain_community/agent_toolkits/spark_sql/toolkit.py,sha256=w3BgQ6YTerfQNvAHg0gV4CXrq9hCW1IDxFYEkxoRiXE,1143 +langchain_community/agent_toolkits/sql/__init__.py,sha256=eqqu9Hd5KiY9-04X2_9acILI2bShgSqNxJFsQ7cm9Dw,17 +langchain_community/agent_toolkits/sql/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/sql/__pycache__/base.cpython-311.pyc,, +langchain_community/agent_toolkits/sql/__pycache__/prompt.cpython-311.pyc,, +langchain_community/agent_toolkits/sql/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/sql/base.py,sha256=Gnq7sJAtebJjCgqLGItjvnOGqyWx2IGqsKAHeTdPWgY,9518 +langchain_community/agent_toolkits/sql/prompt.py,sha256=RJ0vcjEAkqrfJxo8X9gnCzl0Sk_NekVL65OsF-3yhQo,1428 +langchain_community/agent_toolkits/sql/toolkit.py,sha256=m0bdy3ndRlB4wYWS_fHKjo3X_1Oufk-vpwjXH4UCAgQ,4952 +langchain_community/agent_toolkits/steam/__init__.py,sha256=iOMgxWCt0FTNLMNq0wScgSN_YdBBq-56VM6j0Ud8GpI,21 +langchain_community/agent_toolkits/steam/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/steam/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/steam/toolkit.py,sha256=TWpCnkBX3mZOD4_yFOr-2jwr2uFiw0zJSCH4CgBi5as,1803 +langchain_community/agent_toolkits/xorbits/__init__.py,sha256=LJ-yZ3UKg4vjibzbgMXocR03vcsU_7ZvU7TlScM9RlE,1095 +langchain_community/agent_toolkits/xorbits/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/zapier/__init__.py,sha256=19Hc7HG8DzQfg83qqEbYiXA5FklLoRAEOfIs9JqTjX8,22 +langchain_community/agent_toolkits/zapier/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agent_toolkits/zapier/__pycache__/toolkit.cpython-311.pyc,, +langchain_community/agent_toolkits/zapier/toolkit.py,sha256=GvQU7rkIQI2-oYWHUzcn35l8jyHcabMgn3U64DWVAfQ,2406 +langchain_community/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/agents/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agents/openai_assistant/__init__.py,sha256=O2-R-HDb4oc2i0_YXggL535xTd9EHlYZEiD2lmxNqcY,128 +langchain_community/agents/openai_assistant/__pycache__/__init__.cpython-311.pyc,, +langchain_community/agents/openai_assistant/__pycache__/base.cpython-311.pyc,, +langchain_community/agents/openai_assistant/base.py,sha256=41i_P_gTkfNcazfia9B5XdNnJID4SBhxzGrhDWz7Rqo,24451 +langchain_community/cache.py,sha256=yu2uFamT0Tk2M8Xdw4LkGratQw4GbrhyNOiNGqirKI4,109814 +langchain_community/callbacks/__init__.py,sha256=fjw-V-qyOiEqrK1veAWnd92gdgj2h01esXVc5euC6eo,6043 +langchain_community/callbacks/__pycache__/__init__.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/aim_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/argilla_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/arize_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/arthur_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/bedrock_anthropic_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/clearml_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/comet_ml_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/confident_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/context_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/fiddler_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/flyte_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/human.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/infino_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/labelstudio_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/llmonitor_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/manager.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/mlflow_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/openai_info.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/promptlayer_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/sagemaker_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/trubrics_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/upstash_ratelimit_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/uptrain_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/utils.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/wandb_callback.cpython-311.pyc,, +langchain_community/callbacks/__pycache__/whylabs_callback.cpython-311.pyc,, +langchain_community/callbacks/aim_callback.py,sha256=dkcwq7oYPKjB_tD1cWjLa-E6rw6wf-XQg5kfinGddYc,14597 +langchain_community/callbacks/argilla_callback.py,sha256=WhMG8tbKdqooowXwQ1nGOTKfbLRqDCCLinXs4fDKKZw,14738 +langchain_community/callbacks/arize_callback.py,sha256=oe-w_R42K1D_ab2CcGbp3LRURRUJNWPaVVruJRw7MGQ,7480 +langchain_community/callbacks/arthur_callback.py,sha256=6yAGbCfgeyZqdL02f3SEEvk7pBHPsoK8es0uuGTd-Ts,11243 +langchain_community/callbacks/bedrock_anthropic_callback.py,sha256=8fOkCpcwitSIibNEgeKEGwkY5dTYYiN9AgsZ1HHBqXg,5234 +langchain_community/callbacks/clearml_callback.py,sha256=xq9EewLvZnYN3xM_4JWZMA7ONSStReNF-hMD6tve7Zo,18620 +langchain_community/callbacks/comet_ml_callback.py,sha256=Zeoyg8uTgAYgxDmxbehSkRGpjiQSi_OTC0DyPFcZAW8,22961 +langchain_community/callbacks/confident_callback.py,sha256=LcZjFPdSAbyyk0Q6k4Z1G_hhwKcH6KS_dY8mmDBYxds,6382 +langchain_community/callbacks/context_callback.py,sha256=eb03MuoD-L1BFU9d0OSqzP8MNmFM-xN48EKegtA8oJA,6504 +langchain_community/callbacks/fiddler_callback.py,sha256=f4lqtHCn-VsgZzXbyqbqeAK3kq9RXPBgk6pCv0TMcvQ,11427 +langchain_community/callbacks/flyte_callback.py,sha256=LuFz9hXm_u5hoz3G3RM5nqEQaykbgoiysUaXw2m8EXU,12755 +langchain_community/callbacks/human.py,sha256=RbSomRXDMuYE-EbYWubRKbs9hZ39m_9BASJfaBS4zRU,2587 +langchain_community/callbacks/infino_callback.py,sha256=lT727jUQ4s_MrONdR-wbGK51UZ9TRUsOiIxJVDsANe0,8764 +langchain_community/callbacks/labelstudio_callback.py,sha256=V6c4isSRg1CQNZMtmwQH-elC1Flk8NL1RB92lO2XBwY,13879 +langchain_community/callbacks/llmonitor_callback.py,sha256=YuqZ1dFUYrLNDKrJnXTUvPJHDTz8AJQLiqtOGO7irJc,20555 +langchain_community/callbacks/manager.py,sha256=hligt3ka6phOoE7qGdyfkq6IDdip-wV0RMwBGawmTas,3185 +langchain_community/callbacks/mlflow_callback.py,sha256=LxkHQzYcbXV1s90VHNTK5ZOlOsgQnif_EhAx2XJNv_w,27392 +langchain_community/callbacks/openai_info.py,sha256=pNWbhYFvP2D5wZTHoDtvoYamcZvOmYY5N7cCOY1gXMk,20584 +langchain_community/callbacks/promptlayer_callback.py,sha256=LqjabEfCxvlyl-FnxdmCC0Ux5Bz8ijSd_W8rFiSMksk,5536 +langchain_community/callbacks/sagemaker_callback.py,sha256=7n9tC-bRGEIcbdrSvAPD4kssQUvTldnwbTPt4Q9IdAg,8787 +langchain_community/callbacks/streamlit/__init__.py,sha256=0swQo328EzGKysQApexlvvefE0L2K4eI88EqcFZhjIs,3183 +langchain_community/callbacks/streamlit/__pycache__/__init__.cpython-311.pyc,, +langchain_community/callbacks/streamlit/__pycache__/mutable_expander.cpython-311.pyc,, +langchain_community/callbacks/streamlit/__pycache__/streamlit_callback_handler.cpython-311.pyc,, +langchain_community/callbacks/streamlit/mutable_expander.py,sha256=74VHeBaD2ewp9bh1-4bQ3GpXvUF4JWPdYl6Lf6bgpCc,5395 +langchain_community/callbacks/streamlit/streamlit_callback_handler.py,sha256=84HOsLDk07_je2Uo_d3Jm5LTFhyd6HJkm8mly5qFBOw,15616 +langchain_community/callbacks/tracers/__init__.py,sha256=tiFFHqyjXs8OWNIDmbxM8LXcSGGYlzA4O7InSqBHY4c,407 +langchain_community/callbacks/tracers/__pycache__/__init__.cpython-311.pyc,, +langchain_community/callbacks/tracers/__pycache__/comet.cpython-311.pyc,, +langchain_community/callbacks/tracers/__pycache__/wandb.cpython-311.pyc,, +langchain_community/callbacks/tracers/comet.py,sha256=zlUBzzdUaRFN7o63jQDBjH5hdvgKrBD7Vao1txbNs-M,4615 +langchain_community/callbacks/tracers/wandb.py,sha256=0sw6gKgPfvOnSDYCCbts8b_NTEE_huPETaEUPWgOltw,18341 +langchain_community/callbacks/trubrics_callback.py,sha256=vllJRiwUwJqKNY7-VNcvTskMrRGYINTXnRJ7TZOAQ4U,4526 +langchain_community/callbacks/upstash_ratelimit_callback.py,sha256=tIdOIykAICaqonqoRGB4Sh2nfrm7z9blGmEGWOP64ow,7570 +langchain_community/callbacks/uptrain_callback.py,sha256=D4JCfP85Zdw1Qk7yB3XdbleadvjmiYfq0HDWU7TNBhc,14532 +langchain_community/callbacks/utils.py,sha256=q7GcdOwgqIKFxWWAMx5CfxwtBJ2heQhPTZOLBYFZapI,7879 +langchain_community/callbacks/wandb_callback.py,sha256=FjFx94Q38AgidwlOS9c_LxGGOJPIHtgmvSrDHiliMa4,21164 +langchain_community/callbacks/whylabs_callback.py,sha256=ZYx00gC0if7BX1GHB7zBbbFCXWWcaVqGXW5gObHH9ns,7881 +langchain_community/chains/__init__.py,sha256=mOJ-SmMO-GQ1Jk3UgMfD2h_U6f5DFikpEZt6z2qsfZs,618 +langchain_community/chains/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chains/__pycache__/llm_requests.cpython-311.pyc,, +langchain_community/chains/ernie_functions/__init__.py,sha256=j0ZRfzFTviUox1MXjB95fyUSl56TIf40YKEPYOBL7qw,473 +langchain_community/chains/ernie_functions/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chains/ernie_functions/__pycache__/base.cpython-311.pyc,, +langchain_community/chains/ernie_functions/base.py,sha256=Vr2DWsT9lcxx8nhOZ3DHoSOf_3RQuKBFtdff3nQUvnA,23306 +langchain_community/chains/graph_qa/__init__.py,sha256=42PVlGI3l9gze7kEp9PVGJyMoHoo4IdozzrKCT_W_uM,49 +langchain_community/chains/graph_qa/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/arangodb.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/base.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/cypher.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/cypher_utils.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/falkordb.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/gremlin.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/hugegraph.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/kuzu.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/memgraph.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/nebulagraph.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/neptune_cypher.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/neptune_sparql.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/ontotext_graphdb.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/prompts.cpython-311.pyc,, +langchain_community/chains/graph_qa/__pycache__/sparql.cpython-311.pyc,, +langchain_community/chains/graph_qa/arangodb.py,sha256=ZZ9nGqQ0deZ0WBrniwrcB9Ls-MbekhEXBd75j5UvH5Y,10112 +langchain_community/chains/graph_qa/base.py,sha256=qvosdnFZJLZnOxhiKDSEF19d_FynlMNEbVoYCAOEzfg,3698 +langchain_community/chains/graph_qa/cypher.py,sha256=1BHQ1qPIXYTmmsoXtG9XJUsdptajQA3K19CWOKK7VmQ,15678 +langchain_community/chains/graph_qa/cypher_utils.py,sha256=RR7-3SzgXOaXa8YhsNw25FjiORJC9sR2u26YZ84dODs,9826 +langchain_community/chains/graph_qa/falkordb.py,sha256=c22WH1K39kIMhTr7fWFQop_l3wRwv2Vq0l5UzBgMJgM,7000 +langchain_community/chains/graph_qa/gremlin.py,sha256=xHZjxvNgOxc5nGrOmuscHfXysPAAG-OA5dqpQS9NLh4,9523 +langchain_community/chains/graph_qa/hugegraph.py,sha256=ZBM1_N59dmeg0q5HvNk-npGEJ_pIAeMGi2dyQK3fMJQ,5432 +langchain_community/chains/graph_qa/kuzu.py,sha256=NTC1rveHc109szz9bONL2ROrPGyG_Q3UeJvGy9nxAzo,7221 +langchain_community/chains/graph_qa/memgraph.py,sha256=zk7BOWVgFgrvfoq7yzmdQKMFLqllTpmngvjc7e7AaoM,12045 +langchain_community/chains/graph_qa/nebulagraph.py,sha256=P933pOwgD_NIU0rVNXRxgFcSJ6hMk1N7zUG_zkRSKEM,5420 +langchain_community/chains/graph_qa/neptune_cypher.py,sha256=duzXabs5_ht-Lf4I87OzOfCmNAWeWnxmnrrYyFNAZlI,8802 +langchain_community/chains/graph_qa/neptune_sparql.py,sha256=pKn0kKMmEIcyReMAxOhfreXcUwKlBIAjpI6TFduUHJ8,8677 +langchain_community/chains/graph_qa/ontotext_graphdb.py,sha256=H1izAtOeVngYymNkipeU0meGufaBPU2Y9HFfEsA3j7U,8902 +langchain_community/chains/graph_qa/prompts.py,sha256=yY226i8rVWBdxsC9OYXMAmrSIQwczN7EXeYS8fkquWY,19061 +langchain_community/chains/graph_qa/sparql.py,sha256=kPHAlrKrUfFrupxB0jWlyLQ4V1kIA8JNHlthwzYewLM,7553 +langchain_community/chains/llm_requests.py,sha256=3aXkEMMv5v4c9mh9d2xn4TLOpreIyDS9aoGKfiTmciw,3212 +langchain_community/chains/natbot/__init__.py,sha256=hUrO8T-tqSv5fztUA9xPo4OKBQO65TJViRpe9YbqctA,187 +langchain_community/chains/natbot/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chains/natbot/__pycache__/base.cpython-311.pyc,, +langchain_community/chains/natbot/__pycache__/crawler.cpython-311.pyc,, +langchain_community/chains/natbot/__pycache__/prompt.cpython-311.pyc,, +langchain_community/chains/natbot/base.py,sha256=QLwjw-XtjwTa0M7pxQ0ovlWPjUS3ashDQsDBqLLlYr8,76 +langchain_community/chains/natbot/crawler.py,sha256=bPHIqSIq0KOBAIQfvZVI7PUX-BsY25rxyw4Qt0QdhZo,188 +langchain_community/chains/natbot/prompt.py,sha256=WuXM1McGA_xzelOYwo1NR0LRCOBkx-HjhV4ILDfzjUU,80 +langchain_community/chains/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/chains/openapi/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chains/openapi/__pycache__/chain.cpython-311.pyc,, +langchain_community/chains/openapi/__pycache__/prompts.cpython-311.pyc,, +langchain_community/chains/openapi/__pycache__/requests_chain.cpython-311.pyc,, +langchain_community/chains/openapi/__pycache__/response_chain.cpython-311.pyc,, +langchain_community/chains/openapi/chain.py,sha256=_8xhGshITH9_FY57Q2_d3p3vIcAZP2u9-YclPqwC9M4,8808 +langchain_community/chains/openapi/prompts.py,sha256=4nNrzIYN1AR69B_NxH1DK2bt0sJgnlSFVdymNbCknK4,1791 +langchain_community/chains/openapi/requests_chain.py,sha256=eCvXDhn2n6otx5K_rvcG7Ik57ODPJkpy4-qOfMMFCLk,1990 +langchain_community/chains/openapi/response_chain.py,sha256=mus2hzvJRanHPO-OpQCnC515r0vEjzTL_aOdu8yBDss,1862 +langchain_community/chains/pebblo_retrieval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/chains/pebblo_retrieval/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chains/pebblo_retrieval/__pycache__/base.cpython-311.pyc,, +langchain_community/chains/pebblo_retrieval/__pycache__/enforcement_filters.cpython-311.pyc,, +langchain_community/chains/pebblo_retrieval/__pycache__/models.cpython-311.pyc,, +langchain_community/chains/pebblo_retrieval/__pycache__/utilities.cpython-311.pyc,, +langchain_community/chains/pebblo_retrieval/base.py,sha256=vbGT1pIM26sFh9E3AwXMKh0NWpf1qa71dV3u3tWD2vU,12922 +langchain_community/chains/pebblo_retrieval/enforcement_filters.py,sha256=WV7sTapiACEZL7k1hkvmnrAJqhx7cieKA_kox2gWW7M,22368 +langchain_community/chains/pebblo_retrieval/models.py,sha256=gpCwc6tqgCZTFvltovu6KsXDPNNX0mBWBsNF5YJRkWk,3465 +langchain_community/chains/pebblo_retrieval/utilities.py,sha256=0zvWV2Ai4wPMBhIQG4nrwHIpVaSJe3biM7PZFsZzCBs,20378 +langchain_community/chat_loaders/__init__.py,sha256=sHlxQaGzJsSNIxzZvOepnSyY57wNOwNESgx3zUsdA5s,2708 +langchain_community/chat_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/base.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/facebook_messenger.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/gmail.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/imessage.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/langsmith.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/slack.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/telegram.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/utils.cpython-311.pyc,, +langchain_community/chat_loaders/__pycache__/whatsapp.cpython-311.pyc,, +langchain_community/chat_loaders/base.py,sha256=vTi948QJLHp8kjKFcycT0PX9sS1bNpSsPkDmk6WYRsI,85 +langchain_community/chat_loaders/facebook_messenger.py,sha256=R3cugFD60x_Q9C9Tpzbcyj_bYuI06oaVlKE_xyC2O5M,2540 +langchain_community/chat_loaders/gmail.py,sha256=iXKPZkKT1PVgDcrY3h9T28yGPu4L5EjQeZm2uGAh8XA,4211 +langchain_community/chat_loaders/imessage.py,sha256=lYe5AQN6GTp6zFAkS5K7UedOCCOrhDguA_wV55Px1tU,8118 +langchain_community/chat_loaders/langsmith.py,sha256=Tx3s5Xf_XbYMix-9JhWk0IHmAkK0e5AozO9aFIKBPJM,5734 +langchain_community/chat_loaders/slack.py,sha256=EbXnrig8jbjYoKlDPwgfxfmh4CigvlXK1uV--7HjNjE,3125 +langchain_community/chat_loaders/telegram.py,sha256=ztynfhxyhEj8dY4jQ5nA6iCakmxuXvwGGPAqCxGBvuM,5546 +langchain_community/chat_loaders/utils.py,sha256=oeUThLknL2TYTehEIuEw7X62qJIYLecQAxkmsfSlWCQ,3580 +langchain_community/chat_loaders/whatsapp.py,sha256=XizRECyos1L607xI830Hra5PMFUcrRk8TaLHkJjBmOY,4281 +langchain_community/chat_message_histories/__init__.py,sha256=ro2hz7Vg4DsNkQ00ngPu-j3wFmiNFP9CP7woQeKcAo0,6108 +langchain_community/chat_message_histories/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/astradb.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/cassandra.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/cosmos_db.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/dynamodb.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/file.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/firestore.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/in_memory.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/kafka.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/momento.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/mongodb.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/neo4j.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/postgres.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/redis.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/rocksetdb.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/singlestoredb.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/sql.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/streamlit.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/tidb.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/upstash_redis.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/xata.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/zep.cpython-311.pyc,, +langchain_community/chat_message_histories/__pycache__/zep_cloud.cpython-311.pyc,, +langchain_community/chat_message_histories/astradb.py,sha256=StITv2s6vMJXDqKAfSVfAVk9SCsIYpRNgK7TLiFdetw,5873 +langchain_community/chat_message_histories/cassandra.py,sha256=da37nE2rme6ku7jhzlgzNxT04oskZ9Rp0rf1ZDZ8YUs,4551 +langchain_community/chat_message_histories/cosmos_db.py,sha256=CZUUHOJEQGnqNSVyswOBdIcoXkpUDL8jYj_dYbV1k1U,6472 +langchain_community/chat_message_histories/dynamodb.py,sha256=juD-ab8uszQBlfVClZWWQMwYUcKZIfRs_eV1Y-4NwEE,7319 +langchain_community/chat_message_histories/elasticsearch.py,sha256=lcNw2teXZkwECk0Fj0J6-sEUo7ncKIcIMBjxcI6cu_I,7174 +langchain_community/chat_message_histories/file.py,sha256=d-jV_esCJ7aFUxhgjKnrgvHNJapRkLM85bLaNNlV7Rc,2029 +langchain_community/chat_message_histories/firestore.py,sha256=6UeX62u5R5JSz37ae17RlIXNPjmNHhV6dpIbk4akGxk,3350 +langchain_community/chat_message_histories/in_memory.py,sha256=yEw3IaYUR8CsQFx0IIUPE-OaSdMzRkk4uDSHhUJulvs,130 +langchain_community/chat_message_histories/kafka.py,sha256=qWEV9KCk4H-4cXol0wT-zlJeyavan0E1akOudZbD4-M,13589 +langchain_community/chat_message_histories/momento.py,sha256=ZF5mLaTw7bbwT5u14pgFe246YgvUvUrtRApJNr7qw9I,7112 +langchain_community/chat_message_histories/mongodb.py,sha256=i3qvYp8ww21PhCU1b6Gb9zpyEd3VThPAyN9LnkkoavI,3115 +langchain_community/chat_message_histories/neo4j.py,sha256=5nVSUoohUqvEDE3ACURtE0BRdgfC7o3AR9bhqum8Y4M,5305 +langchain_community/chat_message_histories/postgres.py,sha256=IDaMt5jattljLJXfkJjMmy-WbepIuzm3i8-OoBv5Zd8,3357 +langchain_community/chat_message_histories/redis.py,sha256=9mwsEL-VsNjVe9FGRj7O-qbJjp1_DP85jnB7yhv0_nI,3660 +langchain_community/chat_message_histories/rocksetdb.py,sha256=aFdg_Otov2vrP3J1CUtx5Ir_V3CGD9mUOs9FziDQbTY,9539 +langchain_community/chat_message_histories/singlestoredb.py,sha256=4q3OOJtauJaRo-JBT9271BXjXfvzmUpeobFsyrTCslc,10877 +langchain_community/chat_message_histories/sql.py,sha256=KGQ8XHAvk7XykmHbQsWz6m5AwowXtcLGLVyyb_lUmEY,13053 +langchain_community/chat_message_histories/streamlit.py,sha256=RC5NbXNdXY3MGRW7bBRhqE2ImGI1SLIfyoxMvC4-vJM,1444 +langchain_community/chat_message_histories/tidb.py,sha256=PbFLGSvCu_Y8MbG-6Y45la_Q86Ec4qhC2kPbsXxpYEY,5255 +langchain_community/chat_message_histories/upstash_redis.py,sha256=xC78X24q0AR0Z2Oj8mBEIfTTMw_UsRo1dfL0swjDOsk,2158 +langchain_community/chat_message_histories/xata.py,sha256=Xbw9vNHj3IaOQ-zhR3zVohr8fJ5wyyOwRx_VM4wjK3w,4649 +langchain_community/chat_message_histories/zep.py,sha256=AYvqIKFeUguW_dN-l2jb3-tvX6boNSyGJZtyFQX7Vkg,8920 +langchain_community/chat_message_histories/zep_cloud.py,sha256=dfWCZVPPHS6NjrotJNO8auaXkoCy9KEVLHzHGdJ1mzY,9842 +langchain_community/chat_models/__init__.py,sha256=fuJ8er9exd6iOSOdAMxnqCZlgZQzl_lkNW32OndUlow,11690 +langchain_community/chat_models/__pycache__/__init__.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/anthropic.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/anyscale.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/azure_openai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/azureml_endpoint.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/baichuan.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/baidu_qianfan_endpoint.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/bedrock.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/cloudflare_workersai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/cohere.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/coze.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/dappier.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/databricks.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/deepinfra.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/edenai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/ernie.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/everlyai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/fake.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/fireworks.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/friendli.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/gigachat.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/google_palm.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/gpt_router.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/huggingface.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/human.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/hunyuan.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/javelin_ai_gateway.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/jinachat.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/kinetica.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/konko.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/litellm.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/litellm_router.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/llama_edge.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/llamacpp.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/maritalk.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/meta.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/minimax.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/mlflow.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/mlflow_ai_gateway.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/mlx.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/moonshot.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/naver.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/oci_data_science.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/oci_generative_ai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/octoai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/ollama.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/openai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/outlines.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/pai_eas_endpoint.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/perplexity.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/premai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/promptlayer_openai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/reka.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/sambanova.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/snowflake.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/solar.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/sparkllm.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/symblai_nebula.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/tongyi.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/vertexai.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/volcengine_maas.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/writer.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/yandex.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/yi.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/yuan2.cpython-311.pyc,, +langchain_community/chat_models/__pycache__/zhipuai.cpython-311.pyc,, +langchain_community/chat_models/anthropic.py,sha256=XNbV4ePEwppEgcXm71DRn-xo0xjkmbXz_8zNYFCdLfI,8190 +langchain_community/chat_models/anyscale.py,sha256=C6qCNBZUKG2aGAMvL_9fClDOyGPTImzLMnd0M-wSrNk,8711 +langchain_community/chat_models/azure_openai.py,sha256=pfrcIdtcH99Yq58dsAk2N7xt1p9dbw_RBwahrKb1POk,11956 +langchain_community/chat_models/azureml_endpoint.py,sha256=0p7UwbnB3zLDsUAFA8a717XtQSRFN9Cu_3o2hWVrEiA,15615 +langchain_community/chat_models/baichuan.py,sha256=C0zJG1eI0G0xKxDTaR_Zi-3QjdZlCEug2pKk-jXA7Yg,22020 +langchain_community/chat_models/baidu_qianfan_endpoint.py,sha256=T6oEGZ30wnU2RgzXZ7RvdLgaMt4oVegW59HbE_XHSDo,33435 +langchain_community/chat_models/bedrock.py,sha256=NMaQ9m30Tn3tEvMOv_opHlIwEoSglqGeD6u0ORM2soM,10907 +langchain_community/chat_models/cloudflare_workersai.py,sha256=_4l4jBE-c1cnAlGryLjTSTBt21Nud5JRP1Q9Ycih1s8,9301 +langchain_community/chat_models/cohere.py,sha256=uG6Fvj6UPPLQOJEbCDl9qDGb-SzNPCF_Y1bVBzaNmm8,8187 +langchain_community/chat_models/coze.py,sha256=vV9dH-NB1NWDP-NtEB1tFZOQ3GMIXX54NoO4WtHG7xo,8492 +langchain_community/chat_models/dappier.py,sha256=u1ryNBQ89UZ9D6SyNk3cXsS48WA6OryQMDynzgoDflI,5373 +langchain_community/chat_models/databricks.py,sha256=po-i9IZovOGt7xK5zS0qRwerGOAX09wG8yOM747qYRw,1697 +langchain_community/chat_models/deepinfra.py,sha256=MPmGNN5XtBcSY6S8VyqoXncNtYYhx4XZC8mZhi3kcjs,19372 +langchain_community/chat_models/edenai.py,sha256=DX47xmCadlI0ApGUS6QKp6wrGQsZmMqKKmGJ1mrvWj4,22248 +langchain_community/chat_models/ernie.py,sha256=tzLddXOSavy6YiuR6wL5vnJ1FDt7KT34ID1LX9RyF4A,8052 +langchain_community/chat_models/everlyai.py,sha256=WNUiVH5rsV94EtcRHWyESWsibFyhcmTh6wYCYyeOuQM,6109 +langchain_community/chat_models/fake.py,sha256=j_3OgCvnEWWuCM4WBncI4OlpgQOFiArPPH6Vwl6-8FQ,3218 +langchain_community/chat_models/fireworks.py,sha256=nKvVJ6AuTRsUEwo5ncD6aH6ZjWbjE0st9w5kjiWOkDY,12082 +langchain_community/chat_models/friendli.py,sha256=WOMtK6BRpDhPLNBHJMjXyHBatkNDjOzBCBmkmKRNSv0,7134 +langchain_community/chat_models/gigachat.py,sha256=H3XYQDz2wj_Nm8Ct_YjCFsGZ55dMs7upd-4FIVW9MDc,9899 +langchain_community/chat_models/google_palm.py,sha256=YL0w2L_z2YwqP_p6l_hNxNBgZLKnVMGKYjEUP_A9xp0,11725 +langchain_community/chat_models/gpt_router.py,sha256=Whv7ECMNecqZtYPoQWwsYUY0WEkeh3aJkPqpS_vMOKA,13239 +langchain_community/chat_models/huggingface.py,sha256=RfbB8uYmVfvXZYaT7-FRhv6D8oydjb9P6tVB2sGZaKo,7887 +langchain_community/chat_models/human.py,sha256=mOANIfBqOKDF3ZbQNSk2qUkDpy9XdSD2eJISb_h1G80,3723 +langchain_community/chat_models/hunyuan.py,sha256=v4XCLk9mZJnmjC3jC_OislBRN-6RLnv2dY27gV0YmwM,9825 +langchain_community/chat_models/javelin_ai_gateway.py,sha256=zDI8BUCvSx8CPTNPV_5aRezy2npDs4YrxytiiWWtlkc,7718 +langchain_community/chat_models/jinachat.py,sha256=Kn16smcQx8pOMrU3OS9ke5I1b1spMl6krEWf9YZGjY0,15344 +langchain_community/chat_models/kinetica.py,sha256=cSlG-mVoqvysmKiZgrqRasuEwn-QoKc3R1dp26EPzJg,20200 +langchain_community/chat_models/konko.py,sha256=APRMYQFNVwct_EK3F_SgEkEEVZF2LenNhAGfT3AnSZ0,10027 +langchain_community/chat_models/litellm.py,sha256=G8YH-Fh2zMSRr78h7FiJXonETv2i4cHQ3WaxUv8ZUxM,23600 +langchain_community/chat_models/litellm_router.py,sha256=cLmNXJFyo_uuOg2_T98XO0cq1Pi9bRZjLIQDbyMcIM8,8879 +langchain_community/chat_models/llama_edge.py,sha256=vsgzGcS5_IJoXVU3xdbhkBNI1hMrvdYkatqr2SUdgu4,8596 +langchain_community/chat_models/llamacpp.py,sha256=Ituj9TRVJ0XArN-VvMgsR4sh8OHUOhOdU4n9eRwtr6I,31406 +langchain_community/chat_models/maritalk.py,sha256=fVkX8IMSYnDYrtIjBS0ylVrKr8NgLY-cijGFi3I7Bqw,13466 +langchain_community/chat_models/meta.py,sha256=VdmrYsuCfdVKQuzHXHne95_bk6ZaW3Vbra_iGybahwM,967 +langchain_community/chat_models/minimax.py,sha256=EyLYw-H2tL-Bc7VhBWTYbsreDMI3HzkcTeRVvgoOLxI,30242 +langchain_community/chat_models/mlflow.py,sha256=N81zsMssnxHQpFuUf6isLKlMxQX_f5lrDMNeX92kons,17633 +langchain_community/chat_models/mlflow_ai_gateway.py,sha256=akpWkSLME29TD4WQrLpXFxIjS3iPaqnxiopcTrkWAOI,6682 +langchain_community/chat_models/mlx.py,sha256=4QpSxXM5YwVw_mc9Olv6_G8Q9VvBNKPJ3Gfis0F04zQ,9637 +langchain_community/chat_models/moonshot.py,sha256=ZNpzTQeeUcF4v9mstjFFqHLRhE7GO21c9RGbE-y1s9Y,6142 +langchain_community/chat_models/naver.py,sha256=pKciAmLc40ADdm0nOP-lAiIGWzhpGs29sh_QErw_-t4,19936 +langchain_community/chat_models/oci_data_science.py,sha256=UwVh8tJN9erE7w5Bx2FfEfC2gCo2tS0fOJ_RgRfDJl0,36564 +langchain_community/chat_models/oci_generative_ai.py,sha256=_vvJWt_c2MD_COVtZMxzO29Sj2zkRR4RlsqjwTaTsfo,32330 +langchain_community/chat_models/octoai.py,sha256=tGqIeRpH2ViIFB1M6a6zyVz8MwEFGhswPFehcWcOrx8,5795 +langchain_community/chat_models/ollama.py,sha256=hUhjRBednCqCicKZajw0TyI94-1t-M31tXBG5bWAno0,14681 +langchain_community/chat_models/openai.py,sha256=z9x08zHvi75ZcnSkhA9SgHaw99tjEtwRZosJi9YMNBs,28521 +langchain_community/chat_models/outlines.py,sha256=eDuBWsJT9ld52NB5mMGkLwtyTCd9rSvYIqzxHyjQYC4,20238 +langchain_community/chat_models/pai_eas_endpoint.py,sha256=3WqSwupCFvaU97vgNI5wcJ4fOiaHX0t2N1ce76TAGyY,10517 +langchain_community/chat_models/perplexity.py,sha256=2UFrPa1rCP2VGSd_O1RTaqbOoo4_xvx9yFqqoeMbOwk,20386 +langchain_community/chat_models/premai.py,sha256=p5XBMauTjRf5a-2btydBiLRtlhUSBsQvd7MCmFKt9yU,18365 +langchain_community/chat_models/promptlayer_openai.py,sha256=uZqyG6Hqv9X7auEPzw496lLE8KNRf2TsSKYm1A7es_o,5257 +langchain_community/chat_models/reka.py,sha256=0HanSq8x7mbsDDEwLb6fvkUcOKuM3BdmVyD-8w07oek,16509 +langchain_community/chat_models/sambanova.py,sha256=kUa2Y5GLC6Gji6z3Ao3D6nb3c29v93LP_5ArigbTmbw,99692 +langchain_community/chat_models/snowflake.py,sha256=80HuMmHWoKUO_T10jpeTCwzvGpj8r-7PEMTG9f4M8BI,14497 +langchain_community/chat_models/solar.py,sha256=-GYicpxhcpasACxL8_fOlZaW4w0cWZd7Wo7FLQ5NWWY,2214 +langchain_community/chat_models/sparkllm.py,sha256=a6Ih1_kETvMOGf2pkCxuxiGVI3ZbeZboW-KY1JNRqv8,22935 +langchain_community/chat_models/symblai_nebula.py,sha256=dd92Iz91ABDG7zmxsGIHfiFK3hX5uCY74q3pwWfbrx8,9548 +langchain_community/chat_models/tongyi.py,sha256=0yfZyq2L67SfkL6X-HiYWPb6fGY42O99qJnxv3sxGpY,32929 +langchain_community/chat_models/vertexai.py,sha256=lbb_Bl7oOSC-c0uS9psCsX7gfBE4BV7tAYUPz_pryAk,14562 +langchain_community/chat_models/volcengine_maas.py,sha256=yKWoGu8i2-8odRWntzi8o7jdN14Z0oVP7fgvoeoUnY0,5296 +langchain_community/chat_models/writer.py,sha256=3lBgYfSZUKzJQE-PDXimCLlZg9gImDIwjDhVgN2UK3A,12508 +langchain_community/chat_models/yandex.py,sha256=dBEgj3ARveUtm1BE4tTgEPYiXIvLs6PNr_FKvNRVXSc,10738 +langchain_community/chat_models/yi.py,sha256=mR5ew1nyVARrq5WwtfKaYjx9JwlcmQIV3DXUkVbHGHU,12048 +langchain_community/chat_models/yuan2.py,sha256=Gu5EyeH9wj9viw-qrFnb95RUrQhfRaO6RMx7wYLyWAU,17691 +langchain_community/chat_models/zhipuai.py,sha256=4WShjwy4KwucPqgg5xSO2mn0hnTyK3VOLI8KyoVd4Jw,33988 +langchain_community/cross_encoders/__init__.py,sha256=erF0pz5L1I1JHYmEUwae7IkFwYvbm3MmCiAgMKEAL1E,1469 +langchain_community/cross_encoders/__pycache__/__init__.cpython-311.pyc,, +langchain_community/cross_encoders/__pycache__/base.cpython-311.pyc,, +langchain_community/cross_encoders/__pycache__/fake.cpython-311.pyc,, +langchain_community/cross_encoders/__pycache__/huggingface.cpython-311.pyc,, +langchain_community/cross_encoders/__pycache__/sagemaker_endpoint.cpython-311.pyc,, +langchain_community/cross_encoders/base.py,sha256=5Zvn3uF445_QuQpmtjfZZPj5UzqVDYb5hRaM-p_-hZE,134 +langchain_community/cross_encoders/fake.py,sha256=ggivAlV_mPITzkFTnjsvFP4iJ0bVcIvS45TKDcXB9sM,507 +langchain_community/cross_encoders/huggingface.py,sha256=jItACaCQZsZ9AcRF1vlk1kYRQGmV6I5_JA5Tj-W7RFk,2184 +langchain_community/cross_encoders/sagemaker_endpoint.py,sha256=RXRyd5Q5BEqfqKkR-ePjRJvFgvQN3MUxk-fzMu3col0,5334 +langchain_community/docstore/__init__.py,sha256=L766riaWHaFyDb9ygodDNlfvZGPiXOPwDIiApDOesTk,1137 +langchain_community/docstore/__pycache__/__init__.cpython-311.pyc,, +langchain_community/docstore/__pycache__/arbitrary_fn.cpython-311.pyc,, +langchain_community/docstore/__pycache__/base.cpython-311.pyc,, +langchain_community/docstore/__pycache__/document.cpython-311.pyc,, +langchain_community/docstore/__pycache__/in_memory.cpython-311.pyc,, +langchain_community/docstore/__pycache__/wikipedia.cpython-311.pyc,, +langchain_community/docstore/arbitrary_fn.py,sha256=NhJXWzq4gLUYiQyHCs185nCYOhMJnIotzyoJoy3sC8M,1080 +langchain_community/docstore/base.py,sha256=y9KeW2u-0dGLATNbNN1Vvz1bHj_ql1oURdA-LyUiCxM,834 +langchain_community/docstore/document.py,sha256=oNDzAxnJM3S8h2Pn13b_z5Q6kllet0wXi11nEMDi7X4,70 +langchain_community/docstore/in_memory.py,sha256=7we1uJVmn86UnAaP4hfHX73XIPmnBXd8BGebKgdctp4,1611 +langchain_community/docstore/wikipedia.py,sha256=I18s1Eng9yzAbYbHzK7n4D0wujcbqPW4aiv5uYKx6oY,1471 +langchain_community/document_compressors/__init__.py,sha256=bdpX4rv2Osb2PDX8wMqg5pD31GSID14G9dlsAl8-258,2041 +langchain_community/document_compressors/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/dashscope_rerank.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/flashrank_rerank.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/infinity_rerank.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/jina_rerank.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/llmlingua_filter.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/openvino_rerank.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/rankllm_rerank.cpython-311.pyc,, +langchain_community/document_compressors/__pycache__/volcengine_rerank.cpython-311.pyc,, +langchain_community/document_compressors/dashscope_rerank.py,sha256=9UIgpBGWwyxytdUH0Y4aC2LBAwIRT4PHSVMdgEQ61fE,4011 +langchain_community/document_compressors/flashrank_rerank.py,sha256=LYg0eqK-MzrvhkpYIZF9uUQkLwFHdDmsAusVTuBqo-U,2869 +langchain_community/document_compressors/infinity_rerank.py,sha256=ILw7M8sBpor7sumCtkhiHhY_tAS2crF05qteyC5qtRw,4720 +langchain_community/document_compressors/jina_rerank.py,sha256=qIcmgNfb3HypnR62DcasJxyW4o7y1UKtLeJyJiwNQYU,4369 +langchain_community/document_compressors/llmlingua_filter.py,sha256=Corzs4B_EI6IXKKRe_CShaCMeRMDArGvCbuMSMbngtg,6858 +langchain_community/document_compressors/openvino_rerank.py,sha256=G4376Gci5nx6z8X5aMORBg4IadwgTlpOAkQ-77B4I9w,6079 +langchain_community/document_compressors/rankllm_rerank.py,sha256=Zdw1gaCppwO7P14iLNzQum09C6JlkdSXJVFldw53bxc,5287 +langchain_community/document_compressors/volcengine_rerank.py,sha256=voM6jBOadsVrEIMxMqQ8m5I7hnpjKPKbVagt4BXBiC4,4450 +langchain_community/document_loaders/__init__.py,sha256=AEbdO4fbLyGAn8t5KAVPj6enZFWN5Sv9v57u3YE139g,37014 +langchain_community/document_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/acreom.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/airbyte.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/airbyte_json.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/airtable.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/apify_dataset.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/arcgis_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/arxiv.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/assemblyai.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/astradb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/async_html.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/athena.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/azlyrics.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/azure_ai_data.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/azure_blob_storage_container.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/azure_blob_storage_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/baiducloud_bos_directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/baiducloud_bos_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/base.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/base_o365.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/bibtex.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/bigquery.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/bilibili.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/blackboard.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/blockchain.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/brave_search.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/browserbase.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/browserless.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/cassandra.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/chatgpt.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/chm.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/chromium.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/college_confidential.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/concurrent.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/confluence.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/conllu.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/couchbase.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/csv_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/cube_semantic.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/datadog_logs.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/dataframe.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/dedoc.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/diffbot.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/discord.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/doc_intelligence.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/docugami.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/docusaurus.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/dropbox.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/duckdb_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/email.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/epub.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/etherscan.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/evernote.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/excel.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/facebook_chat.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/fauna.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/figma.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/firecrawl.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/gcs_directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/gcs_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/generic.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/geodataframe.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/git.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/gitbook.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/github.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/glue_catalog.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/google_speech_to_text.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/googledrive.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/gutenberg.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/helpers.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/hn.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/html.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/html_bs.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/hugging_face_dataset.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/hugging_face_model.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/ifixit.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/image.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/image_captions.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/imsdb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/iugu.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/joplin.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/json_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/kinetica_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/lakefs.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/larksuite.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/llmsherpa.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/markdown.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/mastodon.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/max_compute.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/mediawikidump.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/merge.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/mhtml.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/mintbase.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/modern_treasury.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/mongodb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/needle.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/news.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/notebook.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/notion.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/notiondb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/nuclia.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/obs_directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/obs_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/obsidian.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/odt.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/onedrive.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/onedrive_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/onenote.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/open_city_data.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/oracleadb_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/oracleai.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/org_mode.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/pdf.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/pebblo.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/polars_dataframe.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/powerpoint.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/psychic.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/pubmed.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/pyspark_dataframe.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/python.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/quip.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/readthedocs.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/recursive_url_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/reddit.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/roam.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/rocksetdb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/rspace.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/rss.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/rst.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/rtf.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/s3_directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/s3_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/scrapfly.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/scrapingant.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/sharepoint.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/sitemap.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/slack_directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/snowflake_loader.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/spider.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/spreedly.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/sql_database.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/srt.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/stripe.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/surrealdb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/telegram.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/tencent_cos_directory.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/tencent_cos_file.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/tensorflow_datasets.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/text.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/tidb.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/tomarkdown.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/toml.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/trello.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/tsv.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/twitter.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/unstructured.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/url.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/url_playwright.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/url_selenium.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/vsdx.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/weather.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/web_base.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/whatsapp_chat.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/wikipedia.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/word_document.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/xml.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/xorbits.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/youtube.cpython-311.pyc,, +langchain_community/document_loaders/__pycache__/yuque.cpython-311.pyc,, +langchain_community/document_loaders/acreom.py,sha256=i9IlpDD94esbNZHE1vRV9vQeJDcXo5GztwXLU7UWRTU,2835 +langchain_community/document_loaders/airbyte.py,sha256=X62Y00tn2rOojhmkFLCTiilinVzrQB_2EcSlTyZTRMc,10157 +langchain_community/document_loaders/airbyte_json.py,sha256=m9Zz9QOfjwdH7TAKZpM_GWNdHwFNmFxyaaUKbgM3BcU,865 +langchain_community/document_loaders/airtable.py,sha256=CaHjhBUMoKOQfgOtic6LCXDZW2sgvadsO06i5w2dZ-s,1570 +langchain_community/document_loaders/apify_dataset.py,sha256=DsyvXsUkyVmWhr4lFDOOSbRfAD_8NGWWsO-PoZ8u7_M,3360 +langchain_community/document_loaders/arcgis_loader.py,sha256=YJf7L1QGaakuqKBaaNZy8TuqkvqjuacIA4Jrm9JuhJk,5222 +langchain_community/document_loaders/arxiv.py,sha256=nwkgdycJeILY45az1ShA_XddinAXNs5OTVBShqfMtpA,5540 +langchain_community/document_loaders/assemblyai.py,sha256=FW_HsE4tQbbIlqzjGIrM-dTeeefYQ7xzMGbNCBKnLC8,8134 +langchain_community/document_loaders/astradb.py,sha256=4f01dp4UPAehUfq9-WpSvo6N5E75KetTXzWpPtQUf0U,4640 +langchain_community/document_loaders/async_html.py,sha256=pBDrDOLsyWP0-0g19K2WXq4PQ76GchLewuvwIJLQn_o,8960 +langchain_community/document_loaders/athena.py,sha256=Fe2E-MMB6ntIR3MK8OZCNduwC-7A5GmSIHk15OGSPiY,5993 +langchain_community/document_loaders/azlyrics.py,sha256=2CS2bQvCrEgSKVP2MRIfdFT8uWocxTNynj7ejzyyirw,563 +langchain_community/document_loaders/azure_ai_data.py,sha256=A-Pl9-YBvWNjmgp5ZDT8gkRZDwll9ps6Nu0_bqC9yVM,1432 +langchain_community/document_loaders/azure_blob_storage_container.py,sha256=G8nHkDjftnCFiuTEkfvL4bWBxQZ2_CDgxVPXlt-6dx8,1762 +langchain_community/document_loaders/azure_blob_storage_file.py,sha256=wLiwbNmS8ByADgqDHBUdbRmKMPp8CqiUDKpjBRMUjIw,1840 +langchain_community/document_loaders/baiducloud_bos_directory.py,sha256=gFZ7VcLHpxuW7apayzEP_07aNLRjygBVbn2YZF_Gatk,1774 +langchain_community/document_loaders/baiducloud_bos_file.py,sha256=ldL1Rq--GCCHR9VIX9uR-plb-H1Lsup40mbAyI0m_tY,1848 +langchain_community/document_loaders/base.py,sha256=CCHl_U1zqauVua9p1_pxNjrXd3okY5zGfJlcq8fRKuA,126 +langchain_community/document_loaders/base_o365.py,sha256=huVc1n638zyt2CkocgvSNC7Ks9lYvdtUMWwoG-UvzlQ,13433 +langchain_community/document_loaders/bibtex.py,sha256=5N-YVTw7S7z4ZPqLk780bOal0RlFWC0McwygeQi0ntM,3540 +langchain_community/document_loaders/bigquery.py,sha256=sYwLRWd8GJRaNv7S46V8abesZ6MJTkD6rgxN02aABiM,3850 +langchain_community/document_loaders/bilibili.py,sha256=dMEj3Bxa8cwwcWUz7Ou6KRL6ABJRfVPHX7x-eQ19OYY,4715 +langchain_community/document_loaders/blackboard.py,sha256=eE3nKv4nsygS9-8VMhMC0YdSmqqaB1MgwTdbsvRcNo0,10519 +langchain_community/document_loaders/blob_loaders/__init__.py,sha256=EbOXr5_ucuQWTTQmk2ownN8QXqEdLL-UhiVs5mNkMqg,1198 +langchain_community/document_loaders/blob_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_loaders/blob_loaders/__pycache__/cloud_blob_loader.cpython-311.pyc,, +langchain_community/document_loaders/blob_loaders/__pycache__/file_system.cpython-311.pyc,, +langchain_community/document_loaders/blob_loaders/__pycache__/schema.cpython-311.pyc,, +langchain_community/document_loaders/blob_loaders/__pycache__/youtube_audio.cpython-311.pyc,, +langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py,sha256=-1rWTYOx_fiYC5d_kcILA43az8-fBBbniiXIV0OMGUM,9731 +langchain_community/document_loaders/blob_loaders/file_system.py,sha256=lygeJrkx69L4Y1HMrhsjNA07RE5CpZ7rxgN9U8KWOpY,5390 +langchain_community/document_loaders/blob_loaders/schema.py,sha256=Ml_Vn-x2zYpu6MO3y5aI82pa-8GK0mB4KZ4zBbKnBBg,145 +langchain_community/document_loaders/blob_loaders/youtube_audio.py,sha256=25-1p9O1--P-806YgQKLE2CjJbCGM7UQA8aBRNrdpD4,1506 +langchain_community/document_loaders/blockchain.py,sha256=MWcy097CVSJKnR3RjK6rZuuJcskhdKztA5kgJt2ndg8,6285 +langchain_community/document_loaders/brave_search.py,sha256=EK-HLKc5_eDln84oLSbESi7S5HJ_jQBNfp9JmYIxe5M,1089 +langchain_community/document_loaders/browserbase.py,sha256=LExv7sKQgjCpAbq53qcAZosKGvjhiYPay4Ky5ZpYYyA,3135 +langchain_community/document_loaders/browserless.py,sha256=-DcD8YbH0oxSboeGFoZgxfT8qXLhveiiuT7o-HDfbC4,2007 +langchain_community/document_loaders/cassandra.py,sha256=VEptNlQ7eaoNJQzBr6RDD1pndG_olVMq_xM2JMVIGCw,5059 +langchain_community/document_loaders/chatgpt.py,sha256=sRjSrJTHSZKtRduQvm1NPsHeqscDa_KwvAYp2qfz7wo,1986 +langchain_community/document_loaders/chm.py,sha256=sEciGtNviYScNtbZ5wNJpLBxOd3jHWa9Y7KfVsfV2b8,3912 +langchain_community/document_loaders/chromium.py,sha256=qXDTCtwrLVKPVPNvUJMaoMIlMLgJYJ4KiTFUCLwNS3U,3710 +langchain_community/document_loaders/college_confidential.py,sha256=saZXI5k8Rh4sijMPTRWoOHZ5si32HeFCIQzotHVqpfY,527 +langchain_community/document_loaders/concurrent.py,sha256=5L9HZevjdIkkK6maAOoEuZPVvv3PhI3sotdMaaHQc1Q,3294 +langchain_community/document_loaders/confluence.py,sha256=n9MVP-IhKi_ZsLHInpof2gY6A0qw0P8jOoR4F1ch21s,32580 +langchain_community/document_loaders/conllu.py,sha256=ggulR8X_wGegI3rorwAl8dVPRR5tyD_CjNawxqLZCYQ,1102 +langchain_community/document_loaders/couchbase.py,sha256=rp-lgJ3eg2ClKWSl8W0ol4rf8Az-Q0slW5-5QCsiOiw,3515 +langchain_community/document_loaders/csv_loader.py,sha256=RjhpB97OqMVfMvAyKtuVSlG55x2FVRp0S6itk8iJiYM,8028 +langchain_community/document_loaders/cube_semantic.py,sha256=hHxQPyvOJXDGWkQp86hG_PGwagd1g-KhKvOmgHLipEU,6840 +langchain_community/document_loaders/datadog_logs.py,sha256=Uq_r9Hh6RuFAqB4_AH5GUuIm-cLI2qCpooW0Zs-eHfY,4939 +langchain_community/document_loaders/dataframe.py,sha256=eP6tAFhQNXzFkyjHeaqvOxRIpCY6S9jH2CmQ1o53GR0,2134 +langchain_community/document_loaders/dedoc.py,sha256=UU4p9lyeOaTeYvkSWFdDwMxwgxmk50y6NVe2N-J6Xf8,20871 +langchain_community/document_loaders/diffbot.py,sha256=3GsfJLgGClIbJ0wfrKuxDZYJSK5aMeXK8QME0y1JdZ4,2054 +langchain_community/document_loaders/directory.py,sha256=rHgfgZbmyKkiEJC16TBPvC_26RQ55iPTcesfWqvCdqM,9036 +langchain_community/document_loaders/discord.py,sha256=KAkW8TnQUyVoVav0m49SljmcwnSPKrZcQtsEZ7-uo2s,1237 +langchain_community/document_loaders/doc_intelligence.py,sha256=xffR0TaWTbk3iye3ZA_V0nLCCNbcugNR20piup_KJt0,5069 +langchain_community/document_loaders/docugami.py,sha256=MrqqUCaFHslHBUbS93XWlh7UkGUrobBqgLkopikFlrM,13657 +langchain_community/document_loaders/docusaurus.py,sha256=U-5PsukYd9PeABTNpNHWCc32QALtNRHlmWMiIaqXI2U,1853 +langchain_community/document_loaders/dropbox.py,sha256=nTVc3XRb6Yd8_SL7RaxTA-EaCWcJE70muUtaASDqe2A,6267 +langchain_community/document_loaders/duckdb_loader.py,sha256=o1tEI0VOQNLWHhpD_de5EsAC7wdupbHGKSD7F65Krfg,3150 +langchain_community/document_loaders/email.py,sha256=yAnEA8wIb9QjAtWC59TiTmNwvYeZ_02wS8rblMErRrw,3855 +langchain_community/document_loaders/epub.py,sha256=yS8A2zNsYllXH2TL8vhTxcdd5a-re29cb_E9MXsA_10,1853 +langchain_community/document_loaders/etherscan.py,sha256=0pweNXluzsHL2YBTgAqpyHYddjtD46VC38m10KN5HN4,7753 +langchain_community/document_loaders/evernote.py,sha256=rq270XujCbEdEwz24VA-2PatR_QkYNqeFFuk_s1x3us,9383 +langchain_community/document_loaders/excel.py,sha256=9e5uZeMV_ruIFk9qojBARDE4dw3glSHp3t2UpuG6WYs,1789 +langchain_community/document_loaders/facebook_chat.py,sha256=why6d58ELKfRjss1pspPdX7V2eMAZrxa5LnTUopQB1M,1270 +langchain_community/document_loaders/fauna.py,sha256=AMOjqPwKn-anHu5imw7Eo_W7B61eJqOivGHziTFc2Yw,2171 +langchain_community/document_loaders/figma.py,sha256=BgWmavQPYR1q-m9b2T24QVdMZsRGAgxBrcKUAjUl7Tc,1543 +langchain_community/document_loaders/firecrawl.py,sha256=CXE8uxFEDoEzOZc61GaXMKPuM1Oiz8DNwL1gHwr2y8I,17538 +langchain_community/document_loaders/gcs_directory.py,sha256=GnvxQVgGYXViYo8ShXmCRvDEVhwKlUi6OWcs1DC-XM4,3039 +langchain_community/document_loaders/gcs_file.py,sha256=314r8rC5L_cBAqBiTNNl5AnH9Ctffm2nt-AkeTQyHas,3314 +langchain_community/document_loaders/generic.py,sha256=cPkwXeaK-KRe0lhmr22_V20XegN8eYTRqXGLfFtvd04,6280 +langchain_community/document_loaders/geodataframe.py,sha256=S5CaJThmpp3FFnP3mNXL9QRwQYkrd7-x3TzPswJ9dsI,2400 +langchain_community/document_loaders/git.py,sha256=QFjaNFvFiP6vIOwdHP9mdOPyoEI1x1VFX3AKSun1AYM,4018 +langchain_community/document_loaders/gitbook.py,sha256=TaWn742qEovpCtjaZ_dfNX6yWKCe3CJpoxtr2Hw9oq8,15855 +langchain_community/document_loaders/github.py,sha256=dJBWZghreB-IWCXGPfspijImo6KCUb5wy5PpmQBARSE,8751 +langchain_community/document_loaders/glue_catalog.py,sha256=xYV-IF3H0AuB2GpxAMr4s-o1jj-rlB1E_Hj8q2RkOAM,4459 +langchain_community/document_loaders/google_speech_to_text.py,sha256=T95aobpcGFM3E6KOPD2WFn-eyrJ2zjfsD-sCnGXT9YM,5277 +langchain_community/document_loaders/googledrive.py,sha256=Za2890QDpRewwGxWwz6WgA_4XFK0XCuU37LjWMhjY5Y,14716 +langchain_community/document_loaders/gutenberg.py,sha256=y1elY_VN0zls2MjOEUQmSkwMyyloXO1sfn-6gTcSJ3g,928 +langchain_community/document_loaders/helpers.py,sha256=Mi1Wtt3IPKJCLs37IbDOjyaMAq916Tj9wQRsC2wutKI,1640 +langchain_community/document_loaders/hn.py,sha256=d_-puCC2uHA6iMpH7am7w1RSCf2ko2Jfd336TFhbXnk,2075 +langchain_community/document_loaders/html.py,sha256=o-5R7vjXucgnR3azEVh3nM6weEvjlGYbg2qbX601ih8,1762 +langchain_community/document_loaders/html_bs.py,sha256=tz3R_WHEDNY3Ug66hcTe0AxD8Q9cL80kFYh9ntnv0zY,3839 +langchain_community/document_loaders/hugging_face_dataset.py,sha256=zdRTDmcgiX5ghOSbm-42EVCZVj4Lc4vvDmWxRQ3xzBI,3095 +langchain_community/document_loaders/hugging_face_model.py,sha256=QHLBgUZt-H5ANg5vOVPQ-PJxTmkz-Mp-4AnTJ61gt8Y,3638 +langchain_community/document_loaders/ifixit.py,sha256=vrKGoV2bwH4Cp2yE5u8mQzuyndPAbev0T2QFUqGCswI,7642 +langchain_community/document_loaders/image.py,sha256=9gupQ6IbUyl8kuNIyCrVVp2E9eNxxLlGUwIH0jbSpSY,1778 +langchain_community/document_loaders/image_captions.py,sha256=YGGiI7gNd3oIfO_lO7fptrW9TU2_AyzR8IB15_MILZ4,3707 +langchain_community/document_loaders/imsdb.py,sha256=HLKUh7hXZRU0CQxrJ5RpBFyNWPlZpqo5rqovyjFdII0,477 +langchain_community/document_loaders/iugu.py,sha256=LsxrDEnQID_sc76ZQgyBh42r5U2jtSLTe_8pOQ9MpJU,1688 +langchain_community/document_loaders/joplin.py,sha256=MN39rWnFJkTZEE_AxJHvae8O3BPrpe66WzC45p_k7mM,3628 +langchain_community/document_loaders/json_loader.py,sha256=5LsgYv6paotPHpANsZM5uAe2PZVVfyATJS6okeyQX_s,8810 +langchain_community/document_loaders/kinetica_loader.py,sha256=0je1_1krGb8gt4VEz7lXmf_sN9NXt-FbdqItW5ZkeKA,3889 +langchain_community/document_loaders/lakefs.py,sha256=ZX-yjp-nrDJhmc29uw4q1by-2CvGSOBvggRYhq54p8U,6058 +langchain_community/document_loaders/larksuite.py,sha256=rnJHJ0SePJ-I-OdK-uL5D__i-ijBDu58eThD7FNSolA,2959 +langchain_community/document_loaders/llmsherpa.py,sha256=xS50QBedzPDfVN5uSiDBGwA5FTUCElW2egOaJQSWFGs,4881 +langchain_community/document_loaders/markdown.py,sha256=JMg61Izv3hpTkYoK2N3wEl1F-pMoqz3bporYP66lSbs,3345 +langchain_community/document_loaders/mastodon.py,sha256=CRX6JvB7OIp3RNW6BaxMbTneR9hndYWfRorz4oFLqUU,3079 +langchain_community/document_loaders/max_compute.py,sha256=Ow2wQd4C_9FmQ3kj9g1SHIP2gNPJBRJmMIMjhSd_cuY,3199 +langchain_community/document_loaders/mediawikidump.py,sha256=RfiZ2sqgC_AswN4lg9_rvKRX4mviQVVdGRlL8cNm4vk,3889 +langchain_community/document_loaders/merge.py,sha256=XdmAd-5qVd5Cxj1JP4O7o53bc0OEhHvArlMOlx5az2E,999 +langchain_community/document_loaders/mhtml.py,sha256=MlWix_c6ZbnPij7j7tXYDGWi3SnHYWgX-nKzpatzaGw,2658 +langchain_community/document_loaders/mintbase.py,sha256=M85bYFL1EQZqHq-fd06m9dM0wxMHPb8AUiiwOeyYUL8,8923 +langchain_community/document_loaders/modern_treasury.py,sha256=mTt8FzyN3A3jpdYFYtfAh6lTGpJGXsFtmN_QTAUi0gI,3074 +langchain_community/document_loaders/mongodb.py,sha256=Uzs5sSaB0lWMsI0tf6HyXMO4EqatEe8FHQQ_f84GEtU,7184 +langchain_community/document_loaders/needle.py,sha256=oQkf9nzh1HW2u_uUO3J01WpQdAqxVO1RcPEaCSTYJTY,5281 +langchain_community/document_loaders/news.py,sha256=7w1VqADC6Fxw3mn29xO4JYY2TIXtFO_PpSkOEZ7ZAmA,4284 +langchain_community/document_loaders/notebook.py,sha256=kV7dT156wxBMxDZdNgAf6AJV0h-OXqrrP59E9r0XptY,4297 +langchain_community/document_loaders/notion.py,sha256=s3kwb49CF80jS7HkI84xEd11YpvAcghkitf2g7UbdFc,834 +langchain_community/document_loaders/notiondb.py,sha256=w5Fhw7Qeiw-HhE-cYpl65vshLDokfgofIoL5g39r58Y,8174 +langchain_community/document_loaders/nuclia.py,sha256=9sKWoPzsen84i08QfZwoLCCmcNCTz3ii7uN0WRFQuKI,1181 +langchain_community/document_loaders/obs_directory.py,sha256=tG4xIW1yHN02SBzadSr3gLMJRImSYf6hwuVrg7qUaHA,3593 +langchain_community/document_loaders/obs_file.py,sha256=78GFqnPAZbZlj63v0q0prD0VjGnPmFCywSZw2ZSP9qQ,4801 +langchain_community/document_loaders/obsidian.py,sha256=AR_1tdaV-efwDjKwcC62km5JfH5v_nHmwMkE2wQDbSo,6223 +langchain_community/document_loaders/odt.py,sha256=wkASg5bY1BFTVd7K_9GoJQqYqcrfAm1YQxWrvtFXVJI,1875 +langchain_community/document_loaders/onedrive.py,sha256=mQagU1YC3WhCYyTo5Yz52FqSDvBX_PgyICAyUb5Bfvo,496 +langchain_community/document_loaders/onedrive_file.py,sha256=DfUsqZGziuCE8V-HMDtBGbzREITeUhgVKTHH5WVYbEE,992 +langchain_community/document_loaders/onenote.py,sha256=VNn7ZCvGZQdiHnghQC-VdJJfcSrjWLM1U2_krWzzKqI,8180 +langchain_community/document_loaders/open_city_data.py,sha256=UdpSiKcqItLkkh_554nwu52ZzdB1wuLQfi5luDCmWd4,1219 +langchain_community/document_loaders/oracleadb_loader.py,sha256=hsn5F0X1uwy_2Ln3WYhmbzN3QgwgHRAirfA2A5ZV8S4,4689 +langchain_community/document_loaders/oracleai.py,sha256=8-Vy5mqz7amnr99Zv9qJaMwkjdeTa8Jx9Xg7wGS9T9o,15573 +langchain_community/document_loaders/org_mode.py,sha256=Lh2SKigCMlTJ3xctltrgYm4yoSj85uG-asB-elnFmUo,1853 +langchain_community/document_loaders/parsers/__init__.py,sha256=2xTVuv534NA525FlI3TDIPxS5BH9dfuFonod3pvx2JY,3105 +langchain_community/document_loaders/parsers/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/audio.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/doc_intelligence.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/docai.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/documentloader_adapter.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/generic.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/grobid.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/images.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/msword.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/pdf.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/registry.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/txt.cpython-311.pyc,, +langchain_community/document_loaders/parsers/__pycache__/vsdx.cpython-311.pyc,, +langchain_community/document_loaders/parsers/audio.py,sha256=Ki2RMJxMe8tlVRAZ5ohJnLIGa2PontALlyUk3QYUNLg,24367 +langchain_community/document_loaders/parsers/doc_intelligence.py,sha256=Nm7ej8I-Z9W3vHrr1RaodszXR_b2Y5AywdeMlYfzJwQ,5056 +langchain_community/document_loaders/parsers/docai.py,sha256=7YAC1Irpk0IFrFDStqn7g926GJ6I3786Q5gy1B5agrw,15437 +langchain_community/document_loaders/parsers/documentloader_adapter.py,sha256=TPt-OuJ25SjYaqpgQeuiv6RlIwOFs9CtmyuC024Nn88,2676 +langchain_community/document_loaders/parsers/generic.py,sha256=eKu0kA45gikY_M1rvrSdIMi4TU9LQkpLMBDZ8FgXMyQ,2531 +langchain_community/document_loaders/parsers/grobid.py,sha256=i0ezmonjeKfenFRRucHZSjdbhs1Hk4ws8Tcla4yuVUo,6026 +langchain_community/document_loaders/parsers/html/__init__.py,sha256=ahE8oP4C2qFmEBT-G65UQEnQjz9fsQzFA7DuQfsEn74,109 +langchain_community/document_loaders/parsers/html/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_loaders/parsers/html/__pycache__/bs4.cpython-311.pyc,, +langchain_community/document_loaders/parsers/html/bs4.py,sha256=6y90LwpLKyB2u2sEBFlW4t-SsosYo1sr-RU1D7Gw-Og,1608 +langchain_community/document_loaders/parsers/images.py,sha256=AsEYw_roadPlX3x1YMeXd8gqcn54SsgfSnktTE17VxA,6766 +langchain_community/document_loaders/parsers/language/__init__.py,sha256=XUbP3aVIyahpn5p0wbEuQRFkYogN9FtCH_x6nS79Cxc,136 +langchain_community/document_loaders/parsers/language/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/c.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/cobol.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/code_segmenter.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/cpp.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/csharp.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/elixir.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/go.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/java.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/javascript.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/kotlin.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/language_parser.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/lua.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/perl.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/php.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/python.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/ruby.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/rust.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/scala.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/sql.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/tree_sitter_segmenter.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/__pycache__/typescript.cpython-311.pyc,, +langchain_community/document_loaders/parsers/language/c.py,sha256=7T8UJ26ZO3d2AVREPaBMeFz3EJDPn9txuGFIeLoTeB0,877 +langchain_community/document_loaders/parsers/language/cobol.py,sha256=VGMUgB7TOPpvb9iSAusi_JgC6G6toQ061BnRg8fn_yo,3781 +langchain_community/document_loaders/parsers/language/code_segmenter.py,sha256=4BJ8MqBmjHaTf5q0W3EnTwjbGES8wj6ToRRr63MCkX8,495 +langchain_community/document_loaders/parsers/language/cpp.py,sha256=88UhzjyweVoBVA3FOGd8r28tSyy3QQTkZ4U_5rhmgdE,893 +langchain_community/document_loaders/parsers/language/csharp.py,sha256=BUN0kmY7SFM-KfLoWRtJQ9frgljLZy9P4ANEhlW4M3Q,893 +langchain_community/document_loaders/parsers/language/elixir.py,sha256=9GIR8sPo6D_gH1_JZRS61EIhcurvkW2GkXqSiBdI7FM,1059 +langchain_community/document_loaders/parsers/language/go.py,sha256=ZYzwc3dmiYLtCYwTvDVpeUdvIw7e1ua5ctGalJon-tY,693 +langchain_community/document_loaders/parsers/language/java.py,sha256=spP6K5-9uwzly48ciIZLC6oCbt82PqWMmTmSwX2_U0o,736 +langchain_community/document_loaders/parsers/language/javascript.py,sha256=A081W0IMUiOsRP1fPVJLxCX2Rz5KTuuMRXSqkLwb6l0,2185 +langchain_community/document_loaders/parsers/language/kotlin.py,sha256=jl_PeNJYWS7IHAdPIsD9Kw7J2vg6C2tTnmHCBYd9msw,707 +langchain_community/document_loaders/parsers/language/language_parser.py,sha256=2Ufm6kjwI8HDwP3lxecmiBnTiEQFR0LWFRD_XKkqd20,7881 +langchain_community/document_loaders/parsers/language/lua.py,sha256=1-c00i1q07t8plB2qr2n596x6A1UcOhkFNH79LUYOeE,790 +langchain_community/document_loaders/parsers/language/perl.py,sha256=it3VIfAKeL7Bg20qOJIfna8_vlLaUUo7Ma70OMUsxrg,666 +langchain_community/document_loaders/parsers/language/php.py,sha256=YeOJwbYx3Y42IRR12chT8SdQ5NgFkuCMn2Q8toQofpc,850 +langchain_community/document_loaders/parsers/language/python.py,sha256=IP8nZo4n0YUHprqIs1DlNmuAvvzcVf2dtR6tUvgD6pw,1731 +langchain_community/document_loaders/parsers/language/ruby.py,sha256=0ppOknZ4D4McAn51u5Z2ox5MOJJKc0MJpu142T82qvE,697 +langchain_community/document_loaders/parsers/language/rust.py,sha256=tV0LOIdxw3zFv8xSmio73m99x3aO24AljtFylSscEl8,774 +langchain_community/document_loaders/parsers/language/scala.py,sha256=NNCJ4hRLOg7pdDwSEjr8_hOhP1AM431VMo6iGGORzeU,772 +langchain_community/document_loaders/parsers/language/sql.py,sha256=HFZkxSxAal-MODeqCOvketzCjiIbTFPkTppJSsTjjFQ,2037 +langchain_community/document_loaders/parsers/language/tree_sitter_segmenter.py,sha256=tBVZUPQkb4Pt2UZH8eA2QwWhdWnY2PLIPCGcffKDzwI,3488 +langchain_community/document_loaders/parsers/language/typescript.py,sha256=I0a87gYfMpuufjvrgVKpakqlFElzDglpd5gvgSA1oQM,795 +langchain_community/document_loaders/parsers/msword.py,sha256=0UcL5sg1F3K-GtyejwKf8PUID9P2eWokKZeTd-s2aGc,1664 +langchain_community/document_loaders/parsers/pdf.py,sha256=RuenQDiokLbpxHB7HMTuD7lAKaJHE5ZafXCw8G6kgBI,60957 +langchain_community/document_loaders/parsers/registry.py,sha256=H4Iiky2zVDj-dC98mD5mdJabLJdXIRbOndInosRJ7rA,1215 +langchain_community/document_loaders/parsers/txt.py,sha256=vjzGpnxGcqBGAFDI95iZBaOfJCU8Y1PcFfUtumIUbV8,506 +langchain_community/document_loaders/parsers/vsdx.py,sha256=6EAVjevUcAhijpkDiAku3wHqmDOMcY1-Ackip1FvMzo,7902 +langchain_community/document_loaders/pdf.py,sha256=o68xx_SfHNFIsbZ8t_S8WBQ40FpTdquH3Qoo0x1YzX4,51456 +langchain_community/document_loaders/pebblo.py,sha256=7UQoeWqMni6TZwOcjZnTGTVhE0Bh_hwG7gVTFVkAb68,11308 +langchain_community/document_loaders/polars_dataframe.py,sha256=L5oAncFYot-0RX15RwojsaheFWrbRWkYo3_svuqXXW8,1161 +langchain_community/document_loaders/powerpoint.py,sha256=XYCcxmJpjova6ZbqWwpgHWCo2LRIeWj87IiGdw_D1GY,2694 +langchain_community/document_loaders/psychic.py,sha256=OCzM0wVHYUW0LjcW-9vJzTHL2sN1kQy7lcp4rW8kF1A,1315 +langchain_community/document_loaders/pubmed.py,sha256=wbCOQG2c8emD58nLnOxCxEpobodXH4qVkxBpNb2Qg2M,1118 +langchain_community/document_loaders/pyspark_dataframe.py,sha256=thkC9NPdUX12gHnUgoaj0BO89rAzGV5ZbNZx2TiSbrI,3369 +langchain_community/document_loaders/python.py,sha256=dsPooB_NhF-hIWESa2U6mkHqI3Qga7bBICj1Ui6x75s,590 +langchain_community/document_loaders/quip.py,sha256=97K8Gi0GnVdQMVfRl69PdxauUI3vq5kETrwjnqmah4I,9203 +langchain_community/document_loaders/readthedocs.py,sha256=MfujijvH6_CiW_ZJu5Q99Vq6-kmmYsMbMnQNS0uKVYw,6847 +langchain_community/document_loaders/recursive_url_loader.py,sha256=O0uHBuqmjxO6AHxfQj9eoF3MfkMDt7C1LxfKO9ayLYI,22640 +langchain_community/document_loaders/reddit.py,sha256=9wGLbJLFChZiBa1N06zHjkwBuTHiyxd_6Q53fhItOZI,4584 +langchain_community/document_loaders/roam.py,sha256=n0x3uQCDjaPg1DOEMievR-ffCdPHxPQcB3GM7q3TsDs,725 +langchain_community/document_loaders/rocksetdb.py,sha256=kqz22-nJcZiO3-2oIi3xVt3FJ6jVmFiGarSRlmKDpqc,4527 +langchain_community/document_loaders/rspace.py,sha256=_I0obGlYqQJ6-Uh7a16nBlEKXW001tApCMhMEYrw0p0,4836 +langchain_community/document_loaders/rss.py,sha256=hKwrtuXig1riGf4IZTdVKCroZQUNgxvd-77M6m8xHV8,4882 +langchain_community/document_loaders/rst.py,sha256=vmJoBJgXi-J1NJ6pn0qawrkXNGWtcIqma7F_10WRuDw,1938 +langchain_community/document_loaders/rtf.py,sha256=CPWrxz3k3lK22Sil4rC3aXC6NePgIjFDzJ4mX3FE_mg,1920 +langchain_community/document_loaders/s3_directory.py,sha256=wnOKjB_JlsycXr6y-PhIl2gzKNeGgyaZMOj-qB5CRnQ,5871 +langchain_community/document_loaders/s3_file.py,sha256=X_VOHRoqX4DHhjl7xnG0pro8v-x80e93MYBPSsxD7_M,5956 +langchain_community/document_loaders/scrapfly.py,sha256=pvwCp2c05JLendl_guiy0KYbjy_XML3J_lkDDBgBQH4,2513 +langchain_community/document_loaders/scrapingant.py,sha256=hayN4yaPIA1wXfVBj8Enq_S9FoQzOq5sVyVmP4_8ERw,2325 +langchain_community/document_loaders/sharepoint.py,sha256=BORADJlpwu2tdlEzNvfM20SvU954k6S8CURIgNhSrA0,9275 +langchain_community/document_loaders/sitemap.py,sha256=ilz9rSwLKneSfUNCCtSy2BsFlmd8Ir7y6B2oJ391J7k,8885 +langchain_community/document_loaders/slack_directory.py,sha256=zCklV2uN_EI6SbjjHDBB2WkGsu3spugSE1OmcuNuZFQ,4027 +langchain_community/document_loaders/snowflake_loader.py,sha256=dzj_-Nm85KbLMsbW5IvHvYph4jkBbI8hMR0chGu-vGM,4703 +langchain_community/document_loaders/spider.py,sha256=ZkUZkIWBZJds9_sCgsEjmuWJ2nbj8vozpLPMZfntS8U,3369 +langchain_community/document_loaders/spreedly.py,sha256=G4WX4ZmNaV9PwiwAx4ikSbRqSLZk9_DlrqteCyjDxy8,2004 +langchain_community/document_loaders/sql_database.py,sha256=cm6apmM26D4mBfbyml_WgCexdWcZaolbCO00kDrfqt0,5634 +langchain_community/document_loaders/srt.py,sha256=rpC3S9NIz90vVdaabR92OY7oUOcurjRgmCEO2r6-P_k,901 +langchain_community/document_loaders/stripe.py,sha256=IInMlwg1_DsWPjhb_eTaN2ftBDSRFkYtcIdxWJ82kss,1811 +langchain_community/document_loaders/surrealdb.py,sha256=0lczkvXH2uOy7HQspS98NnO2SmrzKOmYIuDWvT4oxe0,2965 +langchain_community/document_loaders/telegram.py,sha256=9mHTwSV9SRQZub-il3iSiV-zQfCKGkGG6KCf-cQpRtw,9079 +langchain_community/document_loaders/tencent_cos_directory.py,sha256=yWLdyn3Z92IcD9DKgF1N68KUeBMBhLo_5xHcKWkHOHM,1700 +langchain_community/document_loaders/tencent_cos_file.py,sha256=5RpzXpPWgdi7eYjpl72ojIiCW6x51_deu_6VM25n3s0,1617 +langchain_community/document_loaders/tensorflow_datasets.py,sha256=R0WhP3sR8jXRowcZOvxDb3DBhd9WhGGL6Xlcst0fQho,2995 +langchain_community/document_loaders/text.py,sha256=4fI6gIsWnYune7n5iWrxL3dx1BcO3QokpfPW4LrnOyY,2070 +langchain_community/document_loaders/tidb.py,sha256=XWdItLPYVpisX6UgQD2Wy1quBFZYUP1zeNB8mELbjZA,2610 +langchain_community/document_loaders/tomarkdown.py,sha256=hf69CGuxU6jTO7YUl3kNMMwSHMeQVy50Jbh7Pv1t0qo,848 +langchain_community/document_loaders/toml.py,sha256=F_nu243ouRfM-kvOb1KwhGT0t69tvFPKMtBFRU1eJvw,1458 +langchain_community/document_loaders/trello.py,sha256=yrRabuZ3lmI4v1z2jYKiiixhg-La5fkAv-xxo4Yu_C0,6552 +langchain_community/document_loaders/tsv.py,sha256=-svHJqBliGa3tXvAAsNwBRetsobMTuVWFs-R1T5kaag,1398 +langchain_community/document_loaders/twitter.py,sha256=ffGGUb1f1dWdQHoUJwJ0sFj7Nv6-_gAU5VCRtftNnlw,3438 +langchain_community/document_loaders/unstructured.py,sha256=9yxX0kuToy7Q5maH-huO-I-BvjJ3dy_eFJogHdDe9LI,19913 +langchain_community/document_loaders/url.py,sha256=mrMXamQe60Jh9XgZrWTpmODJ1Va5SmWmmsSu8FgmGl4,6020 +langchain_community/document_loaders/url_playwright.py,sha256=ZlrnDxMTS8kTXwC14_eaHHcM8P4XSxkoF5wNG3mOGsc,9868 +langchain_community/document_loaders/url_selenium.py,sha256=hD7CHYa9qDmyXHaR8eXqDiuGGNr_hB5oWIjgLMU_yB8,6640 +langchain_community/document_loaders/vsdx.py,sha256=xaV5E5iyuAtiJSiAVJGXscmj9kUiFpS9C9OnZQ-9WI4,1894 +langchain_community/document_loaders/weather.py,sha256=CtXD3f25DLCJ1QC0hEKQVb1e8Aw_B4e89IWG24lCiIc,1528 +langchain_community/document_loaders/web_base.py,sha256=Hoe31ZxiaumdwtIGrfs_HZZyFFQ1-cNyFCgdeAHhr94,15342 +langchain_community/document_loaders/whatsapp_chat.py,sha256=49yold_X43R4k2P6fZED9x0oV-uSPuGTKvC_6eZjnns,1750 +langchain_community/document_loaders/wikipedia.py,sha256=8EpTH6zcNJ2OLXUJ-Di3ina9KnHxPWemny-C3jzq55g,2238 +langchain_community/document_loaders/word_document.py,sha256=LXVMRoEPPRmjZocraHK6U-AUrUSwnvylDUpinCaYxBs,4840 +langchain_community/document_loaders/xml.py,sha256=UAm9C0eK4YWv6Yn-xVara64ysCSQglLkJVzqvFZoFQQ,1595 +langchain_community/document_loaders/xorbits.py,sha256=4UdKHC76qJ60HHz_oLHc-NRGSurEzUK9PMoKcTx8Mlg,1119 +langchain_community/document_loaders/youtube.py,sha256=viwcW3b6QFVoaS6G5wsWEELzNdh4Ljee-KFWvNYlYSs,19004 +langchain_community/document_loaders/yuque.py,sha256=kIXt-nfcSqBiyLtJfiZZ-DH0K_Wg6jhU6RzonbrKKC4,2958 +langchain_community/document_transformers/__init__.py,sha256=cLzJHA9o0wHRqjJo9kLAB3ziOonnCLCpC_PcUghuIO8,3849 +langchain_community/document_transformers/__pycache__/__init__.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/beautiful_soup_transformer.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/doctran_text_extract.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/doctran_text_qa.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/doctran_text_translate.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/embeddings_redundant_filter.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/google_translate.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/html2text.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/long_context_reorder.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/markdownify.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/nuclia_text_transform.cpython-311.pyc,, +langchain_community/document_transformers/__pycache__/openai_functions.cpython-311.pyc,, +langchain_community/document_transformers/beautiful_soup_transformer.py,sha256=xdINIFaZwCPPUKlouATDCMRisebz15swa4Q8qFoM6FM,6975 +langchain_community/document_transformers/doctran_text_extract.py,sha256=JlOQKKC9lzkTSyXrKjfWOlXASc-72XYr8Mi8axpHEOc,4240 +langchain_community/document_transformers/doctran_text_qa.py,sha256=4-G-uOmArJrKcxcitPcosRbbboAsUUk_JrNKr7F03Qg,2155 +langchain_community/document_transformers/doctran_text_translate.py,sha256=vPx6QWN_2Od7crBMeN3fa5oblJ4OxpCe7Qmi695x3q4,4129 +langchain_community/document_transformers/embeddings_redundant_filter.py,sha256=DKJFSNzEKk1f7AS5CTUE6HTOye6k5NXP9ps4yejFd0I,8364 +langchain_community/document_transformers/google_translate.py,sha256=54uTAhWp5OPhRKYbfmvyYGpgBYe2OkC_Z8Ud5GQ7L5g,4307 +langchain_community/document_transformers/html2text.py,sha256=A029mJz86lK2P2fP-HTQ29xVVq_xJ8nl7gXfI7pRq24,1834 +langchain_community/document_transformers/long_context_reorder.py,sha256=a109QljIL8ZN2bzVlOdHdkFY9KH2FFFVMF-sYjGQAV0,1410 +langchain_community/document_transformers/markdownify.py,sha256=p97TSTMmxMZAZu2zBuVdWmFm9C6trBeHPgzwukBCcAM,2976 +langchain_community/document_transformers/nuclia_text_transform.py,sha256=UOP07cwRqqTPpvWBnB_c6VS0wf4ZFOVcbVBP7MsRu2A,1500 +langchain_community/document_transformers/openai_functions.py,sha256=VdA81gB0dQnA6I7kxFgRNsTSh9Wga1kKH6AjvTUGz7U,6192 +langchain_community/document_transformers/xsl/html_chunks_with_headers.xslt,sha256=ti9sT_zWqZQf0aaeX5zT6tfHT1CuUpAVCvzoZWutE0o,6033 +langchain_community/embeddings/__init__.py,sha256=ImY-LRLP6810pLHaoC7rz9T8RXaXLlYwuNhOPyKl-LE,17429 +langchain_community/embeddings/__pycache__/__init__.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/aleph_alpha.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/anyscale.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/ascend.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/awa.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/azure_openai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/baichuan.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/baidu_qianfan_endpoint.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/bedrock.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/bookend.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/clarifai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/cloudflare_workersai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/clova.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/cohere.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/dashscope.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/databricks.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/deepinfra.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/edenai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/embaas.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/ernie.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/fake.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/fastembed.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/gigachat.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/google_palm.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/gpt4all.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/gradient_ai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/huggingface.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/huggingface_hub.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/hunyuan.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/infinity.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/infinity_local.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/ipex_llm.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/itrex.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/javelin_ai_gateway.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/jina.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/johnsnowlabs.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/laser.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/llamacpp.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/llamafile.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/llm_rails.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/localai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/minimax.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/mlflow.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/mlflow_gateway.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/model2vec.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/modelscope_hub.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/mosaicml.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/naver.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/nemo.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/nlpcloud.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/oci_generative_ai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/octoai_embeddings.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/ollama.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/openai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/openvino.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/optimum_intel.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/oracleai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/ovhcloud.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/premai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/sagemaker_endpoint.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/sambanova.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/self_hosted.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/self_hosted_hugging_face.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/sentence_transformer.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/solar.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/spacy_embeddings.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/sparkllm.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/tensorflow_hub.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/text2vec.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/textembed.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/titan_takeoff.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/vertexai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/volcengine.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/voyageai.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/xinference.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/yandex.cpython-311.pyc,, +langchain_community/embeddings/__pycache__/zhipuai.cpython-311.pyc,, +langchain_community/embeddings/aleph_alpha.py,sha256=hT0oTjDlRCap0Xz3bOhLm9-gjRwkhhN_K6McQ8kT4Ds,9618 +langchain_community/embeddings/anyscale.py,sha256=zGON-MRpn1UBb59hmC28jAJVeGQqFW8xzOT-x7A1zE0,2598 +langchain_community/embeddings/ascend.py,sha256=IqHMk5OcWdumzwVAcl4Hh_nLjsKFzqGAPE4BOejrtFA,4909 +langchain_community/embeddings/awa.py,sha256=MeuKKUfj9NOzVkXZwhhkecY2RmE14h43t98a6FcXdT4,1878 +langchain_community/embeddings/azure_openai.py,sha256=qZx95_5wdnb_E_iDZxhT5TcythspctciDOoeod2SURo,8062 +langchain_community/embeddings/baichuan.py,sha256=7Bn7aVf1NOSlKHMBq1lBb9on3kgOEthBo9F6iFGaqSA,5461 +langchain_community/embeddings/baidu_qianfan_endpoint.py,sha256=_ODFLFrBDaXc7B-cir3_j6utUqnBubvYidEAnAB2oMk,6317 +langchain_community/embeddings/bedrock.py,sha256=B-Bof65fozH4HfaoR5fxtNZnA7Q2fDnlTVnnrkWQQEI,7396 +langchain_community/embeddings/bookend.py,sha256=ALuVwaM5j1opVHihcq-3EK-YZb8opgBxbeXTWG_gS4U,2874 +langchain_community/embeddings/clarifai.py,sha256=q0_nbg-lUvAbEyefQx5KtwC_Fcrq5qlTdPO6qT8tZI4,4664 +langchain_community/embeddings/cloudflare_workersai.py,sha256=GCDiGr_oyGCF_vMXnd0tX1GQWmYBMFXe_vIQzrKUE4A,3011 +langchain_community/embeddings/clova.py,sha256=vwSE5s05d6Mor-IINBR5rjx2RTQcm1px33fIa2HsJ44,4729 +langchain_community/embeddings/cohere.py,sha256=yaiDy69piUQuMrJQNYop0_UcRtfiXnfdFL90QsXiAbg,5503 +langchain_community/embeddings/dashscope.py,sha256=iXt6mmtT_WseB8EC-wwofB06Gx3Bf_BXnfCiBhV1ots,5461 +langchain_community/embeddings/databricks.py,sha256=do07aeAeK6wzuZTecMUonG96S6AHxeav-Yhp9hvHCKg,1436 +langchain_community/embeddings/deepinfra.py,sha256=RkB-vab-qqaX_bEXHL0nLn33Z38sUbjr1O4_yjw-OEo,4944 +langchain_community/embeddings/edenai.py,sha256=Y4mmF5GO3uEHrrPXSLBmJfNdAJ8oXUGlSIt8Q5ejzNo,3627 +langchain_community/embeddings/elasticsearch.py,sha256=k9xFqOfstsm-OgT5bNZkF1YMP9giL71f0JJ4EzCpN2Q,8532 +langchain_community/embeddings/embaas.py,sha256=wVi0hN963Ei11HaUWb5JWjimBSTGpeQceR4-JOLRVWA,5460 +langchain_community/embeddings/ernie.py,sha256=DfxRdpxCEgL9vN1LFb1ewfU1qg6Hvc3_MdK7thhfgho,5038 +langchain_community/embeddings/fake.py,sha256=3cDaTZPwmTyQ407xQztOToD3dmjHzy3kr0unRisnnOs,1506 +langchain_community/embeddings/fastembed.py,sha256=xaqel0KI_D73zgJe4oPSLeSnHKgeGSUjXYr2Ya8qgVo,4990 +langchain_community/embeddings/gigachat.py,sha256=EdGsFsvZm5ZxS4Sx-i4jZv1tN8UQMuMje7K7SWKg69o,6213 +langchain_community/embeddings/google_palm.py,sha256=4WKWSjDcA4_runqWsXIUcO8C0olPdArKfra-gjj8YUo,3308 +langchain_community/embeddings/gpt4all.py,sha256=bcl5CfqS4rOr8etIDqoIYxbFqfWHcugOUC8F8Ql8SMg,2332 +langchain_community/embeddings/gradient_ai.py,sha256=Ig6q99qmGYPth-d9dWjWo4CDMbUHQhSBd5IsiuYuxmU,5419 +langchain_community/embeddings/huggingface.py,sha256=RRQZ8xCiOrhYIguJfYniMA2UPm52DZxol8TFvsVBPvY,17922 +langchain_community/embeddings/huggingface_hub.py,sha256=pwgc6oagiuO_49QJvGO9pTLoB4kph-bVLUOXDRSzXsU,5560 +langchain_community/embeddings/hunyuan.py,sha256=ZEp-sttA10_r0zAuJu-DQvPmRY1wKNmceuWmV6JFfbU,4804 +langchain_community/embeddings/infinity.py,sha256=evxz3EcBiDogC_OWfYlDQb-nrN4JPJAgd_TB4w6zqVg,10155 +langchain_community/embeddings/infinity_local.py,sha256=IA2sGcBN3qK1CF4cpkT3Ey7aSehJ-0z33xUfK9vmiHM,5059 +langchain_community/embeddings/ipex_llm.py,sha256=tLjKxG5y_Iym-HGssffo3pGdBBa1pbdgsIoWiv38pQ8,5174 +langchain_community/embeddings/itrex.py,sha256=lB3iD6JZZTahmj-eO-UDpwGLs1D_rcQZgWE15jGcPb8,8147 +langchain_community/embeddings/javelin_ai_gateway.py,sha256=J66smrAt6wF9vQTKLcYPrwB6hdtqceM14d-AsDDOi-c,3651 +langchain_community/embeddings/jina.py,sha256=3E3IbA2rWMSBqQhhRyMIvyDucfYM4rKJF6LCH7yc29E,3896 +langchain_community/embeddings/johnsnowlabs.py,sha256=q1VDt8ks7x_5rLdKPXpYjnvrCIBLynY4cr5ePL17SFQ,2819 +langchain_community/embeddings/laser.py,sha256=VQnkP2y9L5CBb9vIP2u9i-X5znYR2mxArlD4l8ROEaA,3098 +langchain_community/embeddings/llamacpp.py,sha256=IsBVteNHonNSr0pBfXiREk-NM8F6pce19sVxQeYLcQ4,4994 +langchain_community/embeddings/llamafile.py,sha256=2bO_Zf2RqkVJ3B7eZmQnDrsUPYGLZwETPeUd6Pffa38,3991 +langchain_community/embeddings/llm_rails.py,sha256=RsKgpC1PkqzGGpW0__xXM4BiIe2XR_34h3BptOgSukE,2252 +langchain_community/embeddings/localai.py,sha256=TcgiMUJiRpAlj4aqYwLXpuM2mE0Qi5WCJ4J0FwqnDzQ,12214 +langchain_community/embeddings/minimax.py,sha256=z0r0amUTEaPIJ3bAHKdgsfkEN83jl8FRcfZq2ebLlzo,6149 +langchain_community/embeddings/mlflow.py,sha256=cdCp3WXaDbOjn9h1920jVapd_B-URK833Wwz9n9imc0,3003 +langchain_community/embeddings/mlflow_gateway.py,sha256=QrSQNuBxEke9Mdn8Z7TXApDpmeAZJ-ox8yZ0xdJzv-M,2643 +langchain_community/embeddings/model2vec.py,sha256=7B6jbc2F1W3lLmUU0ClKwN_DK44LoFvoVyZ4lEeKVio,1843 +langchain_community/embeddings/modelscope_hub.py,sha256=k9IkzZh8cVoClxJhRq5Jd914nFiHkjqKuMSUw8JOD5k,2347 +langchain_community/embeddings/mosaicml.py,sha256=VS0piCfo7kIhyQUl35aPbr5QrZww6H9Y_n_eU-45-4g,5092 +langchain_community/embeddings/naver.py,sha256=R4BiywhqeyIYbisIBIqWmMnqQFPoAvBX2BRXJJJy5aM,8234 +langchain_community/embeddings/nemo.py,sha256=6b_ijjhHJjR9sKE7OR0E-4cE10exo6WI1P53Blok4Ak,5879 +langchain_community/embeddings/nlpcloud.py,sha256=1ZouSvAiyvPfCjBZNglQLfX4Eiyr9UrFISpOloNOEWQ,2239 +langchain_community/embeddings/oci_generative_ai.py,sha256=KLsADpbYwrp4mqZVaroYxHjxYK-y2TvrwLxszNyTHkE,8024 +langchain_community/embeddings/octoai_embeddings.py,sha256=PJA7L1NgXKB99U1QHcpI-s9-1ErgikVIX6tyQ4vu4Dw,3093 +langchain_community/embeddings/ollama.py,sha256=rhrlF7p9N42VZzHnXj5_N1qotgJDHnlhGEbgUhI8kXw,8079 +langchain_community/embeddings/openai.py,sha256=T9pjOSLQ5BuNJ9NwzKtHVqN-mkkldGXA1-7V74qBZfc,29261 +langchain_community/embeddings/openvino.py,sha256=NJ6FrKRWr1LvCcx5eGj5rBqJQzAAmr7SNEOEh4MFKPU,12723 +langchain_community/embeddings/optimum_intel.py,sha256=nkn3VJvScHD5tmA-uQCWfrh8U930FJFrQrwjBCdz9QE,7642 +langchain_community/embeddings/oracleai.py,sha256=feqOJm8wSWvnopv747GJv7URS37nonHkVS76YaUEqCg,5636 +langchain_community/embeddings/ovhcloud.py,sha256=UBgxx9fkYVyhp3n2kly1JV0YM2lz3tDiCiqlZBTkHdk,4067 +langchain_community/embeddings/premai.py,sha256=A6Ud9YAx93iXY4N1Oi9bo5ovvbBscx5l6e10EKNNWno,4449 +langchain_community/embeddings/sagemaker_endpoint.py,sha256=SPla2TZKIFdEPdlPFDLg-QNwTJrc1vLT8AS75s9pGP4,7575 +langchain_community/embeddings/sambanova.py,sha256=BFRuO9WKoNVyY1OAMOlmkmVbctDik0gHd4Ky9_hKgDA,12739 +langchain_community/embeddings/self_hosted.py,sha256=lRCdeoRMwkI14gfQ7Dxe64vlBD5vTUdKTU8Duwaa91M,3753 +langchain_community/embeddings/self_hosted_hugging_face.py,sha256=8XxOBp-qz7Itpa2BVqGg8NX4JIgWCiOxXFQ0qn8LSW8,6583 +langchain_community/embeddings/sentence_transformer.py,sha256=0ysq8CVrGOhncqZEGzg1LyH8lAittXQ7HN8ghjEPUd4,190 +langchain_community/embeddings/solar.py,sha256=t_LXhyiU9g6tZEocPYFRGFQZNVZT937QCjk0YS_Oy9Q,4199 +langchain_community/embeddings/spacy_embeddings.py,sha256=gf3uUnsWf3wft-J-mKYM937ViFbUq5lMO9_7OxhN7y4,3860 +langchain_community/embeddings/sparkllm.py,sha256=VrZuq49ja81Fk6GxrQ1b4KuMXrACBFBhtfBTZHA0VE8,9776 +langchain_community/embeddings/tensorflow_hub.py,sha256=d5CJfF2CctlY6dTFpfSh_30zh7uQKTUtLKvAEDFgo24,2399 +langchain_community/embeddings/text2vec.py,sha256=Juz24K9PAre7-ezGLZ8mwFaZ3lc3OOUC0qtQAB4MXLU,2414 +langchain_community/embeddings/textembed.py,sha256=ND5nXCRUlKfxmfJgo2Miw9CoV2BBnr2gCYG1CC3ixrA,11566 +langchain_community/embeddings/titan_takeoff.py,sha256=cjO7NedhK4rkc78ca7JiJw_--A1biOYipTP5e3Ix6C8,7737 +langchain_community/embeddings/vertexai.py,sha256=0aasYb7l5EE2B3F4KRsMi4oQaSF9ACiw4mRTWvMDN84,14672 +langchain_community/embeddings/volcengine.py,sha256=AZuwtcWJiKMgxoJ4MfmUNrpy5iAr-FGw3T9_2HhUi_Y,4166 +langchain_community/embeddings/voyageai.py,sha256=Jfj_B8xbyCLkmzWKHy7s2iH6uRhhZQkLpqwxqokB-r4,7456 +langchain_community/embeddings/xinference.py,sha256=RtgnMNUuvASZllpuiOGBHynZxrXuyuNC1-3FB2mCXvk,3829 +langchain_community/embeddings/yandex.py,sha256=e0lPVWvp_UktZOV-8YoFSZI26qXyFbKsrgL5-TErRzc,7913 +langchain_community/embeddings/zhipuai.py,sha256=o3lD-EIQggxVn3sEjEH8Os7R1NKG52JXsEuXkd_UOho,4149 +langchain_community/example_selectors/__init__.py,sha256=yWkaFowNfU_vyyw5rZhECCJuo-ZSDOz5ZngKJHPw6gE,609 +langchain_community/example_selectors/__pycache__/__init__.cpython-311.pyc,, +langchain_community/example_selectors/__pycache__/ngram_overlap.cpython-311.pyc,, +langchain_community/example_selectors/ngram_overlap.py,sha256=oLxrfxyDlrkj02CtmrihC3o9Iv0NevrAuIChd3PIMa8,3837 +langchain_community/graph_vectorstores/__init__.py,sha256=EJvs04gr4WhCSsZLkOWfbitHn3mdrIdAZ4sYDdrTst8,5980 +langchain_community/graph_vectorstores/__pycache__/__init__.cpython-311.pyc,, +langchain_community/graph_vectorstores/__pycache__/base.cpython-311.pyc,, +langchain_community/graph_vectorstores/__pycache__/cassandra.cpython-311.pyc,, +langchain_community/graph_vectorstores/__pycache__/links.cpython-311.pyc,, +langchain_community/graph_vectorstores/__pycache__/mmr_helper.cpython-311.pyc,, +langchain_community/graph_vectorstores/__pycache__/networkx.cpython-311.pyc,, +langchain_community/graph_vectorstores/__pycache__/visualize.cpython-311.pyc,, +langchain_community/graph_vectorstores/base.py,sha256=cIVq5Zc1VNS6kBGrjyMAStPa2p0r1NF-yQJKPRqXKrI,33323 +langchain_community/graph_vectorstores/cassandra.py,sha256=jz9I7PSH4V7mPZKmWiBjb68_czPhZbq6E2PWMLpY4ao,47011 +langchain_community/graph_vectorstores/extractors/__init__.py,sha256=X_V4M9yKJNKCeKeqh37kaTgAZjT-wsw7yXSLvmzpS1E,1211 +langchain_community/graph_vectorstores/extractors/__pycache__/__init__.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/gliner_link_extractor.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/hierarchy_link_extractor.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/html_link_extractor.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/keybert_link_extractor.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_adapter.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/__pycache__/link_extractor_transformer.cpython-311.pyc,, +langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py,sha256=tSOoY4a8S-2ZDd51gp7jYMKy7tbyn627TDm6GsJLCAc,6072 +langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py,sha256=TAElGjx2V-YDeTS5x5ZPrjjgE-HTjpU-jFOWNO9r01c,4047 +langchain_community/graph_vectorstores/extractors/html_link_extractor.py,sha256=V5YKvCr7a0SVoZ5zS4N83urPw4edI2mjKzySsZpQNQs,11848 +langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py,sha256=7Vew6pwjH6cTsdZkga3b0gf09D26vRr3OUL_ZkmX8lA,6835 +langchain_community/graph_vectorstores/extractors/link_extractor.py,sha256=68L3SqnN5XrSXVhOQl-vdyLQ6ot55jNjQIJQ4d6AXPU,1079 +langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py,sha256=h93ISrP3GDO_QGECCF8sdqIPtor_bdUURDq0wQTPhpU,951 +langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py,sha256=goAdRwwzQiyE2wH_rSYzwa8-7FN-CEY20ofF_F5gsAQ,1644 +langchain_community/graph_vectorstores/links.py,sha256=CbG4tmqEZQmefep0jGqC2_wKQFh1gJkPUtfAQunKLLA,7922 +langchain_community/graph_vectorstores/mmr_helper.py,sha256=jsMVTovPm5xpzoJdfDs0z-TU9LNAQA8566fW61eWUjc,9851 +langchain_community/graph_vectorstores/networkx.py,sha256=76Q3JTzFO-L5hk1BpCD5hRr6qg31hboEZKAyXEJMgbA,3260 +langchain_community/graph_vectorstores/visualize.py,sha256=qarZYnO6UXOlA4MufhjyU8faOvssEGZPRJ2nRMy2HxA,3692 +langchain_community/graphs/__init__.py,sha256=3sZiCQHFYP8yBm6Jz88bQUX7b3rgvNio76CoeNShw0I,3094 +langchain_community/graphs/__pycache__/__init__.cpython-311.pyc,, +langchain_community/graphs/__pycache__/age_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/arangodb_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/falkordb_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/graph_document.cpython-311.pyc,, +langchain_community/graphs/__pycache__/graph_store.cpython-311.pyc,, +langchain_community/graphs/__pycache__/gremlin_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/hugegraph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/index_creator.cpython-311.pyc,, +langchain_community/graphs/__pycache__/kuzu_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/memgraph_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/nebula_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/neo4j_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/neptune_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/neptune_rdf_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/networkx_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/ontotext_graphdb_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/rdf_graph.cpython-311.pyc,, +langchain_community/graphs/__pycache__/tigergraph_graph.cpython-311.pyc,, +langchain_community/graphs/age_graph.py,sha256=Nzo5yFZn2lK34FqPlNkw-EAepH6ZXwErWjonyuUnYIM,27507 +langchain_community/graphs/arangodb_graph.py,sha256=2a7-h-ZvTUUnQ-gIjs1cK3jVsYlZpvPOcL9LFnDVepE,6795 +langchain_community/graphs/falkordb_graph.py,sha256=NAOQyP8IL_sL_y32F7inGekJmwov2fMbQMhME8U15PU,6948 +langchain_community/graphs/graph_document.py,sha256=gHsSKSu5rKFTDOY2Is61kQ_xeNKW0AAxUrGzqMQtwlI,1566 +langchain_community/graphs/graph_store.py,sha256=WeKEOjXkm4ecjaLWjLjk9NBN_mH9zlQBs2YOB8JuuZU,993 +langchain_community/graphs/gremlin_graph.py,sha256=Ev1vcPu9B_yn3B5Xgyx65rVveppysp6VSVXRUv2jFc0,9162 +langchain_community/graphs/hugegraph.py,sha256=ObstcLcRt6_QlnqYVkdCdUv81e58vUP9zvNo_c9_gf4,2511 +langchain_community/graphs/index_creator.py,sha256=ApT26lCQow48qEkrYTPAsz7kI5Es4_sJCtRieoB7i4Y,3968 +langchain_community/graphs/kuzu_graph.py,sha256=UNqiaHIE3RZrvI8fALX-F5Ft7Tc01duNh3CfNfN4XyU,10903 +langchain_community/graphs/memgraph_graph.py,sha256=oV3YIhAnFzjFLxYS0zOEmhcy5kM5zCDAbIwT2Yii8l8,17925 +langchain_community/graphs/nebula_graph.py,sha256=aib7eRuYElfrc_aYtDrYz3BohPbHi7ydO4AUDJ9xVjU,8208 +langchain_community/graphs/neo4j_graph.py,sha256=6u8fsaxN2PmlYk4Qh-jTrkWSLzDOCJqkx1TdyRDGsxg,33596 +langchain_community/graphs/neptune_graph.py,sha256=iyO9eEo_aYS5KXMg4Aq9z3oGPYZnpSOzHa3yrSa0GeA,14586 +langchain_community/graphs/neptune_rdf_graph.py,sha256=XUFMpzD-Lb9jaUNjPOuirLikvmpJHMbd4XXzjvb26UI,10484 +langchain_community/graphs/networkx_graph.py,sha256=9DOzNivZA3drK2K42ocge5CpKaC1e5SPfnbjunYU_20,7897 +langchain_community/graphs/ontotext_graphdb_graph.py,sha256=wqTguvPYIPA2Fz1F4apHmpBVswW4O0z7fkmXE_tCFaU,7750 +langchain_community/graphs/rdf_graph.py,sha256=aYS-vWQWR7Xq7xK5M8ofUEwLrLuvqGf2QGOnyZGg6vY,10571 +langchain_community/graphs/tigergraph_graph.py,sha256=laeQZA98ZJHKgNKVKxhtJcAv1nasUD1pjB3NiH_Y5Tk,3519 +langchain_community/indexes/__init__.py,sha256=RDI_w1cj4HyHD9R37q6UnfcvrK4rGZ5oN2_xkN6vetw,488 +langchain_community/indexes/__pycache__/__init__.cpython-311.pyc,, +langchain_community/indexes/__pycache__/_document_manager.cpython-311.pyc,, +langchain_community/indexes/__pycache__/_sql_record_manager.cpython-311.pyc,, +langchain_community/indexes/__pycache__/base.cpython-311.pyc,, +langchain_community/indexes/_document_manager.py,sha256=zBW3MH7YqtOkgI8lv59SULeFHrZ1hx8jV5bclmc8Svw,8289 +langchain_community/indexes/_sql_record_manager.py,sha256=vXSMdxJtFENJEwUBCLkNI-tYEf6mTcz-1-0KK6lq0pE,20494 +langchain_community/indexes/base.py,sha256=ivoDqzrV7b90LGJ_GJcu-J7WNhpYFP7iaHa6szbpHkw,5191 +langchain_community/llms/__init__.py,sha256=OuzXV1V3P3uqGqyvygumqqmHYkDSvUZwqMjid1384hU,28730 +langchain_community/llms/__pycache__/__init__.cpython-311.pyc,, +langchain_community/llms/__pycache__/ai21.cpython-311.pyc,, +langchain_community/llms/__pycache__/aleph_alpha.cpython-311.pyc,, +langchain_community/llms/__pycache__/amazon_api_gateway.cpython-311.pyc,, +langchain_community/llms/__pycache__/anthropic.cpython-311.pyc,, +langchain_community/llms/__pycache__/anyscale.cpython-311.pyc,, +langchain_community/llms/__pycache__/aphrodite.cpython-311.pyc,, +langchain_community/llms/__pycache__/arcee.cpython-311.pyc,, +langchain_community/llms/__pycache__/aviary.cpython-311.pyc,, +langchain_community/llms/__pycache__/azureml_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/baichuan.cpython-311.pyc,, +langchain_community/llms/__pycache__/baidu_qianfan_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/bananadev.cpython-311.pyc,, +langchain_community/llms/__pycache__/baseten.cpython-311.pyc,, +langchain_community/llms/__pycache__/beam.cpython-311.pyc,, +langchain_community/llms/__pycache__/bedrock.cpython-311.pyc,, +langchain_community/llms/__pycache__/bigdl_llm.cpython-311.pyc,, +langchain_community/llms/__pycache__/bittensor.cpython-311.pyc,, +langchain_community/llms/__pycache__/cerebriumai.cpython-311.pyc,, +langchain_community/llms/__pycache__/chatglm.cpython-311.pyc,, +langchain_community/llms/__pycache__/chatglm3.cpython-311.pyc,, +langchain_community/llms/__pycache__/clarifai.cpython-311.pyc,, +langchain_community/llms/__pycache__/cloudflare_workersai.cpython-311.pyc,, +langchain_community/llms/__pycache__/cohere.cpython-311.pyc,, +langchain_community/llms/__pycache__/ctransformers.cpython-311.pyc,, +langchain_community/llms/__pycache__/ctranslate2.cpython-311.pyc,, +langchain_community/llms/__pycache__/databricks.cpython-311.pyc,, +langchain_community/llms/__pycache__/deepinfra.cpython-311.pyc,, +langchain_community/llms/__pycache__/deepsparse.cpython-311.pyc,, +langchain_community/llms/__pycache__/edenai.cpython-311.pyc,, +langchain_community/llms/__pycache__/exllamav2.cpython-311.pyc,, +langchain_community/llms/__pycache__/fake.cpython-311.pyc,, +langchain_community/llms/__pycache__/fireworks.cpython-311.pyc,, +langchain_community/llms/__pycache__/forefrontai.cpython-311.pyc,, +langchain_community/llms/__pycache__/friendli.cpython-311.pyc,, +langchain_community/llms/__pycache__/gigachat.cpython-311.pyc,, +langchain_community/llms/__pycache__/google_palm.cpython-311.pyc,, +langchain_community/llms/__pycache__/gooseai.cpython-311.pyc,, +langchain_community/llms/__pycache__/gpt4all.cpython-311.pyc,, +langchain_community/llms/__pycache__/gradient_ai.cpython-311.pyc,, +langchain_community/llms/__pycache__/huggingface_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/huggingface_hub.cpython-311.pyc,, +langchain_community/llms/__pycache__/huggingface_pipeline.cpython-311.pyc,, +langchain_community/llms/__pycache__/huggingface_text_gen_inference.cpython-311.pyc,, +langchain_community/llms/__pycache__/human.cpython-311.pyc,, +langchain_community/llms/__pycache__/ipex_llm.cpython-311.pyc,, +langchain_community/llms/__pycache__/javelin_ai_gateway.cpython-311.pyc,, +langchain_community/llms/__pycache__/koboldai.cpython-311.pyc,, +langchain_community/llms/__pycache__/konko.cpython-311.pyc,, +langchain_community/llms/__pycache__/layerup_security.cpython-311.pyc,, +langchain_community/llms/__pycache__/llamacpp.cpython-311.pyc,, +langchain_community/llms/__pycache__/llamafile.cpython-311.pyc,, +langchain_community/llms/__pycache__/loading.cpython-311.pyc,, +langchain_community/llms/__pycache__/manifest.cpython-311.pyc,, +langchain_community/llms/__pycache__/minimax.cpython-311.pyc,, +langchain_community/llms/__pycache__/mlflow.cpython-311.pyc,, +langchain_community/llms/__pycache__/mlflow_ai_gateway.cpython-311.pyc,, +langchain_community/llms/__pycache__/mlx_pipeline.cpython-311.pyc,, +langchain_community/llms/__pycache__/modal.cpython-311.pyc,, +langchain_community/llms/__pycache__/moonshot.cpython-311.pyc,, +langchain_community/llms/__pycache__/mosaicml.cpython-311.pyc,, +langchain_community/llms/__pycache__/nlpcloud.cpython-311.pyc,, +langchain_community/llms/__pycache__/oci_data_science_model_deployment_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/oci_generative_ai.cpython-311.pyc,, +langchain_community/llms/__pycache__/octoai_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/ollama.cpython-311.pyc,, +langchain_community/llms/__pycache__/opaqueprompts.cpython-311.pyc,, +langchain_community/llms/__pycache__/openai.cpython-311.pyc,, +langchain_community/llms/__pycache__/openllm.cpython-311.pyc,, +langchain_community/llms/__pycache__/openlm.cpython-311.pyc,, +langchain_community/llms/__pycache__/outlines.cpython-311.pyc,, +langchain_community/llms/__pycache__/pai_eas_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/petals.cpython-311.pyc,, +langchain_community/llms/__pycache__/pipelineai.cpython-311.pyc,, +langchain_community/llms/__pycache__/predibase.cpython-311.pyc,, +langchain_community/llms/__pycache__/predictionguard.cpython-311.pyc,, +langchain_community/llms/__pycache__/promptlayer_openai.cpython-311.pyc,, +langchain_community/llms/__pycache__/replicate.cpython-311.pyc,, +langchain_community/llms/__pycache__/rwkv.cpython-311.pyc,, +langchain_community/llms/__pycache__/sagemaker_endpoint.cpython-311.pyc,, +langchain_community/llms/__pycache__/sambanova.cpython-311.pyc,, +langchain_community/llms/__pycache__/self_hosted.cpython-311.pyc,, +langchain_community/llms/__pycache__/self_hosted_hugging_face.cpython-311.pyc,, +langchain_community/llms/__pycache__/solar.cpython-311.pyc,, +langchain_community/llms/__pycache__/sparkllm.cpython-311.pyc,, +langchain_community/llms/__pycache__/stochasticai.cpython-311.pyc,, +langchain_community/llms/__pycache__/symblai_nebula.cpython-311.pyc,, +langchain_community/llms/__pycache__/textgen.cpython-311.pyc,, +langchain_community/llms/__pycache__/titan_takeoff.cpython-311.pyc,, +langchain_community/llms/__pycache__/together.cpython-311.pyc,, +langchain_community/llms/__pycache__/tongyi.cpython-311.pyc,, +langchain_community/llms/__pycache__/utils.cpython-311.pyc,, +langchain_community/llms/__pycache__/vertexai.cpython-311.pyc,, +langchain_community/llms/__pycache__/vllm.cpython-311.pyc,, +langchain_community/llms/__pycache__/volcengine_maas.cpython-311.pyc,, +langchain_community/llms/__pycache__/watsonxllm.cpython-311.pyc,, +langchain_community/llms/__pycache__/weight_only_quantization.cpython-311.pyc,, +langchain_community/llms/__pycache__/writer.cpython-311.pyc,, +langchain_community/llms/__pycache__/xinference.cpython-311.pyc,, +langchain_community/llms/__pycache__/yandex.cpython-311.pyc,, +langchain_community/llms/__pycache__/yi.cpython-311.pyc,, +langchain_community/llms/__pycache__/you.cpython-311.pyc,, +langchain_community/llms/__pycache__/yuan2.cpython-311.pyc,, +langchain_community/llms/ai21.py,sha256=IWo2dQaqcnkgw2bKJ4OXj3nkvoiAKKNjO2mOaozUMAU,5224 +langchain_community/llms/aleph_alpha.py,sha256=DgBJZyU_jiK0I4SfCjEiJtT3gFqRS2mxOFyu1khbW-Q,11470 +langchain_community/llms/amazon_api_gateway.py,sha256=J1fnfg_waAf3jQ0Out0GjLyisHsvuEZHYIxQpK-OGaI,3007 +langchain_community/llms/anthropic.py,sha256=C37I0JEPtWuZCd0Whx_bqTMs4BNM3PbNHTYn6P8JiGU,12633 +langchain_community/llms/anyscale.py,sha256=ZRYvhHilCwXWFqvfELiNV-fQpEQz_sYrjo3nTjX_QjU,11916 +langchain_community/llms/aphrodite.py,sha256=1RjrAEmZgXOtXMRb77iEuEad6WYtSl9YMGlKzH-z_E8,9626 +langchain_community/llms/arcee.py,sha256=-q9_TK2Y-kumdIadCp7PUaQdQ5ywbMT2QK6LDugDpN8,4280 +langchain_community/llms/aviary.py,sha256=kJ9DP0R4cItAUz3uBjCw09nGwP-0qkSEe9eKhBr6ElA,5976 +langchain_community/llms/azureml_endpoint.py,sha256=T9OQzup6qXtAAxuWPFUqC_CfqHqLj5hAUUgm5hXYZF4,20658 +langchain_community/llms/baichuan.py,sha256=DejxhwEXp7v6ZgKj6_GgoQnKRDAi7SBjbAjmJUR0J58,3019 +langchain_community/llms/baidu_qianfan_endpoint.py,sha256=UKTPV48YKccvnsVYS3UOrusSl0UY-m3PcXtRQ3qQ2lw,10241 +langchain_community/llms/bananadev.py,sha256=tGTINHKLzutMDsBqZW-5706s4XgLowa3GWk5PE_mx3M,4468 +langchain_community/llms/baseten.py,sha256=_ystNrL9YHXpDiDgnwc_p3GEt-jcgVL7nsnP4W6RD6w,3169 +langchain_community/llms/beam.py,sha256=ahreDYFQ_bw3EbgqA40D2spLEFyzore6M5F-appZ0Yc,9112 +langchain_community/llms/bedrock.py,sha256=uBxqZfp2oqT-b5F2LP3x7hjVVmehFWuqC2p6KqNTVxw,31488 +langchain_community/llms/bigdl_llm.py,sha256=WTj2X8sCO4KfBLQ6aI6B7uRNdNywXl0BZnyLu2ZVig8,5515 +langchain_community/llms/bittensor.py,sha256=dcYwQ4p4FK8uB4DeuBatiufmTTrsbI5uRZ-g0FNy1MQ,6232 +langchain_community/llms/cerebriumai.py,sha256=Bw2ypqKk_w-6ah8-i0z4j_MOcU0lIeTfMftjuuZD7PI,3989 +langchain_community/llms/chatglm.py,sha256=FWp9ZLJAdXf4twKMRt16f3SleGfZ0g0dqowSHuEvLic,3950 +langchain_community/llms/chatglm3.py,sha256=gY_78Jgqm2qYWVQ4ma4lrcjljGircr68wCZAMkW-BlI,4866 +langchain_community/llms/clarifai.py,sha256=sBmkN6Wd9zm_yeni6tHDcNLOO0GXJ9kbya4szCUTZfs,6542 +langchain_community/llms/cloudflare_workersai.py,sha256=J_Wx9Efs0XEOZwBcmitZjOVBuzMBUmESQESzxtf_dWQ,4292 +langchain_community/llms/cohere.py,sha256=c9ldRgzpg6tf1gp7eHV2p4NmTjUWWCqT1wLnZaLM8UI,8645 +langchain_community/llms/ctransformers.py,sha256=jwpzK3Yvpxb-zYELxnt5EyQlsE-vAIUfAVYPM7R279U,4221 +langchain_community/llms/ctranslate2.py,sha256=K_w86ASO7nSy8-uhdSlDyCp3f1ngba7js16nrC9Al4s,4149 +langchain_community/llms/databricks.py,sha256=UmcHhRl4-QyP6Tz-JJDtX8XD71rnih_GV2a3olGbf4o,20838 +langchain_community/llms/deepinfra.py,sha256=L0gpMPxrCAMAmIxnDWe-ZeFhr7shMu4tBFvxsZZQ3xQ,8205 +langchain_community/llms/deepsparse.py,sha256=3og3skeTCIds4vAXAZp7sEaVveeOHxpZIQk75i1Hne4,8904 +langchain_community/llms/edenai.py,sha256=0uWxGVwUJxnyKazP8pH030h6z7YlG6trU5JXDc5PKaQ,9464 +langchain_community/llms/exllamav2.py,sha256=uXrSz76-K5xYuo9Cu5Qi_rgERT_sk6RtKyhR_8oAGv8,6496 +langchain_community/llms/fake.py,sha256=JrJXZXwH4IRTQrmyoR4G78VAUBlcKiwqeFs_LBAQ4FE,2444 +langchain_community/llms/fireworks.py,sha256=vk0ndggBpooj1zuoE4tNegY4W0jqQEekQr1mazwnFLs,11906 +langchain_community/llms/forefrontai.py,sha256=q4KDZbBBFkZgGymeDJDKep3i7vWN0NSNzH9YVEvCcVA,3731 +langchain_community/llms/friendli.py,sha256=eEBvxZdwPuNxRGn06vjWdmGYw4n9oHL_8g4TDeFOLQs,14714 +langchain_community/llms/gigachat.py,sha256=vzVgLeIj7r6x2_YttB66Lcp_Cq6wBEP8aSvhtwx9AbY,11727 +langchain_community/llms/google_palm.py,sha256=YqWEufWxjaBKcERbFRcXGVI87wyTzznu4h2BINqHluc,8828 +langchain_community/llms/gooseai.py,sha256=N6gajMGq8Ez5dKI4fY8IFHLku4B6CAbnq0tT-PIvwZw,5110 +langchain_community/llms/gpt4all.py,sha256=CuYUepIxJYvsuvlOM-fUd-2-V97mKxZuUsZCx57eZNs,6569 +langchain_community/llms/gradient_ai.py,sha256=ehf7PDrwzhwxTXm7t3Wt91sMSVTvsrX4U0tV1n1gZf4,14435 +langchain_community/llms/grammars/json.gbnf,sha256=htDQy5F1h7Q6K9kuc1j7a_LUw8Dhj-_rhQc28OJqluQ,664 +langchain_community/llms/grammars/list.gbnf,sha256=9cg8vDmOQ-jZvKSj-hyvTUl05Igbw_416yRQnB2VqcA,167 +langchain_community/llms/huggingface_endpoint.py,sha256=HXiIxIj7gpXbsPH2JU_MXzIGiOunPW7i_S8tE8uea94,14649 +langchain_community/llms/huggingface_hub.py,sha256=tZGI1FJg95wsCpjLJomJjpRh9vTs4NV6DKO8Ht963WM,5370 +langchain_community/llms/huggingface_pipeline.py,sha256=CxwDk2iAFi15zgAOdEfyxWa47M3Tv6Dvxv-sDlvzD14,13686 +langchain_community/llms/huggingface_text_gen_inference.py,sha256=RfR_QKyt-TzMeqc30MKDnN17rNnZEbgbeOLvMwETNw0,11670 +langchain_community/llms/human.py,sha256=IqPTAowCzNKrY4NpHNc-Y4vi2j9njFmRzQK-RME4K7Q,2557 +langchain_community/llms/ipex_llm.py,sha256=HdvQUaImn0Gd3l-6_ml6q-e7LQ_3PlIewc4qzD5JCrs,10056 +langchain_community/llms/javelin_ai_gateway.py,sha256=-Q8MjQ-OnJdSNXCuhuubEWpto57GxQYeR9lrN6HWCwI,4668 +langchain_community/llms/koboldai.py,sha256=3OAwL9q_rNiWrJp-IR8Ai60AEDgrCfxITRUViTwsRzo,5094 +langchain_community/llms/konko.py,sha256=FfIruQws_EnRliy0mzgewL_8NDfgfLkPQaroZ9ZZBRQ,6514 +langchain_community/llms/layerup_security.py,sha256=qckrnr-0Ore9wMtWruhs5a6TBRq2Sy-GgPXGSN7zuFU,3476 +langchain_community/llms/llamacpp.py,sha256=NxXXty_x4MdI22m9BT8hzU4X5LdF6CD7KzjLUy5JZxU,12390 +langchain_community/llms/llamafile.py,sha256=oOMZJgDK5As4edwziFWK2NzMNgBQrIrkLbZ6QAKwQfk,10368 +langchain_community/llms/loading.py,sha256=sFf8yYhcBBwNeY_EMb7huuL3VcDRSw0ivP5e0Fu_eVM,1764 +langchain_community/llms/manifest.py,sha256=pVaXWwrT3Nu2JsKB6SxfkDZZ_CRs7w-fz2wV39nArC8,1936 +langchain_community/llms/minimax.py,sha256=NZY7tfTZ6fT4qIoCqV7wZsk6X4CLoH9JOFTHLuTZSYA,5519 +langchain_community/llms/mlflow.py,sha256=U8anEMR8CHvGV9bnOLWjKkPlOZ7cFv_iPwvTwHQbZnc,3413 +langchain_community/llms/mlflow_ai_gateway.py,sha256=Iy8FcgRKeMGvMMPgr0zF1pTkk_g9EobtV-basIrkJO8,3185 +langchain_community/llms/mlx_pipeline.py,sha256=VY0vv_KrLf8FkDjbg4TyUsZjzjjXIB5JB15I7LoLnO8,8834 +langchain_community/llms/modal.py,sha256=4zskw3xERCYvSW_aOWTEdS30dB4mXW5vgFu-GZv8eHc,3301 +langchain_community/llms/moonshot.py,sha256=5M-6Idru5VZ6nAyMS-Im2YAS54GrbjtwLyf7ARphSyI,4558 +langchain_community/llms/mosaicml.py,sha256=t-d0zuyK5Sybn-_BP-KwnYkXWL885GCBd_aKWtU-sF0,6089 +langchain_community/llms/nlpcloud.py,sha256=HBuIQKf_BpLG70dUqdNg-2I9PvlFQHF5YUWuw-Lr7HM,4992 +langchain_community/llms/oci_data_science_model_deployment_endpoint.py,sha256=ktOUVHWa-rpOe34PEU_ojXp61nrMhWBbDfZ60pjnzOQ,33397 +langchain_community/llms/oci_generative_ai.py,sha256=pxwlBsHDD0cvrp0hEDcxN7zPj8NG2ZY9iRYy0tZXnZo,12807 +langchain_community/llms/octoai_endpoint.py,sha256=cEMkRO4ilql-TxLDxHMbaV8VkygIQ9J_lPCHJQFxIiE,3886 +langchain_community/llms/ollama.py,sha256=f8_CRtV2eBPLSy6HT1dxDX9Qr_pqIWoQk0Tp_lBD5RU,18254 +langchain_community/llms/opaqueprompts.py,sha256=PDSdlkJ-cerfXgHh2gjtdGcbXcrCx4Igms8mJ8zhgoY,4042 +langchain_community/llms/openai.py,sha256=iujKN4iMaGO8Z6PBzjJYr8qalP3whtQI4ZiEgAM3-xk,48313 +langchain_community/llms/openllm.py,sha256=85t6wH2J0B-9GLrLPmzu8x2c4oCtFfvz0QQ_BIzur04,1061 +langchain_community/llms/openlm.py,sha256=cS1UYwVV5_xyXJCo_SAnn0h2uscYHhK1CkRYPSysyhQ,882 +langchain_community/llms/outlines.py,sha256=exTi1wIV5SR_WwyVYVW88l7aEyByHqbV0iQE1VdIgV0,11497 +langchain_community/llms/pai_eas_endpoint.py,sha256=QL6rR0fkZzwGSthW1run5RfxxWFNIqtWKSg_BwMi6CI,8007 +langchain_community/llms/petals.py,sha256=b1-GT69hO025SuzyxwaQA4kHbSNBV1FTOZ2-KhhBs24,5431 +langchain_community/llms/pipelineai.py,sha256=P9jYfWDT7tlq1thvLfKm4SaEuZA_yml89gUds-Tskq4,4155 +langchain_community/llms/predibase.py,sha256=Dgs-D46WICDFA9ajBLXjziyjJ7XiGwNNIKYuiO1MIWs,8562 +langchain_community/llms/predictionguard.py,sha256=ozMnN6AHIiEOIh11RZEhUaOPV6Nw9iSVif77aflCvFw,5417 +langchain_community/llms/promptlayer_openai.py,sha256=ORhAqHmALf86-UKsjjg4t-_40zW7Moa9KtJdKBWy3T4,8806 +langchain_community/llms/replicate.py,sha256=8qBCSscietWQMlE6lYR9DZG6ObbkRqvaM1BeWuC0P7g,8384 +langchain_community/llms/rwkv.py,sha256=LwaMOVcckEv1Zz9QHHU2sJi1Je88WCNSMTlgEOXJNMo,7366 +langchain_community/llms/sagemaker_endpoint.py,sha256=97aPsOXblPB4WMfM3z56mPa0flP2ISYxaTOe8SFgI2c,13302 +langchain_community/llms/sambanova.py,sha256=R9XOgzeKuFk03Hrnf9nw5fOCPypYc8qZijgg3sCcyjI,31323 +langchain_community/llms/self_hosted.py,sha256=qEh7PAZmG5nWkqu-e3IW30LUFQXwxN2IMBabk0-WKIQ,8600 +langchain_community/llms/self_hosted_hugging_face.py,sha256=jkigb2ILFUcSDosm_06USh_nTNLwaGtQbvrtQGgNy-c,7677 +langchain_community/llms/solar.py,sha256=Y6fVTUfgRaZ31t-QXgnZWjDgOBbsu1ZAirRwL-I2u3U,4180 +langchain_community/llms/sparkllm.py,sha256=UK7irP1Q8a5hYWlVsazPIdWvW-OjY4NnWbeAVcSF92A,15983 +langchain_community/llms/stochasticai.py,sha256=zO-3PdxhvDhRcN2NtjtvF37li_ibjZEuRQRcBKiTgeg,4721 +langchain_community/llms/symblai_nebula.py,sha256=xgCoqVgQeeC-xQ4XkMFIHu8EtzSGMm3NzX_tnWy-Yu0,7470 +langchain_community/llms/textgen.py,sha256=OVYOhVt2auRtPYraZK4sk3vizw8P7DUJ37-Yau3brTM,14147 +langchain_community/llms/titan_takeoff.py,sha256=BkvmQm4hxpJa77G9OQH9qZxymWow9CrCy7KdysJvoQc,9319 +langchain_community/llms/together.py,sha256=vd1yg8p3Ctuy00TEAUjL7ypo-2bZhkR2fLzrrOeqi6Q,7650 +langchain_community/llms/tongyi.py,sha256=lueBNbX0tMMeMbX4ASut2UC4xKY9Gv24BDmcOdMCBNk,15278 +langchain_community/llms/utils.py,sha256=1kOC-KGmdYNogA6b-04bZeZ-2OXoll9k-mR84ceHaYU,259 +langchain_community/llms/vertexai.py,sha256=Lht2LeCHFE_Sz4zAoA5hGCNMfoQnkELQexIkb4uoJcI,19375 +langchain_community/llms/vllm.py,sha256=mLIE0u2rhuJG7Yt9LWeDCIuKBCSb96Wk8zetd2lZydU,5990 +langchain_community/llms/volcengine_maas.py,sha256=z6PGmyzo_R1V7VrlW1AB3oPQcLf2aypbKgFFWHxDyNY,6634 +langchain_community/llms/watsonxllm.py,sha256=rGq54NA1NTpPobNveNKsDnXTVfUn7ZPe3TF9LYZN4S4,15024 +langchain_community/llms/weight_only_quantization.py,sha256=W8lQf32qDXjvX3t1ihC7qzKit-JrZWOCahkJ5VWUHtk,8877 +langchain_community/llms/writer.py,sha256=LLzVn8HEzi40OoegmQNfFgk4tUM1GAlAsOBKWNhsSp4,6918 +langchain_community/llms/xinference.py,sha256=4KxY3n5IhL_nOLEsEMyaHmOlmwTj1pXb_rgRSZKEt7A,13197 +langchain_community/llms/yandex.py,sha256=nDIdYb_bZjjmJ2Iw7JibE81mSuZp6kjyPR_K-hgBkRo,12897 +langchain_community/llms/yi.py,sha256=WBigD0dXlPQq_qLLesGS1-MilY3ZXjIAKPmzwNI9FAs,3504 +langchain_community/llms/you.py,sha256=Gu6Z-gJWDxOv96GckWAOxesjuFCBrlJ84uVEamkH6eY,4540 +langchain_community/llms/yuan2.py,sha256=Mv4qNOViaPbKKPX77Xm4m9JHvdLM5RzQq-W0grgn_w8,5950 +langchain_community/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/memory/__pycache__/__init__.cpython-311.pyc,, +langchain_community/memory/__pycache__/kg.cpython-311.pyc,, +langchain_community/memory/__pycache__/motorhead_memory.cpython-311.pyc,, +langchain_community/memory/__pycache__/zep_cloud_memory.cpython-311.pyc,, +langchain_community/memory/__pycache__/zep_memory.cpython-311.pyc,, +langchain_community/memory/kg.py,sha256=nxL1B2Y4JBzzQPweRVqrY0fZBsvcaNv6myJyz1Zp-pc,5647 +langchain_community/memory/motorhead_memory.py,sha256=4AQuQiqVATUBYMTnPqOchzXPmOD9lB4MvMF8gKCxiYk,3609 +langchain_community/memory/zep_cloud_memory.py,sha256=0m3KoT17Wg4gw0tuCmj5HFQ9M3yo6AgJpNsdA1DvbHg,5662 +langchain_community/memory/zep_memory.py,sha256=Mu6YsBUUJmFcmK5rBw-niUcJkKiaQppdIUqe3sh8Dh8,5632 +langchain_community/output_parsers/__init__.py,sha256=GyTxvY9uZ3JfWnXyMrOjLxCeiFGtJ16L3HLbBSaq2xs,292 +langchain_community/output_parsers/__pycache__/__init__.cpython-311.pyc,, +langchain_community/output_parsers/__pycache__/ernie_functions.cpython-311.pyc,, +langchain_community/output_parsers/__pycache__/rail_parser.cpython-311.pyc,, +langchain_community/output_parsers/ernie_functions.py,sha256=CU-GbC9UBBZxWJzdSsQFK1YUWJbEjUhR25NazZ0Tt-E,6711 +langchain_community/output_parsers/rail_parser.py,sha256=Sbz5nPOk7L2I31p54V5BsNkmAQeh_wNc2NZl7_Z7a9U,3283 +langchain_community/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/query_constructors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/query_constructors/__pycache__/__init__.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/astradb.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/chroma.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/dashvector.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/databricks_vector_search.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/deeplake.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/dingo.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/hanavector.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/milvus.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/mongodb_atlas.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/myscale.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/neo4j.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/opensearch.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/pgvector.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/pinecone.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/qdrant.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/redis.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/supabase.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/tencentvectordb.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/timescalevector.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/vectara.cpython-311.pyc,, +langchain_community/query_constructors/__pycache__/weaviate.cpython-311.pyc,, +langchain_community/query_constructors/astradb.py,sha256=QZDoQBz5FY9O7d5uSfOxScz8ozLvo-9mJoOjS6GDwwU,2189 +langchain_community/query_constructors/chroma.py,sha256=jSGK-_genOLOhkr4yBcFEB2iF0zX1H9kouM7Z-x_7sU,1468 +langchain_community/query_constructors/dashvector.py,sha256=Tysp5Ydh0URk6t-UokrjwM8M3thW5cpc2Gt5v8CfFI8,1913 +langchain_community/query_constructors/databricks_vector_search.py,sha256=2R5OJk2wMmEyYtLGqVHvFvITX9QpvH8SWWqpL3lMu8E,3143 +langchain_community/query_constructors/deeplake.py,sha256=NhnOqxi2on_idMCb4nnMuPpyjYRpg1GwDXI1WcJoF-8,2640 +langchain_community/query_constructors/dingo.py,sha256=t5OhDnjzRXv4SlFWuYOVTfntjyesS-3ZFkMery1M2XU,1343 +langchain_community/query_constructors/elasticsearch.py,sha256=hWMGwwdgi_XVAq1My6WCclfzQnpJX3jJRlhNtd7zUhY,3267 +langchain_community/query_constructors/hanavector.py,sha256=QncdlhSkDYoTmgh8GdtwMKwEVVIK75gcLwKOigODK7I,2322 +langchain_community/query_constructors/milvus.py,sha256=uwAM10_2GXN9hBq2uQ2i7RrbvuBAFiwgKYCAf_O52bU,3347 +langchain_community/query_constructors/mongodb_atlas.py,sha256=ttdKlLGMmW_Uwdwz8QsB8IVFpmwHvs7i_bNqtY_GwxE,2298 +langchain_community/query_constructors/myscale.py,sha256=HQf6XpFU9u5OCMrL-wTYRooePRUU0uha90yaoymmLSU,3630 +langchain_community/query_constructors/neo4j.py,sha256=ebmKZ13S0PeuEEWv9AO-NyFFtzc7JT-JY4oEn_z5J5g,1912 +langchain_community/query_constructors/opensearch.py,sha256=bUYi0Xr-ESQnR83gIrbOB7xZhM96as06Ea_0iIHNsq0,3268 +langchain_community/query_constructors/pgvector.py,sha256=zM5VOcQZlDSbeVhXUfrnIT2FydxTU3Vfce5YKUeLQ_o,1523 +langchain_community/query_constructors/pinecone.py,sha256=M8iPeetOPGsT-STsVMKe5mCJXcjPoVxxrXp7b4tLjgI,1704 +langchain_community/query_constructors/qdrant.py,sha256=Un2nuzJGEtsBXVAxBa5XZCO3s6hSf8gDOjq4xYK6BAI,3162 +langchain_community/query_constructors/redis.py,sha256=_eg5bFk9cR7d6supFLG0pnlNc5lm6mVV6j4CRr28k-c,3370 +langchain_community/query_constructors/supabase.py,sha256=vNto2znW-CaX9PMp2keArHnN-g5W6IpSL6LUs4h4K_o,2973 +langchain_community/query_constructors/tencentvectordb.py,sha256=we0PO8bZHc33KJ6VRhDLA6rvtamlgbfNZeHWE6bl8Tg,3703 +langchain_community/query_constructors/timescalevector.py,sha256=z1ghqfhjrwYULYfUHDbr1yLam4azjpzvkLB2KwV7UAQ,2641 +langchain_community/query_constructors/vectara.py,sha256=qW1asJmgFYgcdnkHqS8jtgtwuYajSqIRuCjf-xl4UnM,2158 +langchain_community/query_constructors/weaviate.py,sha256=A3JUt2WUMwU-T_7cq1DqIbMI7aNFu54MttvHRftpaZE,2613 +langchain_community/retrievers/__init__.py,sha256=f0Ibj33a6oxVek05HqbOYR4YlUe0MK4ne75fLiIYamo,9840 +langchain_community/retrievers/__pycache__/__init__.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/arcee.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/arxiv.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/asknews.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/azure_ai_search.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/bedrock.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/bm25.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/breebs.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/chaindesk.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/chatgpt_plugin_retriever.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/cohere_rag_retriever.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/databerry.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/docarray.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/dria_index.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/elastic_search_bm25.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/embedchain.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/google_cloud_documentai_warehouse.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/google_vertex_ai_search.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/kay.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/kendra.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/knn.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/llama_index.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/metal.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/milvus.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/nanopq.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/needle.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/outline.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/pinecone_hybrid_search.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/pubmed.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/pupmed.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/qdrant_sparse_vector_retriever.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/rememberizer.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/remote_retriever.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/svm.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/tavily_search_api.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/tfidf.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/thirdai_neuraldb.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/vespa_retriever.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/weaviate_hybrid_search.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/web_research.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/wikipedia.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/you.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/zep.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/zep_cloud.cpython-311.pyc,, +langchain_community/retrievers/__pycache__/zilliz.cpython-311.pyc,, +langchain_community/retrievers/arcee.py,sha256=0GWm1leKna_UAgHQ1SzBDCR2tUTpvkOWsVmBAw2wtIM,4185 +langchain_community/retrievers/arxiv.py,sha256=5azHVKfra_MtAC-ypaBVyI2kSRS7SDCarVAfaQnMTOU,2870 +langchain_community/retrievers/asknews.py,sha256=e1ekOjtqSItrIQjummSqXIjYI9ylvUTkHZBvz1r5S_E,4861 +langchain_community/retrievers/azure_ai_search.py,sha256=gyKK14vtml1tePo2Fahmq1v_fdiLfBUj92gsb6MAKX4,8336 +langchain_community/retrievers/bedrock.py,sha256=Y_QwBeqfN0DGtDFoBNJW8JjUAll4tVaA7he86hgNVTI,6203 +langchain_community/retrievers/bm25.py,sha256=oIyuxWY3vyOTrhVcQb5gswkpbfHj3ONxbEz5mtIml3I,4052 +langchain_community/retrievers/breebs.py,sha256=q6QQ7w3vmm7ZaEgNg1Zi4R9_Jsf2yZtXx1vM5mzCBvI,1555 +langchain_community/retrievers/chaindesk.py,sha256=PY_eX5NxKHjDX4u5kLRsL1MyulKJZ28mnPjKymUpnMU,2684 +langchain_community/retrievers/chatgpt_plugin_retriever.py,sha256=gj3y7Ge3QbRk1b0kKYI7kcfGdgXDj9EsJ10eJSqHl9Q,2982 +langchain_community/retrievers/cohere_rag_retriever.py,sha256=Rhvud_dev58raIbGxkUXv75s3_MpmiEB4qRSQcBeJGw,3006 +langchain_community/retrievers/databerry.py,sha256=g5wr_PURwFdlIq08uuztmXwvqSe8TUKULhpkGiBbJfo,2338 +langchain_community/retrievers/docarray.py,sha256=FR1OmXjMhztfQ3QIPBZKD8WjCNoLKYtfFf40Vb5VkNY,6834 +langchain_community/retrievers/dria_index.py,sha256=FztoTejsuRRhgm59EEbErwWhDdhw-UhylwELzaF13IY,2789 +langchain_community/retrievers/elastic_search_bm25.py,sha256=sbV_okez3DBfjU4UmjYE5cEWRiKMmKVh-33wFkdAYgg,4640 +langchain_community/retrievers/embedchain.py,sha256=FwPza4guaQLfe1z0bcipoAHpos6BEC8lgfsTok2Qvg4,2087 +langchain_community/retrievers/google_cloud_documentai_warehouse.py,sha256=GPhk06dXPwS8pJzuAcVEwVkw8EkbJkHOuxhuYyvUCes,4709 +langchain_community/retrievers/google_vertex_ai_search.py,sha256=uu97CtTD2y3wBFO19TDYT7M6HeNX8JMHp7c9vQ_Y1aM,18787 +langchain_community/retrievers/kay.py,sha256=SMlMr3QEbZTkISBWpY1W6hcu-5Mk9axjBEw2h6bgoq8,1985 +langchain_community/retrievers/kendra.py,sha256=ngHF1dBezAImNfYhxy5yin6Rz-9OfZZml2xEYOimGx4,15744 +langchain_community/retrievers/knn.py,sha256=6r0WkOZpfkSlbPnAV3oyyikqQYkCnGP6WMJUxzYp-KM,3324 +langchain_community/retrievers/llama_index.py,sha256=N1OkbS_zbBPEcZVL3QRac4lvf0sMpw6igomJNH3ZY8s,3162 +langchain_community/retrievers/metal.py,sha256=A0a74Ql3Dl2epH2EoxzlPpMOtRrvDKvUB2vIoYv1jDc,1491 +langchain_community/retrievers/milvus.py,sha256=wzaDXx1WspRtQsVhCyIC76BYxJHdRArhYXJfmtlQOfg,4687 +langchain_community/retrievers/nanopq.py,sha256=3Oi_mykNQ69RgysQNFns_Xi3CIPLl3Zi_JfUaMfNIBY,3974 +langchain_community/retrievers/needle.py,sha256=BekThRO-X82WFcdlhb3lbgfvjOHWVMaVtKfIvCL4C6g,3592 +langchain_community/retrievers/outline.py,sha256=J6D1WFLhhob6zowA6dBwDYC2wfb3MdMnA13qimqCFkg,644 +langchain_community/retrievers/pinecone_hybrid_search.py,sha256=oWUOyyA3m1Dm0xzCOCTPysjJVONoeEIZi8IZxWriHQ0,6012 +langchain_community/retrievers/pubmed.py,sha256=PfwAY12pKzLiGxQtsM6i3vdod-QjxfLaQ9NaJta_BqU,643 +langchain_community/retrievers/pupmed.py,sha256=1mLaWJRf0qDJf-jWXoUJoFNtLXJGGnhTHAPAqc4LxQA,104 +langchain_community/retrievers/qdrant_sparse_vector_retriever.py,sha256=sGyRS-Dv52uTa1S0-WprboV5so6jXU7hzGxtCxD40kk,7912 +langchain_community/retrievers/rememberizer.py,sha256=2iJbkLZ5c60HVstTT71bpiPnCVSZ8bax8tY65KEF1oU,670 +langchain_community/retrievers/remote_retriever.py,sha256=BuseP2s-em_mtLduTfdU2uei7jF7DmfHusoaGuIhe3A,1935 +langchain_community/retrievers/svm.py,sha256=Q_bepeYfwO9s9MWHxaeQQI93jRaMGbnY-tZRUQvU8FQ,4132 +langchain_community/retrievers/tavily_search_api.py,sha256=p_T4z1GBkFyDpir6VIGRagz2CqRmM9RYAhLA9fI3gVg,4916 +langchain_community/retrievers/tfidf.py,sha256=R_2qpLs7Lkmk-DCl-yVCHDRfJoUJj7kcmbYHygdliSU,5734 +langchain_community/retrievers/thirdai_neuraldb.py,sha256=RVwDx_kvtSmYGAhoSJ2pE1HdG8MkPt2jOYkNo6aiQaw,9228 +langchain_community/retrievers/vespa_retriever.py,sha256=GsviEeLkWUaAhOjY8HqowUXLNqb1kRkEZS-sF6xxoxk,4555 +langchain_community/retrievers/weaviate_hybrid_search.py,sha256=SuWQUU__MOB1rURXBu-VZ7htTGZYMRlEKoLU_JUjBXU,6334 +langchain_community/retrievers/web_research.py,sha256=9ezpDyIka465f_62ceqPpp0HpOCelJk6pj3Rjkyeris,10307 +langchain_community/retrievers/wikipedia.py,sha256=Xv609Txop3eQDzfbzsnHxNCyLVnhABWGVTihSJmnYAM,2381 +langchain_community/retrievers/you.py,sha256=uf5Xgd6gUY4Ph4Sbj32q-Eb-SbhxJW95Kj2sByxNcxc,1124 +langchain_community/retrievers/zep.py,sha256=tUjIV8mBVOE4OFFcP5ztGxYU0LiPyHSN3kd5wcbRImg,5909 +langchain_community/retrievers/zep_cloud.py,sha256=A_nTPFq8gu-SOOjK_cPutBmLAIMDdfu1umSaxhW3QiM,5529 +langchain_community/retrievers/zilliz.py,sha256=BskzA_ZTRwIg962s0-uEBWFQdVLVuZ9UUtlZ8Jk1r2I,2724 +langchain_community/storage/__init__.py,sha256=i1GlBJpx-6aEQ2qhE-ZERgNyUFyFK_MnCRiYTb5G30E,2015 +langchain_community/storage/__pycache__/__init__.cpython-311.pyc,, +langchain_community/storage/__pycache__/astradb.cpython-311.pyc,, +langchain_community/storage/__pycache__/cassandra.cpython-311.pyc,, +langchain_community/storage/__pycache__/exceptions.cpython-311.pyc,, +langchain_community/storage/__pycache__/mongodb.cpython-311.pyc,, +langchain_community/storage/__pycache__/redis.cpython-311.pyc,, +langchain_community/storage/__pycache__/sql.cpython-311.pyc,, +langchain_community/storage/__pycache__/upstash_redis.cpython-311.pyc,, +langchain_community/storage/astradb.py,sha256=YiTQDH14ogqAtGYcLf4surJyjxDcbpeNtSOXxTwc6GA,8746 +langchain_community/storage/cassandra.py,sha256=2N9j6ebUuxEf4MNbUNtFVLhwxEFo3Ox7KR_6QYPwqGw,7805 +langchain_community/storage/exceptions.py,sha256=P5FiMbxsTA0bLbc96i_DgWmQGOUEc1snGBtxn7sOjZk,89 +langchain_community/storage/mongodb.py,sha256=jSXhCcYXBUUcyLmT8KtfJA8w9YfUXOZRvRGyd07EdqI,8585 +langchain_community/storage/redis.py,sha256=3xPXe9EKL7IlSN702-KNxIPRgpiwuoQrQVwrY2MlVLo,4930 +langchain_community/storage/sql.py,sha256=FWyBaDKkcadAiapKHYyr0_2POBgSAiFT8KwSkvEwRyk,10343 +langchain_community/storage/upstash_redis.py,sha256=F96ONrxTp8W0yoXDgalgsq0BAgZ1QBCJFv7JO-ZYs8A,5762 +langchain_community/tools/__init__.py,sha256=emh3eKzdiypGpBkuOQhaAGJ7LmK0Q0hCBJ6jMEVJafw,25493 +langchain_community/tools/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/__pycache__/convert_to_openai.cpython-311.pyc,, +langchain_community/tools/__pycache__/google_books.cpython-311.pyc,, +langchain_community/tools/__pycache__/ifttt.cpython-311.pyc,, +langchain_community/tools/__pycache__/plugin.cpython-311.pyc,, +langchain_community/tools/__pycache__/render.cpython-311.pyc,, +langchain_community/tools/__pycache__/yahoo_finance_news.cpython-311.pyc,, +langchain_community/tools/ainetwork/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/ainetwork/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/app.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/base.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/owner.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/rule.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/transfer.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/ainetwork/__pycache__/value.cpython-311.pyc,, +langchain_community/tools/ainetwork/app.py,sha256=tIO8KpXcVBrtd7X-YJBN863W4uqktd7h7qGzlgKcSGY,3167 +langchain_community/tools/ainetwork/base.py,sha256=j4KCndER_0nxqMXT-MbyJXc6KD2hgOZrWHVZDmeAvxk,2091 +langchain_community/tools/ainetwork/owner.py,sha256=5IiYPYLmbL4QNDBqb3VYvBEPG14RNZ7FnVi3eZyivcQ,4122 +langchain_community/tools/ainetwork/rule.py,sha256=vw_F03jREOm3aYhHt8wrwIAqVkZCYdLPppIgROLpLUI,2728 +langchain_community/tools/ainetwork/transfer.py,sha256=tHVnX4fwVDWE_YTjKJBB3vpe5oWVxreeiiRFZt7dcb4,1056 +langchain_community/tools/ainetwork/utils.py,sha256=fF9AE8PySA0W4rFixpCSpikeWwQpYwWa9UG3TE0u3UI,2315 +langchain_community/tools/ainetwork/value.py,sha256=Qblx39vZL_1AvL9781O1PTCU5UdoqEXTJvOB7VZzmRc,2606 +langchain_community/tools/amadeus/__init__.py,sha256=oCyY-VdpTaAVsYB2kN4UvaJamolHnlhosBDe3wt9GwA,257 +langchain_community/tools/amadeus/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/amadeus/__pycache__/base.cpython-311.pyc,, +langchain_community/tools/amadeus/__pycache__/closest_airport.cpython-311.pyc,, +langchain_community/tools/amadeus/__pycache__/flight_search.cpython-311.pyc,, +langchain_community/tools/amadeus/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/amadeus/base.py,sha256=c5uKfguNl4EzwP82-az42GI9gAdGJKx2qYst82szR7c,418 +langchain_community/tools/amadeus/closest_airport.py,sha256=fucDqOaZaARuSfqwkwjc9zxKq2ommOcLnUlTktko2lY,2333 +langchain_community/tools/amadeus/flight_search.py,sha256=gDX6hqvRwtVb-dtsUJ3dPL5IgOD6JCtlWcMO5L_T_UY,5753 +langchain_community/tools/amadeus/utils.py,sha256=ruayGO8ERFw9HAndkGgljTRL0QaP9e0-fF7T3Ghr0HA,1277 +langchain_community/tools/arxiv/__init__.py,sha256=4s-rTs5xjyJ_Iw8D1ntCK52eKNen1srJjnQmoLCwGBI,155 +langchain_community/tools/arxiv/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/arxiv/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/arxiv/tool.py,sha256=_4Tfof44H8VuOekFH9ibXw9YH4FkeeN6e4mZfVZLizQ,1236 +langchain_community/tools/asknews/__init__.py,sha256=-BcEjCI2PFlGI8KJ7Xdv0AzTye3tvEN-YI6VS6tLJK8,131 +langchain_community/tools/asknews/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/asknews/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/asknews/tool.py,sha256=qpozYW4FQzZUFdOdRLEl5ofwXtU8tUAs8JIga7DU6WE,2530 +langchain_community/tools/audio/__init__.py,sha256=ZqmAqz0lhBpMw2rPqovZoFBk2njk2HKk1M6V-shbFfw,188 +langchain_community/tools/audio/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/audio/__pycache__/huggingface_text_to_speech_inference.cpython-311.pyc,, +langchain_community/tools/audio/huggingface_text_to_speech_inference.py,sha256=gC72rY2o5CHTDFDFAtYjw0WUyj_w1BRgh4AC4T7ej5E,4271 +langchain_community/tools/azure_ai_services/__init__.py,sha256=4xDNayf79QHAzYk3Dfsg6t8r_hDXsXEFk7Djx6QVj3s,858 +langchain_community/tools/azure_ai_services/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/__pycache__/document_intelligence.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/__pycache__/image_analysis.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/__pycache__/speech_to_text.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/__pycache__/text_analytics_for_health.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/__pycache__/text_to_speech.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/azure_ai_services/document_intelligence.py,sha256=R-_UdFcsJYldZIYharNDPT7mwB694yfbTKXkEb2eU9Y,5491 +langchain_community/tools/azure_ai_services/image_analysis.py,sha256=L8mo6gJLKgHgxQqMAr2nKOY0vA2nY0cFibKJVOeoxC4,7613 +langchain_community/tools/azure_ai_services/speech_to_text.py,sha256=nDmg0Y7GaOS0NEBKLD9fo4VTALfyI4iA6nYCNCoCfpI,4435 +langchain_community/tools/azure_ai_services/text_analytics_for_health.py,sha256=NYMInCXgtAld-dSDft655JP2DYlZm7Stx5vWYRvaSkY,3602 +langchain_community/tools/azure_ai_services/text_to_speech.py,sha256=Dl3oaW69WwClRt4-On6F_1DPEhnrXu_uoFPOaQUxkaw,3816 +langchain_community/tools/azure_ai_services/utils.py,sha256=cbWxcaIKRUxFsvMAJ1fbXc9e3U9DsEYU1DJ5n7l7wd4,776 +langchain_community/tools/azure_cognitive_services/__init__.py,sha256=vRoE4ioEcgnWzya8wPCAW296HiQS-PdRjas8L79pmlg,802 +langchain_community/tools/azure_cognitive_services/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/__pycache__/form_recognizer.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/__pycache__/image_analysis.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/__pycache__/speech2text.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/__pycache__/text2speech.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/__pycache__/text_analytics_health.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/azure_cognitive_services/form_recognizer.py,sha256=o67sEgPB5ZpsSZYBFmh_twXjDzQm1vJ7GaND7U0R8Lo,5380 +langchain_community/tools/azure_cognitive_services/image_analysis.py,sha256=_ZeRBw9_uV0hL0brj9n_xSLrpTZNAeqj4TlOCVzZX9g,5309 +langchain_community/tools/azure_cognitive_services/speech2text.py,sha256=KQ32_tX2IiDYuKcJfWagKjRPrWvPL0WcWeSO6uEq9kY,4341 +langchain_community/tools/azure_cognitive_services/text2speech.py,sha256=3J2sXHESIVvRpGLm4niufNFUkgXyc_MVB1yYCwWoXnM,3680 +langchain_community/tools/azure_cognitive_services/text_analytics_health.py,sha256=05JBJi7kYwTb2qoXSmZjE6SAe_hmw3k463DAm27pCW0,3543 +langchain_community/tools/azure_cognitive_services/utils.py,sha256=cbWxcaIKRUxFsvMAJ1fbXc9e3U9DsEYU1DJ5n7l7wd4,776 +langchain_community/tools/bearly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/bearly/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/bearly/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/bearly/tool.py,sha256=3Bjyv9GTOgwSSbOt7AM38roBRFqLAi9WMMf1LrBu3P4,5537 +langchain_community/tools/bing_search/__init__.py,sha256=TrKKXeLieagRg0w09grJnRjPVVcb83DP44Bb6xot_CM,170 +langchain_community/tools/bing_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/bing_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/bing_search/tool.py,sha256=XWjZnnVpIvgXRSl8Yj2u5SQFJY7V--aj6keYwKSAPs8,7169 +langchain_community/tools/brave_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/brave_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/brave_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/brave_search/tool.py,sha256=WgQNqrt4SkO2sgKNQLaN7ONORFLKHZ9Zj55e74ibB54,2997 +langchain_community/tools/cassandra_database/__init__.py,sha256=g1oQQt9o0jikNZX7QcR7nvzXQ89gYvS5bI1vxCht5BA,21 +langchain_community/tools/cassandra_database/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/cassandra_database/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/cassandra_database/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/cassandra_database/prompt.py,sha256=yGgHFhoAGhMU1YzeQ8yKMbvhUaWqyUkui1cFYViC8tQ,1221 +langchain_community/tools/cassandra_database/tool.py,sha256=_mrEfvWpmaZFkpikrpiz8rcQZVVemEvLKPCXWoNmDB8,4946 +langchain_community/tools/clickup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/clickup/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/clickup/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/clickup/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/clickup/prompt.py,sha256=oce6eOkfMPBdJy9oKfQMX984AhF9SHuhll33cEO10H8,8298 +langchain_community/tools/clickup/tool.py,sha256=EvlW5epGk7vhV3Xm_wkNk3DYNCfNbcVKhxblnq-UWjE,1213 +langchain_community/tools/cogniswitch/__init__.py,sha256=uDEn1jkR85TqZSKQBNnnXf-WryGEJVD3tDz_FqJhwYA,20 +langchain_community/tools/cogniswitch/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/cogniswitch/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/cogniswitch/tool.py,sha256=Tsz5fkb83u9Xmf2FANF764pnrZsU-WfPVHB4xdFqCUg,13763 +langchain_community/tools/connery/__init__.py,sha256=kH--SvQo7vscfLlkQxSQ1r9VesK3mKhBtH4VwBi1jSI,188 +langchain_community/tools/connery/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/connery/__pycache__/models.cpython-311.pyc,, +langchain_community/tools/connery/__pycache__/service.cpython-311.pyc,, +langchain_community/tools/connery/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/connery/models.py,sha256=xVv2r9zdIioSNXi1dPaad3EzUMtQ8wjRTtMYseZ4C6g,634 +langchain_community/tools/connery/service.py,sha256=iQqj7N1nu6udry97gWT6fYpdlJ-DBroswlIDbDd8TOM,5759 +langchain_community/tools/connery/tool.py,sha256=NZucc86XdEg8x2EPArmhyQvRkHBhzqHuYaPN3zVGE7s,5533 +langchain_community/tools/convert_to_openai.py,sha256=Yvcu3wqqNpFiqpM94LVh32ifbg31qvYvphMizzFsyos,308 +langchain_community/tools/databricks/__init__.py,sha256=GJ0wmzB9RcqCNt0bkIlVCux6skN0aQpNfqMBnJOgBYY,105 +langchain_community/tools/databricks/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/databricks/__pycache__/_execution.cpython-311.pyc,, +langchain_community/tools/databricks/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/databricks/_execution.py,sha256=HaG1Le7ubi6qlBkBCIiRALiE6J2sSRoviFPt-8D0puM,9669 +langchain_community/tools/databricks/tool.py,sha256=bbrSjxezGktmFJWsC3oT_-MXOva9ACYRfrcijl6LFFI,7951 +langchain_community/tools/dataforseo_api_search/__init__.py,sha256=5lOqC2RP6PYUOn6VyW4LCUzh92Qj_kjaddUo7rxvTNM,268 +langchain_community/tools/dataforseo_api_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/dataforseo_api_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/dataforseo_api_search/tool.py,sha256=toZloZRsrsmzZI5OrFElm2vUXee-F3q9txyKZZ-wJQU,2196 +langchain_community/tools/dataherald/__init__.py,sha256=p71znTt3l6x_CtdQTr_KUKa-r06pFymntNW341WPaCQ,147 +langchain_community/tools/dataherald/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/dataherald/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/dataherald/tool.py,sha256=ZmtS1nkgCgPCOg5QvCJ5DqvfS3oX299jDNJq46fJ1ws,1045 +langchain_community/tools/ddg_search/__init__.py,sha256=Foj-IE35XDV4EpnDDYxIBiKjysvk_gSE-DoFWymxclY,147 +langchain_community/tools/ddg_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/ddg_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/ddg_search/tool.py,sha256=vI4YB08N7Eg6vR8vjv5kzls09A68S-lkuhBWaKWbI0w,7886 +langchain_community/tools/e2b_data_analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/e2b_data_analysis/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/e2b_data_analysis/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/e2b_data_analysis/__pycache__/unparse.cpython-311.pyc,, +langchain_community/tools/e2b_data_analysis/tool.py,sha256=5v4N26_VejJ0IGez_lntLi_bv6FgjTrWUnY1M338HOE,7996 +langchain_community/tools/e2b_data_analysis/unparse.py,sha256=EDSCz18qBgkgyuYky6utIb0Yv1p-w_kJ_XX_o1k6D34,20668 +langchain_community/tools/edenai/__init__.py,sha256=cugnqCWLdChYfPxflLin8PVudS5Ytg0r-Irkp7u_TVE,1025 +langchain_community/tools/edenai/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/audio_speech_to_text.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/audio_text_to_speech.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/edenai_base_tool.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/image_explicitcontent.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/image_objectdetection.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/ocr_identityparser.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/ocr_invoiceparser.cpython-311.pyc,, +langchain_community/tools/edenai/__pycache__/text_moderation.cpython-311.pyc,, +langchain_community/tools/edenai/audio_speech_to_text.py,sha256=2oeMfAzb8bUgUf5FuljeeWiOxV2wKS54hj_sdAPIk5E,3619 +langchain_community/tools/edenai/audio_text_to_speech.py,sha256=YdW87N01bb3iDtpiCsVw9mlkQfOo6OaAOu-Ud6kTyWc,4124 +langchain_community/tools/edenai/edenai_base_tool.py,sha256=N_tjZDli__ptngBlrAf2AFU0-maCl9c7OVcJLFBeVqI,5198 +langchain_community/tools/edenai/image_explicitcontent.py,sha256=pnzVGyQCgSGETgvF6-FxGCLBKvBVlohuI-irMhuTUpY,2490 +langchain_community/tools/edenai/image_objectdetection.py,sha256=vRzECM6rR5FPD6fZPL9D0-A0wk-PugPOCxsCa1591MM,2815 +langchain_community/tools/edenai/ocr_identityparser.py,sha256=IuQMvz3mM09Phn8H8WF2HZjPn5PoyFpmzHJ7PVrC25U,2195 +langchain_community/tools/edenai/ocr_invoiceparser.py,sha256=H5KCXWphOrXtpFFYckUeG5yWVnRdGN0WhCX89DcQbNU,2425 +langchain_community/tools/edenai/text_moderation.py,sha256=06TQtx6CjkS3Kmk_4qqysQPw4svoKtIK4aU9m-jm6Gs,2610 +langchain_community/tools/eleven_labs/__init__.py,sha256=ZVMb18r014U4kKzrSDUWj9DFr2BbxxudjZ3sPT_sUtA,164 +langchain_community/tools/eleven_labs/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/eleven_labs/__pycache__/models.cpython-311.pyc,, +langchain_community/tools/eleven_labs/__pycache__/text2speech.cpython-311.pyc,, +langchain_community/tools/eleven_labs/models.py,sha256=lKIKMoj3tZSvHMOkgUQd7dMKoAsvN-60DTyl6kmPJ1A,243 +langchain_community/tools/eleven_labs/text2speech.py,sha256=ohRNNktVgtIrkDr4q0cSEWC2k1BiPLXXN_ZL5AY7-48,3078 +langchain_community/tools/few_shot/__init__.py,sha256=mluhZ26qlFTCU027UrDhAhCQBNNyL6EBxhhYrXyhhAo,97 +langchain_community/tools/few_shot/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/few_shot/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/few_shot/tool.py,sha256=o_VunAQa_ehsAf-DfSt2Y0YK8z-VZNYzF6De6iTOgDA,1618 +langchain_community/tools/file_management/__init__.py,sha256=nQvziZtgKWL3GIdep-TO37d2rkL4Ipehf8RuaAEA8gc,723 +langchain_community/tools/file_management/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/copy.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/delete.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/file_search.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/list_dir.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/move.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/read.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/file_management/__pycache__/write.cpython-311.pyc,, +langchain_community/tools/file_management/copy.py,sha256=gl7WUy0n5ijWY5_p8LTs4Ganq_CEWSFIuuZ2kytr0JQ,1731 +langchain_community/tools/file_management/delete.py,sha256=1R_LWczNmE0Ch90FKI3jKaYRPWQi_6wBeK3t9eE-_Rs,1327 +langchain_community/tools/file_management/file_search.py,sha256=Rjz-rIM6xeAiqNW3QIpRS6BeXS7_qbj9VVdxiVFxTvY,1947 +langchain_community/tools/file_management/list_dir.py,sha256=eqDPy-YMffkGQzh4e-2s6-RYrNd1SdD8R34FZmnNVgM,1414 +langchain_community/tools/file_management/move.py,sha256=WKXxM8roJUMJ6Qga0VPVMsAXxwLD77M5iVR8njC5-rk,1871 +langchain_community/tools/file_management/read.py,sha256=SCIQWp6FUbHIwZLwtgyisTycq-o4jwLE6Re3YJRVJpE,1322 +langchain_community/tools/file_management/utils.py,sha256=CeD1HuY3ojrGVBB9I19Dln9Z_rpumkea5iJOG5tIrDQ,1708 +langchain_community/tools/file_management/write.py,sha256=rUyjCOVgMebBQjE_MYIMbzNL--npDRIwvN32PTSK1vE,1595 +langchain_community/tools/financial_datasets/__init__.py,sha256=U2da_rcNZhi-MlqbpAv1dBJKvTesVcp3yFSAD8WcUzI,421 +langchain_community/tools/financial_datasets/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/financial_datasets/__pycache__/balance_sheets.cpython-311.pyc,, +langchain_community/tools/financial_datasets/__pycache__/cash_flow_statements.cpython-311.pyc,, +langchain_community/tools/financial_datasets/__pycache__/income_statements.cpython-311.pyc,, +langchain_community/tools/financial_datasets/balance_sheets.py,sha256=KcsKWHqtcCIDahD4MCnSRW0v_y_30tRUmqSUNXZbE68,2019 +langchain_community/tools/financial_datasets/cash_flow_statements.py,sha256=x8Yz9AaxiRl2mprPjCII-uf3ePdu9lJFB8uPZJMq-kw,2109 +langchain_community/tools/financial_datasets/income_statements.py,sha256=jpjOaBURALEsr3gX8Yish3k8hG16ovxiV2DZPHSIFWc,2066 +langchain_community/tools/github/__init__.py,sha256=ZXL9LlaXRlpyALvDiNVUpUA6KpyfAzEuC443yl8JHAE,18 +langchain_community/tools/github/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/github/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/github/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/github/prompt.py,sha256=g6o5sEtfDGOiAl-idApR7sNDlB9vFMFH3wadVES_EmU,6657 +langchain_community/tools/github/tool.py,sha256=psUQufzwZ2FwmOpY9G6NdubXIRenn5RYHIK2aUWpJfQ,1697 +langchain_community/tools/gitlab/__init__.py,sha256=7R2k7i3s3Ylo6QfzxByw3doSjUOdAQUBtW8ZcQJjQSI,18 +langchain_community/tools/gitlab/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/gitlab/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/gitlab/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/gitlab/prompt.py,sha256=T3k41ynkd-dWpmNSbmNsqbo2cFjMKZNf3FvlQORrM3U,4680 +langchain_community/tools/gitlab/tool.py,sha256=N5b2MG49sk0_Qg2C8oVla0lkNO_jZBGQ1u9ET1b9Ugo,955 +langchain_community/tools/gmail/__init__.py,sha256=GMGEm_d89jPgRr78wFlrqjxYBDcmETs-usn_CIMso5I,601 +langchain_community/tools/gmail/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/base.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/create_draft.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/get_message.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/get_thread.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/search.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/send_message.cpython-311.pyc,, +langchain_community/tools/gmail/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/gmail/base.py,sha256=cr3CxZsYnbTMx-gSNnnSLsJ9VLaU0461saUMPWMd5wA,1013 +langchain_community/tools/gmail/create_draft.py,sha256=MtbKtnYwFIPLne7xnMIaqmRhOb6XPsIUycHC0SDq1WU,2546 +langchain_community/tools/gmail/get_message.py,sha256=GcCSt3OIP4iycK3Plmzu8oRo_z-a9rI8pdKcoMym3FM,2240 +langchain_community/tools/gmail/get_thread.py,sha256=xhjNtB3l0-2G02DJkiZLmiRszQb0Ddkz1QkhBYYOi04,1542 +langchain_community/tools/gmail/search.py,sha256=teZZariYFOjj-4gF6qlBQCWAyBDN7IgsPlRtZtoYqB0,5357 +langchain_community/tools/gmail/send_message.py,sha256=g_Vo_Yqunl5q7848xLmXFL4DyMVWTWSUTh7DuKKkSjs,2919 +langchain_community/tools/gmail/utils.py,sha256=wRgyb8e99QRsizUG4cfmIHlIDQR-MF7ZblQf1CdVbXI,4129 +langchain_community/tools/golden_query/__init__.py,sha256=3Yg_tDxcvqsb1G_q0IRfG9OjEJyT-idqqG19YQ4ojCc,135 +langchain_community/tools/golden_query/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/golden_query/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/golden_query/tool.py,sha256=FU9NzZ7ep3pf3A_Hjbk_tifls8DMToh9P7K5yhu1bvU,1108 +langchain_community/tools/google_books.py,sha256=_jQnhxIxgTnJCdj0iM1B0xg3nFgBYTvxsX-6jf5RwvU,1164 +langchain_community/tools/google_cloud/__init__.py,sha256=CaKO4qRuLzz4--tUQ-xNL_3JQcs0NhB6l-a4JtgCyTI,171 +langchain_community/tools/google_cloud/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_cloud/__pycache__/texttospeech.cpython-311.pyc,, +langchain_community/tools/google_cloud/texttospeech.py,sha256=szE3WIBKqYNaX46Z7RMm0X_2n_pqikpQ26jgdUmzFFM,3352 +langchain_community/tools/google_finance/__init__.py,sha256=uK-k2yxn2OKULEBFgufDbs_56ryHJRq4-gG_iQ62C-4,152 +langchain_community/tools/google_finance/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_finance/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_finance/tool.py,sha256=rZ_P8C6E05j_U3giiwgNn2CMaZ4jbVBftAKwzPAlWNY,854 +langchain_community/tools/google_jobs/__init__.py,sha256=dFNdE76BeJZ3SpCZu--sKU-GlFZVP9e10pQ__pxhH_k,140 +langchain_community/tools/google_jobs/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_jobs/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_jobs/tool.py,sha256=mGo17l1_rJmQ12fL33eGvxzpNl6_6DNTaFoxPROgP9I,826 +langchain_community/tools/google_lens/__init__.py,sha256=8apk9RIaDwKrfObKYUpJr7cSASUiJBGSIu1JkCpHsWU,140 +langchain_community/tools/google_lens/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_lens/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_lens/tool.py,sha256=TdRAnUUAFXNacljKnj1bQZyU9JCB9lPUp2nRYRjHXtI,822 +langchain_community/tools/google_places/__init__.py,sha256=n5wwZvgpm7sohzv2hRRacS2d9vw_vwf2jOizLnpdvTc,140 +langchain_community/tools/google_places/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_places/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_places/tool.py,sha256=TF9TjM7oZalRDTnEAy37H4XH8o6f3sjiVOML_pDvcho,1302 +langchain_community/tools/google_scholar/__init__.py,sha256=F7g-IX4a0sfQQZnyXkAsvGHlyhwit56TdxUQeGBBRQE,152 +langchain_community/tools/google_scholar/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_scholar/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_scholar/tool.py,sha256=vblvOo7pzvdnd1dC4I5k9JjAe1dfGKctLxDHCKZ7a2U,847 +langchain_community/tools/google_search/__init__.py,sha256=uLCt2uzM_rndct88evNdlXuaBJOeMqWn6F7ibrGVF9M,195 +langchain_community/tools/google_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_search/tool.py,sha256=GEJO1T_qNjkOu_WuUFI-4W2-AEtulNhgMBtyfj2AjXE,1794 +langchain_community/tools/google_serper/__init__.py,sha256=hOe3l5NFDTBGh8kqeUhjq0BhHJMeWv8V0C4dBNGHsWw,243 +langchain_community/tools/google_serper/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_serper/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_serper/tool.py,sha256=sXoYTJDSzOpo57XPte2rwOqx9pEgS0wax_vDqMuEqY8,2095 +langchain_community/tools/google_trends/__init__.py,sha256=Lwn7fs35f2twAs1U-GppbqGqtGLibu5n3bnd9CblDUg,148 +langchain_community/tools/google_trends/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/google_trends/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/google_trends/tool.py,sha256=sg2zb93ps6SJIK6W7JSbX8KPhhYRbky2fUQk4ampPeY,844 +langchain_community/tools/graphql/__init__.py,sha256=5WzEFZc0S0sh1mn6kciABqotz0Zf1fftuwJ6XTs5LgU,47 +langchain_community/tools/graphql/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/graphql/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/graphql/tool.py,sha256=9zE75Toa0r2nElKqi-xruNmIgjb4hPEqBdLMJTyQawU,1199 +langchain_community/tools/human/__init__.py,sha256=96BPmcHUQOeclH24p3y5ZMHqsyYSnnEmObFFhTTkOFM,132 +langchain_community/tools/human/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/human/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/human/tool.py,sha256=8cJS6u8-0wECw5iaYQ8N2JRmN3CsEft0KumLpS52VAM,993 +langchain_community/tools/ifttt.py,sha256=zftbJnZGYTa3KKW8VLSsCT9rQuep53mBPlHvkdXk3KQ,2287 +langchain_community/tools/interaction/__init__.py,sha256=RYCJKa2M7CrzMbz59xYFJ_c3hwGJKOPyyP4G_sAt48w,43 +langchain_community/tools/interaction/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/interaction/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/interaction/tool.py,sha256=8VqjOyXgS_fORBvDMCi3s4tMcOuTHP98WVvcNoANZNA,463 +langchain_community/tools/jina_search/__init__.py,sha256=4tHwRJBNoONduMAWZp53XLKaVmiHKkc4uqomdSlAVMk,115 +langchain_community/tools/jina_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/jina_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/jina_search/tool.py,sha256=vWZvqBccx9YjHryOjV74TSSfii3xSFaR1ONyWybE1SA,1283 +langchain_community/tools/jira/__init__.py,sha256=Zz6Gy5kGFFIfVAnG0a6c4ovi5XM9KZheGKaZ_fFbmGY,17 +langchain_community/tools/jira/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/jira/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/jira/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/jira/prompt.py,sha256=cBIJz8kk3IojCBrZRm6cRYi_mmfdupTLdkrJemOZD_I,3171 +langchain_community/tools/jira/tool.py,sha256=3zcor7iFOG0x-wjMCih4-hiLmCB2LTB2pWY2Gv70gKs,1340 +langchain_community/tools/json/__init__.py,sha256=ieEWuRmzcehYXhGc-KcC6z1Lhbbn_nBEyMtnE04vyFU,46 +langchain_community/tools/json/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/json/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/json/tool.py,sha256=2gZuXYNG28dXNNK78Y3Mc5392yE9F5TRfjxR6eB-VBQ,4122 +langchain_community/tools/memorize/__init__.py,sha256=Iv2FZHKB8eNuMKKjv873n1qDSQxUJxnkLA01z40aKv0,134 +langchain_community/tools/memorize/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/memorize/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/memorize/tool.py,sha256=6zHqHtTTGGMMa81psfpYDhWkRcODBrksFKAG9vNByP0,1794 +langchain_community/tools/merriam_webster/__init__.py,sha256=6n0Uz-TRpAh6M7LMI_p6_qa1c-4vT2kEvU3nDgxzr1Q,35 +langchain_community/tools/merriam_webster/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/merriam_webster/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/merriam_webster/tool.py,sha256=wyR0co0TPJVOQ1JOr5P5UHVJpOcKmQ_9OPiaWzv1r_0,854 +langchain_community/tools/metaphor_search/__init__.py,sha256=ORai2wY3PgqxgWPGpQA4ztTNu0iJ2kohn9H55zceHCA,154 +langchain_community/tools/metaphor_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/metaphor_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/metaphor_search/tool.py,sha256=rXU9TGdFsMeexGz7wuusMP7FBZmsyE28VBMVqNSsEGA,2849 +langchain_community/tools/mojeek_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/mojeek_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/mojeek_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/mojeek_search/tool.py,sha256=uHKsyRO3gAyaGf1_Kn5YWRBPUGEqTDg_W-s60CH9B5s,1307 +langchain_community/tools/multion/__init__.py,sha256=Xat7YYznv6EGKw8yuf6y1dlB4qphPVl0Eh0rwnFT7Yk,360 +langchain_community/tools/multion/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/multion/__pycache__/close_session.cpython-311.pyc,, +langchain_community/tools/multion/__pycache__/create_session.cpython-311.pyc,, +langchain_community/tools/multion/__pycache__/update_session.cpython-311.pyc,, +langchain_community/tools/multion/close_session.py,sha256=EJw86ZtUL7_Iyb36W3ji4B5dSuGuyl1LA2rNuDULzOw,1747 +langchain_community/tools/multion/create_session.py,sha256=wA5FeBivRdEp5hxnd09vZfayR2aEgpkoO5axjr5jlKA,2181 +langchain_community/tools/multion/update_session.py,sha256=hnQYdM0gvjH28-YFuKW3cJRqWXi_4zoU5pZ2glW6FTk,2397 +langchain_community/tools/nasa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/nasa/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/nasa/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/nasa/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/nasa/prompt.py,sha256=F4JIDYUfyLKY91N-_iSV-VKy5gM1v-mfK9fZ6TfBiro,5197 +langchain_community/tools/nasa/tool.py,sha256=ywkl2zMg4vtCEa-B_3McaUQQMV536MWo1pc_q5464OM,812 +langchain_community/tools/nuclia/__init__.py,sha256=BiP6ptCcnJjViD2pSOSj3LVlP7vsbz5FIjYQwNRcFjo,111 +langchain_community/tools/nuclia/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/nuclia/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/nuclia/tool.py,sha256=RpY3fJE3uJc_fHNRjd_XYBtgEeytv3U7GrRC0yCJcXs,7919 +langchain_community/tools/office365/__init__.py,sha256=G7NdkwjD5hHgigY2h8iNk4GxzKKAsB7cCl2Cs2KpCW8,654 +langchain_community/tools/office365/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/base.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/create_draft_message.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/events_search.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/messages_search.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/send_event.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/send_message.cpython-311.pyc,, +langchain_community/tools/office365/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/office365/base.py,sha256=XV6THrHR803qciDSEz9mGpTQWIFvrIhn_p1Xav3Kajw,491 +langchain_community/tools/office365/create_draft_message.py,sha256=OksH2PKN5nbOsXvvFb81cND8Ly4sDLGDKG7uTJs1FA0,1840 +langchain_community/tools/office365/events_search.py,sha256=Eapz83WiFCLhx187dXTGd5xwc9pruCMAZBoUT9DAzKs,4767 +langchain_community/tools/office365/messages_search.py,sha256=B21gCNeLbwFuMyu76jUk_jjAr8G4hoGh2QJpzDDpOZw,4179 +langchain_community/tools/office365/send_event.py,sha256=QXjRFsv_Jrod8BO3lltUHRRBg9tQLQlaAQxJ_WCzuEE,3265 +langchain_community/tools/office365/send_message.py,sha256=ftl1EKqwPHRnLIK26-KOcdatKKsdL4PrAenF8yILmx4,1759 +langchain_community/tools/office365/utils.py,sha256=lKifGau0avmFMyMhxO2pUiWrMk-SNLauLDmiL_OFr98,2228 +langchain_community/tools/openai_dalle_image_generation/__init__.py,sha256=jPhZPCqGpudOvHB0fVFC6ZqwzlxEuecHKQJokVMdq08,219 +langchain_community/tools/openai_dalle_image_generation/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/openai_dalle_image_generation/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/openai_dalle_image_generation/tool.py,sha256=ywJIc0Sm3iK3V-T0IJD-15h8B8boK-nYINO4iY7OGZo,953 +langchain_community/tools/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/openapi/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/openapi/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/openapi/utils/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/openapi/utils/__pycache__/api_models.cpython-311.pyc,, +langchain_community/tools/openapi/utils/__pycache__/openapi_utils.cpython-311.pyc,, +langchain_community/tools/openapi/utils/api_models.py,sha256=536iBXPbxvzud5kqP0nbc-8wnCz8keqn582LiMrumk4,21309 +langchain_community/tools/openapi/utils/openapi_utils.py,sha256=iqeupIUUL-yN6ZpuKj4-DJLDX1rMxyn1BbWkeAiktss,192 +langchain_community/tools/openweathermap/__init__.py,sha256=Ci1YsbkOJ6jPKtHlbcjTjvPchsCBi9ztKYxmDgg32kk,161 +langchain_community/tools/openweathermap/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/openweathermap/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/openweathermap/tool.py,sha256=4ajZoOAUXGTiWZn3apDdNXYj0HnqY2yuAIrwym4naew,950 +langchain_community/tools/passio_nutrition_ai/__init__.py,sha256=H-NpjIdIgz2RPPVqkLv2xG9A6rvjpzIavEmQ6dphexM,142 +langchain_community/tools/passio_nutrition_ai/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/passio_nutrition_ai/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/passio_nutrition_ai/tool.py,sha256=As_81cfOhPLbt7naNpY1RT5BDIMvbUADCoRIyDdBULo,1125 +langchain_community/tools/playwright/__init__.py,sha256=pBSkDs07eYOMuQPT9RKq66XoPzeoRpzB_r7PmuyAgFg,763 +langchain_community/tools/playwright/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/base.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/click.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/current_page.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/extract_hyperlinks.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/extract_text.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/get_elements.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/navigate.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/navigate_back.cpython-311.pyc,, +langchain_community/tools/playwright/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/playwright/base.py,sha256=y6-vXZZa5js0vrLxR0L4Bk9G2G5FQ36rJJXlxRued9Q,1970 +langchain_community/tools/playwright/click.py,sha256=cTeCeaA79tSz5bN8bsuYPSLsSsQkfhoWURtxZQBSoyI,3065 +langchain_community/tools/playwright/current_page.py,sha256=p0Jnl8qSv6QGql10n5y6839e66oawNTjwENsuotOUvU,1437 +langchain_community/tools/playwright/extract_hyperlinks.py,sha256=wJ4vSEWi4iiWuM4eSYAu-Y_LrqEluQR2UF2tbWqVyWQ,3134 +langchain_community/tools/playwright/extract_text.py,sha256=ZQyzHDvb7LkU43ztLxd4xkhG-QeeZygIWZWc3Dh-hSM,2509 +langchain_community/tools/playwright/get_elements.py,sha256=DQ1KNQG7qMpeRI2nrNx9EJDXk57s-8Q4AewZPBgllSo,3725 +langchain_community/tools/playwright/navigate.py,sha256=aqsUdSbglxfRgRxBx-aymmitndl5rBLSaixCef9tEF8,2937 +langchain_community/tools/playwright/navigate_back.py,sha256=ojVS6oJEtEf7RRV2_BJxzfNppZW47uQ_uvNkqpoj5q0,2017 +langchain_community/tools/playwright/utils.py,sha256=Z1h6yG_FjQCkLLJFkxMFGeeYqDx433-iNLh0f9J9eiw,3050 +langchain_community/tools/plugin.py,sha256=dxl3jwlCUjcoe7EE5tYJX2032vhp_ht9yXFS0nq5aBs,2884 +langchain_community/tools/polygon/__init__.py,sha256=cIMdjvLuORRSSduowDi2rDr3di8PFkNYmU9Kl6W-5O8,439 +langchain_community/tools/polygon/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/polygon/__pycache__/aggregates.cpython-311.pyc,, +langchain_community/tools/polygon/__pycache__/financials.cpython-311.pyc,, +langchain_community/tools/polygon/__pycache__/last_quote.cpython-311.pyc,, +langchain_community/tools/polygon/__pycache__/ticker_news.cpython-311.pyc,, +langchain_community/tools/polygon/aggregates.py,sha256=60oTWPuQHE9V7T8_P9FPUJFS7iv5TQDzwEq0hg7uycE,2540 +langchain_community/tools/polygon/financials.py,sha256=NfNAH2hdklzJf0twDaYKgj01tzpxP56zlfpilHixh_I,1179 +langchain_community/tools/polygon/last_quote.py,sha256=UpXqL33MZGhAgEQyNryjWHcOvHWiHEexNmOLkNZAy5U,1052 +langchain_community/tools/polygon/ticker_news.py,sha256=w55LK2UQsEk_tZ-SAupNEew42nSvX_mH0PsqHoF0h1w,1058 +langchain_community/tools/powerbi/__init__.py,sha256=lFy__65sASd5e8Eac1E1RHN58uTVSOMprb88zClyEZU,52 +langchain_community/tools/powerbi/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/powerbi/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/powerbi/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/powerbi/prompt.py,sha256=XGl9Z0HeEurKc_vO5R61YBlIx2HH-U8W4wySOMhvx2c,7339 +langchain_community/tools/powerbi/tool.py,sha256=Z3wEEHa82yXTPwW4Bv0_uGYZmBdtlGvimkWx1kOsmKg,11031 +langchain_community/tools/pubmed/__init__.py,sha256=KdYkXaHkUWLyuY35F0HRoZlX6PtTuTCPCYqlkgmBUgY,26 +langchain_community/tools/pubmed/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/pubmed/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/pubmed/tool.py,sha256=hhw9DDDdD9PCzCAx7jsIlZExss1d-E31pirEcYMQB5Y,953 +langchain_community/tools/reddit_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/reddit_search/tool.py,sha256=e6tXXJFKf5iXpD8E8XWwyI98UDlPSTGdm5YgeRhSiKc,1973 +langchain_community/tools/render.py,sha256=Yvcu3wqqNpFiqpM94LVh32ifbg31qvYvphMizzFsyos,308 +langchain_community/tools/requests/__init__.py,sha256=oeutQGdlOp3p6PbcAAfjdYpftaXFmJYJgSWw5SGb6IM,52 +langchain_community/tools/requests/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/requests/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/requests/tool.py,sha256=k7uLnwGtnnGGetCfoJs4BcTo-Nv848idnfIDVZ10fNI,7428 +langchain_community/tools/riza/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/riza/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/riza/__pycache__/command.cpython-311.pyc,, +langchain_community/tools/riza/command.py,sha256=61x7qxezKwF3bcuYOM2_Yv_ZzmtCdyMZ_RGkx-iooBs,4494 +langchain_community/tools/scenexplain/__init__.py,sha256=rRP3hoEnMUUHwABFgXFLGCJkoQi4lyg585ONrgWis3k,31 +langchain_community/tools/scenexplain/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/scenexplain/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/scenexplain/tool.py,sha256=1mDSGiWDa0aL3kL6fGufrpg2Fwof99Fuxe0eupHEM-4,1083 +langchain_community/tools/searchapi/__init__.py,sha256=Uw8Un5_BMfEWxPFWplTf5qjWlRhQaB7u5uQk8r4LJZA,214 +langchain_community/tools/searchapi/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/searchapi/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/searchapi/tool.py,sha256=H4hdAdvU31EGyc17vIjDcEtr0tp-qn9PUdG11yL68Yc,2096 +langchain_community/tools/searx_search/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/searx_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/searx_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/searx_search/tool.py,sha256=bmnfRs99FAXysg0FmdYP0ekrWygsZOxWbBlGCtFXfnw,2511 +langchain_community/tools/semanticscholar/__init__.py,sha256=Vr9-2lToAKNhnc92ITQp_jZ8ZRDk6vL0dN1pXOc_cWA,207 +langchain_community/tools/semanticscholar/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/semanticscholar/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/semanticscholar/tool.py,sha256=S8chqt4vWKDbdIumxH_f9FNyK1kIa7_e_whnmwx2dWQ,1198 +langchain_community/tools/shell/__init__.py,sha256=0na3xEyP8QPmMn3n04761kvzAiq7ikfE8FoAO8dZDzc,103 +langchain_community/tools/shell/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/shell/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/shell/tool.py,sha256=LbpD22pa8oi_tr1XbirHdP0xEjUOcRC39pFm_Kv0Y_w,3158 +langchain_community/tools/slack/__init__.py,sha256=c8jYW3xWJjJM8_Ze58aDlC8e7eh_u9-ZJ8N0tAlZHUQ,502 +langchain_community/tools/slack/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/slack/__pycache__/base.cpython-311.pyc,, +langchain_community/tools/slack/__pycache__/get_channel.cpython-311.pyc,, +langchain_community/tools/slack/__pycache__/get_message.cpython-311.pyc,, +langchain_community/tools/slack/__pycache__/schedule_message.cpython-311.pyc,, +langchain_community/tools/slack/__pycache__/send_message.cpython-311.pyc,, +langchain_community/tools/slack/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/slack/base.py,sha256=o453jWloFReiOVfRX5tYxmaI_X3ivfxK6lpn50HsR1s,653 +langchain_community/tools/slack/get_channel.py,sha256=FUIhZsJIg2c-F8L9DWFwTGJKZuVv6z4TDKwf3wYfnmY,1193 +langchain_community/tools/slack/get_message.py,sha256=juU5hHewwK0HHW8lkoFov9WtzgBNGpVmOJYnsZwnhso,1404 +langchain_community/tools/slack/schedule_message.py,sha256=D1zfBosUtFgZLRDeIsnNTKgiMSQOt6CgCA0mo-QMTJY,2053 +langchain_community/tools/slack/send_message.py,sha256=gTNv2qOiHX4S3fOi7rQZJOm-UL_QiQWjgvhVPKxPGr0,1204 +langchain_community/tools/slack/utils.py,sha256=KbXN1MSpeALsn82Xyi7Ad9BL2_U7s570nEHDOdP9CNs,1136 +langchain_community/tools/sleep/__init__.py,sha256=O3fn_ASDE-eDcU3FsBaPTmLHV75hhMS4c6v2qzrak5E,18 +langchain_community/tools/sleep/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/sleep/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/sleep/tool.py,sha256=FcP3mCzx-ln41mPrSx-sRgC5UhAc7GV8tCnzoDa8bXI,1212 +langchain_community/tools/spark_sql/__init__.py,sha256=HDxRN6dODaOCPByAO48uZz3GbVZd49fE905zLArXCMA,44 +langchain_community/tools/spark_sql/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/spark_sql/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/spark_sql/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/spark_sql/prompt.py,sha256=rXtkj9l8BXtUgsOmSCwnCaC8U5YliYQ4tpShTmQJrok,550 +langchain_community/tools/spark_sql/tool.py,sha256=MMZLNmC5EqB4ywmNfhJAjd5QJPacqXML_bo5c-yveak,4461 +langchain_community/tools/sql_database/__init__.py,sha256=Z7WNXu1y5-DhuoeA_Ync-Zcg3uK1lhdfQOlKBWAifmo,49 +langchain_community/tools/sql_database/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/sql_database/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/sql_database/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/sql_database/prompt.py,sha256=Ex4vEXjmGZXgK8WhLkpGg0MN90wd0YpSapThkot7JDk,597 +langchain_community/tools/sql_database/tool.py,sha256=uumoUXLbKagOeuA-b3PchWsF2znhKKjYmvf-E9Fc4wA,5918 +langchain_community/tools/stackexchange/__init__.py,sha256=dLGMnzEmyYZGoPsv215mPeqAU03McJJ_2WGkIioj3yY,33 +langchain_community/tools/stackexchange/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/stackexchange/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/stackexchange/tool.py,sha256=ncMKV0MOJUBxVS3u2fLdBAroRxZdL6YgB6I5XPcrHME,869 +langchain_community/tools/steam/__init__.py,sha256=_hg6uHJlBNJnCFPctYr80psy7o2hRsuzemhtPYHLENA,24 +langchain_community/tools/steam/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/steam/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/steam/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/steam/prompt.py,sha256=SnGVvWCRSrChEv8hN2LB3jK4SfRYxFEqBX_uPbRz5Bc,1657 +langchain_community/tools/steam/tool.py,sha256=OqprWCa18BPOEF9nhBGu7jXhJvhywdF0PV_RBNga_W8,842 +langchain_community/tools/steamship_image_generation/__init__.py,sha256=1abTK0waz1F1auwU1YEwbluHBSfgmcR44XBeN-SIkwI,186 +langchain_community/tools/steamship_image_generation/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/steamship_image_generation/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/steamship_image_generation/__pycache__/utils.cpython-311.pyc,, +langchain_community/tools/steamship_image_generation/tool.py,sha256=-zvozA4CWvfKHPVxxmj7O7FGP1Oh4V-9FG_42uf-xoU,3405 +langchain_community/tools/steamship_image_generation/utils.py,sha256=UzY1c0a5MH3T0_x1jAQCnF27TkHZkXjpn8hvXGt1jAE,1396 +langchain_community/tools/tavily_search/__init__.py,sha256=SCJ7BPxCZfiYXYcE0FCPPpq-_WAoZWjBI2nVoJ7MRCw,189 +langchain_community/tools/tavily_search/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/tavily_search/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/tavily_search/tool.py,sha256=qU1KwzHzZNpuPzzT3m97wPK2RTFPQOqxjN2Hr6Ym-58,8419 +langchain_community/tools/vectorstore/__init__.py,sha256=kheVdgDafCJHOhU5D5SBZZg9x_j5_gveZHqVhZ0pSZ8,51 +langchain_community/tools/vectorstore/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/vectorstore/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/vectorstore/tool.py,sha256=VNCZFm_487Nq-x0gc_T34otcsD7HE3Wyz4WVxjjIlls,4770 +langchain_community/tools/wikidata/__init__.py,sha256=kLlKIq2gd75ABDxD3-Mq1egWg0dJSddkRpEII3zIYkk,28 +langchain_community/tools/wikidata/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/wikidata/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/wikidata/tool.py,sha256=XcXtiMCpdR92QzlVvzdl3Xs__-0MHRccFgYAHDhFKvc,926 +langchain_community/tools/wikipedia/__init__.py,sha256=h-dMgHpibxNGwmU14vNzpEMhy7TuFPUP_d4GYXzMZZ4,29 +langchain_community/tools/wikipedia/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/wikipedia/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/wikipedia/tool.py,sha256=0jfnMTXSU1e1qgSZUhOkq32MpoSiZOk23NtHbohiYtQ,1121 +langchain_community/tools/wolfram_alpha/__init__.py,sha256=nkPKNXJ4SWFY3eyh0N-s1HE6dUV1hAbkskhxCHwtwk0,155 +langchain_community/tools/wolfram_alpha/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/wolfram_alpha/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/wolfram_alpha/tool.py,sha256=w5_NUKxWAN_aQhgP4wVsUta1GEO_jvjxXVnga0JAHG4,887 +langchain_community/tools/yahoo_finance_news.py,sha256=5YRmnwMA0hyv-AwMfLr2Motc1gpYrdFCb7_cUpyHSGk,3097 +langchain_community/tools/you/__init__.py,sha256=IicnWaYn3RpOgNBbKONUmuCuJer0_2hP9wvT6U999QY,125 +langchain_community/tools/you/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/you/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/you/tool.py,sha256=cvVmpw5tkvQpBpQv7JjjmbQnW4_ZJySLqos1xjnpnYo,1347 +langchain_community/tools/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_community/tools/youtube/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/youtube/__pycache__/search.cpython-311.pyc,, +langchain_community/tools/youtube/search.py,sha256=INLs22Ajgggu3Rquq9YaAXjSb_GJ_IgOUFCysas-gp0,1723 +langchain_community/tools/zapier/__init__.py,sha256=1HpJsHgUIW2E38zayYvNCJnRez-W3wyrD5mRNYkHZBo,193 +langchain_community/tools/zapier/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/zapier/__pycache__/prompt.cpython-311.pyc,, +langchain_community/tools/zapier/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/zapier/prompt.py,sha256=EvFDhjv9G_3PcP6TJzZyb7uFGUwoJScJnOPYIO4_O54,1182 +langchain_community/tools/zapier/tool.py,sha256=BynU_d3uP7A095-RmIY352X9MzAzd53igYcQ6Yx8bZI,7887 +langchain_community/tools/zenguard/__init__.py,sha256=E2jGd4KAa_ayrZgaXWocZBQKWkWsicLtN9JzzYcvRYM,179 +langchain_community/tools/zenguard/__pycache__/__init__.cpython-311.pyc,, +langchain_community/tools/zenguard/__pycache__/tool.cpython-311.pyc,, +langchain_community/tools/zenguard/tool.py,sha256=b_rsaStlyLrJ4NcYIByEb1UVH1kBtqMRGy_6ffbxUtA,3824 +langchain_community/utilities/__init__.py,sha256=-eszxxlij_IVjJ3k_X2nX7_QnwJTNN7ViOkz_IvXypQ,11923 +langchain_community/utilities/__pycache__/__init__.cpython-311.pyc,, +langchain_community/utilities/__pycache__/alpha_vantage.cpython-311.pyc,, +langchain_community/utilities/__pycache__/anthropic.cpython-311.pyc,, +langchain_community/utilities/__pycache__/apify.cpython-311.pyc,, +langchain_community/utilities/__pycache__/arcee.cpython-311.pyc,, +langchain_community/utilities/__pycache__/arxiv.cpython-311.pyc,, +langchain_community/utilities/__pycache__/asknews.cpython-311.pyc,, +langchain_community/utilities/__pycache__/astradb.cpython-311.pyc,, +langchain_community/utilities/__pycache__/awslambda.cpython-311.pyc,, +langchain_community/utilities/__pycache__/bibtex.cpython-311.pyc,, +langchain_community/utilities/__pycache__/bing_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/brave_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/cassandra.cpython-311.pyc,, +langchain_community/utilities/__pycache__/cassandra_database.cpython-311.pyc,, +langchain_community/utilities/__pycache__/clickup.cpython-311.pyc,, +langchain_community/utilities/__pycache__/dalle_image_generator.cpython-311.pyc,, +langchain_community/utilities/__pycache__/dataforseo_api_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/dataherald.cpython-311.pyc,, +langchain_community/utilities/__pycache__/dria_index.cpython-311.pyc,, +langchain_community/utilities/__pycache__/duckduckgo_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/financial_datasets.cpython-311.pyc,, +langchain_community/utilities/__pycache__/github.cpython-311.pyc,, +langchain_community/utilities/__pycache__/gitlab.cpython-311.pyc,, +langchain_community/utilities/__pycache__/golden_query.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_books.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_finance.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_jobs.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_lens.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_places_api.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_scholar.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_serper.cpython-311.pyc,, +langchain_community/utilities/__pycache__/google_trends.cpython-311.pyc,, +langchain_community/utilities/__pycache__/graphql.cpython-311.pyc,, +langchain_community/utilities/__pycache__/infobip.cpython-311.pyc,, +langchain_community/utilities/__pycache__/jina_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/jira.cpython-311.pyc,, +langchain_community/utilities/__pycache__/max_compute.cpython-311.pyc,, +langchain_community/utilities/__pycache__/merriam_webster.cpython-311.pyc,, +langchain_community/utilities/__pycache__/metaphor_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/mojeek_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/nasa.cpython-311.pyc,, +langchain_community/utilities/__pycache__/nvidia_riva.cpython-311.pyc,, +langchain_community/utilities/__pycache__/opaqueprompts.cpython-311.pyc,, +langchain_community/utilities/__pycache__/openapi.cpython-311.pyc,, +langchain_community/utilities/__pycache__/openweathermap.cpython-311.pyc,, +langchain_community/utilities/__pycache__/oracleai.cpython-311.pyc,, +langchain_community/utilities/__pycache__/outline.cpython-311.pyc,, +langchain_community/utilities/__pycache__/passio_nutrition_ai.cpython-311.pyc,, +langchain_community/utilities/__pycache__/pebblo.cpython-311.pyc,, +langchain_community/utilities/__pycache__/polygon.cpython-311.pyc,, +langchain_community/utilities/__pycache__/portkey.cpython-311.pyc,, +langchain_community/utilities/__pycache__/powerbi.cpython-311.pyc,, +langchain_community/utilities/__pycache__/pubmed.cpython-311.pyc,, +langchain_community/utilities/__pycache__/python.cpython-311.pyc,, +langchain_community/utilities/__pycache__/reddit_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/redis.cpython-311.pyc,, +langchain_community/utilities/__pycache__/rememberizer.cpython-311.pyc,, +langchain_community/utilities/__pycache__/requests.cpython-311.pyc,, +langchain_community/utilities/__pycache__/scenexplain.cpython-311.pyc,, +langchain_community/utilities/__pycache__/searchapi.cpython-311.pyc,, +langchain_community/utilities/__pycache__/searx_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/semanticscholar.cpython-311.pyc,, +langchain_community/utilities/__pycache__/serpapi.cpython-311.pyc,, +langchain_community/utilities/__pycache__/spark_sql.cpython-311.pyc,, +langchain_community/utilities/__pycache__/sql_database.cpython-311.pyc,, +langchain_community/utilities/__pycache__/stackexchange.cpython-311.pyc,, +langchain_community/utilities/__pycache__/steam.cpython-311.pyc,, +langchain_community/utilities/__pycache__/tavily_search.cpython-311.pyc,, +langchain_community/utilities/__pycache__/tensorflow_datasets.cpython-311.pyc,, +langchain_community/utilities/__pycache__/twilio.cpython-311.pyc,, +langchain_community/utilities/__pycache__/vertexai.cpython-311.pyc,, +langchain_community/utilities/__pycache__/wikidata.cpython-311.pyc,, +langchain_community/utilities/__pycache__/wikipedia.cpython-311.pyc,, +langchain_community/utilities/__pycache__/wolfram_alpha.cpython-311.pyc,, +langchain_community/utilities/__pycache__/you.cpython-311.pyc,, +langchain_community/utilities/__pycache__/zapier.cpython-311.pyc,, +langchain_community/utilities/alpha_vantage.py,sha256=KGwLJ3qsBm1eqI09Ak1iG08HWXv3_J5ug3UyYZ90FNM,5888 +langchain_community/utilities/anthropic.py,sha256=gfED-04FxKkFyfs7yCS__DHl78ikQJZ-dBWB4nstmZ0,844 +langchain_community/utilities/apify.py,sha256=b6nKnizdUSY9kr-LS2WpKzGwQXuDD96dtTbEAvvy2uE,9335 +langchain_community/utilities/arcee.py,sha256=6CWa1C6ciMX3G0g5zN7OaQIZcxvX8lQjGhP7voIVhnk,8723 +langchain_community/utilities/arxiv.py,sha256=1OoT4TLLkVkCxJklPOvWmKJcrGZoHzy5ThO2_q2ToQE,9682 +langchain_community/utilities/asknews.py,sha256=CyXgZ63HQV2gBylGzob3J69aUJZtTAYarHnquXEnXw4,3605 +langchain_community/utilities/astradb.py,sha256=kwDMu-tfWZL9BhXt2l2HrEmiT5pHRjy68kfN3BNhWyM,6093 +langchain_community/utilities/awslambda.py,sha256=nJGrZwjpm8OdLUrtaBJhNoEWP8XkC-KfVLsVccrnzZU,2349 +langchain_community/utilities/bibtex.py,sha256=yqow4R-3oOf09Vw1rWqIQ-Rn92TSlB2UHJHJWo9_zRM,2477 +langchain_community/utilities/bing_search.py,sha256=D_y_0Npwc8ir8l6A7PguzXPWU-jVyaae5Un-TMQmtew,4485 +langchain_community/utilities/brave_search.py,sha256=2c48Isz6MWkdPCqI0ADqKhVPkwNMzrzUiQ6nLZ_KmHo,2814 +langchain_community/utilities/cassandra.py,sha256=zOdBSRBrog38wAHIU0HFnaCEtvLrK2zsBQG1gHdYyIQ,1613 +langchain_community/utilities/cassandra_database.py,sha256=nuKaVMgeTB0ysrtWkeeyMtmjCW6pD2h_Mzxy1qdS4lg,24534 +langchain_community/utilities/clickup.py,sha256=ygB0wz8iGGWi7bZQi8Y_bysut227F-Xibfom3-X0oao,19849 +langchain_community/utilities/dalle_image_generator.py,sha256=vkEc15WFEoqHlijd5Wv7-Nzb5tq90CpwTj7Qdd5j1pE,6147 +langchain_community/utilities/dataforseo_api_search.py,sha256=t-HRtQ8NfL-g5HRwWok_yCAp4Wgoc3KZgQoEICEe-Mc,7835 +langchain_community/utilities/dataherald.py,sha256=Jkwo0qMYcYg0oBLslbrIPgInDvBGxBzoQPlEL2XpwvU,2052 +langchain_community/utilities/dria_index.py,sha256=ZEDdUH-aJZNOVl2WxW4vb6dHG77FIo2Nl0wQi5lwoAs,3351 +langchain_community/utilities/duckduckgo_search.py,sha256=prLgv5hh3NUS7Wb2CQreWOySO5lKYOv9EobVBxXlsYE,5485 +langchain_community/utilities/financial_datasets.py,sha256=Vlo1_CLaqDSWxRSgG2iPjHocgvEPOfzuAiFa5w61wtU,5108 +langchain_community/utilities/github.py,sha256=qK38ukO4mCobevvovx8SknORLcGwjNPZ7NeN5Nl7hYU,33740 +langchain_community/utilities/gitlab.py,sha256=wWaXrEdl0SinWzt8Oa4wPgia247YkNDBfJhcLHekGmg,19107 +langchain_community/utilities/golden_query.py,sha256=1Iw8nsfS_feg9SF4bg6ZRxjnhDV9RVrl4ehmO998_tg,1841 +langchain_community/utilities/google_books.py,sha256=Mdarps3oUBAwLE3JsVdZYEmXuJkp7760Zv5fkk5f-xE,2958 +langchain_community/utilities/google_finance.py,sha256=rxdipHBpautpU1MRn5QMo61b5-VTo4V0LZrADeUVo6w,3385 +langchain_community/utilities/google_jobs.py,sha256=ne8t2034M8vOe3GF9X1ZpziSIvSUe2DwocoVYrhhteY,2789 +langchain_community/utilities/google_lens.py,sha256=IbqZkUvq9XTcbBGnWJ7gRFJceQbDfIKW-4iLyJCFG5U,3001 +langchain_community/utilities/google_places_api.py,sha256=oz8eV6FzeRM38dvKgdr5EkrPJcWjznGsPggoun4nvts,4276 +langchain_community/utilities/google_scholar.py,sha256=onCYqWL0E-Mr5Aicu_ICyfXq99NMyAW4nnRdQyD5-Mg,5168 +langchain_community/utilities/google_search.py,sha256=-LqEVXrPTYEFIqFGMiaKNx_ZwH7QRnDG9GZGEWssjqo,5218 +langchain_community/utilities/google_serper.py,sha256=_AwqlWqY2pXxEXRg2nimHyzM66esuNj-v0-H0ziC9J8,6498 +langchain_community/utilities/google_trends.py,sha256=gN3hxSuAEmXDMkTLFlEr-6vURat0Ec_bo4E6MAslMqI,4154 +langchain_community/utilities/graphql.py,sha256=K3lUkxQDcztBMPcCykmZ72g0sslVWFlRuV_0u30KRTQ,2065 +langchain_community/utilities/infobip.py,sha256=olC6C695uOB4gKeX6HUj4xKWFW4WA8cReoREZwtRHrc,5866 +langchain_community/utilities/jina_search.py,sha256=OyVGSUt9kxVMoIvXNXP4Qb7JHHPkOM29o3xznmMWyaY,2616 +langchain_community/utilities/jira.py,sha256=K372RyHT9-GuP8MBGZjZRJq0Z0LzTNKg1Yw0znuHzzM,9510 +langchain_community/utilities/max_compute.py,sha256=WEU0NjPA2Vs7V860lwmYTA0vNfnGkIqTnRV7OIMPdNI,2647 +langchain_community/utilities/merriam_webster.py,sha256=J1-BAlBfiP7y83oblvH1CQEwvFikrdj1sLcgjLZk_Ro,3727 +langchain_community/utilities/metaphor_search.py,sha256=MP5_W5KP9AqDnEpT1s4Yl87sIz1AdefjqaKjGI7ByWc,6757 +langchain_community/utilities/mojeek_search.py,sha256=FnpOxqni5ZuBTkLzbyeNSmYy8fhVTZWW08CYx8DjDvg,1306 +langchain_community/utilities/nasa.py,sha256=YfA8_oUcolHvYRBpYVEIizFU5JMXZjdzDe28KCsKsm8,1803 +langchain_community/utilities/nvidia_riva.py,sha256=kppaFL4JhXgSNEdoreNrKOyOMqm9AiTRUi6zHvvgElA,21906 +langchain_community/utilities/opaqueprompts.py,sha256=L60OwawG4jW8aYp73bPYAfXYcz8aSDSLyEuEFlizFIU,3287 +langchain_community/utilities/openapi.py,sha256=q6pIC0O9fMMm7DfuhksDBHBeEymemWkQ-iDS7nG6KPs,11656 +langchain_community/utilities/openweathermap.py,sha256=ZTDiv1uVTz8YP7wYzNIKnE98VNRGd3ksLDAb8xGvb7Y,2439 +langchain_community/utilities/oracleai.py,sha256=Up1Fyacm3x9Xgnpv7gfRoyhT0s0GVgRBNPE8xXhCsRg,6224 +langchain_community/utilities/outline.py,sha256=dvZHDNRYq8j-l9HDITmqnNxKEWY0NiZendx-jW17s0c,3365 +langchain_community/utilities/passio_nutrition_ai.py,sha256=1B2I1jb88MH_e03dJrqSeRYg41kwzRVRuHK2kypYQ54,5565 +langchain_community/utilities/pebblo.py,sha256=KVzDaCKDUy1vsJ5dL-j9aJSZIJg2AsOJaLKHEJEpK7c,25503 +langchain_community/utilities/polygon.py,sha256=iytY4-nM8hEsKVMyLembaHzKFaQzNA-S-BQw7zdNPEc,4487 +langchain_community/utilities/portkey.py,sha256=Yarq8ZfrK0RNDr8BvnVOGEQbV-4cZPn9K14zzgKlAIY,2364 +langchain_community/utilities/powerbi.py,sha256=7Zb0e4_KI-V1nYAWZ8MpxvXks2horkuZibUjBSq8Bjs,11158 +langchain_community/utilities/pubmed.py,sha256=QTiFr7Cag73BcCLtLdTGJPA3EYN6QeWmOG0TSrcEmP8,7258 +langchain_community/utilities/python.py,sha256=5E2cqzkrCf5HieGfNoP_Og9fa3nNbTaiu4AaWeT-pJA,640 +langchain_community/utilities/reddit_search.py,sha256=Mi53xDBjvcbMvUJAnfWETtKvp-67k3Nlk6SU-AeuGHI,4487 +langchain_community/utilities/redis.py,sha256=IDtwgrKSWsY7STdsYsVVtSj3OHSjcXz3W90CptJLgJk,8279 +langchain_community/utilities/rememberizer.py,sha256=Z2WlilIqHHxoI7AlxcjlxE-MEXSg23rMiVNS0bbFbLQ,1708 +langchain_community/utilities/requests.py,sha256=VawgGT7TyEqGxvoCQW_fzWI4uaR9FKm2Jpdf0IYAofU,9285 +langchain_community/utilities/scenexplain.py,sha256=8hcBC-xlAdL8559wcOAIOJyjpEN8iSi_ALLI5jWdXdo,2266 +langchain_community/utilities/searchapi.py,sha256=vumYMzWxKdkJdnMKwtZ6iCryG-CEecBi7so4UA6CalU,5214 +langchain_community/utilities/searx_search.py,sha256=g7nNlxVuy6psFrfWXNkNY75udxZyPsX3k3x4F8dsAKk,16248 +langchain_community/utilities/semanticscholar.py,sha256=puDqdMVJXviuNu8a7I78RDfjuUN3Vmqpg-s1DnH-3Hg,2821 +langchain_community/utilities/serpapi.py,sha256=s4L3bRJngLikB6ChTjNKqnO1SWBFhdKDAn3jNi2_ojY,8688 +langchain_community/utilities/spark_sql.py,sha256=LFKLDLUpISkbSC6ekZx_RcAydXB-jW7KJvjLkfr9O2c,7520 +langchain_community/utilities/sql_database.py,sha256=0JPqstbD6qVgsktAVgQX0Ku1GDqg-NnyINYnUtCW0tU,25818 +langchain_community/utilities/stackexchange.py,sha256=vmSWf2iFG8bMwGyLbOVL1uA2WzRylZ5BJxZrVEt13zI,2659 +langchain_community/utilities/steam.py,sha256=mNBbTi-wCHzr98Fq3Ib0-obG5G_Z9tLt3dkGLUFAimw,5857 +langchain_community/utilities/tavily_search.py,sha256=CTX93cM7ijLUVWTaczir1_lw5Ub6P4mGKPGyezMOH7U,7073 +langchain_community/utilities/tensorflow_datasets.py,sha256=g3sSMHRadXgdJrMfFffIGxXdDwyvpqKYbD-yA6-s7A8,4019 +langchain_community/utilities/twilio.py,sha256=GrJvsWk1YpoKCfotJetL9uZGC741F3Frq7mXEY1T6Fg,3397 +langchain_community/utilities/vertexai.py,sha256=wY4oCUZqlDqbAKXARtxsfTYH_a1pVLHlQNjjj2qZMZ0,4088 +langchain_community/utilities/wikidata.py,sha256=45oLZY6G1kQuF9lkMGt5SzvyoZ-R3zEb4NlmN7NNezs,5429 +langchain_community/utilities/wikipedia.py,sha256=wIeoty4dG_slk7Q9v2GO4hoxfgEGzUE73jOmGCwC0yc,4318 +langchain_community/utilities/wolfram_alpha.py,sha256=4Gmrffaxk1BH23opTZmH0WCH0Uxrv_yPjW79QdM24e0,1996 +langchain_community/utilities/you.py,sha256=lAjTcv6v5lC_eU4P27hYlyoOxyI9XiK71N8EX8n9ty0,10198 +langchain_community/utilities/zapier.py,sha256=bGwYDQY_wHLJ0hfeO1oCmaf5JxoPmPfrAQnq31OE2nc,11447 +langchain_community/utils/__init__.py,sha256=S6zkHzdthvyPDlHZFJ7a4TKDXHEfDHCfiNYyoDIpRcM,45 +langchain_community/utils/__pycache__/__init__.cpython-311.pyc,, +langchain_community/utils/__pycache__/ernie_functions.cpython-311.pyc,, +langchain_community/utils/__pycache__/google.cpython-311.pyc,, +langchain_community/utils/__pycache__/math.cpython-311.pyc,, +langchain_community/utils/__pycache__/openai.cpython-311.pyc,, +langchain_community/utils/__pycache__/openai_functions.cpython-311.pyc,, +langchain_community/utils/__pycache__/user_agent.cpython-311.pyc,, +langchain_community/utils/ernie_functions.py,sha256=XTSItV7L2BuHXDrzTH4Xj_xT8wY9bWLN-hp0wHxWpW8,1491 +langchain_community/utils/google.py,sha256=KyUCAJ20nbExzsMwaaNz-ZdNfnBAL8psg6t1_cuKHFA,775 +langchain_community/utils/math.py,sha256=_d5IOqxhHLoZ58eyrGgtG5_cnawFsqP_rGUApyDLRi4,2697 +langchain_community/utils/openai.py,sha256=sD8qZZkLqRL44Px9KGyeuu5F6MoZm9NmzNlBIjAt0FY,298 +langchain_community/utils/openai_functions.py,sha256=7_30edqSCI01QRjmDhailgWfGd9U7pnlfRYlfZRtBI8,541 +langchain_community/utils/user_agent.py,sha256=zLuwb8hl1b88eahFq0hVbZH2nTpM1KESq5kOkEwMEPQ,437 +langchain_community/vectorstores/__init__.py,sha256=rU1I7v8-747E39882NL_-LMw4jLm65kIv-4XwbtRwNk,18407 +langchain_community/vectorstores/__pycache__/__init__.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/aerospike.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/alibabacloud_opensearch.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/analyticdb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/annoy.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/apache_doris.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/aperturedb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/astradb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/atlas.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/awadb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/azure_cosmos_db.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/azure_cosmos_db_no_sql.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/azuresearch.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/bagel.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/bageldb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/baiducloud_vector_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/baiduvectordb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/bigquery_vector_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/cassandra.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/chroma.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/clarifai.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/clickhouse.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/couchbase.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/dashvector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/databricks_vector_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/deeplake.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/dingo.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/documentdb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/duckdb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/ecloud_vector_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/elastic_vector_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/elasticsearch.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/epsilla.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/faiss.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/falkordb_vector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/hanavector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/hippo.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/hologres.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/infinispanvs.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/inmemory.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/jaguar.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/kdbai.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/kinetica.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/lancedb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/lantern.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/llm_rails.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/manticore_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/marqo.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/matching_engine.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/meilisearch.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/milvus.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/momento_vector_index.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/mongodb_atlas.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/myscale.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/neo4j_vector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/nucliadb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/opensearch_vector_search.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/oraclevs.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/pathway.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/pgembedding.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/pgvecto_rs.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/pgvector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/pinecone.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/qdrant.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/relyt.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/rocksetdb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/scann.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/semadb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/singlestoredb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/sklearn.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/sqlitevec.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/sqlitevss.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/starrocks.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/supabase.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/surrealdb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/tablestore.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/tair.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/tencentvectordb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/thirdai_neuraldb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/tidb_vector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/tigris.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/tiledb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/timescalevector.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/typesense.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/upstash.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/usearch.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/utils.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vald.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vdms.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vearch.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vectara.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vespa.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vikingdb.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/vlite.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/weaviate.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/xata.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/yellowbrick.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/zep.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/zep_cloud.cpython-311.pyc,, +langchain_community/vectorstores/__pycache__/zilliz.cpython-311.pyc,, +langchain_community/vectorstores/aerospike.py,sha256=wNIuo3817K7Y3TK-UVJMwT86NCUlmmODncGRKLCdc3M,20995 +langchain_community/vectorstores/alibabacloud_opensearch.py,sha256=pli7LhoJ3kwdwP7YBMrnGCd-CNCmiuVoDo-HrDI7sP4,19806 +langchain_community/vectorstores/analyticdb.py,sha256=3kXvbNZfmJE4fLoB0N5EBRj9c-mNYqcnwcn4yRTt3yI,15754 +langchain_community/vectorstores/annoy.py,sha256=6XnY1uyu5_ygg6ckEQNKZrA6DW8y3jL5Pq1XPh1yM6s,17952 +langchain_community/vectorstores/apache_doris.py,sha256=pSMgJupKlhFzOp7WIGUw2OoC9Cku1elA4_z50l1Lg8Q,20025 +langchain_community/vectorstores/aperturedb.py,sha256=9l58cBi6qwp-52mmdh7lIB7N4ejJKGIZh8WV4zhqrCk,19543 +langchain_community/vectorstores/astradb.py,sha256=xrwPLZMBgz9LfkOgk-2r9CEtfDVKywVQ15VXcrQApTk,46685 +langchain_community/vectorstores/atlas.py,sha256=UBQdZWs7yoLsz6vSHA754-Cs1m3qsWl1iqY4RZuwrac,12141 +langchain_community/vectorstores/awadb.py,sha256=f7NEV_AFQcUGbahNAnh54dvpHPIMGXgmSzc55aW3JJA,21160 +langchain_community/vectorstores/azure_cosmos_db.py,sha256=lscSVz__5Z9QsiAI5BPtZc466Uy1Tm6fUsRtwYEha6E,25737 +langchain_community/vectorstores/azure_cosmos_db_no_sql.py,sha256=ePi_yP003Udeo_hQlMLHbuUkdL57IKJV9yK01gnkWEI,32745 +langchain_community/vectorstores/azuresearch.py,sha256=6pqJqLwTCsi0TdrRSksokmvrB0nXL0gVmJFxTQ5BHnE,71494 +langchain_community/vectorstores/bagel.py,sha256=xkMb4BQaxpcTMJUMqSszaV_k2_xEt1QTwzI30AeblyI,15250 +langchain_community/vectorstores/bageldb.py,sha256=vjGbYwzkpV0SwHhNTLhgTxMhhPh0iQPHk5I3sCbZP4k,78 +langchain_community/vectorstores/baiducloud_vector_search.py,sha256=kwccLU16TvcaHGnM9l9p8KHiDLXakCTyL2WIl9AoE2k,16548 +langchain_community/vectorstores/baiduvectordb.py,sha256=YtZZH-Q0K0SEM0vDE0IBijamG_wb0lbKk4NWr76EvK4,15272 +langchain_community/vectorstores/bigquery_vector_search.py,sha256=CVAXyd9BfjJexIhQDSIrT-7VXVFOFl4qdNcuF5kZyNY,34443 +langchain_community/vectorstores/cassandra.py,sha256=VZTbb-P8JBcZhFP_6AH8Z4jntMFDP1WV9LFAECQ7CZ0,56422 +langchain_community/vectorstores/chroma.py,sha256=sVBR4ykbkLMbL522YyVMUi2IzbcPhnlpsW8uKrHOn18,34764 +langchain_community/vectorstores/clarifai.py,sha256=jPdaFGetIW0gmo1YzBtJ3q0cEx-6eV0l44Y0gfxSGyU,12079 +langchain_community/vectorstores/clickhouse.py,sha256=okixMC2ZlvtuZvcuQZ4S9LQNHwZckWh-CJM9AZ11MYs,25827 +langchain_community/vectorstores/couchbase.py,sha256=QXtbbX-ZbeYJYzO4fOzsEaPF2R0BuJpNPf4cykw8X98,23344 +langchain_community/vectorstores/dashvector.py,sha256=wSWmH-GqIh1wNkn8-YNehhuhNBcsnSXIaj-imuIlvfQ,13905 +langchain_community/vectorstores/databricks_vector_search.py,sha256=ZaTFutXdl8wqEwBN77bcoQyxX8yseW6WLH9vILZR-Jo,26268 +langchain_community/vectorstores/deeplake.py,sha256=xL1pg6gTl1_igR7SEE5oYe1zbvT-3GP0DSYBwWBX3lM,43457 +langchain_community/vectorstores/dingo.py,sha256=1DI-UCsPvtJOxfkDCTnubIOFT9DnRgm4WPlDRupigAI,13208 +langchain_community/vectorstores/docarray/__init__.py,sha256=-yA5diUG1xNKEhq2okPUWwbpUzT52YB5baxVLmtbTys,236 +langchain_community/vectorstores/docarray/__pycache__/__init__.cpython-311.pyc,, +langchain_community/vectorstores/docarray/__pycache__/base.cpython-311.pyc,, +langchain_community/vectorstores/docarray/__pycache__/hnsw.cpython-311.pyc,, +langchain_community/vectorstores/docarray/__pycache__/in_memory.cpython-311.pyc,, +langchain_community/vectorstores/docarray/base.py,sha256=cFLX1XQpsLuS0sbzNo64xXowt51yo0oI9cDg3t_PZNo,6910 +langchain_community/vectorstores/docarray/hnsw.py,sha256=l0G29d_H25kpXWdk--5PEbVVyNnVcfPG4dtiX-zn4Pk,4015 +langchain_community/vectorstores/docarray/in_memory.py,sha256=VYQ6lNwAWNKy4mOy7xjUOgc2lyeuliLQtJgU94sED1I,2280 +langchain_community/vectorstores/documentdb.py,sha256=TyJE2eUqOWRmQE6gB2Podysj8UJxcsJjeEyg7cR5pfE,12382 +langchain_community/vectorstores/duckdb.py,sha256=Dsvhz69GmDR3BZ-hwigdjowRe2KxJfT8uwP9iJwtQC8,13381 +langchain_community/vectorstores/ecloud_vector_search.py,sha256=yfLj71khlfQwrVzAfjiqxFA4LrI1h9UQpgBlkwTDbGI,20627 +langchain_community/vectorstores/elastic_vector_search.py,sha256=ZUw6A_c8C2M7FMi-Oz7adKFpuRJbHq9Iv60fGMo5O-k,29007 +langchain_community/vectorstores/elasticsearch.py,sha256=Ftgcd9pi65e7OfywyWE9HjxL-TCeRXlhuy9fwdNJsAU,48602 +langchain_community/vectorstores/epsilla.py,sha256=L25HHQNjOQR1TNFi6JDqQ_NZVGYtY6uoZoWqZA44C4c,14290 +langchain_community/vectorstores/faiss.py,sha256=fzeoThsmX3P4G01t9TiCR5uzoIHOYSIBIaFwH0xBNes,55208 +langchain_community/vectorstores/falkordb_vector.py,sha256=HQeljeUIUHo2q68FYGy_vYlXdsoaEPHtNrC-s1b4YgY,69267 +langchain_community/vectorstores/hanavector.py,sha256=HKxwCReYEM6JQCiXzDCtmE_ZoYqKjTYYKlGir86rOCU,32934 +langchain_community/vectorstores/hippo.py,sha256=keobFDFF74WV6IiFnHtWBz2XDXcOdI7-trLQo79zcWM,26849 +langchain_community/vectorstores/hologres.py,sha256=dUq-kfiby3fQ96ciaaUQO2e57LwzCvZ_O2W60YsGRN4,13642 +langchain_community/vectorstores/infinispanvs.py,sha256=Iy_9Si8IU8vnhuee-NjYko8dj8F3P_KKoKkcQJUZVMo,25564 +langchain_community/vectorstores/inmemory.py,sha256=mWSrawseKyVFQRN4u8CEdqV8IlcJtTAD8WppvMYgopU,102 +langchain_community/vectorstores/jaguar.py,sha256=5YxPe7LyYpK7D8RaD1Ki_U0zOVCnFkOmR-BjZuegIfs,14567 +langchain_community/vectorstores/kdbai.py,sha256=jH8FA1metQWnjZX9i0DfJhvZzsggiX1y1CDiIANbLGA,9069 +langchain_community/vectorstores/kinetica.py,sha256=JA4TZ4MFYWqHvFGWEc8N1S7EDXfO57w9yF0cqsIi7-o,36493 +langchain_community/vectorstores/lancedb.py,sha256=IAvLZcH_BgGRyvzLLL-AmqscyEpKpBYjaRPZZqcyRUg,24956 +langchain_community/vectorstores/lantern.py,sha256=3UrgxHBYJmlRmkz2XUGX5ljn7E2s9Q6lZ-9OMjwelzY,38525 +langchain_community/vectorstores/llm_rails.py,sha256=TSKPxweXgOpYQD670iGSXQLeJlMzfrU52qKmZzS89DI,7728 +langchain_community/vectorstores/manticore_search.py,sha256=NNEMWzWLzzWU00W6-qeWzH4TF33CCbDbkorpzpvZj0Q,12258 +langchain_community/vectorstores/marqo.py,sha256=xXi_UjwO872VXU3uOusHHUBMolKR45CaYP0PT934Zso,17274 +langchain_community/vectorstores/matching_engine.py,sha256=RK_MbQZzUbXmfsP-YK1gVxViWQ24S6k058qA21w7_mA,21652 +langchain_community/vectorstores/meilisearch.py,sha256=oDOhJq2ds3qw38HcuZSsunfjfrGEQfroPhg3BH98KG0,12182 +langchain_community/vectorstores/milvus.py,sha256=hjGNY5oebVyb-mRwos_lMb-_GzhAC34x_i_4vQiB_Yo,42275 +langchain_community/vectorstores/momento_vector_index.py,sha256=tFdDvfzJ3VvEfWTcnc81j01E5Gz2BZN7oz2JvwFwqnY,19027 +langchain_community/vectorstores/mongodb_atlas.py,sha256=QdExie4cC8faj0gXUsN4kgm98HcAvnNxCjadfvAceok,13656 +langchain_community/vectorstores/myscale.py,sha256=sklFo1EuHbKI-dxgWrNQ8eZ3zfcg_lZ6-HialjFnSb4,22967 +langchain_community/vectorstores/neo4j_vector.py,sha256=vowN0zTqkQf2UP6xdS7dsmVzbGOMwScTellDGrDJgcE,61891 +langchain_community/vectorstores/nucliadb.py,sha256=iG6U6K7ZnGV7_IPagMnuZ9gxjv07q0yOgOX2zwPAoPI,5404 +langchain_community/vectorstores/opensearch_vector_search.py,sha256=kv_b4utdHi6JyWeotFtRgFBrbEIYg_BbcGlSRJzItEo,60269 +langchain_community/vectorstores/oraclevs.py,sha256=o-6YJnKcSxyXXLYdze9bxYAlEnxg5zwZ-MhjB8c0xyw,37223 +langchain_community/vectorstores/pathway.py,sha256=XOvGEdTnD0kT6JwSA54th9MvUcRYXqOZZAktsv89pBw,7708 +langchain_community/vectorstores/pgembedding.py,sha256=q7Rk3KrPM0XuqMZcAYfzLYxFLqx9SpmobRs2uF-Qihg,17948 +langchain_community/vectorstores/pgvecto_rs.py,sha256=4zQr-UTHz5Au-id71fHBNL-7rnnqyLjF1ae5gCGI800,7838 +langchain_community/vectorstores/pgvector.py,sha256=BVnkj1_jaJx0CVY-F0xvsahfJNi3WATMAgBBWlh0uGk,51646 +langchain_community/vectorstores/pinecone.py,sha256=tjU_8juvzJnckzBtdqJfnE-7N-sX1z3ZGM7esAsBnw0,17659 +langchain_community/vectorstores/qdrant.py,sha256=ShPBzlSPg-CfsrhwS8U2LmCEwSyx86n-BnYeOMZ3UUI,93777 +langchain_community/vectorstores/redis/__init__.py,sha256=iDkWyYU-o8d7_mnGxK-HV8vsFtTyfEy1wJB9LY_fbSY,265 +langchain_community/vectorstores/redis/__pycache__/__init__.cpython-311.pyc,, +langchain_community/vectorstores/redis/__pycache__/base.cpython-311.pyc,, +langchain_community/vectorstores/redis/__pycache__/constants.cpython-311.pyc,, +langchain_community/vectorstores/redis/__pycache__/filters.cpython-311.pyc,, +langchain_community/vectorstores/redis/__pycache__/schema.cpython-311.pyc,, +langchain_community/vectorstores/redis/base.py,sha256=mLQt7uZtAyVwV9W-WJo_dbaajf_Sk_GevzXx9a-1Nds,56498 +langchain_community/vectorstores/redis/constants.py,sha256=IDLancB3c8EZgvx4fun3cx-zSTirqomE3vfX5bqgRqo,420 +langchain_community/vectorstores/redis/filters.py,sha256=wz0-o_FFKaA8QYT_x7cCCLxhvqLWcIc1J2CCxXqzYHo,16319 +langchain_community/vectorstores/redis/schema.py,sha256=p-sPdNnXtt3zwsQW-BCj6B3XG_k8W1A_5AD2rWjpXMs,10368 +langchain_community/vectorstores/relyt.py,sha256=ecO2GdrkSo-zttBb4VgUCd7egWpFjB8QkwhDfaTGAgo,18390 +langchain_community/vectorstores/rocksetdb.py,sha256=kdKZhfScBpY1ntG7h1P2ChMdfpjUXsnf71cgpe6WbV4,15304 +langchain_community/vectorstores/scann.py,sha256=_wi87sdxn35VuT_iO7sn9mbTuXmCYnPCCHuJ7fFLWSc,20922 +langchain_community/vectorstores/semadb.py,sha256=u1LhqddStRZ5HJsM0s7ySvsKoADkCc-NCcDqBlfXKJI,9776 +langchain_community/vectorstores/singlestoredb.py,sha256=eZpCHYLrWqUtDO3PVRfle1LzikgS3TIOgB_p5vR-2Ds,47861 +langchain_community/vectorstores/sklearn.py,sha256=NHxRLb48mT_3idzxxgiv2SKCVRuD6IuvEvZQgCnKTAE,12349 +langchain_community/vectorstores/sqlitevec.py,sha256=FbrkBd_o8-N9WhaYGvZ18kyFlNXX0veDEocQlGaIO2I,7739 +langchain_community/vectorstores/sqlitevss.py,sha256=J89eMJbiDhljeJkZHVtSZVtTrZHSnbkuD_XYWkfjJ5g,7286 +langchain_community/vectorstores/starrocks.py,sha256=c8CvxzP_0qGxkKdWQX9BQvzER7YGBpqAXVz2k-aXqMA,20178 +langchain_community/vectorstores/supabase.py,sha256=714QmT1IGb-9YchHD6rjeEMsKVuRG-jtdl0ix8-VThA,16481 +langchain_community/vectorstores/surrealdb.py,sha256=MUkHGWjRTDCFMntyMrud-qgrkc922Smqo6pO7dOduWA,23946 +langchain_community/vectorstores/tablestore.py,sha256=fcPGPMgrVKeIqQttTQa8vi7W_KsiIcD2SNjb7Bch_-k,20822 +langchain_community/vectorstores/tair.py,sha256=fkWRn2ae02iiGaM7tcP4sNgnc3QageccM8pOCK0DYDI,9559 +langchain_community/vectorstores/tencentvectordb.py,sha256=BOOw_n_YeQZpve3IoeHcGw3_MUaSgophq0XKQmt6mgo,21188 +langchain_community/vectorstores/thirdai_neuraldb.py,sha256=-ETt6eJVAZeKxT42YOIngRguy9q3v5v3COZFFnDaZQg,16786 +langchain_community/vectorstores/tidb_vector.py,sha256=IFkMB8-NMo3WwhRJvg_2aGcgz6JK9v2qEbguFmFWd5Q,13469 +langchain_community/vectorstores/tigris.py,sha256=gTik_ffTEzZwx_jvv8K4c9wct--NAKv2CrgpEJEU_RQ,4927 +langchain_community/vectorstores/tiledb.py,sha256=siB0en9DxnOfjzpc-opgcs6GuK4QgS34MmiyVMXRvPE,29832 +langchain_community/vectorstores/timescalevector.py,sha256=CLxTVXjkCPEDn_1rsh_ia-74o2UjtjJg-vrUphN1DF0,29818 +langchain_community/vectorstores/typesense.py,sha256=aiONRUe7hTMDPlifJCMq27HJRHQtmLQw847quB_-MBs,9760 +langchain_community/vectorstores/upstash.py,sha256=DNORdisNTcqFk4Q8kaJIjuSSyMfAynLrz0N6nWbCspU,37020 +langchain_community/vectorstores/usearch.py,sha256=7kd7PvlraH-SKC9puHG9iJa83Kc_zPESOGC_kU-ye90,6084 +langchain_community/vectorstores/utils.py,sha256=smPoWsr4YqkKNFHSh0dL4b-IHd7-3JtJXzWy9PeugDc,2474 +langchain_community/vectorstores/vald.py,sha256=fbywIsMSlDywOFHyO3E6jGCLA6HHjrUE46-hZpYLAak,12987 +langchain_community/vectorstores/vdms.py,sha256=ScJCT1CEYUQLRpCHCduAkcwSDWJQXbEgSOQISB9tZHc,60367 +langchain_community/vectorstores/vearch.py,sha256=Xpc90xOnK2fXtYINSH8-DgUwI_C7-MzY6ka5gkTfGMU,19845 +langchain_community/vectorstores/vectara.py,sha256=pJ8oHvghmGZcieVen9xcB6yZ8WkSYtA1g9q5BK644c4,33049 +langchain_community/vectorstores/vespa.py,sha256=AUZLwZxYMcA0fRIzUeFK75OlN5Jm_XmgE4dOAy4gQK0,9787 +langchain_community/vectorstores/vikingdb.py,sha256=JcJegBHKJcbztJRGEXsN-agio5xHzkNrgUB_UX2cIpY,15520 +langchain_community/vectorstores/vlite.py,sha256=o5Xg_SAqST92E0um2P8Vq0pWVuEN-aN3jIc4hdcdmO4,8161 +langchain_community/vectorstores/weaviate.py,sha256=aNpXeR7Eq_pnKrhO6FHewd1t1oN2nZM1S67L1jZl8CM,19413 +langchain_community/vectorstores/xata.py,sha256=g9SXHDU-iybzHkJAIFk2n5dExK484LVaSmRerfw8Vl8,9018 +langchain_community/vectorstores/yellowbrick.py,sha256=MSrMciwfQgw0xgsTmP7RM8EqBm21TWdziV3yLzmFIhA,34543 +langchain_community/vectorstores/zep.py,sha256=RENSLk_Ayv7ZOC68qTSS4oMYvJlxpRsCk13KuBmEJBQ,23190 +langchain_community/vectorstores/zep_cloud.py,sha256=fjz7DdVqmThay6jj8UBK8u4S82F4m6q9CwFltCe8fWE,15305 +langchain_community/vectorstores/zilliz.py,sha256=rfxos8nuBaqnM7AqA2qnlo4wYJeajCefptyzLK6C-nQ,8255 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/REQUESTED b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..045c8acdea31cbca5be986e915f784c1aafc720f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: pdm-backend (2.4.5) +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/entry_points.txt b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3ad4726d437022e5c606a4206ffb6007347a008 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community-0.4.1.dist-info/entry_points.txt @@ -0,0 +1,4 @@ +[console_scripts] + +[gui_scripts] + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3368893c0ea39205491fa6d63a7f23a35ffc0653 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/__init__.py @@ -0,0 +1,10 @@ +"""Main entrypoint into package.""" + +from importlib import metadata + +try: + __version__ = metadata.version(__package__) +except metadata.PackageNotFoundError: + # Case where package metadata is not available. + __version__ = "" +del metadata # optional, avoids polluting the results of dir(__package__) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/cache.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/cache.py new file mode 100644 index 0000000000000000000000000000000000000000..ba9dd9f43d2afa579e1d5123d50975ee4ffebe1a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/cache.py @@ -0,0 +1,2812 @@ +""" +.. warning:: + Beta Feature! + +**Cache** provides an optional caching layer for LLMs. + +Cache is useful for two reasons: + +- It can save you money by reducing the number of API calls you make to the LLM + provider if you're often requesting the same completion multiple times. +- It can speed up your application by reducing the number of API calls you make + to the LLM provider. + +Cache directly competes with Memory. See documentation for Pros and Cons. + +**Class hierarchy:** + +.. code-block:: + + BaseCache --> Cache # Examples: InMemoryCache, RedisCache, GPTCache +""" + +from __future__ import annotations + +import hashlib +import inspect +import json +import logging +import uuid +import warnings +from abc import ABC +from datetime import timedelta +from enum import Enum +from functools import lru_cache, wraps +from typing import ( + TYPE_CHECKING, + Any, + Awaitable, + Callable, + Dict, + Generator, + List, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) + +from sqlalchemy import Column, Integer, String, create_engine, delete, select +from sqlalchemy.engine import Row +from sqlalchemy.engine.base import Engine +from sqlalchemy.orm import Session + +from langchain_community.utilities.cassandra import SetupMode as CassandraSetupMode +from langchain_community.vectorstores.azure_cosmos_db import ( + CosmosDBSimilarityType, + CosmosDBVectorSearchType, +) +from langchain_community.vectorstores.utils import DistanceStrategy + +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base + +from langchain_core._api.deprecation import deprecated, warn_deprecated +from langchain_core.caches import RETURN_VAL_TYPE, BaseCache +from langchain_core.embeddings import Embeddings +from langchain_core.language_models.llms import LLM, aget_prompts, get_prompts +from langchain_core.load.dump import dumps +from langchain_core.load.load import loads +from langchain_core.outputs import ChatGeneration, Generation +from langchain_core.utils import get_from_env + +from langchain_community.utilities.astradb import ( + SetupMode as AstraSetupMode, +) +from langchain_community.utilities.astradb import ( + _AstraDBCollectionEnvironment, +) +from langchain_community.vectorstores import ( + AzureCosmosDBNoSqlVectorSearch, + AzureCosmosDBVectorSearch, +) +from langchain_community.vectorstores import ( + OpenSearchVectorSearch as OpenSearchVectorStore, +) +from langchain_community.vectorstores.redis import Redis as RedisVectorstore +from langchain_community.vectorstores.singlestoredb import SingleStoreDB + +logger = logging.getLogger(__file__) + +if TYPE_CHECKING: + import momento + import pymemcache + from astrapy.db import AstraDB, AsyncAstraDB + from azure.cosmos.cosmos_client import CosmosClient + from cassandra.cluster import Session as CassandraSession + + +def _hash(_input: str) -> str: + """Use a deterministic hashing approach.""" + return hashlib.md5(_input.encode()).hexdigest() + + +def _dump_generations_to_json(generations: RETURN_VAL_TYPE) -> str: + """Dump generations to json. + + Args: + generations (RETURN_VAL_TYPE): A list of language model generations. + + Returns: + str: Json representing a list of generations. + + Warning: would not work well with arbitrary subclasses of `Generation` + """ + return json.dumps([generation.dict() for generation in generations]) + + +def _load_generations_from_json(generations_json: str) -> RETURN_VAL_TYPE: + """Load generations from json. + + Args: + generations_json (str): A string of json representing a list of generations. + + Raises: + ValueError: Could not decode json string to list of generations. + + Returns: + RETURN_VAL_TYPE: A list of generations. + + Warning: would not work well with arbitrary subclasses of `Generation` + """ + try: + results = json.loads(generations_json) + return [Generation(**generation_dict) for generation_dict in results] + except json.JSONDecodeError: + raise ValueError( + f"Could not decode json to list of generations: {generations_json}" + ) + + +def _dumps_generations(generations: RETURN_VAL_TYPE) -> str: + """ + Serialization for generic RETURN_VAL_TYPE, i.e. sequence of `Generation` + + Args: + generations (RETURN_VAL_TYPE): A list of language model generations. + + Returns: + str: a single string representing a list of generations. + + This function (+ its counterpart `_loads_generations`) rely on + the dumps/loads pair with Reviver, so are able to deal + with all subclasses of Generation. + + Each item in the list can be `dumps`ed to a string, + then we make the whole list of strings into a json-dumped. + """ + return json.dumps([dumps(_item) for _item in generations]) + + +def _loads_generations(generations_str: str) -> Union[RETURN_VAL_TYPE, None]: + """ + Deserialization of a string into a generic RETURN_VAL_TYPE + (i.e. a sequence of `Generation`). + + See `_dumps_generations`, the inverse of this function. + + Args: + generations_str (str): A string representing a list of generations. + + Compatible with the legacy cache-blob format + Does not raise exceptions for malformed entries, just logs a warning + and returns none: the caller should be prepared for such a cache miss. + + Returns: + RETURN_VAL_TYPE: A list of generations. + """ + try: + generations = [loads(_item_str) for _item_str in json.loads(generations_str)] + return generations + except (json.JSONDecodeError, TypeError): + # deferring the (soft) handling to after the legacy-format attempt + pass + + try: + gen_dicts = json.loads(generations_str) + # not relying on `_load_generations_from_json` (which could disappear): + generations = [Generation(**generation_dict) for generation_dict in gen_dicts] + logger.warning( + f"Legacy 'Generation' cached blob encountered: '{generations_str}'" + ) + return generations + except (json.JSONDecodeError, TypeError): + logger.warning( + f"Malformed/unparsable cached blob encountered: '{generations_str}'" + ) + return None + + +class InMemoryCache(BaseCache): + """Cache that stores things in memory.""" + + def __init__(self) -> None: + """Initialize with empty cache.""" + self._cache: Dict[Tuple[str, str], RETURN_VAL_TYPE] = {} + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + return self._cache.get((prompt, llm_string), None) + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + self._cache[(prompt, llm_string)] = return_val + + def clear(self, **kwargs: Any) -> None: + """Clear cache.""" + self._cache = {} + + async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + return self.lookup(prompt, llm_string) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + """Update cache based on prompt and llm_string.""" + self.update(prompt, llm_string, return_val) + + async def aclear(self, **kwargs: Any) -> None: + """Clear cache.""" + self.clear() + + +Base = declarative_base() + + +class FullLLMCache(Base): # type: ignore[misc,valid-type] + """SQLite table for full LLM Cache (all generations).""" + + __tablename__ = "full_llm_cache" + prompt = Column(String, primary_key=True) + llm = Column(String, primary_key=True) + idx = Column(Integer, primary_key=True) + response = Column(String) + + +class SQLAlchemyCache(BaseCache): + """Cache that uses SQAlchemy as a backend.""" + + def __init__(self, engine: Engine, cache_schema: Type[FullLLMCache] = FullLLMCache): + """Initialize by creating all tables.""" + self.engine = engine + self.cache_schema = cache_schema + self.cache_schema.metadata.create_all(self.engine) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + stmt = ( + select(self.cache_schema.response) + .where(self.cache_schema.prompt == prompt) + .where(self.cache_schema.llm == llm_string) + .order_by(self.cache_schema.idx) + ) + with Session(self.engine) as session: + rows = session.execute(stmt).fetchall() + if rows: + try: + return [loads(row[0]) for row in rows] + except Exception: + logger.warning( + "Retrieving a cache value that could not be deserialized " + "properly. This is likely due to the cache being in an " + "older format. Please recreate your cache to avoid this " + "error." + ) + # In a previous life we stored the raw text directly + # in the table, so assume it's in that format. + return [Generation(text=row[0]) for row in rows] + return None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update based on prompt and llm_string.""" + items = [ + self.cache_schema(prompt=prompt, llm=llm_string, response=dumps(gen), idx=i) + for i, gen in enumerate(return_val) + ] + with Session(self.engine) as session, session.begin(): + for item in items: + session.merge(item) + + def clear(self, **kwargs: Any) -> None: + """Clear cache.""" + with Session(self.engine) as session: + session.query(self.cache_schema).delete() + session.commit() + + +class SQLiteCache(SQLAlchemyCache): + """Cache that uses SQLite as a backend.""" + + def __init__(self, database_path: str = ".langchain.db"): + """Initialize by creating the engine and all tables.""" + engine = create_engine(f"sqlite:///{database_path}") + super().__init__(engine) + + +class UpstashRedisCache(BaseCache): + """Cache that uses Upstash Redis as a backend.""" + + def __init__(self, redis_: Any, *, ttl: Optional[int] = None): + """ + Initialize an instance of UpstashRedisCache. + + This method initializes an object with Upstash Redis caching capabilities. + It takes a `redis_` parameter, which should be an instance of an Upstash Redis + client class, allowing the object to interact with Upstash Redis + server for caching purposes. + + Parameters: + redis_: An instance of Upstash Redis client class + (e.g., Redis) used for caching. + This allows the object to communicate with + Redis server for caching operations on. + ttl (int, optional): Time-to-live (TTL) for cached items in seconds. + If provided, it sets the time duration for how long cached + items will remain valid. If not provided, cached items will not + have an automatic expiration. + """ + try: + from upstash_redis import Redis + except ImportError: + raise ImportError( + "Could not import upstash_redis python package. " + "Please install it with `pip install upstash_redis`." + ) + if not isinstance(redis_, Redis): + raise ValueError("Please pass in Upstash Redis object.") + self.redis = redis_ + self.ttl = ttl + + def _key(self, prompt: str, llm_string: str) -> str: + """Compute key from prompt and llm_string""" + return _hash(prompt + llm_string) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + generations = [] + # Read from a HASH + results = self.redis.hgetall(self._key(prompt, llm_string)) + if results: + for _, text in results.items(): + generations.append(Generation(text=text)) + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "UpstashRedisCache supports caching of normal LLM generations, " + f"got {type(gen)}" + ) + if isinstance(gen, ChatGeneration): + warnings.warn( + "NOTE: Generation has not been cached. UpstashRedisCache does not" + " support caching ChatModel outputs." + ) + return + # Write to a HASH + key = self._key(prompt, llm_string) + + mapping = { + str(idx): generation.text for idx, generation in enumerate(return_val) + } + self.redis.hset(key=key, values=mapping) + + if self.ttl is not None: + self.redis.expire(key, self.ttl) + + def clear(self, **kwargs: Any) -> None: + """ + Clear cache. If `asynchronous` is True, flush asynchronously. + This flushes the *whole* db. + """ + asynchronous = kwargs.get("asynchronous", False) + if asynchronous: + asynchronous = "ASYNC" + else: + asynchronous = "SYNC" + self.redis.flushdb(flush_type=asynchronous) + + +class _RedisCacheBase(BaseCache, ABC): + @staticmethod + def _key(prompt: str, llm_string: str) -> str: + """Compute key from prompt and llm_string""" + return _hash(prompt + llm_string) + + @staticmethod + def _ensure_generation_type(return_val: RETURN_VAL_TYPE) -> None: + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "RedisCache only supports caching of normal LLM generations, " + f"got {type(gen)}" + ) + + @staticmethod + def _get_generations( + results: dict[str | bytes, str | bytes], + ) -> Optional[List[Generation]]: + generations = [] + if results: + for _, text in results.items(): + try: + generations.append(loads(cast(str, text))) + except Exception: + logger.warning( + "Retrieving a cache value that could not be deserialized " + "properly. This is likely due to the cache being in an " + "older format. Please recreate your cache to avoid this " + "error." + ) + # In a previous life we stored the raw text directly + # in the table, so assume it's in that format. + generations.append(Generation(text=text)) # type: ignore[arg-type] + return generations if generations else None + + @staticmethod + def _configure_pipeline_for_update( + key: str, pipe: Any, return_val: RETURN_VAL_TYPE, ttl: Optional[int] = None + ) -> None: + pipe.hset( + key, + mapping={ + str(idx): dumps(generation) for idx, generation in enumerate(return_val) + }, + ) + if ttl is not None: + pipe.expire(key, ttl) + + +class RedisCache(_RedisCacheBase): + """ + Cache that uses Redis as a backend. Allows to use a sync `redis.Redis` client. + """ + + def __init__(self, redis_: Any, *, ttl: Optional[int] = None): + """ + Initialize an instance of RedisCache. + + This method initializes an object with Redis caching capabilities. + It takes a `redis_` parameter, which should be an instance of a Redis + client class (`redis.Redis`), allowing the object + to interact with a Redis server for caching purposes. + + Parameters: + redis_ (Any): An instance of a Redis client class + (`redis.Redis`) to be used for caching. + This allows the object to communicate with a + Redis server for caching operations. + ttl (int, optional): Time-to-live (TTL) for cached items in seconds. + If provided, it sets the time duration for how long cached + items will remain valid. If not provided, cached items will not + have an automatic expiration. + """ + try: + from redis import Redis + except ImportError: + raise ImportError( + "Could not import `redis` python package. " + "Please install it with `pip install redis`." + ) + if not isinstance(redis_, Redis): + raise ValueError("Please pass a valid `redis.Redis` client.") + self.redis = redis_ + self.ttl = ttl + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + # Read from a Redis HASH + try: + results = self.redis.hgetall(self._key(prompt, llm_string)) + return self._get_generations(results) + except Exception as e: + logger.error(f"Redis lookup failed: {e}") + return None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + self._ensure_generation_type(return_val) + key = self._key(prompt, llm_string) + try: + with self.redis.pipeline() as pipe: + self._configure_pipeline_for_update(key, pipe, return_val, self.ttl) + pipe.execute() + except Exception as e: + logger.error(f"Redis update failed: {e}") + + def clear(self, **kwargs: Any) -> None: + """Clear cache. If `asynchronous` is True, flush asynchronously.""" + try: + asynchronous = kwargs.get("asynchronous", False) + self.redis.flushdb(asynchronous=asynchronous, **kwargs) + except Exception as e: + logger.error(f"Redis clear failed: {e}") + + +class AsyncRedisCache(_RedisCacheBase): + """ + Cache that uses Redis as a backend. Allows to use an + async `redis.asyncio.Redis` client. + """ + + def __init__(self, redis_: Any, *, ttl: Optional[int] = None): + """ + Initialize an instance of AsyncRedisCache. + + This method initializes an object with Redis caching capabilities. + It takes a `redis_` parameter, which should be an instance of a Redis + client class (`redis.asyncio.Redis`), allowing the object + to interact with a Redis server for caching purposes. + + Parameters: + redis_ (Any): An instance of a Redis client class + (`redis.asyncio.Redis`) to be used for caching. + This allows the object to communicate with a + Redis server for caching operations. + ttl (int, optional): Time-to-live (TTL) for cached items in seconds. + If provided, it sets the time duration for how long cached + items will remain valid. If not provided, cached items will not + have an automatic expiration. + """ + try: + from redis.asyncio import Redis + except ImportError: + raise ImportError( + "Could not import `redis.asyncio` python package. " + "Please install it with `pip install redis`." + ) + if not isinstance(redis_, Redis): + raise ValueError("Please pass a valid `redis.asyncio.Redis` client.") + self.redis = redis_ + self.ttl = ttl + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + raise NotImplementedError( + "This async Redis cache does not implement `lookup()` method. " + "Consider using the async `alookup()` version." + ) + + async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string. Async version.""" + try: + results = await self.redis.hgetall(self._key(prompt, llm_string)) + return self._get_generations(results) + except Exception as e: + logger.error(f"Redis async lookup failed: {e}") + return None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + raise NotImplementedError( + "This async Redis cache does not implement `update()` method. " + "Consider using the async `aupdate()` version." + ) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + """Update cache based on prompt and llm_string. Async version.""" + self._ensure_generation_type(return_val) + key = self._key(prompt, llm_string) + try: + async with self.redis.pipeline() as pipe: + self._configure_pipeline_for_update(key, pipe, return_val, self.ttl) + await pipe.execute() + except Exception as e: + logger.error(f"Redis async update failed: {e}") + + def clear(self, **kwargs: Any) -> None: + """Clear cache. If `asynchronous` is True, flush asynchronously.""" + raise NotImplementedError( + "This async Redis cache does not implement `clear()` method. " + "Consider using the async `aclear()` version." + ) + + async def aclear(self, **kwargs: Any) -> None: + """ + Clear cache. If `asynchronous` is True, flush asynchronously. + Async version. + """ + try: + asynchronous = kwargs.get("asynchronous", False) + await self.redis.flushdb(asynchronous=asynchronous, **kwargs) + except Exception as e: + logger.error(f"Redis async clear failed: {e}") + + +class RedisSemanticCache(BaseCache): + """Cache that uses Redis as a vector-store backend.""" + + # TODO - implement a TTL policy in Redis + + DEFAULT_SCHEMA = { + "content_key": "prompt", + "text": [ + {"name": "prompt"}, + ], + "extra": [{"name": "return_val"}, {"name": "llm_string"}], + } + + def __init__( + self, redis_url: str, embedding: Embeddings, score_threshold: float = 0.2 + ): + """Initialize by passing in the `init` GPTCache func + + Args: + redis_url (str): URL to connect to Redis. + embedding (Embedding): Embedding provider for semantic encoding and search. + score_threshold (float, 0.2): + + Example: + + .. code-block:: python + + from langchain_community.globals import set_llm_cache + + from langchain_community.cache import RedisSemanticCache + from langchain_community.embeddings import OpenAIEmbeddings + + set_llm_cache(RedisSemanticCache( + redis_url="redis://localhost:6379", + embedding=OpenAIEmbeddings() + )) + + """ + self._cache_dict: Dict[str, RedisVectorstore] = {} + self.redis_url = redis_url + self.embedding = embedding + self.score_threshold = score_threshold + + def _index_name(self, llm_string: str) -> str: + hashed_index = _hash(llm_string) + return f"cache:{hashed_index}" + + def _get_llm_cache(self, llm_string: str) -> RedisVectorstore: + index_name = self._index_name(llm_string) + + # return vectorstore client for the specific llm string + if index_name in self._cache_dict: + return self._cache_dict[index_name] + + # create new vectorstore client for the specific llm string + try: + self._cache_dict[index_name] = RedisVectorstore.from_existing_index( + embedding=self.embedding, + index_name=index_name, + redis_url=self.redis_url, + schema=cast(Dict, self.DEFAULT_SCHEMA), + ) + except ValueError: + redis = RedisVectorstore( + embedding=self.embedding, + index_name=index_name, + redis_url=self.redis_url, + index_schema=cast(Dict, self.DEFAULT_SCHEMA), + ) + _embedding = self.embedding.embed_query(text="test") + redis._create_index_if_not_exist(dim=len(_embedding)) + self._cache_dict[index_name] = redis + + return self._cache_dict[index_name] + + def clear(self, **kwargs: Any) -> None: + """Clear semantic cache for a given llm_string.""" + index_name = self._index_name(kwargs["llm_string"]) + if index_name in self._cache_dict: + self._cache_dict[index_name].drop_index( + index_name=index_name, delete_documents=True, redis_url=self.redis_url + ) + del self._cache_dict[index_name] + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + llm_cache = self._get_llm_cache(llm_string) + generations: List = [] + # Read from a Hash + results = llm_cache.similarity_search( + query=prompt, + k=1, + distance_threshold=self.score_threshold, + ) + if results: + for document in results: + try: + generations.extend(loads(document.metadata["return_val"])) + except Exception: + logger.warning( + "Retrieving a cache value that could not be deserialized " + "properly. This is likely due to the cache being in an " + "older format. Please recreate your cache to avoid this " + "error." + ) + # In a previous life we stored the raw text directly + # in the table, so assume it's in that format. + generations.extend( + _load_generations_from_json(document.metadata["return_val"]) + ) + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "RedisSemanticCache only supports caching of " + f"normal LLM generations, got {type(gen)}" + ) + llm_cache = self._get_llm_cache(llm_string) + + metadata = { + "llm_string": llm_string, + "prompt": prompt, + "return_val": dumps([g for g in return_val]), + } + llm_cache.add_texts(texts=[prompt], metadatas=[metadata]) + + +class GPTCache(BaseCache): + """Cache that uses GPTCache as a backend.""" + + def __init__( + self, + init_func: Union[ + Callable[[Any, str], None], Callable[[Any], None], None + ] = None, + ): + """Initialize by passing in init function (default: `None`). + + Args: + init_func (Optional[Callable[[Any], None]]): init `GPTCache` function + (default: `None`) + + Example: + .. code-block:: python + + # Initialize GPTCache with a custom init function + import gptcache + from gptcache.processor.pre import get_prompt + from gptcache.manager.factory import get_data_manager + from langchain_community.globals import set_llm_cache + + # Avoid multiple caches using the same file, + causing different llm model caches to affect each other + + def init_gptcache(cache_obj: gptcache.Cache, llm str): + cache_obj.init( + pre_embedding_func=get_prompt, + data_manager=manager_factory( + manager="map", + data_dir=f"map_cache_{llm}" + ), + ) + + set_llm_cache(GPTCache(init_gptcache)) + + """ + try: + import gptcache # noqa: F401 + except ImportError: + raise ImportError( + "Could not import gptcache python package. " + "Please install it with `pip install gptcache`." + ) + + self.init_gptcache_func: Union[ + Callable[[Any, str], None], Callable[[Any], None], None + ] = init_func + self.gptcache_dict: Dict[str, Any] = {} + + def _new_gptcache(self, llm_string: str) -> Any: + """New gptcache object""" + from gptcache import Cache + from gptcache.manager.factory import get_data_manager + from gptcache.processor.pre import get_prompt + + _gptcache = Cache() + if self.init_gptcache_func is not None: + sig = inspect.signature(self.init_gptcache_func) + if len(sig.parameters) == 2: + self.init_gptcache_func(_gptcache, llm_string) # type: ignore[call-arg] + else: + self.init_gptcache_func(_gptcache) # type: ignore[call-arg] + else: + _gptcache.init( + pre_embedding_func=get_prompt, + data_manager=get_data_manager(data_path=llm_string), + ) + + self.gptcache_dict[llm_string] = _gptcache + return _gptcache + + def _get_gptcache(self, llm_string: str) -> Any: + """Get a cache object. + + When the corresponding llm model cache does not exist, it will be created.""" + _gptcache = self.gptcache_dict.get(llm_string, None) + if not _gptcache: + _gptcache = self._new_gptcache(llm_string) + return _gptcache + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up the cache data. + First, retrieve the corresponding cache object using the `llm_string` parameter, + and then retrieve the data from the cache based on the `prompt`. + """ + from gptcache.adapter.api import get + + _gptcache = self._get_gptcache(llm_string) + + res = get(prompt, cache_obj=_gptcache) + return _loads_generations(res) if res is not None else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache. + First, retrieve the corresponding cache object using the `llm_string` parameter, + and then store the `prompt` and `return_val` in the cache object. + """ + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "GPTCache only supports caching of normal LLM generations, " + f"got {type(gen)}" + ) + from gptcache.adapter.api import put + + _gptcache = self._get_gptcache(llm_string) + handled_data = _dumps_generations(return_val) + put(prompt, handled_data, cache_obj=_gptcache) + return None + + def clear(self, **kwargs: Any) -> None: + """Clear cache.""" + from gptcache import Cache + + for gptcache_instance in self.gptcache_dict.values(): + gptcache_instance = cast(Cache, gptcache_instance) + gptcache_instance.flush() + + self.gptcache_dict.clear() + + +def _ensure_cache_exists(cache_client: momento.CacheClient, cache_name: str) -> None: + """Create cache if it doesn't exist. + + Raises: + SdkException: Momento service or network error + Exception: Unexpected response + """ + from momento.responses import CreateCache + + create_cache_response = cache_client.create_cache(cache_name) + if isinstance(create_cache_response, CreateCache.Success) or isinstance( + create_cache_response, CreateCache.CacheAlreadyExists + ): + return None + elif isinstance(create_cache_response, CreateCache.Error): + raise create_cache_response.inner_exception + else: + raise Exception(f"Unexpected response cache creation: {create_cache_response}") + + +def _validate_ttl(ttl: Optional[timedelta]) -> None: + if ttl is not None and ttl <= timedelta(seconds=0): + raise ValueError(f"ttl must be positive but was {ttl}.") + + +class MomentoCache(BaseCache): + """Cache that uses Momento as a backend. See https://gomomento.com/""" + + def __init__( + self, + cache_client: momento.CacheClient, + cache_name: str, + *, + ttl: Optional[timedelta] = None, + ensure_cache_exists: bool = True, + ): + """Instantiate a prompt cache using Momento as a backend. + + Note: to instantiate the cache client passed to MomentoCache, + you must have a Momento account. See https://gomomento.com/. + + Args: + cache_client (CacheClient): The Momento cache client. + cache_name (str): The name of the cache to use to store the data. + ttl (Optional[timedelta], optional): The time to live for the cache items. + Defaults to None, ie use the client default TTL. + ensure_cache_exists (bool, optional): Create the cache if it doesn't + exist. Defaults to True. + + Raises: + ImportError: Momento python package is not installed. + TypeError: cache_client is not of type momento.CacheClientObject + ValueError: ttl is non-null and non-negative + """ + try: + from momento import CacheClient + except ImportError: + raise ImportError( + "Could not import momento python package. " + "Please install it with `pip install momento`." + ) + if not isinstance(cache_client, CacheClient): + raise TypeError("cache_client must be a momento.CacheClient object.") + _validate_ttl(ttl) + if ensure_cache_exists: + _ensure_cache_exists(cache_client, cache_name) + + self.cache_client = cache_client + self.cache_name = cache_name + self.ttl = ttl + + @classmethod + def from_client_params( + cls, + cache_name: str, + ttl: timedelta, + *, + configuration: Optional[momento.config.Configuration] = None, + api_key: Optional[str] = None, + auth_token: Optional[str] = None, # for backwards compatibility + **kwargs: Any, + ) -> MomentoCache: + """Construct cache from CacheClient parameters.""" + try: + from momento import CacheClient, Configurations, CredentialProvider + except ImportError: + raise ImportError( + "Could not import momento python package. " + "Please install it with `pip install momento`." + ) + if configuration is None: + configuration = Configurations.Laptop.v1() + + # Try checking `MOMENTO_AUTH_TOKEN` first for backwards compatibility + try: + api_key = auth_token or get_from_env("auth_token", "MOMENTO_AUTH_TOKEN") + except ValueError: + api_key = api_key or get_from_env("api_key", "MOMENTO_API_KEY") + credentials = CredentialProvider.from_string(api_key) + cache_client = CacheClient(configuration, credentials, default_ttl=ttl) + return cls(cache_client, cache_name, ttl=ttl, **kwargs) + + def __key(self, prompt: str, llm_string: str) -> str: + """Compute cache key from prompt and associated model and settings. + + Args: + prompt (str): The prompt run through the language model. + llm_string (str): The language model version and settings. + + Returns: + str: The cache key. + """ + return _hash(prompt + llm_string) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Lookup llm generations in cache by prompt and associated model and settings. + + Args: + prompt (str): The prompt run through the language model. + llm_string (str): The language model version and settings. + + Raises: + SdkException: Momento service or network error + + Returns: + Optional[RETURN_VAL_TYPE]: A list of language model generations. + """ + from momento.responses import CacheGet + + generations: RETURN_VAL_TYPE = [] + + get_response = self.cache_client.get( + self.cache_name, self.__key(prompt, llm_string) + ) + if isinstance(get_response, CacheGet.Hit): + value = get_response.value_string + generations = _load_generations_from_json(value) + elif isinstance(get_response, CacheGet.Miss): + pass + elif isinstance(get_response, CacheGet.Error): + raise get_response.inner_exception + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Store llm generations in cache. + + Args: + prompt (str): The prompt run through the language model. + llm_string (str): The language model string. + return_val (RETURN_VAL_TYPE): A list of language model generations. + + Raises: + SdkException: Momento service or network error + Exception: Unexpected response + """ + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "Momento only supports caching of normal LLM generations, " + f"got {type(gen)}" + ) + key = self.__key(prompt, llm_string) + value = _dump_generations_to_json(return_val) + set_response = self.cache_client.set(self.cache_name, key, value, self.ttl) + from momento.responses import CacheSet + + if isinstance(set_response, CacheSet.Success): + pass + elif isinstance(set_response, CacheSet.Error): + raise set_response.inner_exception + else: + raise Exception(f"Unexpected response: {set_response}") + + def clear(self, **kwargs: Any) -> None: + """Clear the cache. + + Raises: + SdkException: Momento service or network error + """ + from momento.responses import CacheFlush + + flush_response = self.cache_client.flush_cache(self.cache_name) + if isinstance(flush_response, CacheFlush.Success): + pass + elif isinstance(flush_response, CacheFlush.Error): + raise flush_response.inner_exception + + +CASSANDRA_CACHE_DEFAULT_TABLE_NAME = "langchain_llm_cache" +CASSANDRA_CACHE_DEFAULT_TTL_SECONDS = None + + +class CassandraCache(BaseCache): + """ + Cache that uses Cassandra / Astra DB as a backend. + + Example: + + .. code-block:: python + + import cassio + + from langchain_community.cache import CassandraCache + from langchain_core.globals import set_llm_cache + + cassio.init(auto=True) # Requires env. variables, see CassIO docs + + set_llm_cache(CassandraCache()) + + It uses a single Cassandra table. + The lookup keys (which get to form the primary key) are: + - prompt, a string + - llm_string, a deterministic str representation of the model parameters. + (needed to prevent same-prompt-different-model collisions) + + Args: + session: an open Cassandra session. + Leave unspecified to use the global cassio init (see below) + keyspace: the keyspace to use for storing the cache. + Leave unspecified to use the global cassio init (see below) + table_name: name of the Cassandra table to use as cache + ttl_seconds: time-to-live for cache entries + (default: None, i.e. forever) + setup_mode: a value in langchain_community.utilities.cassandra.SetupMode. + Choose between SYNC, ASYNC and OFF - the latter if the Cassandra + table is guaranteed to exist already, for a faster initialization. + + Note: + The session and keyspace parameters, when left out (or passed as None), + fall back to the globally-available cassio settings if any are available. + In other words, if a previously-run 'cassio.init(...)' has been + executed previously anywhere in the code, Cassandra-based objects + need not specify the connection parameters at all. + """ + + def __init__( + self, + session: Optional[CassandraSession] = None, + keyspace: Optional[str] = None, + table_name: str = CASSANDRA_CACHE_DEFAULT_TABLE_NAME, + ttl_seconds: Optional[int] = CASSANDRA_CACHE_DEFAULT_TTL_SECONDS, + skip_provisioning: bool = False, + setup_mode: CassandraSetupMode = CassandraSetupMode.SYNC, + ): + if skip_provisioning: + warn_deprecated( + "0.0.33", + name="skip_provisioning", + alternative=( + "setup_mode=langchain_community.utilities.cassandra.SetupMode.OFF" + ), + pending=True, + ) + try: + from cassio.table import ElasticCassandraTable + except (ImportError, ModuleNotFoundError): + raise ImportError( + "Could not import cassio python package. " + "Please install it with `pip install -U cassio`." + ) + + self.session = session + self.keyspace = keyspace + self.table_name = table_name + self.ttl_seconds = ttl_seconds + + kwargs = {} + if setup_mode == CassandraSetupMode.ASYNC: + kwargs["async_setup"] = True + + self.kv_cache = ElasticCassandraTable( + session=self.session, + keyspace=self.keyspace, + table=self.table_name, + keys=["llm_string", "prompt"], + primary_key_type=["TEXT", "TEXT"], + ttl_seconds=self.ttl_seconds, + skip_provisioning=skip_provisioning or setup_mode == CassandraSetupMode.OFF, + **kwargs, + ) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + item = self.kv_cache.get( + llm_string=_hash(llm_string), + prompt=_hash(prompt), + ) + if item is not None: + return _loads_generations(item["body_blob"]) + else: + return None + + async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + item = await self.kv_cache.aget( + llm_string=_hash(llm_string), + prompt=_hash(prompt), + ) + if item is not None: + return _loads_generations(item["body_blob"]) + else: + return None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + blob = _dumps_generations(return_val) + self.kv_cache.put( + llm_string=_hash(llm_string), + prompt=_hash(prompt), + body_blob=blob, + ) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + blob = _dumps_generations(return_val) + await self.kv_cache.aput( + llm_string=_hash(llm_string), + prompt=_hash(prompt), + body_blob=blob, + ) + + def delete_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> None: + """ + A wrapper around `delete` with the LLM being passed. + In case the llm.invoke(prompt) calls have a `stop` param, you should + pass it here + """ + llm_string = get_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + )[1] + return self.delete(prompt, llm_string=llm_string) + + def delete(self, prompt: str, llm_string: str) -> None: + """Evict from cache if there's an entry.""" + return self.kv_cache.delete( + llm_string=_hash(llm_string), + prompt=_hash(prompt), + ) + + def clear(self, **kwargs: Any) -> None: + """Clear cache. This is for all LLMs at once.""" + self.kv_cache.clear() + + async def aclear(self, **kwargs: Any) -> None: + """Clear cache. This is for all LLMs at once.""" + await self.kv_cache.aclear() + + +# This constant is in fact a similarity - the 'distance' name is kept for compatibility: +CASSANDRA_SEMANTIC_CACHE_DEFAULT_DISTANCE_METRIC = "dot" +CASSANDRA_SEMANTIC_CACHE_DEFAULT_SCORE_THRESHOLD = 0.85 +CASSANDRA_SEMANTIC_CACHE_DEFAULT_TABLE_NAME = "langchain_llm_semantic_cache" +CASSANDRA_SEMANTIC_CACHE_DEFAULT_TTL_SECONDS = None +CASSANDRA_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE = 16 + + +class CassandraSemanticCache(BaseCache): + """ + Cache that uses Cassandra as a vector-store backend for semantic + (i.e. similarity-based) lookup. + + Example: + + .. code-block:: python + + import cassio + + from langchain_community.cache import CassandraSemanticCache + from langchain_core.globals import set_llm_cache + + cassio.init(auto=True) # Requires env. variables, see CassIO docs + + my_embedding = ... + + set_llm_cache(CassandraSemanticCache( + embedding=my_embedding, + table_name="my_semantic_cache", + )) + + It uses a single (vector) Cassandra table and stores, in principle, + cached values from several LLMs, so the LLM's llm_string is part + of the rows' primary keys. + + One can choose a similarity measure (default: "dot" for dot-product). + Choosing another one ("cos", "l2") almost certainly requires threshold tuning. + (which may be in order nevertheless, even if sticking to "dot"). + + Args: + session: an open Cassandra session. + Leave unspecified to use the global cassio init (see below) + keyspace: the keyspace to use for storing the cache. + Leave unspecified to use the global cassio init (see below) + embedding: Embedding provider for semantic + encoding and search. + table_name: name of the Cassandra (vector) table + to use as cache. There is a default for "simple" usage, but + remember to explicitly specify different tables if several embedding + models coexist in your app (they cannot share one cache table). + distance_metric: an alias for the 'similarity_measure' parameter (see below). + As the "distance" terminology is misleading, please prefer + 'similarity_measure' for clarity. + score_threshold: numeric value to use as + cutoff for the similarity searches + ttl_seconds: time-to-live for cache entries + (default: None, i.e. forever) + similarity_measure: which measure to adopt for similarity searches. + Note: this parameter is aliased by 'distance_metric' - however, + it is suggested to use the "similarity" terminology since this value + is in fact a similarity (i.e. higher means closer). + Note that at most one of the two parameters 'distance_metric' + and 'similarity_measure' can be provided. + setup_mode: a value in langchain_community.utilities.cassandra.SetupMode. + Choose between SYNC, ASYNC and OFF - the latter if the Cassandra + table is guaranteed to exist already, for a faster initialization. + + Note: + The session and keyspace parameters, when left out (or passed as None), + fall back to the globally-available cassio settings if any are available. + In other words, if a previously-run 'cassio.init(...)' has been + executed previously anywhere in the code, Cassandra-based objects + need not specify the connection parameters at all. + """ + + def __init__( + self, + session: Optional[CassandraSession] = None, + keyspace: Optional[str] = None, + embedding: Optional[Embeddings] = None, + table_name: str = CASSANDRA_SEMANTIC_CACHE_DEFAULT_TABLE_NAME, + distance_metric: Optional[str] = None, + score_threshold: float = CASSANDRA_SEMANTIC_CACHE_DEFAULT_SCORE_THRESHOLD, + ttl_seconds: Optional[int] = CASSANDRA_SEMANTIC_CACHE_DEFAULT_TTL_SECONDS, + skip_provisioning: bool = False, + similarity_measure: str = CASSANDRA_SEMANTIC_CACHE_DEFAULT_DISTANCE_METRIC, + setup_mode: CassandraSetupMode = CassandraSetupMode.SYNC, + ): + if skip_provisioning: + warn_deprecated( + "0.0.33", + name="skip_provisioning", + alternative=( + "setup_mode=langchain_community.utilities.cassandra.SetupMode.OFF" + ), + pending=True, + ) + try: + from cassio.table import MetadataVectorCassandraTable + except (ImportError, ModuleNotFoundError): + raise ImportError( + "Could not import cassio python package. " + "Please install it with `pip install -U cassio`." + ) + + if not embedding: + raise ValueError("Missing required parameter 'embedding'.") + + # detect if legacy 'distance_metric' parameter used + if distance_metric is not None: + # if passed, takes precedence over 'similarity_measure', but we warn: + warn_deprecated( + "0.0.33", + name="distance_metric", + alternative="similarity_measure", + pending=True, + ) + similarity_measure = distance_metric + + self.session = session + self.keyspace = keyspace + self.embedding = embedding + self.table_name = table_name + self.similarity_measure = similarity_measure + self.score_threshold = score_threshold + self.ttl_seconds = ttl_seconds + + # The contract for this class has separate lookup and update: + # in order to spare some embedding calculations we cache them between + # the two calls. + # Note: each instance of this class has its own `_get_embedding` with + # its own lru. + @lru_cache(maxsize=CASSANDRA_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE) + def _cache_embedding(text: str) -> List[float]: + return self.embedding.embed_query(text=text) + + self._get_embedding = _cache_embedding + + @_async_lru_cache(maxsize=CASSANDRA_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE) + async def _acache_embedding(text: str) -> List[float]: + return await self.embedding.aembed_query(text=text) + + self._aget_embedding = _acache_embedding + kwargs = {} + embedding_dimension: Union[int, Awaitable[int], None] = None + if setup_mode == CassandraSetupMode.ASYNC: + embedding_dimension = self._aget_embedding_dimension() + kwargs["async_setup"] = True + elif setup_mode == CassandraSetupMode.SYNC: + embedding_dimension = self._get_embedding_dimension() + + self.table = MetadataVectorCassandraTable( + session=self.session, + keyspace=self.keyspace, + table=self.table_name, + primary_key_type=["TEXT"], + vector_dimension=embedding_dimension, + ttl_seconds=self.ttl_seconds, + metadata_indexing=("allow", {"_llm_string_hash"}), + skip_provisioning=skip_provisioning or setup_mode == CassandraSetupMode.OFF, + **kwargs, + ) + + def _get_embedding_dimension(self) -> int: + return len(self._get_embedding(text="This is a sample sentence.")) + + async def _aget_embedding_dimension(self) -> int: + return len(await self._aget_embedding(text="This is a sample sentence.")) + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + embedding_vector = self._get_embedding(text=prompt) + llm_string_hash = _hash(llm_string) + body = _dumps_generations(return_val) + metadata = { + "_prompt": prompt, + "_llm_string_hash": llm_string_hash, + } + row_id = f"{_hash(prompt)}-{llm_string_hash}" + + self.table.put( + body_blob=body, + vector=embedding_vector, + row_id=row_id, + metadata=metadata, + ) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + embedding_vector = await self._aget_embedding(text=prompt) + llm_string_hash = _hash(llm_string) + body = _dumps_generations(return_val) + metadata = { + "_prompt": prompt, + "_llm_string_hash": llm_string_hash, + } + row_id = f"{_hash(prompt)}-{llm_string_hash}" + + await self.table.aput( + body_blob=body, + vector=embedding_vector, + row_id=row_id, + metadata=metadata, + ) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + hit_with_id = self.lookup_with_id(prompt, llm_string) + if hit_with_id is not None: + return hit_with_id[1] + else: + return None + + async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + hit_with_id = await self.alookup_with_id(prompt, llm_string) + if hit_with_id is not None: + return hit_with_id[1] + else: + return None + + def lookup_with_id( + self, prompt: str, llm_string: str + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + """ + Look up based on prompt and llm_string. + If there are hits, return (document_id, cached_entry) + """ + prompt_embedding: List[float] = self._get_embedding(text=prompt) + hits = list( + self.table.metric_ann_search( + vector=prompt_embedding, + metadata={"_llm_string_hash": _hash(llm_string)}, + n=1, + metric=self.similarity_measure, + metric_threshold=self.score_threshold, + ) + ) + if hits: + hit = hits[0] + generations = _loads_generations(hit["body_blob"]) + if generations is not None: + # this protects against malformed cached items: + return ( + hit["row_id"], + generations, + ) + else: + return None + else: + return None + + async def alookup_with_id( + self, prompt: str, llm_string: str + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + """ + Look up based on prompt and llm_string. + If there are hits, return (document_id, cached_entry) + """ + prompt_embedding: List[float] = await self._aget_embedding(text=prompt) + hits = list( + await self.table.ametric_ann_search( + vector=prompt_embedding, + metadata={"_llm_string_hash": _hash(llm_string)}, + n=1, + metric=self.similarity_measure, + metric_threshold=self.score_threshold, + ) + ) + if hits: + hit = hits[0] + generations = _loads_generations(hit["body_blob"]) + if generations is not None: + # this protects against malformed cached items: + return ( + hit["row_id"], + generations, + ) + else: + return None + else: + return None + + def lookup_with_id_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + llm_string = get_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + )[1] + return self.lookup_with_id(prompt, llm_string=llm_string) + + async def alookup_with_id_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + llm_string = ( + await aget_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + ) + )[1] + return await self.alookup_with_id(prompt, llm_string=llm_string) + + def delete_by_document_id(self, document_id: str) -> None: + """ + Given this is a "similarity search" cache, an invalidation pattern + that makes sense is first a lookup to get an ID, and then deleting + with that ID. This is for the second step. + """ + self.table.delete(row_id=document_id) + + async def adelete_by_document_id(self, document_id: str) -> None: + """ + Given this is a "similarity search" cache, an invalidation pattern + that makes sense is first a lookup to get an ID, and then deleting + with that ID. This is for the second step. + """ + await self.table.adelete(row_id=document_id) + + def clear(self, **kwargs: Any) -> None: + """Clear the *whole* semantic cache.""" + self.table.clear() + + async def aclear(self, **kwargs: Any) -> None: + """Clear the *whole* semantic cache.""" + await self.table.aclear() + + +class FullMd5LLMCache(Base): # type: ignore[misc,valid-type] + """SQLite table for full LLM Cache (all generations).""" + + __tablename__ = "full_md5_llm_cache" + id = Column(String, primary_key=True) + prompt_md5 = Column(String, index=True) + llm = Column(String, index=True) + idx = Column(Integer, index=True) + prompt = Column(String) + response = Column(String) + + +class SQLAlchemyMd5Cache(BaseCache): + """Cache that uses SQAlchemy as a backend.""" + + def __init__( + self, engine: Engine, cache_schema: Type[FullMd5LLMCache] = FullMd5LLMCache + ): + """Initialize by creating all tables.""" + self.engine = engine + self.cache_schema = cache_schema + self.cache_schema.metadata.create_all(self.engine) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + rows = self._search_rows(prompt, llm_string) + if rows: + return [loads(row[0]) for row in rows] + return None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update based on prompt and llm_string.""" + with Session(self.engine) as session, session.begin(): + self._delete_previous(session, prompt, llm_string) + prompt_md5 = self.get_md5(prompt) + items = [ + self.cache_schema( + id=str(uuid.uuid1()), + prompt=prompt, + prompt_md5=prompt_md5, + llm=llm_string, + response=dumps(gen), + idx=i, + ) + for i, gen in enumerate(return_val) + ] + for item in items: + session.merge(item) + + def _delete_previous(self, session: Session, prompt: str, llm_string: str) -> None: + stmt = ( + delete(self.cache_schema) + .where(self.cache_schema.prompt_md5 == self.get_md5(prompt)) + .where(self.cache_schema.llm == llm_string) + .where(self.cache_schema.prompt == prompt) + ) + session.execute(stmt) + + def _search_rows(self, prompt: str, llm_string: str) -> Sequence[Row]: + prompt_pd5 = self.get_md5(prompt) + stmt = ( + select(self.cache_schema.response) + .where(self.cache_schema.prompt_md5 == prompt_pd5) + .where(self.cache_schema.llm == llm_string) + .where(self.cache_schema.prompt == prompt) + .order_by(self.cache_schema.idx) + ) + with Session(self.engine) as session: + return session.execute(stmt).fetchall() + + def clear(self, **kwargs: Any) -> None: + """Clear cache.""" + with Session(self.engine) as session: + session.execute(self.cache_schema.delete()) + + @staticmethod + def get_md5(input_string: str) -> str: + return hashlib.md5(input_string.encode()).hexdigest() + + +ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME = "langchain_astradb_cache" + + +@deprecated( + since="0.0.28", + removal="1.0", + alternative_import="langchain_astradb.AstraDBCache", +) +class AstraDBCache(BaseCache): + @staticmethod + def _make_id(prompt: str, llm_string: str) -> str: + return f"{_hash(prompt)}#{_hash(llm_string)}" + + def __init__( + self, + *, + collection_name: str = ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME, + token: Optional[str] = None, + api_endpoint: Optional[str] = None, + astra_db_client: Optional[AstraDB] = None, + async_astra_db_client: Optional[AsyncAstraDB] = None, + namespace: Optional[str] = None, + pre_delete_collection: bool = False, + setup_mode: AstraSetupMode = AstraSetupMode.SYNC, + ): + """ + Cache that uses Astra DB as a backend. + + It uses a single collection as a kv store + The lookup keys, combined in the _id of the documents, are: + - prompt, a string + - llm_string, a deterministic str representation of the model parameters. + (needed to prevent same-prompt-different-model collisions) + + Args: + collection_name: name of the Astra DB collection to create/use. + token: API token for Astra DB usage. + api_endpoint: full URL to the API endpoint, + such as `https://-us-east1.apps.astra.datastax.com`. + astra_db_client: *alternative to token+api_endpoint*, + you can pass an already-created 'astrapy.db.AstraDB' instance. + async_astra_db_client: *alternative to token+api_endpoint*, + you can pass an already-created 'astrapy.db.AsyncAstraDB' instance. + namespace: namespace (aka keyspace) where the + collection is created. Defaults to the database's "default namespace". + setup_mode: mode used to create the Astra DB collection (SYNC, ASYNC or + OFF). + pre_delete_collection: whether to delete the collection + before creating it. If False and the collection already exists, + the collection will be used as is. + """ + self.astra_env = _AstraDBCollectionEnvironment( + collection_name=collection_name, + token=token, + api_endpoint=api_endpoint, + astra_db_client=astra_db_client, + async_astra_db_client=async_astra_db_client, + namespace=namespace, + setup_mode=setup_mode, + pre_delete_collection=pre_delete_collection, + ) + self.collection = self.astra_env.collection + self.async_collection = self.astra_env.async_collection + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + self.astra_env.ensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + item = self.collection.find_one( + filter={ + "_id": doc_id, + }, + projection={ + "body_blob": 1, + }, + )["data"]["document"] + return _loads_generations(item["body_blob"]) if item is not None else None + + async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + await self.astra_env.aensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + item = ( + await self.async_collection.find_one( + filter={ + "_id": doc_id, + }, + projection={ + "body_blob": 1, + }, + ) + )["data"]["document"] + return _loads_generations(item["body_blob"]) if item is not None else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + self.astra_env.ensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + blob = _dumps_generations(return_val) + self.collection.upsert( + { + "_id": doc_id, + "body_blob": blob, + }, + ) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + await self.astra_env.aensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + blob = _dumps_generations(return_val) + await self.async_collection.upsert( + { + "_id": doc_id, + "body_blob": blob, + }, + ) + + def delete_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> None: + """ + A wrapper around `delete` with the LLM being passed. + In case the llm.invoke(prompt) calls have a `stop` param, you should + pass it here + """ + llm_string = get_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + )[1] + return self.delete(prompt, llm_string=llm_string) + + async def adelete_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> None: + """ + A wrapper around `adelete` with the LLM being passed. + In case the llm.invoke(prompt) calls have a `stop` param, you should + pass it here + """ + llm_string = ( + await aget_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + ) + )[1] + return await self.adelete(prompt, llm_string=llm_string) + + def delete(self, prompt: str, llm_string: str) -> None: + """Evict from cache if there's an entry.""" + self.astra_env.ensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + self.collection.delete_one(doc_id) + + async def adelete(self, prompt: str, llm_string: str) -> None: + """Evict from cache if there's an entry.""" + await self.astra_env.aensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + await self.async_collection.delete_one(doc_id) + + def clear(self, **kwargs: Any) -> None: + self.astra_env.ensure_db_setup() + self.collection.clear() + + async def aclear(self, **kwargs: Any) -> None: + await self.astra_env.aensure_db_setup() + await self.async_collection.clear() + + +ASTRA_DB_SEMANTIC_CACHE_DEFAULT_THRESHOLD = 0.85 +ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME = "langchain_astradb_semantic_cache" +ASTRA_DB_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE = 16 + + +_unset = ["unset"] + + +class _CachedAwaitable: + """Caches the result of an awaitable so it can be awaited multiple times""" + + def __init__(self, awaitable: Awaitable[Any]): + self.awaitable = awaitable + self.result = _unset + + def __await__(self) -> Generator: + if self.result is _unset: + self.result = yield from self.awaitable.__await__() + return self.result # type: ignore[return-value] + + +def _reawaitable(func: Callable) -> Callable: + """Makes an async function result awaitable multiple times""" + + @wraps(func) + def wrapper(*args: Any, **kwargs: Any) -> _CachedAwaitable: + return _CachedAwaitable(func(*args, **kwargs)) + + return wrapper + + +def _async_lru_cache(maxsize: int = 128, typed: bool = False) -> Callable: + """Least-recently-used async cache decorator. + Equivalent to functools.lru_cache for async functions""" + + def decorating_function(user_function: Callable) -> Callable: + return lru_cache(maxsize, typed)(_reawaitable(user_function)) + + return decorating_function + + +@deprecated( + since="0.0.28", + removal="1.0", + alternative_import="langchain_astradb.AstraDBSemanticCache", +) +class AstraDBSemanticCache(BaseCache): + def __init__( + self, + *, + collection_name: str = ASTRA_DB_CACHE_DEFAULT_COLLECTION_NAME, + token: Optional[str] = None, + api_endpoint: Optional[str] = None, + astra_db_client: Optional[AstraDB] = None, + async_astra_db_client: Optional[AsyncAstraDB] = None, + namespace: Optional[str] = None, + setup_mode: AstraSetupMode = AstraSetupMode.SYNC, + pre_delete_collection: bool = False, + embedding: Embeddings, + metric: Optional[str] = None, + similarity_threshold: float = ASTRA_DB_SEMANTIC_CACHE_DEFAULT_THRESHOLD, + ): + """ + Cache that uses Astra DB as a vector-store backend for semantic + (i.e. similarity-based) lookup. + + It uses a single (vector) collection and can store + cached values from several LLMs, so the LLM's 'llm_string' is stored + in the document metadata. + + You can choose the preferred similarity (or use the API default). + The default score threshold is tuned to the default metric. + Tune it carefully yourself if switching to another distance metric. + + Args: + collection_name: name of the Astra DB collection to create/use. + token: API token for Astra DB usage. + api_endpoint: full URL to the API endpoint, + such as `https://-us-east1.apps.astra.datastax.com`. + astra_db_client: *alternative to token+api_endpoint*, + you can pass an already-created 'astrapy.db.AstraDB' instance. + async_astra_db_client: *alternative to token+api_endpoint*, + you can pass an already-created 'astrapy.db.AsyncAstraDB' instance. + namespace: namespace (aka keyspace) where the + collection is created. Defaults to the database's "default namespace". + setup_mode: mode used to create the Astra DB collection (SYNC, ASYNC or + OFF). + pre_delete_collection: whether to delete the collection + before creating it. If False and the collection already exists, + the collection will be used as is. + embedding: Embedding provider for semantic encoding and search. + metric: the function to use for evaluating similarity of text embeddings. + Defaults to 'cosine' (alternatives: 'euclidean', 'dot_product') + similarity_threshold: the minimum similarity for accepting a + (semantic-search) match. + """ + self.embedding = embedding + self.metric = metric + self.similarity_threshold = similarity_threshold + self.collection_name = collection_name + + # The contract for this class has separate lookup and update: + # in order to spare some embedding calculations we cache them between + # the two calls. + # Note: each instance of this class has its own `_get_embedding` with + # its own lru. + @lru_cache(maxsize=ASTRA_DB_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE) + def _cache_embedding(text: str) -> List[float]: + return self.embedding.embed_query(text=text) + + self._get_embedding = _cache_embedding + + @_async_lru_cache(maxsize=ASTRA_DB_SEMANTIC_CACHE_EMBEDDING_CACHE_SIZE) + async def _acache_embedding(text: str) -> List[float]: + return await self.embedding.aembed_query(text=text) + + self._aget_embedding = _acache_embedding + + embedding_dimension: Union[int, Awaitable[int], None] = None + if setup_mode == AstraSetupMode.ASYNC: + embedding_dimension = self._aget_embedding_dimension() + elif setup_mode == AstraSetupMode.SYNC: + embedding_dimension = self._get_embedding_dimension() + + self.astra_env = _AstraDBCollectionEnvironment( + collection_name=collection_name, + token=token, + api_endpoint=api_endpoint, + astra_db_client=astra_db_client, + async_astra_db_client=async_astra_db_client, + namespace=namespace, + setup_mode=setup_mode, + pre_delete_collection=pre_delete_collection, + embedding_dimension=embedding_dimension, + metric=metric, + ) + self.collection = self.astra_env.collection + self.async_collection = self.astra_env.async_collection + + def _get_embedding_dimension(self) -> int: + return len(self._get_embedding(text="This is a sample sentence.")) + + async def _aget_embedding_dimension(self) -> int: + return len(await self._aget_embedding(text="This is a sample sentence.")) + + @staticmethod + def _make_id(prompt: str, llm_string: str) -> str: + return f"{_hash(prompt)}#{_hash(llm_string)}" + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + self.astra_env.ensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + llm_string_hash = _hash(llm_string) + embedding_vector = self._get_embedding(text=prompt) + body = _dumps_generations(return_val) + # + self.collection.upsert( + { + "_id": doc_id, + "body_blob": body, + "llm_string_hash": llm_string_hash, + "$vector": embedding_vector, + } + ) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + await self.astra_env.aensure_db_setup() + doc_id = self._make_id(prompt, llm_string) + llm_string_hash = _hash(llm_string) + embedding_vector = await self._aget_embedding(text=prompt) + body = _dumps_generations(return_val) + # + await self.async_collection.upsert( + { + "_id": doc_id, + "body_blob": body, + "llm_string_hash": llm_string_hash, + "$vector": embedding_vector, + } + ) + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + hit_with_id = self.lookup_with_id(prompt, llm_string) + if hit_with_id is not None: + return hit_with_id[1] + else: + return None + + async def alookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + hit_with_id = await self.alookup_with_id(prompt, llm_string) + if hit_with_id is not None: + return hit_with_id[1] + else: + return None + + def lookup_with_id( + self, prompt: str, llm_string: str + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + """ + Look up based on prompt and llm_string. + If there are hits, return (document_id, cached_entry) for the top hit + """ + self.astra_env.ensure_db_setup() + prompt_embedding: List[float] = self._get_embedding(text=prompt) + llm_string_hash = _hash(llm_string) + + hit = self.collection.vector_find_one( + vector=prompt_embedding, + filter={ + "llm_string_hash": llm_string_hash, + }, + fields=["body_blob", "_id"], + include_similarity=True, + ) + + if hit is None or hit["$similarity"] < self.similarity_threshold: + return None + else: + generations = _loads_generations(hit["body_blob"]) + if generations is not None: + # this protects against malformed cached items: + return hit["_id"], generations + else: + return None + + async def alookup_with_id( + self, prompt: str, llm_string: str + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + """ + Look up based on prompt and llm_string. + If there are hits, return (document_id, cached_entry) for the top hit + """ + await self.astra_env.aensure_db_setup() + prompt_embedding: List[float] = await self._aget_embedding(text=prompt) + llm_string_hash = _hash(llm_string) + + hit = await self.async_collection.vector_find_one( + vector=prompt_embedding, + filter={ + "llm_string_hash": llm_string_hash, + }, + fields=["body_blob", "_id"], + include_similarity=True, + ) + + if hit is None or hit["$similarity"] < self.similarity_threshold: + return None + else: + generations = _loads_generations(hit["body_blob"]) + if generations is not None: + # this protects against malformed cached items: + return hit["_id"], generations + else: + return None + + def lookup_with_id_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + llm_string = get_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + )[1] + return self.lookup_with_id(prompt, llm_string=llm_string) + + async def alookup_with_id_through_llm( + self, prompt: str, llm: LLM, stop: Optional[List[str]] = None + ) -> Optional[Tuple[str, RETURN_VAL_TYPE]]: + llm_string = ( + await aget_prompts( + {**llm.dict(), **{"stop": stop}}, + [], + ) + )[1] + return await self.alookup_with_id(prompt, llm_string=llm_string) + + def delete_by_document_id(self, document_id: str) -> None: + """ + Given this is a "similarity search" cache, an invalidation pattern + that makes sense is first a lookup to get an ID, and then deleting + with that ID. This is for the second step. + """ + self.astra_env.ensure_db_setup() + self.collection.delete_one(document_id) + + async def adelete_by_document_id(self, document_id: str) -> None: + """ + Given this is a "similarity search" cache, an invalidation pattern + that makes sense is first a lookup to get an ID, and then deleting + with that ID. This is for the second step. + """ + await self.astra_env.aensure_db_setup() + await self.async_collection.delete_one(document_id) + + def clear(self, **kwargs: Any) -> None: + self.astra_env.ensure_db_setup() + self.collection.clear() + + async def aclear(self, **kwargs: Any) -> None: + await self.astra_env.aensure_db_setup() + await self.async_collection.clear() + + +class AzureCosmosDBSemanticCache(BaseCache): + """Cache that uses Cosmos DB Mongo vCore vector-store backend""" + + DEFAULT_DATABASE_NAME = "CosmosMongoVCoreCacheDB" + DEFAULT_COLLECTION_NAME = "CosmosMongoVCoreCacheColl" + + def __init__( + self, + cosmosdb_connection_string: str, + database_name: str, + collection_name: str, + embedding: Embeddings, + *, + cosmosdb_client: Optional[Any] = None, + num_lists: int = 100, + similarity: CosmosDBSimilarityType = CosmosDBSimilarityType.COS, + kind: CosmosDBVectorSearchType = CosmosDBVectorSearchType.VECTOR_IVF, + dimensions: int = 1536, + m: int = 16, + ef_construction: int = 64, + ef_search: int = 40, + score_threshold: Optional[float] = None, + application_name: str = "LangChain-CDBMongoVCore-SemanticCache-Python", + ): + """ + Args: + cosmosdb_connection_string: Cosmos DB Mongo vCore connection string + cosmosdb_client: Cosmos DB Mongo vCore client + embedding (Embedding): Embedding provider for semantic encoding and search. + database_name: Database name for the CosmosDBMongoVCoreSemanticCache + collection_name: Collection name for the CosmosDBMongoVCoreSemanticCache + num_lists: This integer is the number of clusters that the + inverted file (IVF) index uses to group the vector data. + We recommend that numLists is set to documentCount/1000 + for up to 1 million documents and to sqrt(documentCount) + for more than 1 million documents. + Using a numLists value of 1 is akin to performing + brute-force search, which has limited performance + dimensions: Number of dimensions for vector similarity. + The maximum number of supported dimensions is 2000 + similarity: Similarity metric to use with the IVF index. + + Possible options are: + - CosmosDBSimilarityType.COS (cosine distance), + - CosmosDBSimilarityType.L2 (Euclidean distance), and + - CosmosDBSimilarityType.IP (inner product). + kind: Type of vector index to create. + Possible options are: + - vector-ivf + - vector-hnsw: available as a preview feature only, + to enable visit https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/preview-features + m: The max number of connections per layer (16 by default, minimum + value is 2, maximum value is 100). Higher m is suitable for datasets + with high dimensionality and/or high accuracy requirements. + ef_construction: the size of the dynamic candidate list for constructing + the graph (64 by default, minimum value is 4, maximum + value is 1000). Higher ef_construction will result in + better index quality and higher accuracy, but it will + also increase the time required to build the index. + ef_construction has to be at least 2 * m + ef_search: The size of the dynamic candidate list for search + (40 by default). A higher value provides better + recall at the cost of speed. + score_threshold: Maximum score used to filter the vector search documents. + application_name: Application name for the client for tracking and logging + """ + + self._validate_enum_value(similarity, CosmosDBSimilarityType) + self._validate_enum_value(kind, CosmosDBVectorSearchType) + + if not cosmosdb_connection_string: + raise ValueError(" CosmosDB connection string can be empty.") + + self.cosmosdb_connection_string = cosmosdb_connection_string + self.cosmosdb_client = cosmosdb_client + self.embedding = embedding + self.database_name = database_name or self.DEFAULT_DATABASE_NAME + self.collection_name = collection_name or self.DEFAULT_COLLECTION_NAME + self.num_lists = num_lists + self.dimensions = dimensions + self.similarity = similarity + self.kind = kind + self.m = m + self.ef_construction = ef_construction + self.ef_search = ef_search + self.score_threshold = score_threshold + self._cache_dict: Dict[str, AzureCosmosDBVectorSearch] = {} + self.application_name = application_name + + def _index_name(self, llm_string: str) -> str: + hashed_index = _hash(llm_string) + return f"cache:{hashed_index}" + + def _get_llm_cache(self, llm_string: str) -> AzureCosmosDBVectorSearch: + index_name = self._index_name(llm_string) + + namespace = self.database_name + "." + self.collection_name + + # return vectorstore client for the specific llm string + if index_name in self._cache_dict: + return self._cache_dict[index_name] + + # create new vectorstore client for the specific llm string + if self.cosmosdb_client: + collection = self.cosmosdb_client[self.database_name][self.collection_name] + self._cache_dict[index_name] = AzureCosmosDBVectorSearch( + collection=collection, + embedding=self.embedding, + index_name=index_name, + ) + else: + self._cache_dict[index_name] = ( + AzureCosmosDBVectorSearch.from_connection_string( + connection_string=self.cosmosdb_connection_string, + namespace=namespace, + embedding=self.embedding, + index_name=index_name, + application_name=self.application_name, + ) + ) + + # create index for the vectorstore + vectorstore = self._cache_dict[index_name] + if not vectorstore.index_exists(): + vectorstore.create_index( + self.num_lists, + self.dimensions, + self.similarity, + self.kind, + self.m, + self.ef_construction, + ) + + return vectorstore + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + llm_cache = self._get_llm_cache(llm_string) + generations: List = [] + # Read from a Hash + results = llm_cache.similarity_search( + query=prompt, + k=1, + kind=self.kind, + ef_search=self.ef_search, + score_threshold=self.score_threshold, # type: ignore[arg-type] + ) + if results: + for document in results: + try: + generations.extend(loads(document.metadata["return_val"])) + except Exception: + logger.warning( + "Retrieving a cache value that could not be deserialized " + "properly. This is likely due to the cache being in an " + "older format. Please recreate your cache to avoid this " + "error." + ) + # In a previous life we stored the raw text directly + # in the table, so assume it's in that format. + generations.extend( + _load_generations_from_json(document.metadata["return_val"]) + ) + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "CosmosDBMongoVCoreSemanticCache only supports caching of " + f"normal LLM generations, got {type(gen)}" + ) + + llm_cache = self._get_llm_cache(llm_string) + metadata = { + "llm_string": llm_string, + "prompt": prompt, + "return_val": dumps([g for g in return_val]), + } + llm_cache.add_texts(texts=[prompt], metadatas=[metadata]) + + def clear(self, **kwargs: Any) -> None: + """Clear semantic cache for a given llm_string.""" + index_name = self._index_name(kwargs["llm_string"]) + if index_name in self._cache_dict: + self._cache_dict[index_name].get_collection().delete_many({}) + + @staticmethod + def _validate_enum_value(value: Any, enum_type: Type[Enum]) -> None: + if not isinstance(value, enum_type): + raise ValueError(f"Invalid enum value: {value}. Expected {enum_type}.") + + +class AzureCosmosDBNoSqlSemanticCache(BaseCache): + """Cache that uses Cosmos DB NoSQL backend""" + + def __init__( + self, + embedding: Embeddings, + cosmos_client: CosmosClient, + database_name: str = "CosmosNoSqlCacheDB", + container_name: str = "CosmosNoSqlCacheContainer", + *, + vector_embedding_policy: Dict[str, Any], + indexing_policy: Dict[str, Any], + cosmos_container_properties: Dict[str, Any], + cosmos_database_properties: Dict[str, Any], + create_container: bool = True, + ): + self.cosmos_client = cosmos_client + self.database_name = database_name + self.container_name = container_name + self.embedding = embedding + self.vector_embedding_policy = vector_embedding_policy + self.indexing_policy = indexing_policy + self.cosmos_container_properties = cosmos_container_properties + self.cosmos_database_properties = cosmos_database_properties + self.create_container = create_container + self._cache_dict: Dict[str, AzureCosmosDBNoSqlVectorSearch] = {} + + def _cache_name(self, llm_string: str) -> str: + hashed_index = _hash(llm_string) + return f"cache:{hashed_index}" + + def _get_llm_cache(self, llm_string: str) -> AzureCosmosDBNoSqlVectorSearch: + cache_name = self._cache_name(llm_string) + + # return vectorstore client for the specific llm string + if cache_name in self._cache_dict: + return self._cache_dict[cache_name] + + # create new vectorstore client to create the cache + if self.cosmos_client: + self._cache_dict[cache_name] = AzureCosmosDBNoSqlVectorSearch( + cosmos_client=self.cosmos_client, + embedding=self.embedding, + vector_embedding_policy=self.vector_embedding_policy, + indexing_policy=self.indexing_policy, + cosmos_container_properties=self.cosmos_container_properties, + cosmos_database_properties=self.cosmos_database_properties, + database_name=self.database_name, + container_name=self.container_name, + create_container=self.create_container, + ) + + return self._cache_dict[cache_name] + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt.""" + llm_cache = self._get_llm_cache(llm_string) + generations: List = [] + # Read from a Hash + results = llm_cache.similarity_search( + query=prompt, + k=1, + ) + if results: + for document in results: + try: + generations.extend(loads(document.metadata["return_val"])) + except Exception: + logger.warning( + "Retrieving a cache value that could not be deserialized " + "properly. This is likely due to the cache being in an " + "older format. Please recreate your cache to avoid this " + "error." + ) + + generations.extend( + _load_generations_from_json(document.metadata["return_val"]) + ) + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "CosmosDBNoSqlSemanticCache only supports caching of " + f"normal LLM generations, got {type(gen)}" + ) + llm_cache = self._get_llm_cache(llm_string) + metadata = { + "llm_string": llm_string, + "prompt": prompt, + "return_val": dumps([g for g in return_val]), + } + llm_cache.add_texts(texts=[prompt], metadatas=[metadata]) + + def clear(self, **kwargs: Any) -> None: + """Clear semantic cache for a given llm_string.""" + cache_name = self._cache_name(llm_string=kwargs["llm-string"]) + if cache_name in self._cache_dict: + container = self._cache_dict["cache_name"].get_container() + for item in container.read_all_items(): + container.delete_item(item) + + +class OpenSearchSemanticCache(BaseCache): + """Cache that uses OpenSearch vector store backend""" + + def __init__( + self, + opensearch_url: str, + embedding: Embeddings, + score_threshold: float = 0.2, + **kwargs: Any, + ): + """ + Args: + opensearch_url (str): URL to connect to OpenSearch. + embedding (Embedding): Embedding provider for semantic encoding and search. + score_threshold (float, 0.2): + Example: + .. code-block:: python + import langchain + from langchain_classic.cache import OpenSearchSemanticCache + from langchain_classic.embeddings import OpenAIEmbeddings + langchain.llm_cache = OpenSearchSemanticCache( + opensearch_url="http//localhost:9200", + embedding=OpenAIEmbeddings() + ) + """ + self._cache_dict: Dict[str, OpenSearchVectorStore] = {} + self.opensearch_url = opensearch_url + self.embedding = embedding + self.score_threshold = score_threshold + self.connection_kwargs = kwargs + + def _index_name(self, llm_string: str) -> str: + hashed_index = _hash(llm_string) + return f"cache_{hashed_index}" + + def _get_llm_cache(self, llm_string: str) -> OpenSearchVectorStore: + index_name = self._index_name(llm_string) + + # return vectorstore client for the specific llm string + if index_name in self._cache_dict: + return self._cache_dict[index_name] + + # create new vectorstore client for the specific llm string + self._cache_dict[index_name] = OpenSearchVectorStore( + opensearch_url=self.opensearch_url, + index_name=index_name, + embedding_function=self.embedding, + **self.connection_kwargs, + ) + + # create index for the vectorstore + vectorstore = self._cache_dict[index_name] + if not vectorstore.index_exists(): + _embedding = self.embedding.embed_query(text="test") + vectorstore.create_index(len(_embedding), index_name) + return vectorstore + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + llm_cache = self._get_llm_cache(llm_string) + generations: List = [] + # Read from a Hash + results = llm_cache.similarity_search( + query=prompt, + k=1, + score_threshold=self.score_threshold, + ) + if results: + for document in results: + try: + generations.extend(loads(document.metadata["return_val"])) + except Exception: + logger.warning( + "Retrieving a cache value that could not be deserialized " + "properly. This is likely due to the cache being in an " + "older format. Please recreate your cache to avoid this " + "error." + ) + + generations.extend( + _load_generations_from_json(document.metadata["return_val"]) + ) + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "OpenSearchSemanticCache only supports caching of " + f"normal LLM generations, got {type(gen)}" + ) + llm_cache = self._get_llm_cache(llm_string) + metadata = { + "llm_string": llm_string, + "prompt": prompt, + "return_val": dumps([g for g in return_val]), + } + llm_cache.add_texts(texts=[prompt], metadatas=[metadata]) + + def clear(self, **kwargs: Any) -> None: + """Clear semantic cache for a given llm_string.""" + index_name = self._index_name(kwargs["llm_string"]) + if index_name in self._cache_dict: + self._cache_dict[index_name].delete_index(index_name=index_name) + del self._cache_dict[index_name] + + +@deprecated( + since="0.3.22", + message=( + "This class is pending deprecation and may be removed in a future version. " + "You can swap to using the `SingleStoreSemanticCache` " + "implementation in `langchain_singlestore`. " + "See for details " + " about the new implementation." + ), + alternative="from langchain_singlestore import SingleStoreSemanticCache", + pending=True, +) +class SingleStoreDBSemanticCache(BaseCache): + """Cache that uses SingleStore DB as a backend""" + + def __init__( + self, + embedding: Embeddings, + *, + cache_table_prefix: str = "cache_", + search_threshold: float = 0.2, + **kwargs: Any, + ): + """Initialize with necessary components. + + Args: + embedding (Embeddings): A text embedding model. + cache_table_prefix (str, optional): Prefix for the cache table name. + Defaults to "cache_". + search_threshold (float, optional): The minimum similarity score for + a search result to be considered a match. Defaults to 0.2. + + Following arguments pertrain to the SingleStoreDB vector store: + + distance_strategy (DistanceStrategy, optional): + Determines the strategy employed for calculating + the distance between vectors in the embedding space. + Defaults to DOT_PRODUCT. + Available options are: + - DOT_PRODUCT: Computes the scalar product of two vectors. + This is the default behavior + - EUCLIDEAN_DISTANCE: Computes the Euclidean distance between + two vectors. This metric considers the geometric distance in + the vector space, and might be more suitable for embeddings + that rely on spatial relationships. This metric is not + compatible with the WEIGHTED_SUM search strategy. + + content_field (str, optional): Specifies the field to store the content. + Defaults to "content". + metadata_field (str, optional): Specifies the field to store metadata. + Defaults to "metadata". + vector_field (str, optional): Specifies the field to store the vector. + Defaults to "vector". + id_field (str, optional): Specifies the field to store the id. + Defaults to "id". + + use_vector_index (bool, optional): Toggles the use of a vector index. + Works only with SingleStoreDB 8.5 or later. Defaults to False. + If set to True, vector_size parameter is required to be set to + a proper value. + + vector_index_name (str, optional): Specifies the name of the vector index. + Defaults to empty. Will be ignored if use_vector_index is set to False. + + vector_index_options (dict, optional): Specifies the options for + the vector index. Defaults to {}. + Will be ignored if use_vector_index is set to False. The options are: + index_type (str, optional): Specifies the type of the index. + Defaults to IVF_PQFS. + For more options, please refer to the SingleStoreDB documentation: + https://docs.singlestore.com/cloud/reference/sql-reference/vector-functions/vector-indexing/ + + vector_size (int, optional): Specifies the size of the vector. + Defaults to 1536. Required if use_vector_index is set to True. + Should be set to the same value as the size of the vectors + stored in the vector_field. + + Following arguments pertain to the connection pool: + + pool_size (int, optional): Determines the number of active connections in + the pool. Defaults to 5. + max_overflow (int, optional): Determines the maximum number of connections + allowed beyond the pool_size. Defaults to 10. + timeout (float, optional): Specifies the maximum wait time in seconds for + establishing a connection. Defaults to 30. + + Following arguments pertain to the database connection: + + host (str, optional): Specifies the hostname, IP address, or URL for the + database connection. The default scheme is "mysql". + user (str, optional): Database username. + password (str, optional): Database password. + port (int, optional): Database port. Defaults to 3306 for non-HTTP + connections, 80 for HTTP connections, and 443 for HTTPS connections. + database (str, optional): Database name. + + Additional optional arguments provide further customization over the + database connection: + + pure_python (bool, optional): Toggles the connector mode. If True, + operates in pure Python mode. + local_infile (bool, optional): Allows local file uploads. + charset (str, optional): Specifies the character set for string values. + ssl_key (str, optional): Specifies the path of the file containing the SSL + key. + ssl_cert (str, optional): Specifies the path of the file containing the SSL + certificate. + ssl_ca (str, optional): Specifies the path of the file containing the SSL + certificate authority. + ssl_cipher (str, optional): Sets the SSL cipher list. + ssl_disabled (bool, optional): Disables SSL usage. + ssl_verify_cert (bool, optional): Verifies the server's certificate. + Automatically enabled if ``ssl_ca`` is specified. + ssl_verify_identity (bool, optional): Verifies the server's identity. + conv (dict[int, Callable], optional): A dictionary of data conversion + functions. + credential_type (str, optional): Specifies the type of authentication to + use: auth.PASSWORD, auth.JWT, or auth.BROWSER_SSO. + autocommit (bool, optional): Enables autocommits. + results_type (str, optional): Determines the structure of the query results: + tuples, namedtuples, dicts. + results_format (str, optional): Deprecated. This option has been renamed to + results_type. + + Examples: + Basic Usage: + + .. code-block:: python + + import langchain + from langchain_classic.cache import SingleStoreDBSemanticCache + from langchain_classic.embeddings import OpenAIEmbeddings + + langchain.llm_cache = SingleStoreDBSemanticCache( + embedding=OpenAIEmbeddings(), + host="https://user:password@127.0.0.1:3306/database" + ) + + Advanced Usage: + + .. code-block:: python + + import langchain + from langchain_classic.cache import SingleStoreDBSemanticCache + from langchain_classic.embeddings import OpenAIEmbeddings + + langchain.llm_cache = = SingleStoreDBSemanticCache( + embeddings=OpenAIEmbeddings(), + use_vector_index=True, + host="127.0.0.1", + port=3306, + user="user", + password="password", + database="db", + table_name="my_custom_table", + pool_size=10, + timeout=60, + ) + """ + + self._cache_dict: Dict[str, SingleStoreDB] = {} + self.embedding = embedding + self.cache_table_prefix = cache_table_prefix + self.search_threshold = search_threshold + + # Pass the rest of the kwargs to the connection. + self.connection_kwargs = kwargs + + def _index_name(self, llm_string: str) -> str: + hashed_index = _hash(llm_string) + return f"{self.cache_table_prefix}{hashed_index}" + + def _get_llm_cache(self, llm_string: str) -> SingleStoreDB: + index_name = self._index_name(llm_string) + + # return vectorstore client for the specific llm string + if index_name not in self._cache_dict: + self._cache_dict[index_name] = SingleStoreDB( + embedding=self.embedding, + table_name=index_name, + **self.connection_kwargs, + ) + return self._cache_dict[index_name] + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + llm_cache = self._get_llm_cache(llm_string) + generations: List = [] + # Read from a Hash + results = llm_cache.similarity_search_with_score( + query=prompt, + k=1, + ) + if results: + for document_score in results: + if ( + document_score[1] > self.search_threshold + and llm_cache.distance_strategy == DistanceStrategy.DOT_PRODUCT + ) or ( + document_score[1] < self.search_threshold + and llm_cache.distance_strategy + == DistanceStrategy.EUCLIDEAN_DISTANCE + ): + generations.extend(loads(document_score[0].metadata["return_val"])) + return generations if generations else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "SingleStoreDBSemanticCache only supports caching of " + f"normal LLM generations, got {type(gen)}" + ) + llm_cache = self._get_llm_cache(llm_string) + metadata = { + "llm_string": llm_string, + "prompt": prompt, + "return_val": dumps([g for g in return_val]), + } + llm_cache.add_texts(texts=[prompt], metadatas=[metadata]) + + def clear(self, **kwargs: Any) -> None: + """Clear semantic cache for a given llm_string.""" + index_name = self._index_name(kwargs["llm_string"]) + if index_name in self._cache_dict: + self._cache_dict[index_name].drop() + del self._cache_dict[index_name] + + +class MemcachedCache(BaseCache): + """Cache that uses Memcached backend through pymemcache client lib""" + + def __init__(self, client_: Any): + """ + Initialize an instance of MemcachedCache. + + Args: + client_ (str): An instance of any of pymemcache's Clients + (Client, PooledClient, HashClient) + Example: + .. code-block:: python + ifrom langchain_classic.globals import set_llm_cache + from langchain_openai import OpenAI + + from langchain_community.cache import MemcachedCache + from pymemcache.client.base import Client + + llm = OpenAI(model="gpt-3.5-turbo-instruct", n=2, best_of=2) + set_llm_cache(MemcachedCache(Client('localhost'))) + + # The first time, it is not yet in cache, so it should take longer + llm.invoke("Which city is the most crowded city in the USA?") + + # The second time it is, so it goes faster + llm.invoke("Which city is the most crowded city in the USA?") + """ + + try: + from pymemcache.client import ( + Client, + HashClient, + PooledClient, + RetryingClient, + ) + except (ImportError, ModuleNotFoundError): + raise ImportError( + "Could not import pymemcache python package. " + "Please install it with `pip install -U pymemcache`." + ) + + if not ( + isinstance(client_, Client) + or isinstance(client_, PooledClient) + or isinstance(client_, HashClient) + or isinstance(client_, RetryingClient) + ): + raise ValueError("Please pass a valid pymemcached client") + + self.client = client_ + + def lookup(self, prompt: str, llm_string: str) -> Optional[RETURN_VAL_TYPE]: + """Look up based on prompt and llm_string.""" + key = _hash(prompt + llm_string) + try: + result = self.client.get(key) + except pymemcache.MemcacheError: + return None + + return _loads_generations(result) if result is not None else None + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on prompt and llm_string.""" + key = _hash(prompt + llm_string) + + # Validate input is made of standard LLM generations + for gen in return_val: + if not isinstance(gen, Generation): + raise ValueError( + "Memcached only supports caching of normal LLM generations, " + + f"got {type(gen)}" + ) + + # Deserialize return_val into string and update cache + value = _dumps_generations(return_val) + self.client.set(key, value) + + def clear(self, **kwargs: Any) -> None: + """ + Clear the entire cache. Takes optional kwargs: + + delay: optional int, the number of seconds to wait before flushing, + or zero to flush immediately (the default). NON-BLOCKING, returns + immediately. + noreply: optional bool, True to not wait for the reply (defaults to + client.default_noreply). + """ + delay = kwargs.get("delay", 0) + noreply = kwargs.get("noreply", None) + + self.client.flush_all(delay, noreply) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_community/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..ec2ce72908f2754f7e5c387e4db5311bcb6c154a --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/METADATA @@ -0,0 +1,83 @@ +Metadata-Version: 2.4 +Name: langchain-core +Version: 1.4.0 +Summary: Building applications with LLMs through composability +Project-URL: Homepage, https://docs.langchain.com/ +Project-URL: Documentation, https://reference.langchain.com/python/langchain_core/ +Project-URL: Repository, https://github.com/langchain-ai/langchain +Project-URL: Issues, https://github.com/langchain-ai/langchain/issues +Project-URL: Changelog, https://github.com/langchain-ai/langchain/releases?q=%22langchain-core%3D%3D1%22 +Project-URL: Twitter, https://x.com/langchain_oss +Project-URL: Slack, https://www.langchain.com/join-community +Project-URL: Reddit, https://www.reddit.com/r/LangChain/ +License: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +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: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: <4.0.0,>=3.10.0 +Requires-Dist: jsonpatch<2.0.0,>=1.33.0 +Requires-Dist: langchain-protocol>=0.0.14 +Requires-Dist: langsmith<1.0.0,>=0.3.45 +Requires-Dist: packaging>=23.2.0 +Requires-Dist: pydantic<3.0.0,>=2.7.4 +Requires-Dist: pyyaml<7.0.0,>=5.3.0 +Requires-Dist: tenacity!=8.4.0,<10.0.0,>=8.1.0 +Requires-Dist: typing-extensions<5.0.0,>=4.7.0 +Requires-Dist: uuid-utils<1.0,>=0.12.0 +Description-Content-Type: text/markdown + +# 🦜🍎️ LangChain Core + +[![PyPI - Version](https://img.shields.io/pypi/v/langchain-core?label=%20)](https://pypi.org/project/langchain-core/#history) +[![PyPI - License](https://img.shields.io/pypi/l/langchain-core)](https://opensource.org/licenses/MIT) +[![PyPI - Downloads](https://img.shields.io/pepy/dt/langchain-core)](https://pypistats.org/packages/langchain-core) +[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss) + +Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs). + +To help you ship LangChain apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith). +[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications. + +## Quick Install + +```bash +pip install langchain-core +``` + +## 🤔 What is this? + +LangChain Core contains the base abstractions that power the LangChain ecosystem. + +These abstractions are designed to be as modular and simple as possible. + +The benefit of having these abstractions is that any provider can implement the required interface and then easily be used in the rest of the LangChain ecosystem. + +## ⛰️ Why build on top of LangChain Core? + +The LangChain ecosystem is built on top of `langchain-core`. Some of the benefits: + +- **Modularity**: We've designed Core around abstractions that are independent of each other, and not tied to any specific model provider. +- **Stability**: We are committed to a stable versioning scheme, and will communicate any breaking changes with advance notice and version bumps. +- **Battle-tested**: Core components have the largest install base in the LLM ecosystem, and are used in production by many companies. + +## 📖 Documentation + +For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/). For conceptual guides, tutorials, and examples on using LangChain, see the [LangChain Docs](https://docs.langchain.com/oss/python/langchain/overview). You can also chat with the docs using [Chat LangChain](https://chat.langchain.com). + +## 📕 Releases & Versioning + +See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies. + +## 💁 Contributing + +As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation. + +For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview). diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..f5aa7f40ff97b2f4d1d7d45715f4942272ef4d06 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/RECORD @@ -0,0 +1,367 @@ +langchain_core-1.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +langchain_core-1.4.0.dist-info/METADATA,sha256=qEIRcaDSwq6wkbEx6GSWToPRIwd55eQWX3Q-n9EcTsI,4450 +langchain_core-1.4.0.dist-info/RECORD,, +langchain_core-1.4.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +langchain_core/__init__.py,sha256=-k5Uy98k6yz8T9JHdhFYU6m8eXdEe00HKkcPZ2XSp4E,679 +langchain_core/__pycache__/__init__.cpython-311.pyc,, +langchain_core/__pycache__/_import_utils.cpython-311.pyc,, +langchain_core/__pycache__/agents.cpython-311.pyc,, +langchain_core/__pycache__/caches.cpython-311.pyc,, +langchain_core/__pycache__/chat_history.cpython-311.pyc,, +langchain_core/__pycache__/chat_loaders.cpython-311.pyc,, +langchain_core/__pycache__/chat_sessions.cpython-311.pyc,, +langchain_core/__pycache__/cross_encoders.cpython-311.pyc,, +langchain_core/__pycache__/env.cpython-311.pyc,, +langchain_core/__pycache__/exceptions.cpython-311.pyc,, +langchain_core/__pycache__/globals.cpython-311.pyc,, +langchain_core/__pycache__/prompt_values.cpython-311.pyc,, +langchain_core/__pycache__/rate_limiters.cpython-311.pyc,, +langchain_core/__pycache__/retrievers.cpython-311.pyc,, +langchain_core/__pycache__/stores.cpython-311.pyc,, +langchain_core/__pycache__/structured_query.cpython-311.pyc,, +langchain_core/__pycache__/sys_info.cpython-311.pyc,, +langchain_core/__pycache__/version.cpython-311.pyc,, +langchain_core/_api/__init__.py,sha256=XXUlhZwqzJwp-8IpBxwLQYDQco0XmEC4qm36C7q7_3o,2600 +langchain_core/_api/__pycache__/__init__.cpython-311.pyc,, +langchain_core/_api/__pycache__/beta_decorator.cpython-311.pyc,, +langchain_core/_api/__pycache__/deprecation.cpython-311.pyc,, +langchain_core/_api/__pycache__/internal.cpython-311.pyc,, +langchain_core/_api/__pycache__/path.cpython-311.pyc,, +langchain_core/_api/beta_decorator.py,sha256=krk9sonGXshY8Dx2sa3a8j4pRjc0MY5ov5I1ZK6X6pE,8570 +langchain_core/_api/deprecation.py,sha256=vcSPUqYIZMtlGz_iHdu-4lY4p_6gx0k8iuKjQk_n_4w,22034 +langchain_core/_api/internal.py,sha256=sNoimnpmdgl1MikMi_TMCPXWtVts38xSgpmsj4-_pGc,720 +langchain_core/_api/path.py,sha256=y3dAvsG4JS0BuWErpJ5KhxCykJX2i03kYdeDU-Iup3Y,1349 +langchain_core/_import_utils.py,sha256=2cRVz4o3wp7N8uUkS7gXeRLAkeBTm83tugRFhju304A,1428 +langchain_core/_security/__init__.py,sha256=9_PVJ5F0cHhENMejJXZXwiCRF_aAZK1MKYISHP3hlbo,1046 +langchain_core/_security/__pycache__/__init__.cpython-311.pyc,, +langchain_core/_security/__pycache__/_exceptions.cpython-311.pyc,, +langchain_core/_security/__pycache__/_policy.cpython-311.pyc,, +langchain_core/_security/__pycache__/_ssrf_protection.cpython-311.pyc,, +langchain_core/_security/__pycache__/_transport.cpython-311.pyc,, +langchain_core/_security/_exceptions.py,sha256=2BIF-i2jrem6A0UTRrvUnLlsen8eI9LCjzOp3fIGBy0,268 +langchain_core/_security/_policy.py,sha256=ccH2SRVV7Gyr-bsJSVbC7J0ayomnfFWySpNHj0XsKB8,10856 +langchain_core/_security/_ssrf_protection.py,sha256=IFUzHo85kUMc-DZlk-9LKfYFmFuLtOz--Hu2NiPeNIA,4611 +langchain_core/_security/_transport.py,sha256=I7rwnNLKL_xIPBgLZDpXSE8TKAvci5mHDrURRbh7Ubw,8319 +langchain_core/agents.py,sha256=_4YJbA5JzvSS6XJnVYcLl-A_kIUsasF-9bPB-7qlCjc,8426 +langchain_core/caches.py,sha256=7zireTrXQ5z0EhcLC2g-8OsQyf82F6eBlKaoFEdNlLE,10365 +langchain_core/callbacks/__init__.py,sha256=ecuaS4UR2pU2zmT9LX4R4FwZFU-bFEFZ9u6jj9dS2Mk,4221 +langchain_core/callbacks/__pycache__/__init__.cpython-311.pyc,, +langchain_core/callbacks/__pycache__/base.cpython-311.pyc,, +langchain_core/callbacks/__pycache__/file.cpython-311.pyc,, +langchain_core/callbacks/__pycache__/manager.cpython-311.pyc,, +langchain_core/callbacks/__pycache__/stdout.cpython-311.pyc,, +langchain_core/callbacks/__pycache__/streaming_stdout.cpython-311.pyc,, +langchain_core/callbacks/__pycache__/usage.cpython-311.pyc,, +langchain_core/callbacks/base.py,sha256=TVpnzj9ahvtRwF5l31yhMZK4AefTndSVV5JsGksDcVI,37102 +langchain_core/callbacks/file.py,sha256=65qzdSyfNN1qXU1MFGwzbyGr01EoptLvv_DjpS-d5Bw,8340 +langchain_core/callbacks/manager.py,sha256=xb0FRNPUIUCdyQcM5K-Cpl5Hcz-GoOI-6g12X5t5zBM,89654 +langchain_core/callbacks/stdout.py,sha256=fdr6l_cyl6DlFoottuAYcdCHg2SaDzQ3Ac1Xx1Ek1Xg,3695 +langchain_core/callbacks/streaming_stdout.py,sha256=NR3inhvOuXbFmsKRSOnq8al5r24gS-PLWf3XFpHXCUM,4334 +langchain_core/callbacks/usage.py,sha256=j8o3YFVsI0eWGOoBEYccI9RLmXSS4oRt6R0XkxQNLN4,5128 +langchain_core/chat_history.py,sha256=vNc8VBEELIKOtD4TM_RP2Sp_D9uYZTypYMzGz1vuQy8,8456 +langchain_core/chat_loaders.py,sha256=b57Gl3KGPxq9gYJjetsHfJm1I6kSqi7bDE91fJJOR84,601 +langchain_core/chat_sessions.py,sha256=aFUR8EuVN9ZfftFgkzNLnMZ19O3WdYqmRRwqK8RM8-E,565 +langchain_core/cross_encoders.py,sha256=2q1FQseNZXLneOY85Y_OIbdMlpCghDMhIZrdeZBjxEI,394 +langchain_core/document_loaders/__init__.py,sha256=DkZPp9cEVmsnz9SM1xtuefH_fGQFvA2WtpRG6iePPBs,975 +langchain_core/document_loaders/__pycache__/__init__.cpython-311.pyc,, +langchain_core/document_loaders/__pycache__/base.cpython-311.pyc,, +langchain_core/document_loaders/__pycache__/blob_loaders.cpython-311.pyc,, +langchain_core/document_loaders/__pycache__/langsmith.cpython-311.pyc,, +langchain_core/document_loaders/base.py,sha256=iDGuh82DIQaO_hzvP3ZIqVCT6ss34oplOLM-R8i-myE,4773 +langchain_core/document_loaders/blob_loaders.py,sha256=Om4DA4ZG5olfBO9HjwqFjGJgWAdze74fea3_hWEXIwE,1070 +langchain_core/document_loaders/langsmith.py,sha256=Pe4R_ZR64AWxLUJApka0bHnqx989Qh135nsAz57PQ90,5374 +langchain_core/documents/__init__.py,sha256=Sb_pG9C4z2A4cbPgezmcKnAi80UbzKyO0UB70nT8chQ,2013 +langchain_core/documents/__pycache__/__init__.cpython-311.pyc,, +langchain_core/documents/__pycache__/base.cpython-311.pyc,, +langchain_core/documents/__pycache__/compressor.cpython-311.pyc,, +langchain_core/documents/__pycache__/transformers.cpython-311.pyc,, +langchain_core/documents/base.py,sha256=fVrnpairBjnbtlXs9fUXppg3ihUBXCBoh9a2DPFQfWk,11124 +langchain_core/documents/compressor.py,sha256=2y-Vyf9woO4rSJ2W8mcdE5XDANVgfkWU0pLGJmmPvhw,2017 +langchain_core/documents/transformers.py,sha256=wtwHxIPVYXM-_XmCP9K3NpUhquUoB6y2PFg6MKYbbnI,2543 +langchain_core/embeddings/__init__.py,sha256=0SfcdkVSSXmTFXznUyeZq_b1ajpwIGDueGAAfwyMpUY,774 +langchain_core/embeddings/__pycache__/__init__.cpython-311.pyc,, +langchain_core/embeddings/__pycache__/embeddings.cpython-311.pyc,, +langchain_core/embeddings/__pycache__/fake.cpython-311.pyc,, +langchain_core/embeddings/embeddings.py,sha256=u50T2VxLLyfGBCKcVtWfSiZrtKua8sOSHwSSHRKtcno,2405 +langchain_core/embeddings/fake.py,sha256=PCpx32UPKRZzdBjVCzLFM-qTd3CsoLhIM1QTjCGash0,3886 +langchain_core/env.py,sha256=RHExSWJ2bW-6Wxb6UyBGxU5flLoNYOAeslZ9iTjomQE,598 +langchain_core/example_selectors/__init__.py,sha256=k8y0chtEhaHf8Y1_nZVDsb9CWDdRIWFb9U806mnbGvo,1394 +langchain_core/example_selectors/__pycache__/__init__.cpython-311.pyc,, +langchain_core/example_selectors/__pycache__/base.cpython-311.pyc,, +langchain_core/example_selectors/__pycache__/length_based.cpython-311.pyc,, +langchain_core/example_selectors/__pycache__/semantic_similarity.cpython-311.pyc,, +langchain_core/example_selectors/base.py,sha256=4wRCERHak6Ci5JEKHeidQ_pbBgzQyc-vnQsz2sqBFzA,1716 +langchain_core/example_selectors/length_based.py,sha256=ur8S52iKxmSb-zq_4ghnA8K1uMM2-Xyhgm8EIN74fHQ,4379 +langchain_core/example_selectors/semantic_similarity.py,sha256=Rh_-8vZi58gwn7Qa3Tk30zsvx7RiPIjFWw2_sfwKHfQ,13577 +langchain_core/exceptions.py,sha256=XR_2j_BQ7jRpxgUrbCbrHHDYo7xsx8hTZZ8vHcHob6I,3845 +langchain_core/globals.py,sha256=jO27FstGK1cyzNT096GD9lFq2YgNxY1DZ6NtA_yKdR8,1852 +langchain_core/indexing/__init__.py,sha256=KD9ArRpfVccb1fyk2t1QWqrBv1dfyk_Zg9fuSt-BzLQ,1276 +langchain_core/indexing/__pycache__/__init__.cpython-311.pyc,, +langchain_core/indexing/__pycache__/api.cpython-311.pyc,, +langchain_core/indexing/__pycache__/base.cpython-311.pyc,, +langchain_core/indexing/__pycache__/in_memory.cpython-311.pyc,, +langchain_core/indexing/api.py,sha256=PK-hyJ3Lp4Jr72Q8S2niTGbXTQoaT8Cf5BSn4_SOpQk,39072 +langchain_core/indexing/base.py,sha256=rHZNecyskIjRR8L4B5Q-XQgeoVZFI1HUjfox_ExIebM,22449 +langchain_core/indexing/in_memory.py,sha256=eML8Wtg9m4nOI7RFdoyXWxgxSfrOCEUJn-ipoRbkJOc,3283 +langchain_core/language_models/__init__.py,sha256=_0hyoXyAH3svxVhayiXeZ1m0zLntUNIjG32O9D15h_0,3646 +langchain_core/language_models/__pycache__/__init__.cpython-311.pyc,, +langchain_core/language_models/__pycache__/_compat_bridge.cpython-311.pyc,, +langchain_core/language_models/__pycache__/_utils.cpython-311.pyc,, +langchain_core/language_models/__pycache__/base.cpython-311.pyc,, +langchain_core/language_models/__pycache__/chat_model_stream.cpython-311.pyc,, +langchain_core/language_models/__pycache__/chat_models.cpython-311.pyc,, +langchain_core/language_models/__pycache__/fake.cpython-311.pyc,, +langchain_core/language_models/__pycache__/fake_chat_models.cpython-311.pyc,, +langchain_core/language_models/__pycache__/llms.cpython-311.pyc,, +langchain_core/language_models/__pycache__/model_profile.cpython-311.pyc,, +langchain_core/language_models/_compat_bridge.py,sha256=UPFkx1lKBCForTSY6FS_4eER1GSVX7X_6hVlwyrx5kc,29533 +langchain_core/language_models/_utils.py,sha256=jkSDmgOzeAdod2k8t8jyHDKpxQhWadq2Wqvfh6TA3Ho,11601 +langchain_core/language_models/base.py,sha256=DOJIGnoFl5yoZFw1rMd3b7eu9MI398RfJe2xIn1aEB4,12956 +langchain_core/language_models/chat_model_stream.py,sha256=2545JtHWSHsfHIcayelpjahAshybc2LSX4T5pf88G4o,57441 +langchain_core/language_models/chat_models.py,sha256=2wad8ZyS9queI0O7662n48sJ3rGIDwqIDIqSSCtW9rE,106858 +langchain_core/language_models/fake.py,sha256=hb2yU3snYPTueZiJ-0KI0MKHYBNm6zdUw7xe8WqguEY,3732 +langchain_core/language_models/fake_chat_models.py,sha256=ficeNxjfLYqMTGfgLqqJEQxdySJCw7MEzBytXroPdKs,13619 +langchain_core/language_models/llms.py,sha256=-a6VGo5fz6Romg5kHOgqYDXbxldMleVNs6BNvgfb2rU,55589 +langchain_core/language_models/model_profile.py,sha256=9IrtvAMFnkCYoagmfBdAlU6I2oiZEgurYluN2Ulu2pg,4898 +langchain_core/load/__init__.py,sha256=iN4gcGBqIejwElQFDwCKnPZbI_q0cyH4aYpdRQj5gUY,1238 +langchain_core/load/__pycache__/__init__.cpython-311.pyc,, +langchain_core/load/__pycache__/_validation.cpython-311.pyc,, +langchain_core/load/__pycache__/dump.cpython-311.pyc,, +langchain_core/load/__pycache__/load.cpython-311.pyc,, +langchain_core/load/__pycache__/mapping.cpython-311.pyc,, +langchain_core/load/__pycache__/serializable.cpython-311.pyc,, +langchain_core/load/__pycache__/validators.cpython-311.pyc,, +langchain_core/load/_validation.py,sha256=C71rSNVkHc0QVNWkI6YjG81fuoJ05UR_FqP1UUf5pPE,6860 +langchain_core/load/dump.py,sha256=qSjKc61eWEirgnM5OuJXsjYlVJu7Vx3c_14V9PVc5l0,3883 +langchain_core/load/load.py,sha256=s8_L_a_mPZ3znS6TJtE-m50232_d9Eg9PrVeUE4cA2c,33402 +langchain_core/load/mapping.py,sha256=NLEWz_SXQz2-33_gTfD0BqC0ccKiuCvF9G4H7bdSie4,30151 +langchain_core/load/serializable.py,sha256=GFZ5AvakTMZ6XETUqsWDgmciG4peQYNP7ZvQ3hMFbRI,12791 +langchain_core/load/validators.py,sha256=besF3UudLiPPn_c5XUBFserAQTwCz3_smfh2iqDkKtM,3077 +langchain_core/messages/__init__.py,sha256=hrsxGO0wLEIr81gpu2cL89kV6PeiW1yY-G0rhqYYXms,5723 +langchain_core/messages/__pycache__/__init__.cpython-311.pyc,, +langchain_core/messages/__pycache__/ai.cpython-311.pyc,, +langchain_core/messages/__pycache__/base.cpython-311.pyc,, +langchain_core/messages/__pycache__/chat.cpython-311.pyc,, +langchain_core/messages/__pycache__/content.cpython-311.pyc,, +langchain_core/messages/__pycache__/function.cpython-311.pyc,, +langchain_core/messages/__pycache__/human.cpython-311.pyc,, +langchain_core/messages/__pycache__/modifier.cpython-311.pyc,, +langchain_core/messages/__pycache__/system.cpython-311.pyc,, +langchain_core/messages/__pycache__/tool.cpython-311.pyc,, +langchain_core/messages/__pycache__/utils.cpython-311.pyc,, +langchain_core/messages/ai.py,sha256=p3cgyLXJT2y24y8FQd_2Gep4R8UY8VTiesGIPPwdyzQ,28222 +langchain_core/messages/base.py,sha256=yDJXy93-4yJDL-uVZgHWXwv2ojxMVmOz5OzwmBP1c_Q,17472 +langchain_core/messages/block_translators/__init__.py,sha256=ow_94AoqdcAZieFlpjO75l-ZcnBwXznTMhrqruXv8gw,4249 +langchain_core/messages/block_translators/__pycache__/__init__.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/anthropic.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/bedrock.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/bedrock_converse.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/google_genai.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/google_vertexai.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/groq.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/langchain_v0.cpython-311.pyc,, +langchain_core/messages/block_translators/__pycache__/openai.cpython-311.pyc,, +langchain_core/messages/block_translators/anthropic.py,sha256=uT1WEIdDjnAbrwD6heKaXWUH0xE-NcqCY5HIfLLhLR4,20012 +langchain_core/messages/block_translators/bedrock.py,sha256=zO_Z5ae8l8EewbXBT2fx4uCYUgJZujPAxIdMON43jWg,3735 +langchain_core/messages/block_translators/bedrock_converse.py,sha256=4eFzetu3sR460n2rAvMcGNBB7LFbHjV0wD0cv1VezMI,12522 +langchain_core/messages/block_translators/google_genai.py,sha256=qNx0HTc2k47LcWfm9HEoSfEkVqder7Z4HDerbsS55Xc,23158 +langchain_core/messages/block_translators/google_vertexai.py,sha256=2RzpKFKi1991aWGK8osdkKq8bKadmy8q86kR3r0f6K4,632 +langchain_core/messages/block_translators/groq.py,sha256=qHGLt-h78khrLvtstU1_xrAw-1u7SFdRuOrsQ5nZNVM,5622 +langchain_core/messages/block_translators/langchain_v0.py,sha256=WAoQGt1qZ5rVZD5n1A1z0dR-DpN6vgrn-gSII1CxhCA,11658 +langchain_core/messages/block_translators/openai.py,sha256=jrm4qCT_9QybV2c64ObUP0IWxYPFnLJg4Dot9zHvRHY,42203 +langchain_core/messages/chat.py,sha256=t9az-R1De2HdiEhhpGyIFonCqY03UAkqMdvttx11rhM,2204 +langchain_core/messages/content.py,sha256=fan06-n-zqbrCDvxmAj1FynVRr11dvIhLic0pp-Ui3M,42397 +langchain_core/messages/function.py,sha256=RlkcFREWGgAlnD0psOOWc2kQa7wVZ-kJBl-mi-UIcdw,2094 +langchain_core/messages/human.py,sha256=Sgx58Kwlb1y_YaeOXavz1D0V2ald_TAdqlC5zQI_Rz4,2130 +langchain_core/messages/modifier.py,sha256=8d3mhHnKMDU9Xkw_M3-uf5WBtqA4dZj81tD7A6Zgo_o,875 +langchain_core/messages/system.py,sha256=x8OBdba68Nt3SiO7aNTaDREq3iDjDV4XyRoqb-ZOmgo,2140 +langchain_core/messages/tool.py,sha256=yCZGqH2aIQFVRS2FgRddVKPx09SOjMobSIRpbtQE2MI,13228 +langchain_core/messages/utils.py,sha256=mfmcc_sAUXZ8S1qB4Vxt6R6zKamJZrCOUGeR4nIir5M,91489 +langchain_core/output_parsers/__init__.py,sha256=g5MPrD8sJK8jeZRCICvWRp-dtAq1jqy-fF-wS5egr5Q,3487 +langchain_core/output_parsers/__pycache__/__init__.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/base.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/format_instructions.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/json.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/list.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/openai_functions.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/openai_tools.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/pydantic.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/string.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/transform.cpython-311.pyc,, +langchain_core/output_parsers/__pycache__/xml.cpython-311.pyc,, +langchain_core/output_parsers/base.py,sha256=b4YD3zpYptvwynF-C9fyMBG5u008leTklTbg2ZlPLrg,11221 +langchain_core/output_parsers/format_instructions.py,sha256=HK-KjPfQfBNj0V_ato0_GN7PFsC-Wixt8V2Q515FdJk,1108 +langchain_core/output_parsers/json.py,sha256=PTwS2UtAbfzoxCO2IFaXRqiFqBoDm0-wofYN3TiIXbI,4658 +langchain_core/output_parsers/list.py,sha256=KbsB8BX8MaObbw-PkVROO4wqnju_nS-66SFBPZUDYPk,7255 +langchain_core/output_parsers/openai_functions.py,sha256=uGWzfB7yG9dUOtospT3BivQ6dVDNuCa9scIo3WK4U2Y,10604 +langchain_core/output_parsers/openai_tools.py,sha256=31qRnmXH608lXaHuyJBMYnkwEXODxRJkzYDGJiMjXgk,13197 +langchain_core/output_parsers/pydantic.py,sha256=bFnw_Gjac4ayMBHzNYeE4iUU-XGO4vJ3D_twmFpf6DQ,4776 +langchain_core/output_parsers/string.py,sha256=fL5zrW2_zTAnczIjVol5UYcuTFcjlP1JTYMF_fRYJgs,1890 +langchain_core/output_parsers/transform.py,sha256=9qnMxCMQP-xV-WaiVzRcC-upfHVuzSh1ysWgPdiJxyQ,5835 +langchain_core/output_parsers/xml.py,sha256=wd_CaDuSEmDxCch4ON_A2IbU-KMbOpaAmUxEZqLSAwc,11019 +langchain_core/outputs/__init__.py,sha256=Nn2bbkA0xt6ogMHvvSEgkt2dLGzZazbXGCdpWrT-p68,2117 +langchain_core/outputs/__pycache__/__init__.cpython-311.pyc,, +langchain_core/outputs/__pycache__/chat_generation.cpython-311.pyc,, +langchain_core/outputs/__pycache__/chat_result.cpython-311.pyc,, +langchain_core/outputs/__pycache__/generation.cpython-311.pyc,, +langchain_core/outputs/__pycache__/llm_result.cpython-311.pyc,, +langchain_core/outputs/__pycache__/run_info.cpython-311.pyc,, +langchain_core/outputs/chat_generation.py,sha256=JmZnOnKyT1ZpIlkN4UHmbMfZ9cZGe8G3ojCRdodDAg0,5293 +langchain_core/outputs/chat_result.py,sha256=lwnX1TaDdB_ReUN-61CLUSYroK_i6cnaPBjdhW3ncEU,1349 +langchain_core/outputs/generation.py,sha256=qJxsa1trJz_jS1Aqtxlbo3_aQxEu5rM7cLyH9sMcFJc,2572 +langchain_core/outputs/llm_result.py,sha256=_w66w_ihfNp22c_FXb_AcVHVQkwJqlhMW8YWisAwH-E,3952 +langchain_core/outputs/run_info.py,sha256=JaxlRAEFToHGj2i83JgR52Ly7jeu5XZTZx-sWEj4sjI,618 +langchain_core/prompt_values.py,sha256=g42BprRpMYT44TwGX-51raHmA5-STBomyUCixcIHzYs,4512 +langchain_core/prompts/__init__.py,sha256=0Lh2Vc4bpQ9mbfoaPTFtvaXFBr6tBBlIiLA0pfA-9Ac,3031 +langchain_core/prompts/__pycache__/__init__.cpython-311.pyc,, +langchain_core/prompts/__pycache__/base.cpython-311.pyc,, +langchain_core/prompts/__pycache__/chat.cpython-311.pyc,, +langchain_core/prompts/__pycache__/dict.cpython-311.pyc,, +langchain_core/prompts/__pycache__/few_shot.cpython-311.pyc,, +langchain_core/prompts/__pycache__/few_shot_with_templates.cpython-311.pyc,, +langchain_core/prompts/__pycache__/image.cpython-311.pyc,, +langchain_core/prompts/__pycache__/loading.cpython-311.pyc,, +langchain_core/prompts/__pycache__/message.cpython-311.pyc,, +langchain_core/prompts/__pycache__/prompt.cpython-311.pyc,, +langchain_core/prompts/__pycache__/string.cpython-311.pyc,, +langchain_core/prompts/__pycache__/structured.cpython-311.pyc,, +langchain_core/prompts/base.py,sha256=pxrNcfL3x2BK2Nogh_1MbININ9T6VLRsNjvqpgSBupQ,16411 +langchain_core/prompts/chat.py,sha256=qtFrImlLvWjUCEcGSjo_cvI95PB0PygU-ZJBMvV5GRo,51442 +langchain_core/prompts/dict.py,sha256=48QAEyxQa3HrBQFNTc5wpWL24SHFg2SzLLctHHLlshg,5793 +langchain_core/prompts/few_shot.py,sha256=EmtZgWW3iwo-duvQ5mnH5ccUhnFCAftXraC15jT1nhE,16134 +langchain_core/prompts/few_shot_with_templates.py,sha256=1Ms042FD8F8KFalHZWjRrJxH3R8T56tFRxWrq_ST4oo,8199 +langchain_core/prompts/image.py,sha256=XFNahzMGhiqS3JmrLaIQApK-677ydgBK-47jYftx1pM,5504 +langchain_core/prompts/loading.py,sha256=9azU8pQWST4V6pEglKOkm4K_Fng4RGzAuzg_11iwjTQ,10393 +langchain_core/prompts/message.py,sha256=eHZV_aoc8HnXD3W9Dpogvkgo6-MJuZ1gERkcAf5zIow,2652 +langchain_core/prompts/prompt.py,sha256=3t5bqak3N9hWqXDIBCbv2W3t6pY0-ocEPQ1fa3sJVOg,10937 +langchain_core/prompts/string.py,sha256=hRjKBU4GakJBVKUffZqehu3OIA4u-fxeknCN8a8oNC0,12735 +langchain_core/prompts/structured.py,sha256=EeNz9_Jio9IQScj5Wv8DV9BlQ0qRxMQLJuOC8IsPoIk,6081 +langchain_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_core/rate_limiters.py,sha256=nz623hev7rz8etlEHwQbnMC7sXsZB7WNlJFlolFNk_c,9385 +langchain_core/retrievers.py,sha256=eG-QarmH7RoTwGN1UIPAvDxkUlKANhUyJv2H0iCWPEs,11140 +langchain_core/runnables/__init__.py,sha256=MRXuYaGKcDePzfqafrO8nLdlt3NM1IEVYRDXEfnEEUM,3873 +langchain_core/runnables/__pycache__/__init__.cpython-311.pyc,, +langchain_core/runnables/__pycache__/base.cpython-311.pyc,, +langchain_core/runnables/__pycache__/branch.cpython-311.pyc,, +langchain_core/runnables/__pycache__/config.cpython-311.pyc,, +langchain_core/runnables/__pycache__/configurable.cpython-311.pyc,, +langchain_core/runnables/__pycache__/fallbacks.cpython-311.pyc,, +langchain_core/runnables/__pycache__/graph.cpython-311.pyc,, +langchain_core/runnables/__pycache__/graph_ascii.cpython-311.pyc,, +langchain_core/runnables/__pycache__/graph_mermaid.cpython-311.pyc,, +langchain_core/runnables/__pycache__/graph_png.cpython-311.pyc,, +langchain_core/runnables/__pycache__/history.cpython-311.pyc,, +langchain_core/runnables/__pycache__/passthrough.cpython-311.pyc,, +langchain_core/runnables/__pycache__/retry.cpython-311.pyc,, +langchain_core/runnables/__pycache__/router.cpython-311.pyc,, +langchain_core/runnables/__pycache__/schema.cpython-311.pyc,, +langchain_core/runnables/__pycache__/utils.cpython-311.pyc,, +langchain_core/runnables/base.py,sha256=wBjoMweGhXW1TR1aTP3eQMHGTyFr5mYvjAht8Du5Bi8,234021 +langchain_core/runnables/branch.py,sha256=JwlIUcCEW9UcdN0V6X5zKOvHXzPQk1gESSkOuZYxXaE,15777 +langchain_core/runnables/config.py,sha256=-SM_Fb20zRPi-APZJYlPtsHS7wKBMozLYjG4M68pzTU,21321 +langchain_core/runnables/configurable.py,sha256=OovrP3ysn5g8Cho1DGhoE8dhUqqjN_pK0OQOt8JqoQc,24011 +langchain_core/runnables/fallbacks.py,sha256=_Dhap_FioM6k1dT5mGWsSyrDfUf2WkAC2hLU8SkWxfU,24423 +langchain_core/runnables/graph.py,sha256=ad36tC52EKpXpKi0EFpN4xbwKgHBevXWdl2IXLZRbus,23103 +langchain_core/runnables/graph_ascii.py,sha256=n_DZhH4ONOgbzkt2FFjub0Ca08RQYkmI7FhoV70YOEE,10405 +langchain_core/runnables/graph_mermaid.py,sha256=vl6QkAx2nYG7JfTO4INGSazoXddOhBcblwrKqjx42ag,17538 +langchain_core/runnables/graph_png.py,sha256=3JPyWtTRVofnIySxitNx20SNewMka0Cv6VWT4_WGcSM,6513 +langchain_core/runnables/history.py,sha256=VzSbpyb-od7WY5Zy1DvaXeqo126DvmS-bCcwKPQeWls,24693 +langchain_core/runnables/passthrough.py,sha256=a3iZi2HmL5ci3y5DQf_V9kr2YFcHlkokfbLf9xaUtlk,25971 +langchain_core/runnables/retry.py,sha256=FTiYt3t8gH_A8YbP6LofVz-StaFTtqDltodqmFQ7330,13686 +langchain_core/runnables/router.py,sha256=0cZN5PkY0UI4oIIrIEo2d2c304rgQ8LXkDHfPovBJ0A,7175 +langchain_core/runnables/schema.py,sha256=eMBaIXpUASYLuKriRfn3J0jvkqdjkVOkr6mjQe5Og6I,5982 +langchain_core/runnables/utils.py,sha256=ty6K3BK4h6dOz0_OAEuZWxee5C9Cf5BN6hwKoysA6t0,22362 +langchain_core/stores.py,sha256=jajsdHvfXzXdcAmKLAux1HNJZwvh108YJEth8e_91Vk,9214 +langchain_core/structured_query.py,sha256=__Y_cD1siuhDVCxhV3cQXNTPCkkLPgZ3oOmXGZAFkoo,5129 +langchain_core/sys_info.py,sha256=-AW7_Sr2ex7ZtmHRDGxLF6eygDQfVrCdclluSOj063I,3833 +langchain_core/tools/__init__.py,sha256=0b1ywYlDX2k1Byhx5p21hyVwZ03TbbKqIjF0Mh0jWVU,2510 +langchain_core/tools/__pycache__/__init__.cpython-311.pyc,, +langchain_core/tools/__pycache__/base.cpython-311.pyc,, +langchain_core/tools/__pycache__/convert.cpython-311.pyc,, +langchain_core/tools/__pycache__/render.cpython-311.pyc,, +langchain_core/tools/__pycache__/retriever.cpython-311.pyc,, +langchain_core/tools/__pycache__/simple.cpython-311.pyc,, +langchain_core/tools/__pycache__/structured.cpython-311.pyc,, +langchain_core/tools/base.py,sha256=HKiRwLQXwA87umzSih8xZqoRLaWCsRihZhkXhlgzUYk,55634 +langchain_core/tools/convert.py,sha256=LGjCssxYSTD2mtFO4VzmcN5szKV-SZwbG_payRHPDcU,17033 +langchain_core/tools/render.py,sha256=gD3pXYWjCaDKsYq_MZ-yCRXl1wUJbOh6dJobda9VjYM,1817 +langchain_core/tools/retriever.py,sha256=Jof28vFl_4stRbSvFCIorMkJ7sE-Yt-sQ1otZ01uKSU,3211 +langchain_core/tools/simple.py,sha256=5HbwkRjEN1kn-NDb9TXV04coRdJULuo-hKHBS7bz8tQ,6744 +langchain_core/tools/structured.py,sha256=kexoRyxczzufB9atlSDK36RC_bcbsi6eLceCfd8tkIc,9742 +langchain_core/tracers/__init__.py,sha256=FPc8T08agCHfIZXSRDR06SzZKSWzHDNghb_gdOtyYSc,1358 +langchain_core/tracers/__pycache__/__init__.cpython-311.pyc,, +langchain_core/tracers/__pycache__/_compat.cpython-311.pyc,, +langchain_core/tracers/__pycache__/_streaming.cpython-311.pyc,, +langchain_core/tracers/__pycache__/base.cpython-311.pyc,, +langchain_core/tracers/__pycache__/context.cpython-311.pyc,, +langchain_core/tracers/__pycache__/core.cpython-311.pyc,, +langchain_core/tracers/__pycache__/evaluation.cpython-311.pyc,, +langchain_core/tracers/__pycache__/event_stream.cpython-311.pyc,, +langchain_core/tracers/__pycache__/langchain.cpython-311.pyc,, +langchain_core/tracers/__pycache__/log_stream.cpython-311.pyc,, +langchain_core/tracers/__pycache__/memory_stream.cpython-311.pyc,, +langchain_core/tracers/__pycache__/root_listeners.cpython-311.pyc,, +langchain_core/tracers/__pycache__/run_collector.cpython-311.pyc,, +langchain_core/tracers/__pycache__/schemas.cpython-311.pyc,, +langchain_core/tracers/__pycache__/stdout.cpython-311.pyc,, +langchain_core/tracers/_compat.py,sha256=cAJSYOX8wC3lgjT5zD_PqCsz0XLn-WwQ2ZyTtCJhHB0,2824 +langchain_core/tracers/_streaming.py,sha256=Bnk-tfu-6aiP_g0BoSvZk9zgEoDJJlBG_X8i0A2aqQI,1831 +langchain_core/tracers/base.py,sha256=kRFWqtImW2QfqPFX3Pmkg7rFgwhcZH4r-iDfKfNNckU,27489 +langchain_core/tracers/context.py,sha256=FJqfW2YrrsCdGkFVXGDtAFudZdKdAVvR2ugqPHvgXas,6226 +langchain_core/tracers/core.py,sha256=q4mXPDc3z1RE2LXrHQfDNpNQBGD2KJLvTsp-1ZcBfLA,24772 +langchain_core/tracers/evaluation.py,sha256=aH3bG_3bQgt1exbF8iYRoJh7ZMi2-XY3r4R9i3HLOMU,8225 +langchain_core/tracers/event_stream.py,sha256=MrXS8y9xh86kJteSuoByPFvem0Z17LbGVsG0cjVIFhw,35813 +langchain_core/tracers/langchain.py,sha256=A-s4iuQsG8Y8kxo4r4Xz9mAbNUTRrWEZnAC4gKg7SFY,17486 +langchain_core/tracers/log_stream.py,sha256=KMI6JxFN8ZVB7Bdtw0vdu-nGIwGWuXWjpT3XrjzN1P0,25606 +langchain_core/tracers/memory_stream.py,sha256=gTeTS3ty2L5zulAGBq5SeFtE7TZ0fbSMDOIFheNSGm0,4970 +langchain_core/tracers/root_listeners.py,sha256=WMcy62yro8iCYxAjU4mCF8bxtKiKUnw4oo0tez0DpO8,4097 +langchain_core/tracers/run_collector.py,sha256=1bbgc2dxmUK1saVHybFE3Lj7-R2MxNEZFZ-FIiXtkWg,1254 +langchain_core/tracers/schemas.py,sha256=-B159J_A1pLdmN6GLR3yM2S_KozJWawKaFc7vI2xXaU,191 +langchain_core/tracers/stdout.py,sha256=E8jX4pqCHf6TYr0AhrUzI4ATw2fOARZDE1DxGZHzGo0,6731 +langchain_core/utils/__init__.py,sha256=yn6ZGHMxi7MjqojSBkT2sCxYRpo76zAIBcKnTRaJ2Pc,3041 +langchain_core/utils/__pycache__/__init__.cpython-311.pyc,, +langchain_core/utils/__pycache__/_merge.cpython-311.pyc,, +langchain_core/utils/__pycache__/aiter.cpython-311.pyc,, +langchain_core/utils/__pycache__/env.cpython-311.pyc,, +langchain_core/utils/__pycache__/formatting.cpython-311.pyc,, +langchain_core/utils/__pycache__/function_calling.cpython-311.pyc,, +langchain_core/utils/__pycache__/html.cpython-311.pyc,, +langchain_core/utils/__pycache__/image.cpython-311.pyc,, +langchain_core/utils/__pycache__/input.cpython-311.pyc,, +langchain_core/utils/__pycache__/interactive_env.cpython-311.pyc,, +langchain_core/utils/__pycache__/iter.cpython-311.pyc,, +langchain_core/utils/__pycache__/json.cpython-311.pyc,, +langchain_core/utils/__pycache__/json_schema.cpython-311.pyc,, +langchain_core/utils/__pycache__/mustache.cpython-311.pyc,, +langchain_core/utils/__pycache__/pydantic.cpython-311.pyc,, +langchain_core/utils/__pycache__/strings.cpython-311.pyc,, +langchain_core/utils/__pycache__/usage.cpython-311.pyc,, +langchain_core/utils/__pycache__/utils.cpython-311.pyc,, +langchain_core/utils/__pycache__/uuid.cpython-311.pyc,, +langchain_core/utils/_merge.py,sha256=grAJy2NwabFEb73xhbldXJgEBN65lIQVITOsaFmZV3k,8353 +langchain_core/utils/aiter.py,sha256=dGhGgLcuOEiH9NkMzjQRujy7BDrLLl18-aZToiFpdnc,10633 +langchain_core/utils/env.py,sha256=zXGL5TKk6xviTyEtgx1_Doq4NbUM7UueU93SnafmXCM,2469 +langchain_core/utils/formatting.py,sha256=lRsBL5b3KM8wIaX4wtiu6NawJVOz_HsKGpzLXY8aK3U,3058 +langchain_core/utils/function_calling.py,sha256=zss5qDAA81ChdLr-Lxv8UXXVqS-JaBGdCXaapIIuIRI,29602 +langchain_core/utils/html.py,sha256=MxkXWlEptZXHwrQrwq5mQT2L8eMnsab_zKwBrujDsOg,3852 +langchain_core/utils/image.py,sha256=1MH8Lbg0f2HfhTC4zobKMvpVoHRfpsyvWHq9ae4xENo,532 +langchain_core/utils/input.py,sha256=X8S0UNhDYHNTNymV462A_Ua0Yj2GH7lEwVt9HdpnL7w,2087 +langchain_core/utils/interactive_env.py,sha256=ebs61nd0rwNjCH6GKOmHRBSk3FfNmwUftTLhOTEJfd4,291 +langchain_core/utils/iter.py,sha256=IIJ2CaSFjWnnylc5QMuzcIOPG_IKION_K2n98qPEgug,7299 +langchain_core/utils/json.py,sha256=NBkZmXGLta27Chj-T3WsCX2BqMaGDbqxIVYSYGOnVGg,7156 +langchain_core/utils/json_schema.py,sha256=zvmTBn1z9lpbOv6yOggml_yiu97mpuDguMx9FozpSv0,9846 +langchain_core/utils/mustache.py,sha256=MbLfczSQKbdFflmvbOf9NzK4gjrOxGSSzTwpXirWMn8,22705 +langchain_core/utils/pydantic.py,sha256=qN7Ld0rdopd1fSlnUPpJNgvbJqjkbnmAgP23Fg9Onc8,18684 +langchain_core/utils/strings.py,sha256=xMr-M1O6YMuenrHXxDUQORAqMoeUPZTIo_AriNbDeZM,1779 +langchain_core/utils/usage.py,sha256=hlRhUYDT3j8li0JQ77OuwbyZm94L-23xF_y0L8uKWRE,1980 +langchain_core/utils/utils.py,sha256=1QV5LgwvLPt7QZMiXy8oDEnGHgc_dnxoYWEJPQdzUrs,16197 +langchain_core/utils/uuid.py,sha256=X0LqWhrcwYJ_tawpLwn6Xpri-jWeWnJbmpIubnlY1Vs,1825 +langchain_core/vectorstores/__init__.py,sha256=X2WASd-ZgSSOvynfbsbMZ8Zn4akM1YIdL38_4nxkhQw,1386 +langchain_core/vectorstores/__pycache__/__init__.cpython-311.pyc,, +langchain_core/vectorstores/__pycache__/base.cpython-311.pyc,, +langchain_core/vectorstores/__pycache__/in_memory.cpython-311.pyc,, +langchain_core/vectorstores/__pycache__/utils.cpython-311.pyc,, +langchain_core/vectorstores/base.py,sha256=2VysJoCPln-9b8KsIJ6VixrFC5Vc1TI6ld2dq1VsgO4,40772 +langchain_core/vectorstores/in_memory.py,sha256=huw4egg1T3XCP4sUuVaHxbNJDZHRzlq9oxjl-0zQIYg,15727 +langchain_core/vectorstores/utils.py,sha256=5y9FaphhFP7JSky_EV-crnoNkow8rkdGCe9kPyrHmN0,5002 +langchain_core/version.py,sha256=l8pB2Einfhp66NTH6M3LEMMOKoyvwk9nqzeRNJ-YFgI,75 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core-1.4.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0e16b0f744ae0f4fe89fb30215d865af8ac6d695 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/__init__.py @@ -0,0 +1,20 @@ +"""`langchain-core` defines the base abstractions for the LangChain ecosystem. + +The interfaces for core components like chat models, LLMs, vector stores, retrievers, +and more are defined here. The universal invocation protocol (Runnables) along with +a syntax for combining components are also defined here. + +**No third-party integrations are defined here.** The dependencies are kept purposefully +very lightweight. +""" + +from langchain_core._api import ( + surface_langchain_beta_warnings, + surface_langchain_deprecation_warnings, +) +from langchain_core.version import VERSION + +__version__ = VERSION + +surface_langchain_deprecation_warnings() +surface_langchain_beta_warnings() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/_import_utils.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/_import_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..60c6ca0ede99a85eaabab9f6d59d57265d0e3c11 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/_import_utils.py @@ -0,0 +1,41 @@ +from importlib import import_module + + +def import_attr( + attr_name: str, + module_name: str | None, + package: str | None, +) -> object: + """Import an attribute from a module located in a package. + + This utility function is used in custom `__getattr__` methods within `__init__.py` + files to dynamically import attributes. + + Args: + attr_name: The name of the attribute to import. + module_name: The name of the module to import from. + + If `None`, the attribute is imported from the package itself. + package: The name of the package where the module is located. + + Raises: + ImportError: If the module cannot be found. + AttributeError: If the attribute does not exist in the module or package. + + Returns: + The imported attribute. + """ + if module_name == "__module__" or module_name is None: + try: + result = import_module(f".{attr_name}", package=package) + except ModuleNotFoundError: + msg = f"module '{package!r}' has no attribute {attr_name!r}" + raise AttributeError(msg) from None + else: + try: + module = import_module(f".{module_name}", package=package) + except ModuleNotFoundError as err: + msg = f"module '{package!r}.{module_name!r}' not found ({err})" + raise ImportError(msg) from None + result = getattr(module, attr_name) + return result diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/agents.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/agents.py new file mode 100644 index 0000000000000000000000000000000000000000..76f818b06a6417203f00c0dbb0c3252132cd1252 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/agents.py @@ -0,0 +1,256 @@ +"""Schema definitions for representing agent actions, observations, and return values. + +!!! warning + + The schema definitions are provided for backwards compatibility. + +!!! warning + + New agents should be built using the + [`langchain` library](https://pypi.org/project/langchain/), which provides a + simpler and more flexible way to define agents. + + See docs on [building agents](https://docs.langchain.com/oss/python/langchain/agents). + +Agents use language models to choose a sequence of actions to take. + +A basic agent works in the following manner: + +1. Given a prompt an agent uses an LLM to request an action to take + (e.g., a tool to run). +2. The agent executes the action (e.g., runs the tool), and receives an observation. +3. The agent returns the observation to the LLM, which can then be used to generate + the next action. +4. When the agent reaches a stopping condition, it returns a final return value. + +The schemas for the agents themselves are defined in `langchain.agents.agent`. +""" + +from __future__ import annotations + +import json +from collections.abc import Sequence +from typing import Any, Literal + +from langchain_core.load.serializable import Serializable +from langchain_core.messages import ( + AIMessage, + BaseMessage, + FunctionMessage, + HumanMessage, +) + + +class AgentAction(Serializable): + """Represents a request to execute an action by an agent. + + The action consists of the name of the tool to execute and the input to pass + to the tool. The log is used to pass along extra information about the action. + """ + + tool: str + """The name of the `Tool` to execute.""" + + tool_input: str | dict + """The input to pass in to the `Tool`.""" + + log: str + """Additional information to log about the action. + + This log can be used in a few ways. First, it can be used to audit what exactly the + LLM predicted to lead to this `(tool, tool_input)`. + + Second, it can be used in future iterations to show the LLMs prior thoughts. This is + useful when `(tool, tool_input)` does not contain full information about the LLM + prediction (for example, any `thought` before the tool/tool_input). + """ + + type: Literal["AgentAction"] = "AgentAction" + + # Override init to support instantiation by position for backward compat. + def __init__(self, tool: str, tool_input: str | dict, log: str, **kwargs: Any): + """Create an `AgentAction`. + + Args: + tool: The name of the tool to execute. + tool_input: The input to pass in to the `Tool`. + log: Additional information to log about the action. + """ + super().__init__(tool=tool, tool_input=tool_input, log=log, **kwargs) + + @classmethod + def is_lc_serializable(cls) -> bool: + """`AgentAction` is serializable. + + Returns: + `True` + """ + return True + + @classmethod + def get_lc_namespace(cls) -> list[str]: + """Get the namespace of the LangChain object. + + Returns: + `["langchain", "schema", "agent"]` + """ + return ["langchain", "schema", "agent"] + + @property + def messages(self) -> Sequence[BaseMessage]: + """Return the messages that correspond to this action.""" + return _convert_agent_action_to_messages(self) + + +class AgentActionMessageLog(AgentAction): + """Representation of an action to be executed by an agent. + + This is similar to `AgentAction`, but includes a message log consisting of + chat messages. + + This is useful when working with `ChatModels`, and is used to reconstruct + conversation history from the agent's perspective. + """ + + message_log: Sequence[BaseMessage] + """Similar to log, this can be used to pass along extra information about what exact + messages were predicted by the LLM before parsing out the `(tool, tool_input)`. + + This is again useful if `(tool, tool_input)` cannot be used to fully recreate the + LLM prediction, and you need that LLM prediction (for future agent iteration). + + Compared to `log`, this is useful when the underlying LLM is a chat model (and + therefore returns messages rather than a string). + """ + # Ignoring type because we're overriding the type from AgentAction. + # And this is the correct thing to do in this case. + # The type literal is used for serialization purposes. + type: Literal["AgentActionMessageLog"] = "AgentActionMessageLog" # type: ignore[assignment] + + +class AgentStep(Serializable): + """Result of running an `AgentAction`.""" + + action: AgentAction + """The `AgentAction` that was executed.""" + + observation: Any + """The result of the `AgentAction`.""" + + @property + def messages(self) -> Sequence[BaseMessage]: + """Messages that correspond to this observation.""" + return _convert_agent_observation_to_messages(self.action, self.observation) + + +class AgentFinish(Serializable): + """Final return value of an `ActionAgent`. + + Agents return an `AgentFinish` when they have reached a stopping condition. + """ + + return_values: dict + """Dictionary of return values.""" + + log: str + """Additional information to log about the return value. + + This is used to pass along the full LLM prediction, not just the parsed out + return value. + + For example, if the full LLM prediction was `Final Answer: 2` you may want to just + return `2` as a return value, but pass along the full string as a `log` (for + debugging or observability purposes). + """ + type: Literal["AgentFinish"] = "AgentFinish" + + def __init__(self, return_values: dict, log: str, **kwargs: Any): + """Override init to support instantiation by position for backward compat.""" + super().__init__(return_values=return_values, log=log, **kwargs) + + @classmethod + def is_lc_serializable(cls) -> bool: + """Return `True` as this class is serializable.""" + return True + + @classmethod + def get_lc_namespace(cls) -> list[str]: + """Get the namespace of the LangChain object. + + Returns: + `["langchain", "schema", "agent"]` + """ + return ["langchain", "schema", "agent"] + + @property + def messages(self) -> Sequence[BaseMessage]: + """Messages that correspond to this observation.""" + return [AIMessage(content=self.log)] + + +def _convert_agent_action_to_messages( + agent_action: AgentAction, +) -> Sequence[BaseMessage]: + """Convert an agent action to a message. + + This code is used to reconstruct the original AI message from the agent action. + + Args: + agent_action: Agent action to convert. + + Returns: + `AIMessage` that corresponds to the original tool invocation. + """ + if isinstance(agent_action, AgentActionMessageLog): + return agent_action.message_log + return [AIMessage(content=agent_action.log)] + + +def _convert_agent_observation_to_messages( + agent_action: AgentAction, observation: Any +) -> Sequence[BaseMessage]: + """Convert an agent action to a message. + + This code is used to reconstruct the original AI message from the agent action. + + Args: + agent_action: Agent action to convert. + observation: Observation to convert to a message. + + Returns: + `AIMessage` that corresponds to the original tool invocation. + """ + if isinstance(agent_action, AgentActionMessageLog): + return [_create_function_message(agent_action, observation)] + content = observation + if not isinstance(observation, str): + try: + content = json.dumps(observation, ensure_ascii=False) + except Exception: + content = str(observation) + return [HumanMessage(content=content)] + + +def _create_function_message( + agent_action: AgentAction, observation: Any +) -> FunctionMessage: + """Convert agent action and observation into a function message. + + Args: + agent_action: the tool invocation request from the agent. + observation: the result of the tool invocation. + + Returns: + `FunctionMessage` that corresponds to the original tool invocation. + """ + if not isinstance(observation, str): + try: + content = json.dumps(observation, ensure_ascii=False) + except Exception: + content = str(observation) + else: + content = observation + return FunctionMessage( + name=agent_action.tool, + content=content, + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/caches.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/caches.py new file mode 100644 index 0000000000000000000000000000000000000000..1ac250875eeafb5db1a7110872dbebf5573db0f3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/caches.py @@ -0,0 +1,272 @@ +"""Optional caching layer for language models. + +Distinct from provider-based [prompt caching](https://docs.langchain.com/oss/python/langchain/models#prompt-caching). + +!!! warning "Beta feature" + + This is a beta feature. Please be wary of deploying experimental code to production + unless you've taken appropriate precautions. + +A cache is useful for two reasons: + +1. It can save you money by reducing the number of API calls you make to the LLM + provider if you're often requesting the same completion multiple times. +2. It can speed up your application by reducing the number of API calls you make to the + LLM provider. +""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +from collections.abc import Sequence +from typing import Any + +from typing_extensions import override + +from langchain_core.outputs import Generation +from langchain_core.runnables import run_in_executor + +RETURN_VAL_TYPE = Sequence[Generation] + + +class BaseCache(ABC): + """Interface for a caching layer for LLMs and Chat models. + + The cache interface consists of the following methods: + + - lookup: Look up a value based on a prompt and `llm_string`. + - update: Update the cache based on a prompt and `llm_string`. + - clear: Clear the cache. + + In addition, the cache interface provides an async version of each method. + + The default implementation of the async methods is to run the synchronous + method in an executor. It's recommended to override the async methods + and provide async implementations to avoid unnecessary overhead. + """ + + @abstractmethod + def lookup(self, prompt: str, llm_string: str) -> RETURN_VAL_TYPE | None: + """Look up based on `prompt` and `llm_string`. + + A cache implementation is expected to generate a key from the 2-tuple + of `prompt` and `llm_string` (e.g., by concatenating them with a delimiter). + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + + This is used to capture the invocation parameters of the LLM + (e.g., model name, temperature, stop tokens, max tokens, etc.). + + These invocation parameters are serialized into a string representation. + + Returns: + On a cache miss, return `None`. On a cache hit, return the cached value. + The cached value is a list of `Generation` (or subclasses). + """ + + @abstractmethod + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on `prompt` and `llm_string`. + + The `prompt` and `llm_string` are used to generate a key for the cache. The key + should match that of the lookup method. + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + + This is used to capture the invocation parameters of the LLM + (e.g., model name, temperature, stop tokens, max tokens, etc.). + + These invocation parameters are serialized into a string + representation. + return_val: The value to be cached. + + The value is a list of `Generation` (or subclasses). + """ + + @abstractmethod + def clear(self, **kwargs: Any) -> None: + """Clear cache that can take additional keyword arguments.""" + + async def alookup(self, prompt: str, llm_string: str) -> RETURN_VAL_TYPE | None: + """Async look up based on `prompt` and `llm_string`. + + A cache implementation is expected to generate a key from the 2-tuple + of `prompt` and `llm_string` (e.g., by concatenating them with a delimiter). + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + + This is used to capture the invocation parameters of the LLM + (e.g., model name, temperature, stop tokens, max tokens, etc.). + + These invocation parameters are serialized into a string + representation. + + Returns: + On a cache miss, return `None`. On a cache hit, return the cached value. + The cached value is a list of `Generation` (or subclasses). + """ + return await run_in_executor(None, self.lookup, prompt, llm_string) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + """Async update cache based on `prompt` and `llm_string`. + + The prompt and llm_string are used to generate a key for the cache. + The key should match that of the look up method. + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + + This is used to capture the invocation parameters of the LLM + (e.g., model name, temperature, stop tokens, max tokens, etc.). + + These invocation parameters are serialized into a string + representation. + return_val: The value to be cached. The value is a list of `Generation` + (or subclasses). + """ + return await run_in_executor(None, self.update, prompt, llm_string, return_val) + + async def aclear(self, **kwargs: Any) -> None: + """Async clear cache that can take additional keyword arguments.""" + return await run_in_executor(None, self.clear, **kwargs) + + +class InMemoryCache(BaseCache): + """Cache that stores things in memory. + + Example: + ```python + from langchain_core.caches import InMemoryCache + from langchain_core.outputs import Generation + + # Initialize cache + cache = InMemoryCache() + + # Update cache + cache.update( + prompt="What is the capital of France?", + llm_string="model='gpt-5.4-mini', + return_val=[Generation(text="Paris")], + ) + + # Lookup cache + result = cache.lookup( + prompt="What is the capital of France?", + llm_string="model='gpt-5.4-mini', + ) + # result is [Generation(text="Paris")] + ``` + """ + + def __init__(self, *, maxsize: int | None = None) -> None: + """Initialize with empty cache. + + Args: + maxsize: The maximum number of items to store in the cache. + + If `None`, the cache has no maximum size. + + If the cache exceeds the maximum size, the oldest items are removed. + + Raises: + ValueError: If `maxsize` is less than or equal to `0`. + """ + self._cache: dict[tuple[str, str], RETURN_VAL_TYPE] = {} + if maxsize is not None and maxsize <= 0: + msg = "maxsize must be greater than 0" + raise ValueError(msg) + self._maxsize = maxsize + + def lookup(self, prompt: str, llm_string: str) -> RETURN_VAL_TYPE | None: + """Look up based on `prompt` and `llm_string`. + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + + Returns: + On a cache miss, return `None`. On a cache hit, return the cached value. + """ + return self._cache.get((prompt, llm_string), None) + + def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None: + """Update cache based on `prompt` and `llm_string`. + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + return_val: The value to be cached. + + The value is a list of `Generation` (or subclasses). + """ + if self._maxsize is not None and len(self._cache) == self._maxsize: + del self._cache[next(iter(self._cache))] + self._cache[prompt, llm_string] = return_val + + @override + def clear(self, **kwargs: Any) -> None: + """Clear cache.""" + self._cache = {} + + async def alookup(self, prompt: str, llm_string: str) -> RETURN_VAL_TYPE | None: + """Async look up based on `prompt` and `llm_string`. + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + + Returns: + On a cache miss, return `None`. On a cache hit, return the cached value. + """ + return self.lookup(prompt, llm_string) + + async def aupdate( + self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE + ) -> None: + """Async update cache based on `prompt` and `llm_string`. + + Args: + prompt: A string representation of the prompt. + + In the case of a chat model, the prompt is a non-trivial + serialization of the prompt into the language model. + llm_string: A string representation of the LLM configuration. + return_val: The value to be cached. The value is a list of `Generation` + (or subclasses). + """ + self.update(prompt, llm_string, return_val) + + @override + async def aclear(self, **kwargs: Any) -> None: + """Async clear cache.""" + self.clear() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_history.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_history.py new file mode 100644 index 0000000000000000000000000000000000000000..a4a76f534a3b805e205894ffd4fc2f92aa81e5ce --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_history.py @@ -0,0 +1,246 @@ +"""Chat message history stores a history of the message interactions in a chat.""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import TYPE_CHECKING + +from pydantic import BaseModel, Field + +from langchain_core.messages import ( + AIMessage, + BaseMessage, + HumanMessage, + get_buffer_string, +) +from langchain_core.runnables.config import run_in_executor + +if TYPE_CHECKING: + from collections.abc import Sequence + + +class BaseChatMessageHistory(ABC): + """Abstract base class for storing chat message history. + + Implementations guidelines: + + Implementations are expected to over-ride all or some of the following methods: + + * `add_messages`: sync variant for bulk addition of messages + * `aadd_messages`: async variant for bulk addition of messages + * `messages`: sync variant for getting messages + * `aget_messages`: async variant for getting messages + * `clear`: sync variant for clearing messages + * `aclear`: async variant for clearing messages + + `add_messages` contains a default implementation that calls `add_message` + for each message in the sequence. This is provided for backwards compatibility + with existing implementations which only had `add_message`. + + Async variants all have default implementations that call the sync variants. + Implementers can choose to override the async implementations to provide + truly async implementations. + + Usage guidelines: + + When used for updating history, users should favor usage of `add_messages` + over `add_message` or other variants like `add_user_message` and `add_ai_message` + to avoid unnecessary round-trips to the underlying persistence layer. + + Example: + ```python + import json + import os + from langchain_core.messages import messages_from_dict, message_to_dict + + + class FileChatMessageHistory(BaseChatMessageHistory): + storage_path: str + session_id: str + + @property + def messages(self) -> list[BaseMessage]: + try: + with open( + os.path.join(self.storage_path, self.session_id), + "r", + encoding="utf-8", + ) as f: + messages_data = json.load(f) + return messages_from_dict(messages_data) + except FileNotFoundError: + return [] + + def add_messages(self, messages: Sequence[BaseMessage]) -> None: + all_messages = list(self.messages) # Existing messages + all_messages.extend(messages) # Add new messages + + serialized = [message_to_dict(message) for message in all_messages] + file_path = os.path.join(self.storage_path, self.session_id) + os.makedirs(os.path.dirname(file_path), exist_ok=True) + with open(file_path, "w", encoding="utf-8") as f: + json.dump(serialized, f) + + def clear(self) -> None: + file_path = os.path.join(self.storage_path, self.session_id) + os.makedirs(os.path.dirname(file_path), exist_ok=True) + with open(file_path, "w", encoding="utf-8") as f: + json.dump([], f) + ``` + """ + + messages: list[BaseMessage] + """A property or attribute that returns a list of messages. + + In general, getting the messages may involve IO to the underlying persistence + layer, so this operation is expected to incur some latency. + """ + + async def aget_messages(self) -> list[BaseMessage]: + """Async version of getting messages. + + Can over-ride this method to provide an efficient async implementation. + + In general, fetching messages may involve IO to the underlying persistence + layer. + + Returns: + The messages. + """ + return await run_in_executor(None, lambda: self.messages) + + def add_user_message(self, message: HumanMessage | str) -> None: + """Convenience method for adding a human message string to the store. + + !!! note + + This is a convenience method. Code should favor the bulk `add_messages` + interface instead to save on round-trips to the persistence layer. + + This method may be deprecated in a future release. + + Args: + message: The `HumanMessage` to add to the store. + """ + if isinstance(message, HumanMessage): + self.add_message(message) + else: + self.add_message(HumanMessage(content=message)) + + def add_ai_message(self, message: AIMessage | str) -> None: + """Convenience method for adding an `AIMessage` string to the store. + + !!! note + + This is a convenience method. Code should favor the bulk `add_messages` + interface instead to save on round-trips to the persistence layer. + + This method may be deprecated in a future release. + + Args: + message: The `AIMessage` to add. + """ + if isinstance(message, AIMessage): + self.add_message(message) + else: + self.add_message(AIMessage(content=message)) + + def add_message(self, message: BaseMessage) -> None: + """Add a Message object to the store. + + Args: + message: A `BaseMessage` object to store. + + Raises: + NotImplementedError: If the sub-class has not implemented an efficient + `add_messages` method. + """ + if type(self).add_messages != BaseChatMessageHistory.add_messages: + # This means that the sub-class has implemented an efficient add_messages + # method, so we should use it. + self.add_messages([message]) + else: + msg = ( + "add_message is not implemented for this class. " + "Please implement add_message or add_messages." + ) + raise NotImplementedError(msg) + + def add_messages(self, messages: Sequence[BaseMessage]) -> None: + """Add a list of messages. + + Implementations should over-ride this method to handle bulk addition of messages + in an efficient manner to avoid unnecessary round-trips to the underlying store. + + Args: + messages: A sequence of `BaseMessage` objects to store. + """ + for message in messages: + self.add_message(message) + + async def aadd_messages(self, messages: Sequence[BaseMessage]) -> None: + """Async add a list of messages. + + Args: + messages: A sequence of `BaseMessage` objects to store. + """ + await run_in_executor(None, self.add_messages, messages) + + @abstractmethod + def clear(self) -> None: + """Remove all messages from the store.""" + + async def aclear(self) -> None: + """Async remove all messages from the store.""" + await run_in_executor(None, self.clear) + + def __str__(self) -> str: + """Return a string representation of the chat history.""" + return get_buffer_string(self.messages) + + +class InMemoryChatMessageHistory(BaseChatMessageHistory, BaseModel): + """In memory implementation of chat message history. + + Stores messages in a memory list. + """ + + messages: list[BaseMessage] = Field(default_factory=list) + """A list of messages stored in memory.""" + + async def aget_messages(self) -> list[BaseMessage]: + """Async version of getting messages. + + Can over-ride this method to provide an efficient async implementation. + + In general, fetching messages may involve IO to the underlying persistence + layer. + + Returns: + List of messages. + """ + return self.messages + + def add_message(self, message: BaseMessage) -> None: + """Add a self-created message to the store. + + Args: + message: The message to add. + """ + self.messages.append(message) + + async def aadd_messages(self, messages: Sequence[BaseMessage]) -> None: + """Async add messages to the store. + + Args: + messages: The messages to add. + """ + self.add_messages(messages) + + def clear(self) -> None: + """Clear all messages from the store.""" + self.messages = [] + + async def aclear(self) -> None: + """Async clear all messages from the store.""" + self.clear() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_loaders.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_loaders.py new file mode 100644 index 0000000000000000000000000000000000000000..dfb01eb872fcbc41d959a2cbc0eb5e747d4e4d78 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_loaders.py @@ -0,0 +1,26 @@ +"""Chat loaders.""" + +from abc import ABC, abstractmethod +from collections.abc import Iterator + +from langchain_core.chat_sessions import ChatSession + + +class BaseChatLoader(ABC): + """Base class for chat loaders.""" + + @abstractmethod + def lazy_load(self) -> Iterator[ChatSession]: + """Lazy load the chat sessions. + + Returns: + An iterator of chat sessions. + """ + + def load(self) -> list[ChatSession]: + """Eagerly load the chat sessions into memory. + + Returns: + A list of chat sessions. + """ + return list(self.lazy_load()) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_sessions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_sessions.py new file mode 100644 index 0000000000000000000000000000000000000000..ed8c6343c506155511dba39250c7769b3c546325 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/chat_sessions.py @@ -0,0 +1,19 @@ +"""**Chat Sessions** are a collection of messages and function calls.""" + +from collections.abc import Sequence +from typing import TypedDict + +from langchain_core.messages import BaseMessage + + +class ChatSession(TypedDict, total=False): + """Chat Session. + + Chat Session represents a single conversation, channel, or other group of messages. + """ + + messages: Sequence[BaseMessage] + """A sequence of the LangChain chat messages loaded from the source.""" + + functions: Sequence[dict] + """A sequence of the function calling specs for the messages.""" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/cross_encoders.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/cross_encoders.py new file mode 100644 index 0000000000000000000000000000000000000000..7872daab2133ddf0e74e52f1f6976c8d77a0f688 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/cross_encoders.py @@ -0,0 +1,18 @@ +"""Cross Encoder interface.""" + +from abc import ABC, abstractmethod + + +class BaseCrossEncoder(ABC): + """Interface for cross encoder models.""" + + @abstractmethod + def score(self, text_pairs: list[tuple[str, str]]) -> list[float]: + """Score pairs' similarity. + + Args: + text_pairs: List of pairs of texts. + + Returns: + List of scores. + """ diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/env.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/env.py new file mode 100644 index 0000000000000000000000000000000000000000..240e62a8e6e0197ef3b536101eeb8b7f8de1297f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/env.py @@ -0,0 +1,22 @@ +"""Utilities for getting information about the runtime environment.""" + +import platform +from functools import lru_cache + +from langchain_core import __version__ + + +@lru_cache(maxsize=1) +def get_runtime_environment() -> dict: + """Get information about the LangChain runtime environment. + + Returns: + A dictionary with information about the runtime environment. + """ + return { + "library_version": __version__, + "library": "langchain-core", + "platform": platform.platform(), + "runtime": "python", + "runtime_version": platform.python_version(), + } diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/exceptions.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..f58754c9d5526082f75325eab6843ee41f7f84de --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/exceptions.py @@ -0,0 +1,111 @@ +"""Custom **exceptions** for LangChain.""" + +from enum import Enum +from typing import Any + + +class LangChainException(Exception): # noqa: N818 + """General LangChain exception.""" + + +class TracerException(LangChainException): + """Base class for exceptions in tracers module.""" + + +class OutputParserException(ValueError, LangChainException): # noqa: N818 + """Exception that output parsers should raise to signify a parsing error. + + This exists to differentiate parsing errors from other code or execution errors + that also may arise inside the output parser. + + `OutputParserException` will be available to catch and handle in ways to fix the + parsing error, while other errors will be raised. + """ + + def __init__( + self, + error: Any, + observation: str | None = None, + llm_output: str | None = None, + send_to_llm: bool = False, # noqa: FBT001,FBT002 + ): + """Create an `OutputParserException`. + + Args: + error: The error that's being re-raised or an error message. + observation: String explanation of error which can be passed to a model to + try and remediate the issue. + llm_output: String model output which is error-ing. + + send_to_llm: Whether to send the observation and llm_output back to an Agent + after an `OutputParserException` has been raised. + + This gives the underlying model driving the agent the context that the + previous output was improperly structured, in the hopes that it will + update the output to the correct format. + + Raises: + ValueError: If `send_to_llm` is `True` but either observation or + `llm_output` are not provided. + """ + if isinstance(error, str): + error = create_message( + message=error, error_code=ErrorCode.OUTPUT_PARSING_FAILURE + ) + + super().__init__(error) + if send_to_llm and (observation is None or llm_output is None): + msg = ( + "Arguments 'observation' & 'llm_output'" + " are required if 'send_to_llm' is True" + ) + raise ValueError(msg) + self.observation = observation + self.llm_output = llm_output + self.send_to_llm = send_to_llm + + +class ContextOverflowError(LangChainException): + """Exception raised when input exceeds the model's context limit. + + This exception is raised by chat models when the input tokens exceed + the maximum context window supported by the model. + """ + + +class ErrorCode(Enum): + """Error codes.""" + + INVALID_PROMPT_INPUT = "INVALID_PROMPT_INPUT" + INVALID_TOOL_RESULTS = "INVALID_TOOL_RESULTS" # Used in JS; not Py (yet) + MESSAGE_COERCION_FAILURE = "MESSAGE_COERCION_FAILURE" + MODEL_AUTHENTICATION = "MODEL_AUTHENTICATION" # Used in JS; not Py (yet) + MODEL_NOT_FOUND = "MODEL_NOT_FOUND" # Used in JS; not Py (yet) + MODEL_RATE_LIMIT = "MODEL_RATE_LIMIT" # Used in JS; not Py (yet) + OUTPUT_PARSING_FAILURE = "OUTPUT_PARSING_FAILURE" + + +def create_message(*, message: str, error_code: ErrorCode) -> str: + """Create a message with a link to the LangChain troubleshooting guide. + + Args: + message: The message to display. + error_code: The error code to display. + + Returns: + The full message with the troubleshooting link. + + Example: + ```python + create_message( + message="Failed to parse output", + error_code=ErrorCode.OUTPUT_PARSING_FAILURE, + ) + "Failed to parse output. For troubleshooting, visit: ..." + ``` + """ + return ( + f"{message}\n" + "For troubleshooting, visit: https://docs.langchain.com/oss/python/langchain" + f"/errors/{error_code.value} " + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/globals.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/globals.py new file mode 100644 index 0000000000000000000000000000000000000000..6880f675fd072050eeee2fdbe48e17a0870c41fc --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/globals.py @@ -0,0 +1,72 @@ +"""Global values and configuration that apply to all of LangChain.""" + +from typing import TYPE_CHECKING, Optional + +if TYPE_CHECKING: + from langchain_core.caches import BaseCache + + +# DO NOT USE THESE VALUES DIRECTLY! +# Use them only via `get_()` and `set_()` below, +# or else your code may behave unexpectedly with other uses of these global settings: +# https://github.com/langchain-ai/langchain/pull/11311#issuecomment-1743780004 +_verbose: bool = False +_debug: bool = False +_llm_cache: Optional["BaseCache"] = None + + +def set_verbose(value: bool) -> None: # noqa: FBT001 + """Set a new value for the `verbose` global setting. + + Args: + value: The new value for the `verbose` global setting. + """ + global _verbose # noqa: PLW0603 + _verbose = value + + +def get_verbose() -> bool: + """Get the value of the `verbose` global setting. + + Returns: + The value of the `verbose` global setting. + """ + return _verbose + + +def set_debug(value: bool) -> None: # noqa: FBT001 + """Set a new value for the `debug` global setting. + + Args: + value: The new value for the `debug` global setting. + """ + global _debug # noqa: PLW0603 + _debug = value + + +def get_debug() -> bool: + """Get the value of the `debug` global setting. + + Returns: + The value of the `debug` global setting. + """ + return _debug + + +def set_llm_cache(value: Optional["BaseCache"]) -> None: + """Set a new LLM cache, overwriting the previous value, if any. + + Args: + value: The new LLM cache to use. If `None`, the LLM cache is disabled. + """ + global _llm_cache # noqa: PLW0603 + _llm_cache = value + + +def get_llm_cache() -> Optional["BaseCache"]: + """Get the value of the `llm_cache` global setting. + + Returns: + The value of the `llm_cache` global setting. + """ + return _llm_cache diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/prompt_values.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/prompt_values.py new file mode 100644 index 0000000000000000000000000000000000000000..e85fe1efb4c0f419a63a7df93efc4683d7441b05 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/prompt_values.py @@ -0,0 +1,161 @@ +"""**Prompt values** for language model prompts. + +Prompt values are used to represent different pieces of prompts. They can be used to +represent text, images, or chat message pieces. +""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +from collections.abc import Sequence +from typing import Literal, cast + +from typing_extensions import TypedDict + +from langchain_core.load.serializable import Serializable +from langchain_core.messages import ( + AnyMessage, + BaseMessage, + HumanMessage, + get_buffer_string, +) + + +class PromptValue(Serializable, ABC): + """Base abstract class for inputs to any language model. + + `PromptValues` can be converted to both LLM (pure text-generation) inputs and + chat model inputs. + """ + + @classmethod + def is_lc_serializable(cls) -> bool: + """Return `True` as this class is serializable.""" + return True + + @classmethod + def get_lc_namespace(cls) -> list[str]: + """Get the namespace of the LangChain object. + + Returns: + `["langchain", "schema", "prompt"]` + """ + return ["langchain", "schema", "prompt"] + + @abstractmethod + def to_string(self) -> str: + """Return prompt value as string.""" + + @abstractmethod + def to_messages(self) -> list[BaseMessage]: + """Return prompt as a list of messages.""" + + +class StringPromptValue(PromptValue): + """String prompt value.""" + + text: str + """Prompt text.""" + + type: Literal["StringPromptValue"] = "StringPromptValue" + + @classmethod + def get_lc_namespace(cls) -> list[str]: + """Get the namespace of the LangChain object. + + Returns: + `["langchain", "prompts", "base"]` + """ + return ["langchain", "prompts", "base"] + + def to_string(self) -> str: + """Return prompt as string.""" + return self.text + + def to_messages(self) -> list[BaseMessage]: + """Return prompt as messages.""" + return [HumanMessage(content=self.text)] + + +class ChatPromptValue(PromptValue): + """Chat prompt value. + + A type of a prompt value that is built from messages. + """ + + messages: Sequence[BaseMessage] + """List of messages.""" + + def to_string(self) -> str: + """Return prompt as string.""" + return get_buffer_string(self.messages) + + def to_messages(self) -> list[BaseMessage]: + """Return prompt as a list of messages.""" + return list(self.messages) + + @classmethod + def get_lc_namespace(cls) -> list[str]: + """Get the namespace of the LangChain object. + + Returns: + `["langchain", "prompts", "chat"]` + """ + return ["langchain", "prompts", "chat"] + + +class ImageURL(TypedDict, total=False): + """Image URL for multimodal model inputs (OpenAI format). + + Represents the inner `image_url` object in OpenAI's Chat Completion API format. This + is used by `ImagePromptTemplate` and `ChatPromptTemplate`. + + See Also: + `ImageContentBlock`: LangChain's provider-agnostic image format used in message + content blocks. Use `ImageContentBlock` when working with the standardized + message format across different providers. + + Note: + The `detail` field values are not validated locally. Invalid values + will be rejected by the downstream API, allowing new valid values to + be used without requiring a LangChain update. + """ + + detail: Literal["auto", "low", "high"] + """Specifies the detail level of the image. + + Defaults to ``'auto'`` if not specified. Higher detail levels consume + more tokens but provide better image understanding. + """ + + url: str + """URL of the image or base64-encoded image data.""" + + +class ImagePromptValue(PromptValue): + """Image prompt value.""" + + image_url: ImageURL + """Image URL.""" + + type: Literal["ImagePromptValue"] = "ImagePromptValue" + + def to_string(self) -> str: + """Return prompt (image URL) as string.""" + return self.image_url.get("url", "") + + def to_messages(self) -> list[BaseMessage]: + """Return prompt (image URL) as messages.""" + return [HumanMessage(content=[cast("dict", self.image_url)])] + + +class ChatPromptValueConcrete(ChatPromptValue): + """Chat prompt value which explicitly lists out the message types it accepts. + + For use in external schemas. + """ + + messages: Sequence[AnyMessage] + """Sequence of messages.""" + + type: Literal["ChatPromptValueConcrete"] = "ChatPromptValueConcrete" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/rate_limiters.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/rate_limiters.py new file mode 100644 index 0000000000000000000000000000000000000000..8bc45b6b5b020117a8bd43957187bf95c88013b8 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/rate_limiters.py @@ -0,0 +1,256 @@ +"""Interface for a rate limiter and an in-memory rate limiter.""" + +from __future__ import annotations + +import abc +import asyncio +import threading +import time + + +class BaseRateLimiter(abc.ABC): + """Base class for rate limiters. + + Usage of the base limiter is through the acquire and aacquire methods depending + on whether running in a sync or async context. + + Implementations are free to add a timeout parameter to their initialize method + to allow users to specify a timeout for acquiring the necessary tokens when + using a blocking call. + + Current limitations: + + - Rate limiting information is not surfaced in tracing or callbacks. This means + that the total time it takes to invoke a chat model will encompass both + the time spent waiting for tokens and the time spent making the request. + """ + + @abc.abstractmethod + def acquire(self, *, blocking: bool = True) -> bool: + """Attempt to acquire the necessary tokens for the rate limiter. + + This method blocks until the required tokens are available if `blocking` + is set to `True`. + + If `blocking` is set to `False`, the method will immediately return the result + of the attempt to acquire the tokens. + + Args: + blocking: If `True`, the method will block until the tokens are available. + If `False`, the method will return immediately with the result of + the attempt. + + Returns: + `True` if the tokens were successfully acquired, `False` otherwise. + """ + + @abc.abstractmethod + async def aacquire(self, *, blocking: bool = True) -> bool: + """Attempt to acquire the necessary tokens for the rate limiter. + + This method blocks until the required tokens are available if `blocking` + is set to `True`. + + If `blocking` is set to `False`, the method will immediately return the result + of the attempt to acquire the tokens. + + Args: + blocking: If `True`, the method will block until the tokens are available. + If `False`, the method will return immediately with the result of + the attempt. + + Returns: + `True` if the tokens were successfully acquired, `False` otherwise. + """ + + +class InMemoryRateLimiter(BaseRateLimiter): + """An in memory rate limiter based on a token bucket algorithm. + + This is an in memory rate limiter, so it cannot rate limit across + different processes. + + The rate limiter only allows time-based rate limiting and does not + take into account any information about the input or the output, so it + cannot be used to rate limit based on the size of the request. + + It is thread safe and can be used in either a sync or async context. + + The in memory rate limiter is based on a token bucket. The bucket is filled + with tokens at a given rate. Each request consumes a token. If there are + not enough tokens in the bucket, the request is blocked until there are + enough tokens. + + These tokens have nothing to do with LLM tokens. They are just + a way to keep track of how many requests can be made at a given time. + + Current limitations: + + - The rate limiter is not designed to work across different processes. It is + an in-memory rate limiter, but it is thread safe. + - The rate limiter only supports time-based rate limiting. It does not take + into account the size of the request or any other factors. + + Example: + ```python + import time + + from langchain_core.rate_limiters import InMemoryRateLimiter + + rate_limiter = InMemoryRateLimiter( + requests_per_second=0.1, # <-- Can only make a request once every 10 seconds!! + check_every_n_seconds=0.1, # Wake up every 100 ms to check whether allowed to make a request, + max_bucket_size=10, # Controls the maximum burst size. + ) + + from langchain_anthropic import ChatAnthropic + + model = ChatAnthropic( + model_name="claude-sonnet-4-5-20250929", rate_limiter=rate_limiter + ) + + for _ in range(5): + tic = time.time() + model.invoke("hello") + toc = time.time() + print(toc - tic) + ``` + """ # noqa: E501 + + def __init__( + self, + *, + requests_per_second: float = 1, + check_every_n_seconds: float = 0.1, + max_bucket_size: float = 1, + ) -> None: + """A rate limiter based on a token bucket. + + These tokens have nothing to do with LLM tokens. They are just + a way to keep track of how many requests can be made at a given time. + + This rate limiter is designed to work in a threaded environment. + + It works by filling up a bucket with tokens at a given rate. Each + request consumes a given number of tokens. If there are not enough + tokens in the bucket, the request is blocked until there are enough + tokens. + + Args: + requests_per_second: The number of tokens to add per second to the bucket. + The tokens represent "credit" that can be used to make requests. + check_every_n_seconds: Check whether the tokens are available + every this many seconds. Can be a float to represent + fractions of a second. + max_bucket_size: The maximum number of tokens that can be in the bucket. + Must be at least `1`. Used to prevent bursts of requests. + """ + # Number of requests that we can make per second. + self.requests_per_second = requests_per_second + + # Number of tokens in the bucket. + self.available_tokens = 0.0 + + self.max_bucket_size = max_bucket_size + + # A lock to ensure that tokens can only be consumed by one thread + # at a given time. + self._consume_lock = threading.Lock() + + # The last time we tried to consume tokens. + self.last: float | None = None + + self.check_every_n_seconds = check_every_n_seconds + + def _consume(self) -> bool: + """Try to consume a token. + + Returns: + True means that the tokens were consumed, and the caller can proceed to + make the request. A False means that the tokens were not consumed, and + the caller should try again later. + """ + with self._consume_lock: + now = time.monotonic() + + # initialize on first call to avoid a burst + if self.last is None: + self.last = now + + elapsed = now - self.last + + if elapsed * self.requests_per_second >= 1: + self.available_tokens += elapsed * self.requests_per_second + self.last = now + + # Make sure that we don't exceed the bucket size. + # This is used to prevent bursts of requests. + self.available_tokens = min(self.available_tokens, self.max_bucket_size) + + # As long as we have at least one token, we can proceed. + if self.available_tokens >= 1: + self.available_tokens -= 1 + return True + + return False + + def acquire(self, *, blocking: bool = True) -> bool: + """Attempt to acquire a token from the rate limiter. + + This method blocks until the required tokens are available if `blocking` + is set to `True`. + + If `blocking` is set to `False`, the method will immediately return the result + of the attempt to acquire the tokens. + + Args: + blocking: If `True`, the method will block until the tokens are available. + If `False`, the method will return immediately with the result of + the attempt. + + Returns: + `True` if the tokens were successfully acquired, `False` otherwise. + """ + if not blocking: + return self._consume() + + while not self._consume(): + time.sleep(self.check_every_n_seconds) + + return True + + async def aacquire(self, *, blocking: bool = True) -> bool: + """Attempt to acquire a token from the rate limiter. Async version. + + This method blocks until the required tokens are available if `blocking` + is set to `True`. + + If `blocking` is set to `False`, the method will immediately return the result + of the attempt to acquire the tokens. + + Args: + blocking: If `True`, the method will block until the tokens are available. + If `False`, the method will return immediately with the result of + the attempt. + + Returns: + `True` if the tokens were successfully acquired, `False` otherwise. + """ + if not blocking: + return self._consume() + + while not self._consume(): # noqa: ASYNC110 + # This code ignores the ASYNC110 warning which is a false positive in this + # case. + # There is no external actor that can mark that the Event is done + # since the tokens are managed by the rate limiter itself. + # It needs to wake up to re-fill the tokens. + # https://docs.astral.sh/ruff/rules/async-busy-wait/ + await asyncio.sleep(self.check_every_n_seconds) + return True + + +__all__ = [ + "BaseRateLimiter", + "InMemoryRateLimiter", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/retrievers.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/retrievers.py new file mode 100644 index 0000000000000000000000000000000000000000..caaad5005af5604921ecb82e7ff713d8e65fe578 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/retrievers.py @@ -0,0 +1,328 @@ +"""**Retriever** class returns `Document` objects given a text **query**. + +It is more general than a vector store. A retriever does not need to be able to +store documents, only to return (or retrieve) it. Vector stores can be used as +the backbone of a retriever, but there are other types of retrievers as well. +""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +from inspect import signature +from typing import TYPE_CHECKING, Any + +from pydantic import ConfigDict +from typing_extensions import Self, TypedDict, override + +from langchain_core.callbacks.manager import AsyncCallbackManager, CallbackManager +from langchain_core.documents import Document +from langchain_core.runnables import ( + Runnable, + RunnableConfig, + RunnableSerializable, + ensure_config, +) +from langchain_core.runnables.config import run_in_executor + +if TYPE_CHECKING: + from langchain_core.callbacks.manager import ( + AsyncCallbackManagerForRetrieverRun, + CallbackManagerForRetrieverRun, + ) + +RetrieverInput = str +RetrieverOutput = list[Document] +RetrieverLike = Runnable[RetrieverInput, RetrieverOutput] +RetrieverOutputLike = Runnable[Any, RetrieverOutput] + + +class LangSmithRetrieverParams(TypedDict, total=False): + """LangSmith parameters for tracing.""" + + ls_retriever_name: str + """Retriever name.""" + + ls_vector_store_provider: str | None + """Vector store provider.""" + + ls_embedding_provider: str | None + """Embedding provider.""" + + ls_embedding_model: str | None + """Embedding model.""" + + +class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC): + """Abstract base class for a document retrieval system. + + A retrieval system is defined as something that can take string queries and return + the most 'relevant' documents from some source. + + Usage: + + A retriever follows the standard `Runnable` interface, and should be used via the + standard `Runnable` methods of `invoke`, `ainvoke`, `batch`, `abatch`. + + Implementation: + + When implementing a custom retriever, the class should implement the + `_get_relevant_documents` method to define the logic for retrieving documents. + + Optionally, an async native implementations can be provided by overriding the + `_aget_relevant_documents` method. + + !!! example "Retriever that returns the first 5 documents from a list of documents" + + ```python + from langchain_core.documents import Document + from langchain_core.retrievers import BaseRetriever + + class SimpleRetriever(BaseRetriever): + docs: list[Document] + k: int = 5 + + def _get_relevant_documents(self, query: str) -> list[Document]: + \"\"\"Return the first k documents from the list of documents\"\"\" + return self.docs[:self.k] + + async def _aget_relevant_documents(self, query: str) -> list[Document]: + \"\"\"(Optional) async native implementation.\"\"\" + return self.docs[:self.k] + ``` + + !!! example "Simple retriever based on a scikit-learn vectorizer" + + ```python + from sklearn.metrics.pairwise import cosine_similarity + + + class TFIDFRetriever(BaseRetriever, BaseModel): + vectorizer: Any + docs: list[Document] + tfidf_array: Any + k: int = 4 + + class Config: + arbitrary_types_allowed = True + + def _get_relevant_documents(self, query: str) -> list[Document]: + # Ip -- (n_docs,x), Op -- (n_docs,n_Feats) + query_vec = self.vectorizer.transform([query]) + # Op -- (n_docs,1) -- Cosine Sim with each doc + results = cosine_similarity(self.tfidf_array, query_vec).reshape((-1,)) + return [self.docs[i] for i in results.argsort()[-self.k :][::-1]] + ``` + """ + + model_config = ConfigDict( + arbitrary_types_allowed=True, + ) + + _new_arg_supported: bool = False + + _expects_other_args: bool = False + + tags: list[str] | None = None + """Optional list of tags associated with the retriever. + + These tags will be associated with each call to this retriever, + and passed as arguments to the handlers defined in `callbacks`. + + You can use these to eg identify a specific instance of a retriever with its + use case. + """ + + metadata: dict[str, Any] | None = None + """Optional metadata associated with the retriever. + + This metadata will be associated with each call to this retriever, + and passed as arguments to the handlers defined in `callbacks`. + + You can use these to eg identify a specific instance of a retriever with its + use case. + """ + + @override + def __init_subclass__(cls, **kwargs: Any) -> None: + super().__init_subclass__(**kwargs) + parameters = signature(cls._get_relevant_documents).parameters + cls._new_arg_supported = parameters.get("run_manager") is not None + if ( + not cls._new_arg_supported + and cls._aget_relevant_documents == BaseRetriever._aget_relevant_documents + ): + # we need to tolerate no run_manager in _aget_relevant_documents signature + async def _aget_relevant_documents( + self: Self, query: str + ) -> list[Document]: + return await run_in_executor(None, self._get_relevant_documents, query) # type: ignore[call-arg] + + cls._aget_relevant_documents = _aget_relevant_documents # type: ignore[assignment] + + # If a V1 retriever broke the interface and expects additional arguments + cls._expects_other_args = ( + len(set(parameters.keys()) - {"self", "query", "run_manager"}) > 0 + ) + + def _get_ls_params(self, **_kwargs: Any) -> LangSmithRetrieverParams: + """Get standard params for tracing.""" + default_retriever_name = self.get_name() + if default_retriever_name.startswith("Retriever"): + default_retriever_name = default_retriever_name[9:] + elif default_retriever_name.endswith("Retriever"): + default_retriever_name = default_retriever_name[:-9] + default_retriever_name = default_retriever_name.lower() + + return LangSmithRetrieverParams(ls_retriever_name=default_retriever_name) + + @override + def invoke( + self, input: str, config: RunnableConfig | None = None, **kwargs: Any + ) -> list[Document]: + """Invoke the retriever to get relevant documents. + + Main entry point for synchronous retriever invocations. + + Args: + input: The query string. + config: Configuration for the retriever. + **kwargs: Additional arguments to pass to the retriever. + + Returns: + List of relevant documents. + + Examples: + ```python + retriever.invoke("query") + ``` + """ + config = ensure_config(config) + inheritable_metadata = { + **(config.get("metadata") or {}), + **self._get_ls_params(**kwargs), + } + callback_manager = CallbackManager.configure( + config.get("callbacks"), + None, + verbose=kwargs.get("verbose", False), + inheritable_tags=config.get("tags"), + local_tags=self.tags, + inheritable_metadata=inheritable_metadata, + local_metadata=self.metadata, + ) + run_manager = callback_manager.on_retriever_start( + None, + input, + name=config.get("run_name") or self.get_name(), + run_id=kwargs.pop("run_id", None), + ) + try: + kwargs_ = kwargs if self._expects_other_args else {} + if self._new_arg_supported: + result = self._get_relevant_documents( + input, run_manager=run_manager, **kwargs_ + ) + else: + result = self._get_relevant_documents(input, **kwargs_) + except Exception as e: + run_manager.on_retriever_error(e) + raise + else: + run_manager.on_retriever_end( + result, + ) + return result + + @override + async def ainvoke( + self, + input: str, + config: RunnableConfig | None = None, + **kwargs: Any, + ) -> list[Document]: + """Asynchronously invoke the retriever to get relevant documents. + + Main entry point for asynchronous retriever invocations. + + Args: + input: The query string. + config: Configuration for the retriever. + **kwargs: Additional arguments to pass to the retriever. + + Returns: + List of relevant documents. + + Examples: + ```python + await retriever.ainvoke("query") + ``` + """ + config = ensure_config(config) + inheritable_metadata = { + **(config.get("metadata") or {}), + **self._get_ls_params(**kwargs), + } + callback_manager = AsyncCallbackManager.configure( + config.get("callbacks"), + None, + verbose=kwargs.get("verbose", False), + inheritable_tags=config.get("tags"), + local_tags=self.tags, + inheritable_metadata=inheritable_metadata, + local_metadata=self.metadata, + ) + run_manager = await callback_manager.on_retriever_start( + None, + input, + name=config.get("run_name") or self.get_name(), + run_id=kwargs.pop("run_id", None), + ) + try: + kwargs_ = kwargs if self._expects_other_args else {} + if self._new_arg_supported: + result = await self._aget_relevant_documents( + input, run_manager=run_manager, **kwargs_ + ) + else: + result = await self._aget_relevant_documents(input, **kwargs_) + except Exception as e: + await run_manager.on_retriever_error(e) + raise + else: + await run_manager.on_retriever_end( + result, + ) + return result + + @abstractmethod + def _get_relevant_documents( + self, query: str, *, run_manager: CallbackManagerForRetrieverRun + ) -> list[Document]: + """Get documents relevant to a query. + + Args: + query: String to find relevant documents for. + run_manager: The callback handler to use. + + Returns: + List of relevant documents. + """ + + async def _aget_relevant_documents( + self, query: str, *, run_manager: AsyncCallbackManagerForRetrieverRun + ) -> list[Document]: + """Asynchronously get documents relevant to a query. + + Args: + query: String to find relevant documents for + run_manager: The callback handler to use + + Returns: + List of relevant documents + """ + return await run_in_executor( + None, + self._get_relevant_documents, + query, + run_manager=run_manager.get_sync(), + ) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/stores.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/stores.py new file mode 100644 index 0000000000000000000000000000000000000000..080fe03225c191b2ec6e0b193ffe34be60a971d1 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/stores.py @@ -0,0 +1,291 @@ +"""**Store** implements the key-value stores and storage helpers. + +Module provides implementations of various key-value stores that conform +to a simple key-value interface. + +The primary goal of these storages is to support implementation of caching. +""" + +from abc import ABC, abstractmethod +from collections.abc import AsyncIterator, Iterator, Sequence +from typing import ( + Any, + Generic, + TypeVar, +) + +from typing_extensions import override + +from langchain_core.exceptions import LangChainException +from langchain_core.runnables import run_in_executor + +K = TypeVar("K") +V = TypeVar("V") + + +class BaseStore(ABC, Generic[K, V]): + """Abstract interface for a key-value store. + + This is an interface that's meant to abstract away the details of different + key-value stores. It provides a simple interface for getting, setting, and deleting + key-value pairs. + + The basic methods are `mget`, `mset`, and `mdelete` for getting, setting, and + deleting multiple key-value pairs at once. The `yield_keys` method is used to + iterate over keys that match a given prefix. + + The async versions of these methods are also provided, which are meant to be used in + async contexts. The async methods are named with an `a` prefix, e.g., `amget`, + `amset`, `amdelete`, and `ayield_keys`. + + By default, the `amget`, `amset`, `amdelete`, and `ayield_keys` methods are + implemented using the synchronous methods. If the store can natively support async + operations, it should override these methods. + + By design the methods only accept batches of keys and values, and not single keys or + values. This is done to force user code to work with batches which will usually be + more efficient by saving on round trips to the store. + + Examples: + ```python + from langchain.storage import BaseStore + + + class MyInMemoryStore(BaseStore[str, int]): + def __init__(self) -> None: + self.store: dict[str, int] = {} + + def mget(self, keys: Sequence[str]) -> list[int | None]: + return [self.store.get(key) for key in keys] + + def mset(self, key_value_pairs: Sequence[tuple[str, int]]) -> None: + for key, value in key_value_pairs: + self.store[key] = value + + def mdelete(self, keys: Sequence[str]) -> None: + for key in keys: + if key in self.store: + del self.store[key] + + def yield_keys(self, prefix: str | None = None) -> Iterator[str]: + if prefix is None: + yield from self.store.keys() + else: + for key in self.store.keys(): + if key.startswith(prefix): + yield key + ``` + """ + + @abstractmethod + def mget(self, keys: Sequence[K]) -> list[V | None]: + """Get the values associated with the given keys. + + Args: + keys: A sequence of keys. + + Returns: + A sequence of optional values associated with the keys. + If a key is not found, the corresponding value will be `None`. + """ + + async def amget(self, keys: Sequence[K]) -> list[V | None]: + """Async get the values associated with the given keys. + + Args: + keys: A sequence of keys. + + Returns: + A sequence of optional values associated with the keys. + If a key is not found, the corresponding value will be `None`. + """ + return await run_in_executor(None, self.mget, keys) + + @abstractmethod + def mset(self, key_value_pairs: Sequence[tuple[K, V]]) -> None: + """Set the values for the given keys. + + Args: + key_value_pairs: A sequence of key-value pairs. + """ + + async def amset(self, key_value_pairs: Sequence[tuple[K, V]]) -> None: + """Async set the values for the given keys. + + Args: + key_value_pairs: A sequence of key-value pairs. + """ + return await run_in_executor(None, self.mset, key_value_pairs) + + @abstractmethod + def mdelete(self, keys: Sequence[K]) -> None: + """Delete the given keys and their associated values. + + Args: + keys: A sequence of keys to delete. + """ + + async def amdelete(self, keys: Sequence[K]) -> None: + """Async delete the given keys and their associated values. + + Args: + keys: A sequence of keys to delete. + """ + return await run_in_executor(None, self.mdelete, keys) + + @abstractmethod + def yield_keys(self, *, prefix: str | None = None) -> Iterator[K] | Iterator[str]: + """Get an iterator over keys that match the given prefix. + + Args: + prefix: The prefix to match. + + Yields: + An iterator over keys that match the given prefix. + + This method is allowed to return an iterator over either K or str + depending on what makes more sense for the given store. + """ + + async def ayield_keys( + self, *, prefix: str | None = None + ) -> AsyncIterator[K] | AsyncIterator[str]: + """Async get an iterator over keys that match the given prefix. + + Args: + prefix: The prefix to match. + + Yields: + The keys that match the given prefix. + + This method is allowed to return an iterator over either K or str + depending on what makes more sense for the given store. + """ + iterator = await run_in_executor(None, self.yield_keys, prefix=prefix) + done = object() + while True: + item = await run_in_executor(None, lambda it: next(it, done), iterator) + if item is done: + break + yield item # type: ignore[misc] + + +ByteStore = BaseStore[str, bytes] + + +class InMemoryBaseStore(BaseStore[str, V], Generic[V]): + """In-memory implementation of the `BaseStore` using a dictionary.""" + + def __init__(self) -> None: + """Initialize an empty store.""" + self.store: dict[str, V] = {} + + @override + def mget(self, keys: Sequence[str]) -> list[V | None]: + return [self.store.get(key) for key in keys] + + @override + async def amget(self, keys: Sequence[str]) -> list[V | None]: + return self.mget(keys) + + @override + def mset(self, key_value_pairs: Sequence[tuple[str, V]]) -> None: + for key, value in key_value_pairs: + self.store[key] = value + + @override + async def amset(self, key_value_pairs: Sequence[tuple[str, V]]) -> None: + return self.mset(key_value_pairs) + + @override + def mdelete(self, keys: Sequence[str]) -> None: + for key in keys: + if key in self.store: + del self.store[key] + + @override + async def amdelete(self, keys: Sequence[str]) -> None: + self.mdelete(keys) + + def yield_keys(self, *, prefix: str | None = None) -> Iterator[str]: + """Get an iterator over keys that match the given prefix. + + Args: + prefix: The prefix to match. + + Yields: + The keys that match the given prefix. + """ + if prefix is None: + yield from self.store.keys() + else: + for key in self.store: + if key.startswith(prefix): + yield key + + async def ayield_keys(self, *, prefix: str | None = None) -> AsyncIterator[str]: + """Async get an async iterator over keys that match the given prefix. + + Args: + prefix: The prefix to match. + + Yields: + The keys that match the given prefix. + """ + if prefix is None: + for key in self.store: + yield key + else: + for key in self.store: + if key.startswith(prefix): + yield key + + +class InMemoryStore(InMemoryBaseStore[Any]): + """In-memory store for any type of data. + + Attributes: + store: The underlying dictionary that stores the key-value pairs. + + Examples: + ```python + from langchain.storage import InMemoryStore + + store = InMemoryStore() + store.mset([("key1", "value1"), ("key2", "value2")]) + store.mget(["key1", "key2"]) + # ['value1', 'value2'] + store.mdelete(["key1"]) + list(store.yield_keys()) + # ['key2'] + list(store.yield_keys(prefix="k")) + # ['key2'] + ``` + """ + + +class InMemoryByteStore(InMemoryBaseStore[bytes]): + """In-memory store for bytes. + + Attributes: + store: The underlying dictionary that stores the key-value pairs. + + Examples: + ```python + from langchain.storage import InMemoryByteStore + + store = InMemoryByteStore() + store.mset([("key1", b"value1"), ("key2", b"value2")]) + store.mget(["key1", "key2"]) + # [b'value1', b'value2'] + store.mdelete(["key1"]) + list(store.yield_keys()) + # ['key2'] + list(store.yield_keys(prefix="k")) + # ['key2'] + ``` + """ + + +class InvalidKeyException(LangChainException): + """Raised when a key is invalid; e.g., uses incorrect characters.""" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/structured_query.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/structured_query.py new file mode 100644 index 0000000000000000000000000000000000000000..84dcd9a5c281a9d4667d63b07813c52751c33b00 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/structured_query.py @@ -0,0 +1,203 @@ +"""Internal representation of a structured query language.""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +from enum import Enum +from typing import TYPE_CHECKING, Any + +from pydantic import BaseModel + +if TYPE_CHECKING: + from collections.abc import Sequence + + +class Visitor(ABC): + """Defines interface for IR translation using a visitor pattern.""" + + allowed_comparators: Sequence[Comparator] | None = None + """Allowed comparators for the visitor.""" + + allowed_operators: Sequence[Operator] | None = None + """Allowed operators for the visitor.""" + + def _validate_func(self, func: Operator | Comparator) -> None: + if ( + isinstance(func, Operator) + and self.allowed_operators is not None + and func not in self.allowed_operators + ): + msg = ( + f"Received disallowed operator {func}. Allowed " + f"comparators are {self.allowed_operators}" + ) + raise ValueError(msg) + if ( + isinstance(func, Comparator) + and self.allowed_comparators is not None + and func not in self.allowed_comparators + ): + msg = ( + f"Received disallowed comparator {func}. Allowed " + f"comparators are {self.allowed_comparators}" + ) + raise ValueError(msg) + + @abstractmethod + def visit_operation(self, operation: Operation) -> Any: + """Translate an Operation. + + Args: + operation: Operation to translate. + """ + + @abstractmethod + def visit_comparison(self, comparison: Comparison) -> Any: + """Translate a Comparison. + + Args: + comparison: Comparison to translate. + """ + + @abstractmethod + def visit_structured_query(self, structured_query: StructuredQuery) -> Any: + """Translate a StructuredQuery. + + Args: + structured_query: StructuredQuery to translate. + """ + + +def _to_snake_case(name: str) -> str: + """Convert a name into snake_case.""" + snake_case = "" + for i, char in enumerate(name): + if char.isupper() and i != 0: + snake_case += "_" + char.lower() + else: + snake_case += char.lower() + return snake_case + + +class Expr(BaseModel): + """Base class for all expressions.""" + + def accept(self, visitor: Visitor) -> Any: + """Accept a visitor. + + Args: + visitor: visitor to accept. + + Returns: + result of visiting. + """ + return getattr(visitor, f"visit_{_to_snake_case(self.__class__.__name__)}")( + self + ) + + +class Operator(str, Enum): + """Enumerator of the operations.""" + + AND = "and" + OR = "or" + NOT = "not" + + +class Comparator(str, Enum): + """Enumerator of the comparison operators.""" + + EQ = "eq" + NE = "ne" + GT = "gt" + GTE = "gte" + LT = "lt" + LTE = "lte" + CONTAIN = "contain" + LIKE = "like" + IN = "in" + NIN = "nin" + + +class FilterDirective(Expr, ABC): + """Filtering expression.""" + + +class Comparison(FilterDirective): + """Comparison to a value.""" + + comparator: Comparator + """The comparator to use.""" + + attribute: str + """The attribute to compare.""" + + value: Any + """The value to compare to.""" + + def __init__( + self, comparator: Comparator, attribute: str, value: Any, **kwargs: Any + ) -> None: + """Create a Comparison. + + Args: + comparator: The comparator to use. + attribute: The attribute to compare. + value: The value to compare to. + """ + # super exists from BaseModel + super().__init__( + comparator=comparator, attribute=attribute, value=value, **kwargs + ) + + +class Operation(FilterDirective): + """Logical operation over other directives.""" + + operator: Operator + """The operator to use.""" + + arguments: list[FilterDirective] + """The arguments to the operator.""" + + def __init__( + self, operator: Operator, arguments: list[FilterDirective], **kwargs: Any + ) -> None: + """Create an Operation. + + Args: + operator: The operator to use. + arguments: The arguments to the operator. + """ + # super exists from BaseModel + super().__init__(operator=operator, arguments=arguments, **kwargs) + + +class StructuredQuery(Expr): + """Structured query.""" + + query: str + """Query string.""" + + filter: FilterDirective | None + """Filtering expression.""" + + limit: int | None + """Limit on the number of results.""" + + def __init__( + self, + query: str, + filter: FilterDirective | None, # noqa: A002 + limit: int | None = None, + **kwargs: Any, + ) -> None: + """Create a StructuredQuery. + + Args: + query: The query string. + filter: The filtering expression. + limit: The limit on the number of results. + """ + # super exists from BaseModel + super().__init__(query=query, filter=filter, limit=limit, **kwargs) diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/sys_info.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/sys_info.py new file mode 100644 index 0000000000000000000000000000000000000000..e30a7e925ba7e9b31d7e026460ef24d1813b242f --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/sys_info.py @@ -0,0 +1,137 @@ +"""Print information about the system and langchain packages for debugging purposes.""" + +import pkgutil +import platform +import re +import sys +from collections.abc import Sequence +from importlib import metadata, util + + +def _get_sub_deps(packages: Sequence[str]) -> list[str]: + """Get any specified sub-dependencies.""" + sub_deps = set() + underscored_packages = {pkg.replace("-", "_") for pkg in packages} + + for pkg in packages: + try: + required = metadata.requires(pkg) + except metadata.PackageNotFoundError: + continue + + if not required: + continue + + for req in required: + # Extract package name (e.g., "httpx<1,>=0.23.0" -> "httpx") + match = re.match(r"^([a-zA-Z0-9_.-]+)", req) + if match: + pkg_name = match.group(1) + if pkg_name.replace("-", "_") not in underscored_packages: + sub_deps.add(pkg_name) + + return sorted(sub_deps, key=lambda x: x.lower()) + + +def print_sys_info(*, additional_pkgs: Sequence[str] = ()) -> None: + """Print information about the environment for debugging purposes. + + Args: + additional_pkgs: Additional packages to include in the output. + """ + # Packages that do not start with "langchain" prefix. + other_langchain_packages = [ + "langsmith", + "deepagents", + "deepagents-cli", + ] + + langchain_pkgs = [ + name for _, name, _ in pkgutil.iter_modules() if name.startswith("langchain") + ] + + langgraph_pkgs = [ + name for _, name, _ in pkgutil.iter_modules() if name.startswith("langgraph") + ] + + all_packages = sorted( + set( + langchain_pkgs + + langgraph_pkgs + + other_langchain_packages + + list(additional_pkgs) + ) + ) + + # Always surface these packages to the top + order_by = ["langchain_core", "langchain", "langchain_community", "langsmith"] + + for pkg in reversed(order_by): + if pkg in all_packages: + all_packages.remove(pkg) + all_packages = [pkg, *list(all_packages)] + + system_info = { + "OS": platform.system(), + "OS Version": platform.version(), + "Python Version": sys.version, + } + print() + print("System Information") + print("------------------") + print("> OS: ", system_info["OS"]) + print("> OS Version: ", system_info["OS Version"]) + print("> Python Version: ", system_info["Python Version"]) + + # Print out only langchain packages + print() + print("Package Information") + print("-------------------") + + not_installed = [] + + for pkg in all_packages: + try: + found_package = util.find_spec(pkg) + except Exception: + found_package = None + if found_package is None: + not_installed.append(pkg) + continue + + # Package version + try: + package_version = metadata.version(pkg) + except Exception: + package_version = None + + # Print package with version + if package_version is not None: + print(f"> {pkg}: {package_version}") + + if not_installed: + print() + print("Optional packages not installed") + print("-------------------------------") + for pkg in not_installed: + print(f"> {pkg}") + + sub_dependencies = _get_sub_deps(all_packages) + + if sub_dependencies: + print() + print("Other Dependencies") + print("------------------") + + for dep in sub_dependencies: + try: + dep_version = metadata.version(dep) + except Exception: + dep_version = None + + if dep_version is not None: + print(f"> {dep}: {dep_version}") + + +if __name__ == "__main__": + print_sys_info() diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/version.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/version.py new file mode 100644 index 0000000000000000000000000000000000000000..ac08df448164a133ddcd82460ba3af4ec68bad8c --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_core/version.py @@ -0,0 +1,3 @@ +"""langchain-core version information and utilities.""" + +VERSION = "1.4.0" diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..b5ca587d1c5ef798ab086d837dc7b47aae576558 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/METADATA @@ -0,0 +1,81 @@ +Metadata-Version: 2.4 +Name: langchain-huggingface +Version: 1.2.2 +Summary: An integration package connecting Hugging Face and LangChain. +Project-URL: Homepage, https://docs.langchain.com/oss/python/integrations/providers/huggingface +Project-URL: Documentation, https://reference.langchain.com/python/integrations/langchain_huggingface/ +Project-URL: Repository, https://github.com/langchain-ai/langchain +Project-URL: Issues, https://github.com/langchain-ai/langchain/issues +Project-URL: Changelog, https://github.com/langchain-ai/langchain/releases?q=%22langchain-huggingface%22 +Project-URL: Twitter, https://x.com/LangChain +Project-URL: Slack, https://www.langchain.com/join-community +Project-URL: Reddit, https://www.reddit.com/r/LangChain/ +License: MIT +License-File: LICENSE +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +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: Topic :: Scientific/Engineering :: Artificial Intelligence +Requires-Python: <4.0.0,>=3.10.0 +Requires-Dist: huggingface-hub<2.0.0,>=0.33.4 +Requires-Dist: langchain-core<2.0.0,>=1.2.31 +Requires-Dist: tokenizers<1.0.0,>=0.19.1 +Provides-Extra: full +Requires-Dist: sentence-transformers<6.0.0,>=5.2.0; extra == 'full' +Requires-Dist: transformers<6.0.0,>=5.0.0; extra == 'full' +Description-Content-Type: text/markdown + +# langchain-huggingface + +[![PyPI - Version](https://img.shields.io/pypi/v/langchain-huggingface?label=%20)](https://pypi.org/project/langchain-huggingface/#history) +[![PyPI - License](https://img.shields.io/pypi/l/langchain-huggingface)](https://opensource.org/licenses/MIT) +[![PyPI - Downloads](https://img.shields.io/pepy/dt/langchain-huggingface)](https://pypistats.org/packages/langchain-huggingface) +[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain) + +Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs). + +## Quick Install + +```bash +pip install langchain-huggingface +``` + +> **Note:** The base install does not include `sentence-transformers` or `transformers`. +> If you plan to use `HuggingFaceEmbeddings` or `HuggingFacePipeline` for **local inference**, +> install the `[full]` extra which includes `sentence-transformers>=5.2.0` and `transformers>=5.0.0`: +> +> ```bash +> pip install langchain-huggingface[full] +> ``` +> +> **Migrating from `langchain-community`?** Note that `langchain-community` accepted +> `sentence-transformers>=2.2.0`, but `langchain-huggingface[full]` requires `>=5.2.0`. +> If your project pins an older version, upgrade it: +> +> ```bash +> pip install "sentence-transformers>=5.2.0" +> ``` + +## 🤔 What is this? + +This package contains the LangChain integrations for Hugging Face related classes. + +## 📖 Documentation + +For full documentation, see the [API reference](https://reference.langchain.com/python/integrations/langchain_huggingface/). For conceptual guides, tutorials, and examples on using these classes, see the [LangChain Docs](https://docs.langchain.com/oss/python/integrations/providers/huggingface). + +## 📕 Releases & Versioning + +See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies. + +## 💁 Contributing + +As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation. + +For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview). diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..aae014301ed7eccf585ef0561f99df6ef428d185 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/RECORD @@ -0,0 +1,35 @@ +langchain_huggingface-1.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +langchain_huggingface-1.2.2.dist-info/METADATA,sha256=k1cp5djcfd22brxOKUAZJjRoRg7TEOkxm2dAqhbTsQo,3975 +langchain_huggingface-1.2.2.dist-info/RECORD,, +langchain_huggingface-1.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_huggingface-1.2.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +langchain_huggingface-1.2.2.dist-info/licenses/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072 +langchain_huggingface/__init__.py,sha256=wsNf7QiVMFG6Qt5MR5ausxZLflZvLL59iRHR2VLo-Vk,514 +langchain_huggingface/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/chat_models/__init__.py,sha256=_EYjPxCroXW5mdeK_I5JodtbDMGAmSN-W4XSYX-LcS0,272 +langchain_huggingface/chat_models/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/chat_models/__pycache__/huggingface.cpython-311.pyc,, +langchain_huggingface/chat_models/huggingface.py,sha256=tROTjVsClKlwc9Hcw7Tkk_BAXnGahxLBQKO0aKK7HYE,48226 +langchain_huggingface/data/__init__.py,sha256=ZoM4a1AEp0HdKyqqNyDl5fFsGhGaKbzP1WVtiYIb4ec,82 +langchain_huggingface/data/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/data/__pycache__/_profiles.cpython-311.pyc,, +langchain_huggingface/data/_profiles.py,sha256=Le1tr18OiZsRtjvWf0EhQ0HBouvFQ4MSzXQ8R3cAb7c,14275 +langchain_huggingface/embeddings/__init__.py,sha256=EuQ6FIK-B-OoiJv4gMRTpoNE-n66NH45zK75Fgkjp34,308 +langchain_huggingface/embeddings/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/embeddings/__pycache__/huggingface.cpython-311.pyc,, +langchain_huggingface/embeddings/__pycache__/huggingface_endpoint.cpython-311.pyc,, +langchain_huggingface/embeddings/huggingface.py,sha256=KG1GevXt0c3dlBFSrLhsmXtAqi-N7af5QTkHcmJlRFc,6439 +langchain_huggingface/embeddings/huggingface_endpoint.py,sha256=axaV9gwKglCIeEYDSQIktuufoeJ61sWpqr1B0yCYacM,5960 +langchain_huggingface/llms/__init__.py,sha256=DLdtwGEmMrYl6pjfYZTK7OydrBD3wVgZpW5othyMGDU,272 +langchain_huggingface/llms/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/llms/__pycache__/huggingface_endpoint.cpython-311.pyc,, +langchain_huggingface/llms/__pycache__/huggingface_pipeline.cpython-311.pyc,, +langchain_huggingface/llms/huggingface_endpoint.py,sha256=9gTtdb9Er28bM1iTvbcAdAapma4yWMQhzIDF4Z0bZys,17371 +langchain_huggingface/llms/huggingface_pipeline.py,sha256=AAPyF4bqnxXi9SGpyiLmBPnB7QmM5gJeEQv4LIObqNc,14788 +langchain_huggingface/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_huggingface/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_huggingface/tests/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/tests/integration_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_huggingface/tests/integration_tests/__pycache__/__init__.cpython-311.pyc,, +langchain_huggingface/utils/__pycache__/import_utils.cpython-311.pyc,, +langchain_huggingface/utils/import_utils.py,sha256=VZ2dqkHkxf8QyFmYiCRJoPqMPORCsytPp2qHPeAfguo,3349 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/REQUESTED b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface-1.2.2.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a64efaa4812a2975494e14aae24a8135c2b053b7 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface/__init__.py @@ -0,0 +1,21 @@ +"""Hugging Face integration for LangChain.""" + +from langchain_huggingface.chat_models import ( + ChatHuggingFace, # type: ignore[import-not-found] +) +from langchain_huggingface.embeddings import ( + HuggingFaceEmbeddings, + HuggingFaceEndpointEmbeddings, +) +from langchain_huggingface.llms import ( + HuggingFaceEndpoint, + HuggingFacePipeline, +) + +__all__ = [ + "ChatHuggingFace", + "HuggingFaceEmbeddings", + "HuggingFaceEndpoint", + "HuggingFaceEndpointEmbeddings", + "HuggingFacePipeline", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_huggingface/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..d2aeed5fe20f2f9d623f8509360a46475e4c35ac --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/METADATA @@ -0,0 +1,67 @@ +Metadata-Version: 2.4 +Name: langchain-protocol +Version: 0.0.15 +Summary: Python bindings for the LangChain agent streaming protocol +Project-URL: Homepage, https://github.com/langchain-ai/agent-protocol/tree/main/streaming +Project-URL: Repository, https://github.com/langchain-ai/agent-protocol +Project-URL: Issues, https://github.com/langchain-ai/agent-protocol/issues +License: MIT +License-File: LICENSE +Classifier: Development Status :: 3 - Alpha +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +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: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: <4.0.0,>=3.10.0 +Requires-Dist: typing-extensions<5.0.0,>=4.7.0 +Description-Content-Type: text/markdown + +# langchain-protocol + +Python bindings for the [LangChain agent streaming protocol][streaming]. + +This package provides generated `TypedDict` and `Literal` definitions for the +protocol's commands, events, results, and payload shapes. It does not include a +runtime client, transport, or helper APIs — it is intended as a source of +typing primitives only. + +The types are generated from [`protocol.cddl`][cddl], the source of truth for +the wire format. See the [streaming protocol overview][streaming] for the +full design, channel model, and transport details. + +[streaming]: https://github.com/langchain-ai/agent-protocol/tree/main/streaming +[cddl]: https://github.com/langchain-ai/agent-protocol/blob/main/streaming/protocol.cddl + +## Installation + +```bash +pip install langchain-protocol +``` + +## Usage + +```python +from langchain_protocol import Command, SubscribeParams + +params: SubscribeParams = { + "channels": ["messages", "lifecycle"], +} + +subscribe: Command = { + "id": 1, + "method": "subscription.subscribe", + "params": params, +} +``` + +## What this package includes + +- `TypedDict` definitions for commands, events, results, and payload shapes +- `Literal` and union aliases for protocol enums and tagged unions +- A `py.typed` marker so type checkers pick up the bundled annotations diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..d183c7214b713a30f0367a488ebd270e1aa493b2 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/RECORD @@ -0,0 +1,10 @@ +langchain_protocol-0.0.15.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +langchain_protocol-0.0.15.dist-info/METADATA,sha256=5rQYngggOty8si_FDkbBsxhRUb-bHewYXvbQ1_33IpQ,2405 +langchain_protocol-0.0.15.dist-info/RECORD,, +langchain_protocol-0.0.15.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +langchain_protocol-0.0.15.dist-info/licenses/LICENSE,sha256=iT5uMCdYlpEsIcd_n3wRKrqF_ZhdBbJqKUJM9-UR0Xc,1072 +langchain_protocol/__init__.py,sha256=wg507LjA9xPpxi5lGE4cs8neiRUB6UKfMqYfr1sVhNo,123 +langchain_protocol/__pycache__/__init__.cpython-311.pyc,, +langchain_protocol/__pycache__/protocol.cpython-311.pyc,, +langchain_protocol/protocol.py,sha256=3sEwk5CTk8FE95e3kfuB2kFU760RhTrZhWbmdePWqew,17330 +langchain_protocol/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol-0.0.15.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a06d86f467ebc503dc2b00b468818577d3a384cb --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/__init__.py @@ -0,0 +1,3 @@ +"""Python bindings for the LangChain agent streaming protocol.""" + +from langchain_protocol.protocol import * # noqa: F403 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/protocol.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/protocol.py new file mode 100644 index 0000000000000000000000000000000000000000..0769fa7c2f8d4019ef39459a2119427031e840d9 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/protocol.py @@ -0,0 +1,578 @@ +# compiled with https://www.npmjs.com/package/cddl2py v0.2.2 + +from __future__ import annotations + +from typing import Annotated, Any, Literal, Union +from typing_extensions import NotRequired, TypedDict + +JsInt = int + +JsUint = int + +Namespace = list[str] + +Extensible = dict[str, Any] + +Timestamp = int + +MetadataScalar = Union[None, bool, int, float, str] + +MessageRole = Union[Literal["ai"], Literal["human"], Literal["system"]] + +class MessageMetadata(TypedDict, extra_items=MetadataScalar): + provider: NotRequired[str] + model: NotRequired[str] + model_type: NotRequired[str] + run_id: NotRequired[str] + thread_id: NotRequired[str] + system_fingerprint: NotRequired[str] + service_tier: NotRequired[str] + +class TextContentBlock(TypedDict): + type: Literal["text"] + text: str + id: NotRequired[str] + index: NotRequired[BlockIndex] + annotations: NotRequired[list[Annotation]] + +class InvalidToolCall(TypedDict): + type: Literal["invalid_tool_call"] + id: Union[str, None] + name: Union[str, None] + args: Union[str, None] + error: Union[str, None] + index: NotRequired[BlockIndex] + +class ReasoningContentBlock(TypedDict): + type: Literal["reasoning"] + reasoning: NotRequired[str] + id: NotRequired[str] + index: NotRequired[BlockIndex] + +class NonStandardContentBlock(TypedDict): + type: Literal["non_standard"] + value: dict[str, Any] + id: NotRequired[str] + index: NotRequired[BlockIndex] + +class ImageContentBlock(TypedDict): + type: Literal["image"] + id: NotRequired[str] + file_id: NotRequired[str] + url: NotRequired[str] + base64: NotRequired[str] # Base64-encoded image data + mime_type: NotRequired[str] + index: NotRequired[BlockIndex] + +class VideoContentBlock(TypedDict): + type: Literal["video"] + id: NotRequired[str] + file_id: NotRequired[str] + url: NotRequired[str] + base64: NotRequired[str] # Base64-encoded video data + mime_type: NotRequired[str] + index: NotRequired[BlockIndex] + +class AudioContentBlock(TypedDict): + type: Literal["audio"] + id: NotRequired[str] + file_id: NotRequired[str] + url: NotRequired[str] + base64: NotRequired[str] # Base64-encoded audio data + mime_type: NotRequired[str] + index: NotRequired[BlockIndex] + +class FileContentBlock(TypedDict): + type: Literal["file"] + id: NotRequired[str] + file_id: NotRequired[str] + url: NotRequired[str] + base64: NotRequired[str] # Base64-encoded file data + mime_type: NotRequired[str] + index: NotRequired[BlockIndex] + +DataContentBlock = Union[ImageContentBlock, VideoContentBlock, AudioContentBlock, FileContentBlock] + +class ToolCall(TypedDict): + type: Literal["tool_call"] + id: Union[str, None] + name: str + args: dict[str, Any] + index: NotRequired[BlockIndex] + +class ToolCallChunk(TypedDict): + type: Literal["tool_call_chunk"] + id: Union[str, None] + name: Union[str, None] + args: Union[str, None] # Partial JSON string + index: NotRequired[BlockIndex] + +class ServerToolCall(TypedDict): + type: Literal["server_tool_call"] + id: str + name: str + args: dict[str, Any] + index: NotRequired[BlockIndex] + +class ServerToolCallChunk(TypedDict): + type: Literal["server_tool_call_chunk"] + id: NotRequired[str] + name: NotRequired[str] + args: NotRequired[str] + index: NotRequired[BlockIndex] + +class ServerToolResult(TypedDict): + type: Literal["server_tool_result"] + tool_call_id: str + status: Union[Literal["success"], Literal["error"]] + id: NotRequired[str] + output: NotRequired[Any] + index: NotRequired[BlockIndex] + +ToolContentBlock = Union[ToolCall, ToolCallChunk, ServerToolCall, ServerToolCallChunk, ServerToolResult] + +ContentBlock = Union[TextContentBlock, InvalidToolCall, ReasoningContentBlock, NonStandardContentBlock, DataContentBlock, ToolContentBlock] + +FinalizedContentBlock = Union[TextContentBlock, ReasoningContentBlock, ToolCall, InvalidToolCall, ServerToolCall, ServerToolResult, DataContentBlock, NonStandardContentBlock] + +BlockIndex = Union[JsInt, str] + +class Citation(TypedDict): + type: Literal["citation"] + id: NotRequired[str] + url: NotRequired[str] + title: NotRequired[str] + start_index: NotRequired[int] + end_index: NotRequired[int] + cited_text: NotRequired[str] + +class NonStandardAnnotation(TypedDict): + type: Literal["non_standard_annotation"] + id: NotRequired[str] + value: dict[str, Any] + +Annotation = Union[Citation, NonStandardAnnotation] + +class TextDelta(TypedDict): + type: Literal["text-delta"] + text: str + +class ReasoningDelta(TypedDict): + type: Literal["reasoning-delta"] + reasoning: str + +class DataDelta(TypedDict): + type: Literal["data-delta"] + data: str # Encoded data chunk to append + encoding: NotRequired[Literal["base64"]] # Defaults to base64 when absent + +class BlockDeltaFields(TypedDict, extra_items=Any): + type: str + +class BlockDelta(TypedDict): + type: Literal["block-delta"] + fields: BlockDeltaFields + +ContentBlockDelta = Union[TextDelta, ReasoningDelta, DataDelta, BlockDelta] + +class RunStart(TypedDict): + method: Literal["run.start"] + params: RunStartParams + +class SubscriptionSubscribe(TypedDict): + method: Literal["subscription.subscribe"] + params: SubscribeParams + +class SubscriptionUnsubscribe(TypedDict): + method: Literal["subscription.unsubscribe"] + params: UnsubscribeParams + +class SubscriptionReconnect(TypedDict): + method: Literal["subscription.reconnect"] + params: ReconnectParams + +SubscriptionCommand = Union[SubscriptionSubscribe, SubscriptionUnsubscribe, SubscriptionReconnect] + +class AgentGetTree(TypedDict): + method: Literal["agent.getTree"] + params: AgentGetTreeParams + +class InputRespond(TypedDict): + method: Literal["input.respond"] + params: InputRespondParams + +class InputInject(TypedDict): + method: Literal["input.inject"] + params: InputInjectParams + +InputCommand = Union[InputRespond, InputInject] + +class StateGet(TypedDict): + method: Literal["state.get"] + params: StateGetParams + +class StateListCheckpoints(TypedDict): + method: Literal["state.listCheckpoints"] + params: ListCheckpointsParams + +class StateFork(TypedDict): + method: Literal["state.fork"] + params: StateForkParams + +StateCommand = Union[StateGet, StateListCheckpoints, StateFork] + +class _CommandFields(TypedDict): + id: JsUint + +class _CommandVariant1(_CommandFields, SubscriptionSubscribe): + pass + +class _CommandVariant2(_CommandFields, SubscriptionUnsubscribe): + pass + +class _CommandVariant3(_CommandFields, SubscriptionReconnect): + pass + +class _CommandVariant5(_CommandFields, InputRespond): + pass + +class _CommandVariant6(_CommandFields, InputInject): + pass + +class _CommandVariant7(_CommandFields, StateGet): + pass + +class _CommandVariant8(_CommandFields, StateListCheckpoints): + pass + +class _CommandVariant9(_CommandFields, StateFork): + pass + +class CommandResponse(TypedDict): + type: Literal["success"] + id: JsUint + result: ResultData + meta: NotRequired[ResponseMeta] + +class ErrorResponse(TypedDict): + type: Literal["error"] + id: Union[JsUint, None] + error: ErrorCode + message: str + stacktrace: NotRequired[str] + meta: NotRequired[ResponseMeta] + +class LifecycleEvent(TypedDict): + method: Literal["lifecycle"] + params: dict[str, Any] + +class MessagesEvent(TypedDict): + method: Literal["messages"] + params: dict[str, Any] + +class ToolsEvent(TypedDict): + method: Literal["tools"] + params: dict[str, Any] + +class InputEvent(TypedDict): + method: Literal["input.requested"] + params: dict[str, Any] + +class ValuesEvent(TypedDict): + method: Literal["values"] + params: dict[str, Any] + +class UpdatesEvent(TypedDict): + method: Literal["updates"] + params: dict[str, Any] + +class CheckpointsEvent(TypedDict): + method: Literal["checkpoints"] + params: dict[str, Any] + +class CustomEvent(TypedDict): + method: Literal["custom"] + params: dict[str, Any] + +class TasksEvent(TypedDict): + method: Literal["tasks"] + params: dict[str, Any] + +EventData = Union[LifecycleEvent, MessagesEvent, ToolsEvent, InputEvent, ValuesEvent, UpdatesEvent, CheckpointsEvent, CustomEvent, TasksEvent] + +class _EventFields(TypedDict): + type: Literal["event"] + event_id: NotRequired[str] # Unique ID for reconnection (maps to SSE id:) + seq: NotRequired[JsUint] # Monotonic sequence number for ordering + +class _EventVariant0(_EventFields, LifecycleEvent): + pass + +class _EventVariant1(_EventFields, MessagesEvent): + pass + +class _EventVariant2(_EventFields, ToolsEvent): + pass + +class _EventVariant3(_EventFields, InputEvent): + pass + +class _EventVariant4(_EventFields, ValuesEvent): + pass + +class _EventVariant5(_EventFields, UpdatesEvent): + pass + +class _EventVariant6(_EventFields, CheckpointsEvent): + pass + +class _EventVariant7(_EventFields, CustomEvent): + pass + +class _EventVariant8(_EventFields, TasksEvent): + pass + +Event = Union[_EventVariant0, _EventVariant1, _EventVariant2, _EventVariant3, _EventVariant4, _EventVariant5, _EventVariant6, _EventVariant7, _EventVariant8] + +Message = Union[CommandResponse, ErrorResponse, Event] + +class RunResult(TypedDict): + run_id: NotRequired[str] # ID of the started or resumed run + +class SubscribeResult(TypedDict): + subscription_id: str + replayed_events: NotRequired[int] # Events replayed from buffer + +class ReconnectResult(TypedDict): + restored: bool + missed_events: NotRequired[int] + current_namespaces: NotRequired[list[AgentStatusEntry]] + +class EmptyResult(TypedDict): + pass + +class AgentResult(TypedDict): + tree: AgentTreeNode + +class StateGetResult(TypedDict): + values: dict[str, Any] + checkpoint: NotRequired[CheckpointRef] + +class ListCheckpointsResult(TypedDict): + checkpoints: list[CheckpointSummary] + +class StateForkResult(TypedDict): + run_id: str + thread_id: str + +ErrorCode = Union[Literal["invalid_argument"], Literal["unknown_command"], Literal["unknown_error"], Literal["no_such_run"], Literal["no_such_subscription"], Literal["no_such_namespace"], Literal["no_such_interrupt"], Literal["no_such_checkpoint"], Literal["permission_denied"], Literal["not_supported"]] + +class ResponseMeta(TypedDict): + applied_through_seq: NotRequired[JsUint] + +RunCommand = RunStart + +class _CommandVariant0(_CommandFields, RunCommand): + pass + +class RunStartParams(TypedDict): + assistant_id: str # Deployed graph/agent to run + input: Any # Graph input, resume value, or injected message + config: NotRequired[dict[str, Any]] # Per-run config overrides + metadata: NotRequired[dict[str, Any]] # Per-run metadata + +Channel = Union[Literal["values"], Literal["updates"], Literal["messages"], Literal["tools"], Literal["lifecycle"], Literal["input"], Literal["checkpoints"], Literal["tasks"], Literal["custom"], Annotated[str, "custom:.+"]] + +class EventStreamRequest(TypedDict): + channels: list[Channel] + namespaces: NotRequired[list[Namespace]] # Prefix-match these namespace paths + depth: NotRequired[int] # Max depth below namespace prefix + since: NotRequired[JsUint] # Replay events after this seq number + +class SubscribeParams(TypedDict): + channels: list[Channel] + namespaces: NotRequired[list[Namespace]] # Prefix-match these namespace paths + depth: NotRequired[int] # Max depth below namespace prefix + +class UnsubscribeParams(TypedDict): + subscription_id: str + +class ReconnectParams(TypedDict): + run_id: str + last_event_id: NotRequired[str] # Last event the client processed + subscriptions: NotRequired[list[str]] # Subscription IDs to restore + +class AgentStatusEntry(TypedDict): + namespace: Namespace + status: AgentStatus + +SubscriptionResult = Union[SubscribeResult, ReconnectResult, EmptyResult] + +AgentCommand = AgentGetTree + +CommandData = Union[RunCommand, SubscriptionCommand, AgentCommand, InputCommand, StateCommand] + +class _CommandVariant4(_CommandFields, AgentCommand): + pass + +Command = Union[_CommandVariant0, _CommandVariant1, _CommandVariant2, _CommandVariant3, _CommandVariant4, _CommandVariant5, _CommandVariant6, _CommandVariant7, _CommandVariant8, _CommandVariant9] + +class AgentGetTreeParams(TypedDict): + run_id: NotRequired[str] + +class AgentTreeNode(TypedDict): + namespace: Namespace + status: AgentStatus + graph_name: str + children: NotRequired[list[AgentTreeNode]] + metadata: NotRequired[dict[str, Any]] + +AgentStatus = Union[Literal["started"], Literal["running"], Literal["completed"], Literal["failed"], Literal["interrupted"]] + +class LifecycleCauseToolCall(TypedDict): + type: Literal["toolCall"] # The `tool_call_id` from the originating `tool-started` event + tool_call_id: str + +class LifecycleCauseSend(TypedDict): + type: Literal["send"] # Name of the parent node that issued the `Send`. Multiple Sends + from_node: str + +class LifecycleCauseEdge(TypedDict): + type: Literal["edge"] # Name of the parent node the edge originated from. + from_node: str + +LifecycleCause = Union[LifecycleCauseToolCall, LifecycleCauseSend, LifecycleCauseEdge] + +class LifecycleData(TypedDict): + event: AgentStatus + graph_name: NotRequired[str] + cause: NotRequired[LifecycleCause] # Causation edge (see LifecycleCause) + error: NotRequired[str] + checkpoint: NotRequired[CheckpointRef] # Checkpoint reference for time-travel + +class MessageStartData(TypedDict): + event: Literal["message-start"] + role: MessageRole # Author role for this message + id: str # Unique ID for this message + metadata: NotRequired[MessageMetadata] # Concise provider/model metadata for AI messages + +class ContentBlockStartData(TypedDict): + event: Literal["content-block-start"] + index: int # Positional index within the message + content: ContentBlock + +class ContentBlockDeltaData(TypedDict): + event: Literal["content-block-delta"] + index: int + delta: ContentBlockDelta + +class ContentBlockFinishData(TypedDict): + event: Literal["content-block-finish"] + index: int + content: FinalizedContentBlock + +class MessageFinishData(TypedDict): + event: Literal["message-finish"] + usage: NotRequired[UsageInfo] # Token usage for AI-authored messages + +class MessageErrorData(TypedDict): + event: Literal["error"] + message: str + code: NotRequired[str] + +MessagesData = Union[MessageStartData, ContentBlockStartData, ContentBlockDeltaData, ContentBlockFinishData, MessageFinishData, MessageErrorData] + +class UsageInfo(TypedDict): + input_tokens: NotRequired[int] + output_tokens: NotRequired[int] + total_tokens: NotRequired[int] + +class ToolStartedData(TypedDict): + event: Literal["tool-started"] + tool_call_id: str + tool_name: str + input: NotRequired[Any] # Tool input arguments + +class ToolOutputDeltaData(TypedDict): + event: Literal["tool-output-delta"] + tool_call_id: str + delta: str + +class ToolFinishedData(TypedDict): + event: Literal["tool-finished"] + tool_call_id: str + output: Any + +class ToolErrorData(TypedDict): + event: Literal["tool-error"] + tool_call_id: str + message: str + code: NotRequired[str] + +ToolsData = Union[ToolStartedData, ToolOutputDeltaData, ToolFinishedData, ToolErrorData] + +class InputRespondParams(TypedDict): + namespace: Namespace + interrupt_id: str + response: Any + +class InputInjectParams(TypedDict): + namespace: Namespace + message: InputMessage + +class InputMessage(TypedDict): + role: Union[Literal["user"], Literal["system"]] + content: str + name: NotRequired[str] + +InputResult = EmptyResult + +class InputRequestedData(TypedDict): + interrupt_id: str # Correlates this request with input.respond + payload: Any # Opaque interrupt value from runtime; application-defined shape + +class StateGetParams(TypedDict): + namespace: Namespace + keys: NotRequired[list[str]] # Specific state keys, or omit for all + +class ListCheckpointsParams(TypedDict): + namespace: NotRequired[Namespace] + limit: NotRequired[int] + before: NotRequired[str] # Cursor for pagination + +class CheckpointSummary(TypedDict): + id: str + timestamp: str # ISO 8601 + step: int + node_name: NotRequired[str] # Node that produced this checkpoint + metadata: NotRequired[dict[str, Any]] + +class CheckpointRef(TypedDict): + id: str + ns: NotRequired[str] + +class StateForkParams(TypedDict): + checkpoint_id: str + input: NotRequired[Any] # Input for the forked run + config: NotRequired[dict[str, Any]] # Config overrides + +StateResult = Union[StateGetResult, ListCheckpointsResult, StateForkResult, EmptyResult] + +ResultData = Union[RunResult, SubscriptionResult, AgentResult, InputResult, StateResult, EmptyResult] + +class Checkpoint(TypedDict): + id: str # Fork target: pass to state.fork / configurable.checkpoint_id + parent_id: NotRequired[str] # Parent checkpoint id for tree linkage + step: int # Superstep number (-1 for first input, 0 for first loop step, ...) + source: CheckpointSource # Origin of the checkpoint + +CheckpointSource = Union[Literal["input"], Literal["loop"], Literal["update"], Literal["fork"]] + +class UpdatesData(TypedDict): + node: NotRequired[str] # Graph node that produced this update + values: dict[str, Any] # State delta + +class CustomData(TypedDict): + name: NotRequired[str] # Custom event name for dispatch + payload: Any # User-defined payload + diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/py.typed b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_protocol/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/INSTALLER b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/METADATA b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..168a8df2fd9bc09d6367bd8b33b67af3748e2fb4 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/METADATA @@ -0,0 +1,65 @@ +Metadata-Version: 2.4 +Name: langchain-text-splitters +Version: 1.1.2 +Summary: LangChain text splitting utilities +Project-URL: Homepage, https://docs.langchain.com/ +Project-URL: Documentation, https://docs.langchain.com/ +Project-URL: Repository, https://github.com/langchain-ai/langchain +Project-URL: Issues, https://github.com/langchain-ai/langchain/issues +Project-URL: Changelog, https://github.com/langchain-ai/langchain/releases?q=%22langchain-text-splitters%22 +Project-URL: Twitter, https://x.com/LangChain +Project-URL: Slack, https://www.langchain.com/join-community +Project-URL: Reddit, https://www.reddit.com/r/LangChain/ +License: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +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: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Text Processing +Requires-Python: <4.0.0,>=3.10.0 +Requires-Dist: langchain-core<2.0.0,>=1.2.31 +Description-Content-Type: text/markdown + +# 🦜✂️ LangChain Text Splitters + +[![PyPI - Version](https://img.shields.io/pypi/v/langchain-text-splitters?label=%20)](https://pypi.org/project/langchain-text-splitters/#history) +[![PyPI - License](https://img.shields.io/pypi/l/langchain-text-splitters)](https://opensource.org/licenses/MIT) +[![PyPI - Downloads](https://img.shields.io/pepy/dt/langchain-text-splitters)](https://pypistats.org/packages/langchain-text-splitters) +[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain) + +Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs). + +## Quick Install + +```bash +pip install langchain-text-splitters +``` + +## 🤔 What is this? + +LangChain Text Splitters contains utilities for splitting into chunks a wide variety of text documents. + +## 📖 Documentation + +For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_text_splitters/). + +## 📕 Releases & Versioning + +See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies. + +We encourage pinning your version to a specific version in order to avoid breaking your CI when we publish new tests. We recommend upgrading to the latest version periodically to make sure you have the latest tests. + +Not pinning your version will ensure you always have the latest tests, but it may also break your CI if we introduce tests that your integration doesn't pass. + +## 💁 Contributing + +As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation. + +For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview). diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/RECORD b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..6bdd987d1f935af1c33ba89e007b7ce156a67555 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/RECORD @@ -0,0 +1,32 @@ +langchain_text_splitters-1.1.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +langchain_text_splitters-1.1.2.dist-info/METADATA,sha256=BeSrx7rsLh2W5gdrT8SDsLbT-XaEzGLLEWk5HgLANMY,3326 +langchain_text_splitters-1.1.2.dist-info/RECORD,, +langchain_text_splitters-1.1.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +langchain_text_splitters/__init__.py,sha256=VvL36uw1AYqDvvSMMxyOh-ZjNIq6zFPmbVnJV9hxGdw,1982 +langchain_text_splitters/__pycache__/__init__.cpython-311.pyc,, +langchain_text_splitters/__pycache__/base.cpython-311.pyc,, +langchain_text_splitters/__pycache__/character.cpython-311.pyc,, +langchain_text_splitters/__pycache__/html.cpython-311.pyc,, +langchain_text_splitters/__pycache__/json.cpython-311.pyc,, +langchain_text_splitters/__pycache__/jsx.cpython-311.pyc,, +langchain_text_splitters/__pycache__/konlpy.cpython-311.pyc,, +langchain_text_splitters/__pycache__/latex.cpython-311.pyc,, +langchain_text_splitters/__pycache__/markdown.cpython-311.pyc,, +langchain_text_splitters/__pycache__/nltk.cpython-311.pyc,, +langchain_text_splitters/__pycache__/python.cpython-311.pyc,, +langchain_text_splitters/__pycache__/sentence_transformers.cpython-311.pyc,, +langchain_text_splitters/__pycache__/spacy.cpython-311.pyc,, +langchain_text_splitters/base.py,sha256=Zho-QUdloy9AiCZ0dupG5Ph7lYBHtftJrPl0TNMRWXY,15602 +langchain_text_splitters/character.py,sha256=f1Qh0MPltF5jRjTxIa6lY61UKCV-0mGMu1vw5vIYKZg,26184 +langchain_text_splitters/html.py,sha256=AotaPFez3yngYshB24RlhL9mOIgQJIz8CVZrlUx-hd8,39756 +langchain_text_splitters/json.py,sha256=SIeKSODhZAl5xsm_APIb4wrRQKNaDoEp2sh_FwE4bMc,6919 +langchain_text_splitters/jsx.py,sha256=XYkh8XL2855SDuHfh8sySOv4rwlZvkM2keKcYxmcMfM,3567 +langchain_text_splitters/konlpy.py,sha256=E8oFNJqqriBiPNK956m2P4-k7wgSyczkRs1teGsh0FM,1211 +langchain_text_splitters/latex.py,sha256=qMDJHwZfn5bZriru9FNkFn0JbW1vi28_aepf9BFuiK4,574 +langchain_text_splitters/markdown.py,sha256=7_3Cft0X93Obwm-PYTQ1ITYU7RzFjjhojehx4rThKEo,19321 +langchain_text_splitters/nltk.py,sha256=islwSlmu6nYKAvpJfbc_Iwp5_wfqR4nmRIclYdRYqt0,2366 +langchain_text_splitters/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +langchain_text_splitters/python.py,sha256=3XWzkg6SSHm-s3FFgmiXS3rX4E7ffNYh2TgkjCpFCzI,575 +langchain_text_splitters/sentence_transformers.py,sha256=HJGP3K0aqxdpcpR5nFMeNtwpPob0qDdT6OqEDxMsZ00,4725 +langchain_text_splitters/spacy.py,sha256=Uq01ePRpT4h90VfXaqyw-3O0Snn1qnIbNzJrJLwxlhk,2324 +langchain_text_splitters/xsl/converting_to_header.xslt,sha256=WesNqi4fo2d9CPv3bZdRsToLJYE12MrMZFv2ewNvWfU,1073 diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/WHEEL b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters-1.1.2.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/__init__.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7dc07f50b277afe686a2f9eba6a7224197189bfa --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/__init__.py @@ -0,0 +1,69 @@ +"""Text Splitters are classes for splitting text. + +!!! note + + `MarkdownHeaderTextSplitter` and `HTMLHeaderTextSplitter` do not derive from + `TextSplitter`. +""" + +from langchain_text_splitters.base import ( + Language, + TextSplitter, + Tokenizer, + TokenTextSplitter, + split_text_on_tokens, +) +from langchain_text_splitters.character import ( + CharacterTextSplitter, + RecursiveCharacterTextSplitter, +) +from langchain_text_splitters.html import ( + ElementType, + HTMLHeaderTextSplitter, + HTMLSectionSplitter, + HTMLSemanticPreservingSplitter, +) +from langchain_text_splitters.json import RecursiveJsonSplitter +from langchain_text_splitters.jsx import JSFrameworkTextSplitter +from langchain_text_splitters.konlpy import KonlpyTextSplitter +from langchain_text_splitters.latex import LatexTextSplitter +from langchain_text_splitters.markdown import ( + ExperimentalMarkdownSyntaxTextSplitter, + HeaderType, + LineType, + MarkdownHeaderTextSplitter, + MarkdownTextSplitter, +) +from langchain_text_splitters.nltk import NLTKTextSplitter +from langchain_text_splitters.python import PythonCodeTextSplitter +from langchain_text_splitters.sentence_transformers import ( + SentenceTransformersTokenTextSplitter, +) +from langchain_text_splitters.spacy import SpacyTextSplitter + +__all__ = [ + "CharacterTextSplitter", + "ElementType", + "ExperimentalMarkdownSyntaxTextSplitter", + "HTMLHeaderTextSplitter", + "HTMLSectionSplitter", + "HTMLSemanticPreservingSplitter", + "HeaderType", + "JSFrameworkTextSplitter", + "KonlpyTextSplitter", + "Language", + "LatexTextSplitter", + "LineType", + "MarkdownHeaderTextSplitter", + "MarkdownTextSplitter", + "NLTKTextSplitter", + "PythonCodeTextSplitter", + "RecursiveCharacterTextSplitter", + "RecursiveJsonSplitter", + "SentenceTransformersTokenTextSplitter", + "SpacyTextSplitter", + "TextSplitter", + "TokenTextSplitter", + "Tokenizer", + "split_text_on_tokens", +] diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/base.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/base.py new file mode 100644 index 0000000000000000000000000000000000000000..68d3a42b767543eff968c930cc42050c69a06bf3 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/base.py @@ -0,0 +1,458 @@ +"""Text splitter base interface.""" + +from __future__ import annotations + +import copy +import logging +from abc import ABC, abstractmethod +from dataclasses import dataclass +from enum import Enum +from typing import ( + TYPE_CHECKING, + Any, + Literal, + TypeVar, +) + +from langchain_core.documents import BaseDocumentTransformer, Document +from typing_extensions import Self, override + +if TYPE_CHECKING: + from collections.abc import Callable, Collection, Iterable, Sequence + from collections.abc import Set as AbstractSet + + +try: + import tiktoken + + _HAS_TIKTOKEN = True +except ImportError: + _HAS_TIKTOKEN = False + +try: + from transformers.tokenization_utils_base import PreTrainedTokenizerBase + + _HAS_TRANSFORMERS = True +except ImportError: + _HAS_TRANSFORMERS = False + +logger = logging.getLogger(__name__) + +TS = TypeVar("TS", bound="TextSplitter") + + +class TextSplitter(BaseDocumentTransformer, ABC): + """Interface for splitting text into chunks.""" + + def __init__( + self, + chunk_size: int = 4000, + chunk_overlap: int = 200, + length_function: Callable[[str], int] = len, + keep_separator: bool | Literal["start", "end"] = False, # noqa: FBT001,FBT002 + add_start_index: bool = False, # noqa: FBT001,FBT002 + strip_whitespace: bool = True, # noqa: FBT001,FBT002 + ) -> None: + """Create a new `TextSplitter`. + + Args: + chunk_size: Maximum size of chunks to return + chunk_overlap: Overlap in characters between chunks + length_function: Function that measures the length of given chunks + keep_separator: Whether to keep the separator and where to place it + in each corresponding chunk `(True='start')` + add_start_index: If `True`, includes chunk's start index in metadata + strip_whitespace: If `True`, strips whitespace from the start and end of + every document + + Raises: + ValueError: If `chunk_size` is less than or equal to 0 + ValueError: If `chunk_overlap` is less than 0 + ValueError: If `chunk_overlap` is greater than `chunk_size` + """ + if chunk_size <= 0: + msg = f"chunk_size must be > 0, got {chunk_size}" + raise ValueError(msg) + if chunk_overlap < 0: + msg = f"chunk_overlap must be >= 0, got {chunk_overlap}" + raise ValueError(msg) + if chunk_overlap > chunk_size: + msg = ( + f"Got a larger chunk overlap ({chunk_overlap}) than chunk size " + f"({chunk_size}), should be smaller." + ) + raise ValueError(msg) + self._chunk_size = chunk_size + self._chunk_overlap = chunk_overlap + self._length_function = length_function + self._keep_separator = keep_separator + self._add_start_index = add_start_index + self._strip_whitespace = strip_whitespace + + @abstractmethod + def split_text(self, text: str) -> list[str]: + """Split text into multiple components. + + Args: + text: The text to split. + + Returns: + A list of text chunks. + """ + + def create_documents( + self, texts: list[str], metadatas: list[dict[Any, Any]] | None = None + ) -> list[Document]: + """Create a list of `Document` objects from a list of texts. + + Args: + texts: A list of texts to be split and converted into documents. + metadatas: Optional list of metadata to associate with each document. + + Returns: + A list of `Document` objects. + """ + metadatas_ = metadatas or [{}] * len(texts) + documents = [] + for i, text in enumerate(texts): + index = 0 + previous_chunk_len = 0 + for chunk in self.split_text(text): + metadata = copy.deepcopy(metadatas_[i]) + if self._add_start_index: + offset = index + previous_chunk_len - self._chunk_overlap + index = text.find(chunk, max(0, offset)) + metadata["start_index"] = index + previous_chunk_len = len(chunk) + new_doc = Document(page_content=chunk, metadata=metadata) + documents.append(new_doc) + return documents + + def split_documents(self, documents: Iterable[Document]) -> list[Document]: + """Split documents. + + Args: + documents: The documents to split. + + Returns: + A list of split documents. + """ + texts, metadatas = [], [] + for doc in documents: + texts.append(doc.page_content) + metadatas.append(doc.metadata) + return self.create_documents(texts, metadatas=metadatas) + + def _join_docs(self, docs: list[str], separator: str) -> str | None: + text = separator.join(docs) + if self._strip_whitespace: + text = text.strip() + return text or None + + def _merge_splits(self, splits: Iterable[str], separator: str) -> list[str]: + # We now want to combine these smaller pieces into medium size + # chunks to send to the LLM. + separator_len = self._length_function(separator) + + docs = [] + current_doc: list[str] = [] + total = 0 + for d in splits: + len_ = self._length_function(d) + if ( + total + len_ + (separator_len if len(current_doc) > 0 else 0) + > self._chunk_size + ): + if total > self._chunk_size: + logger.warning( + "Created a chunk of size %d, which is longer than the " + "specified %d", + total, + self._chunk_size, + ) + if len(current_doc) > 0: + doc = self._join_docs(current_doc, separator) + if doc is not None: + docs.append(doc) + # Keep on popping if: + # - we have a larger chunk than in the chunk overlap + # - or if we still have any chunks and the length is long + while total > self._chunk_overlap or ( + total + len_ + (separator_len if len(current_doc) > 0 else 0) + > self._chunk_size + and total > 0 + ): + total -= self._length_function(current_doc[0]) + ( + separator_len if len(current_doc) > 1 else 0 + ) + current_doc = current_doc[1:] + current_doc.append(d) + total += len_ + (separator_len if len(current_doc) > 1 else 0) + doc = self._join_docs(current_doc, separator) + if doc is not None: + docs.append(doc) + return docs + + @classmethod + def from_huggingface_tokenizer( + cls, tokenizer: PreTrainedTokenizerBase, **kwargs: Any + ) -> TextSplitter: + """Text splitter that uses Hugging Face tokenizer to count length. + + Args: + tokenizer: The Hugging Face tokenizer to use. + + Returns: + An instance of `TextSplitter` using the Hugging Face tokenizer for length + calculation. + """ + if not _HAS_TRANSFORMERS: + msg = ( + "Could not import transformers python package. " + "Please install it with `pip install transformers`." + ) + raise ValueError(msg) + + if not isinstance(tokenizer, PreTrainedTokenizerBase): + # unreachable: transformers absent -> PreTrainedTokenizerBase is Any + # unused-ignore: transformers present -> branch is reachable + msg = ( # type: ignore[unreachable, unused-ignore] + "Tokenizer received was not an instance of PreTrainedTokenizerBase" + ) + raise ValueError(msg) # noqa: TRY004 + + def _huggingface_tokenizer_length(text: str) -> int: + return len(tokenizer.tokenize(text)) + + return cls(length_function=_huggingface_tokenizer_length, **kwargs) + + @classmethod + def from_tiktoken_encoder( + cls, + encoding_name: str = "gpt2", + model_name: str | None = None, + allowed_special: Literal["all"] | AbstractSet[str] | None = None, + disallowed_special: Literal["all"] | Collection[str] = "all", + **kwargs: Any, + ) -> Self: + """Text splitter that uses `tiktoken` encoder to count length. + + Args: + encoding_name: The name of the tiktoken encoding to use. + model_name: The name of the model to use. + + If provided, this will override the `encoding_name`. + allowed_special: Special tokens that are allowed during encoding. + disallowed_special: Special tokens that are disallowed during encoding. + + Returns: + An instance of `TextSplitter` using tiktoken for length calculation. + + Raises: + ImportError: If the tiktoken package is not installed. + """ + if allowed_special is None: + allowed_special = set() + if not _HAS_TIKTOKEN: + msg = ( + "Could not import tiktoken python package. " + "This is needed in order to calculate max_tokens_for_prompt. " + "Please install it with `pip install tiktoken`." + ) + raise ImportError(msg) + + if model_name is not None: + enc = tiktoken.encoding_for_model(model_name) + else: + enc = tiktoken.get_encoding(encoding_name) + + def _tiktoken_encoder(text: str) -> int: + return len( + enc.encode( + text, + allowed_special=allowed_special, + disallowed_special=disallowed_special, + ) + ) + + if issubclass(cls, TokenTextSplitter): + extra_kwargs = { + "encoding_name": encoding_name, + "model_name": model_name, + "allowed_special": allowed_special, + "disallowed_special": disallowed_special, + } + kwargs = {**kwargs, **extra_kwargs} + + return cls(length_function=_tiktoken_encoder, **kwargs) + + @override + def transform_documents( + self, documents: Sequence[Document], **kwargs: Any + ) -> Sequence[Document]: + """Transform sequence of documents by splitting them. + + Args: + documents: The sequence of documents to split. + + Returns: + A list of split documents. + """ + return self.split_documents(list(documents)) + + +class TokenTextSplitter(TextSplitter): + """Splitting text to tokens using model tokenizer.""" + + def __init__( + self, + encoding_name: str = "gpt2", + model_name: str | None = None, + allowed_special: Literal["all"] | AbstractSet[str] | None = None, + disallowed_special: Literal["all"] | Collection[str] = "all", + **kwargs: Any, + ) -> None: + """Create a new `TextSplitter`. + + Args: + encoding_name: The name of the tiktoken encoding to use. + model_name: The name of the model to use. + + If provided, this will override the `encoding_name`. + allowed_special: Special tokens that are allowed during encoding. + disallowed_special: Special tokens that are disallowed during encoding. + + Raises: + ImportError: If the tiktoken package is not installed. + """ + if allowed_special is None: + allowed_special = set() + super().__init__(**kwargs) + if not _HAS_TIKTOKEN: + msg = ( + "Could not import tiktoken python package. " + "This is needed in order to for TokenTextSplitter. " + "Please install it with `pip install tiktoken`." + ) + raise ImportError(msg) + + if model_name is not None: + enc = tiktoken.encoding_for_model(model_name) + else: + enc = tiktoken.get_encoding(encoding_name) + self._tokenizer = enc + self._allowed_special = allowed_special + self._disallowed_special = disallowed_special + + def split_text(self, text: str) -> list[str]: + """Splits the input text into smaller chunks based on tokenization. + + This method uses a custom tokenizer configuration to encode the input text + into tokens, processes the tokens in chunks of a specified size with overlap, + and decodes them back into text chunks. The splitting is performed using the + `split_text_on_tokens` function. + + Args: + text: The input text to be split into smaller chunks. + + Returns: + A list of text chunks, where each chunk is derived from a portion + of the input text based on the tokenization and chunking rules. + """ + + def _encode(_text: str) -> list[int]: + return self._tokenizer.encode( + _text, + allowed_special=self._allowed_special, + disallowed_special=self._disallowed_special, + ) + + tokenizer = Tokenizer( + chunk_overlap=self._chunk_overlap, + tokens_per_chunk=self._chunk_size, + decode=self._tokenizer.decode, + encode=_encode, + ) + + return split_text_on_tokens(text=text, tokenizer=tokenizer) + + +class Language(str, Enum): + """Enum of the programming languages.""" + + CPP = "cpp" + GO = "go" + JAVA = "java" + KOTLIN = "kotlin" + JS = "js" + TS = "ts" + PHP = "php" + PROTO = "proto" + PYTHON = "python" + R = "r" + RST = "rst" + RUBY = "ruby" + RUST = "rust" + SCALA = "scala" + SWIFT = "swift" + MARKDOWN = "markdown" + LATEX = "latex" + HTML = "html" + SOL = "sol" + CSHARP = "csharp" + COBOL = "cobol" + C = "c" + LUA = "lua" + PERL = "perl" + HASKELL = "haskell" + ELIXIR = "elixir" + POWERSHELL = "powershell" + VISUALBASIC6 = "visualbasic6" + + +@dataclass(frozen=True) +class Tokenizer: + """Tokenizer data class.""" + + chunk_overlap: int + """Overlap in tokens between chunks""" + + tokens_per_chunk: int + """Maximum number of tokens per chunk""" + + decode: Callable[[list[int]], str] + """ Function to decode a list of token IDs to a string""" + + encode: Callable[[str], list[int]] + """ Function to encode a string to a list of token IDs""" + + +def split_text_on_tokens(*, text: str, tokenizer: Tokenizer) -> list[str]: + """Split incoming text and return chunks using tokenizer. + + Args: + text: The input text to be split. + tokenizer: The tokenizer to use for splitting. + + Returns: + A list of text chunks. + """ + splits: list[str] = [] + input_ids = tokenizer.encode(text) + start_idx = 0 + if tokenizer.tokens_per_chunk <= tokenizer.chunk_overlap: + msg = "tokens_per_chunk must be greater than chunk_overlap" + raise ValueError(msg) + + while start_idx < len(input_ids): + cur_idx = min(start_idx + tokenizer.tokens_per_chunk, len(input_ids)) + chunk_ids = input_ids[start_idx:cur_idx] + if not chunk_ids: + break + decoded = tokenizer.decode(chunk_ids) + if decoded: + splits.append(decoded) + if cur_idx == len(input_ids): + break + start_idx += tokenizer.tokens_per_chunk - tokenizer.chunk_overlap + return splits diff --git a/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/character.py b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/character.py new file mode 100644 index 0000000000000000000000000000000000000000..469afdb913212e213f35a030fc567711931bf483 --- /dev/null +++ b/micromamba_root/envs/pytorch_env/Lib/site-packages/langchain_text_splitters/character.py @@ -0,0 +1,803 @@ +"""Character text splitters.""" + +from __future__ import annotations + +import re +from typing import Any, Literal + +from langchain_text_splitters.base import Language, TextSplitter + + +class CharacterTextSplitter(TextSplitter): + """Splitting text that looks at characters.""" + + def __init__( + self, + separator: str = "\n\n", + is_separator_regex: bool = False, # noqa: FBT001,FBT002 + **kwargs: Any, + ) -> None: + """Create a new TextSplitter.""" + super().__init__(**kwargs) + self._separator = separator + self._is_separator_regex = is_separator_regex + + def split_text(self, text: str) -> list[str]: + """Split into chunks without re-inserting lookaround separators. + + Args: + text: The text to split. + + Returns: + A list of text chunks. + """ + # 1. Determine split pattern: raw regex or escaped literal + sep_pattern = ( + self._separator if self._is_separator_regex else re.escape(self._separator) + ) + + # 2. Initial split (keep separator if requested) + splits = _split_text_with_regex( + text, sep_pattern, keep_separator=self._keep_separator + ) + + # 3. Detect zero-width lookaround so we never re-insert it + lookaround_prefixes = ("(?=", "(? don't re-insert + # - else -> re-insert literal separator + merge_sep = "" + if not (self._keep_separator or is_lookaround): + merge_sep = self._separator + + # 5. Merge adjacent splits and return + return self._merge_splits(splits, merge_sep) + + +def _split_text_with_regex( + text: str, separator: str, *, keep_separator: bool | Literal["start", "end"] +) -> list[str]: + # Now that we have the separator, split the text + if separator: + if keep_separator: + # The parentheses in the pattern keep the delimiters in the result. + splits_ = re.split(f"({separator})", text) + splits = ( + ([splits_[i] + splits_[i + 1] for i in range(0, len(splits_) - 1, 2)]) + if keep_separator == "end" + else ([splits_[i] + splits_[i + 1] for i in range(1, len(splits_), 2)]) + ) + if len(splits_) % 2 == 0: + splits += splits_[-1:] + splits = ( + ([*splits, splits_[-1]]) + if keep_separator == "end" + else ([splits_[0], *splits]) + ) + else: + splits = re.split(separator, text) + else: + splits = list(text) + return [s for s in splits if s] + + +class RecursiveCharacterTextSplitter(TextSplitter): + """Splitting text by recursively look at characters. + + Recursively tries to split by different characters to find one + that works. + """ + + def __init__( + self, + separators: list[str] | None = None, + keep_separator: bool | Literal["start", "end"] = True, # noqa: FBT001,FBT002 + is_separator_regex: bool = False, # noqa: FBT001,FBT002 + **kwargs: Any, + ) -> None: + """Create a new TextSplitter.""" + super().__init__(keep_separator=keep_separator, **kwargs) + self._separators = separators or ["\n\n", "\n", " ", ""] + self._is_separator_regex = is_separator_regex + + def _split_text(self, text: str, separators: list[str]) -> list[str]: + """Split incoming text and return chunks.""" + final_chunks = [] + # Get appropriate separator to use + separator = separators[-1] + new_separators = [] + for i, s_ in enumerate(separators): + separator_ = s_ if self._is_separator_regex else re.escape(s_) + if not s_: + separator = s_ + break + if re.search(separator_, text): + separator = s_ + new_separators = separators[i + 1 :] + break + + separator_ = separator if self._is_separator_regex else re.escape(separator) + splits = _split_text_with_regex( + text, separator_, keep_separator=self._keep_separator + ) + + # Now go merging things, recursively splitting longer texts. + good_splits = [] + separator_ = "" if self._keep_separator else separator + for s in splits: + if self._length_function(s) < self._chunk_size: + good_splits.append(s) + else: + if good_splits: + merged_text = self._merge_splits(good_splits, separator_) + final_chunks.extend(merged_text) + good_splits = [] + if not new_separators: + final_chunks.append(s) + else: + other_info = self._split_text(s, new_separators) + final_chunks.extend(other_info) + if good_splits: + merged_text = self._merge_splits(good_splits, separator_) + final_chunks.extend(merged_text) + return final_chunks + + def split_text(self, text: str) -> list[str]: + """Split the input text into smaller chunks based on predefined separators. + + Args: + text: The input text to be split. + + Returns: + A list of text chunks obtained after splitting. + """ + return self._split_text(text, self._separators) + + @classmethod + def from_language( + cls, language: Language, **kwargs: Any + ) -> RecursiveCharacterTextSplitter: + """Return an instance of this class based on a specific language. + + This method initializes the text splitter with language-specific separators. + + Args: + language: The language to configure the text splitter for. + **kwargs: Additional keyword arguments to customize the splitter. + + Returns: + An instance of the text splitter configured for the specified language. + """ + separators = cls.get_separators_for_language(language) + return cls(separators=separators, is_separator_regex=True, **kwargs) + + @staticmethod + def get_separators_for_language(language: Language) -> list[str]: + """Retrieve a list of separators specific to the given language. + + Args: + language: The language for which to get the separators. + + Returns: + A list of separators appropriate for the specified language. + + Raises: + ValueError: If the language is not implemented or supported. + """ + if language in {Language.C, Language.CPP}: + return [ + # Split along class definitions + "\nclass ", + # Split along function definitions + "\nvoid ", + "\nint ", + "\nfloat ", + "\ndouble ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\nswitch ", + "\ncase ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.GO: + return [ + # Split along function definitions + "\nfunc ", + "\nvar ", + "\nconst ", + "\ntype ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nswitch ", + "\ncase ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.JAVA: + return [ + # Split along class definitions + "\nclass ", + # Split along method definitions + "\npublic ", + "\nprotected ", + "\nprivate ", + "\nstatic ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\nswitch ", + "\ncase ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.KOTLIN: + return [ + # Split along class definitions + "\nclass ", + # Split along method definitions + "\npublic ", + "\nprotected ", + "\nprivate ", + "\ninternal ", + "\ncompanion ", + "\nfun ", + "\nval ", + "\nvar ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\nwhen ", + "\ncase ", + "\nelse ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.JS: + return [ + # Split along function definitions + "\nfunction ", + "\nconst ", + "\nlet ", + "\nvar ", + "\nclass ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\nswitch ", + "\ncase ", + "\ndefault ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.TS: + return [ + "\nenum ", + "\ninterface ", + "\nnamespace ", + "\ntype ", + # Split along class definitions + "\nclass ", + # Split along function definitions + "\nfunction ", + "\nconst ", + "\nlet ", + "\nvar ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\nswitch ", + "\ncase ", + "\ndefault ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.PHP: + return [ + # Split along function definitions + "\nfunction ", + # Split along class definitions + "\nclass ", + # Split along control flow statements + "\nif ", + "\nforeach ", + "\nwhile ", + "\ndo ", + "\nswitch ", + "\ncase ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.PROTO: + return [ + # Split along message definitions + "\nmessage ", + # Split along service definitions + "\nservice ", + # Split along enum definitions + "\nenum ", + # Split along option definitions + "\noption ", + # Split along import statements + "\nimport ", + # Split along syntax declarations + "\nsyntax ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.PYTHON: + return [ + # First, try to split along class definitions + "\nclass ", + "\ndef ", + "\n\tdef ", + # Now split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.R: + return [ + # Split along function definitions + "\nfunction ", + # Split along S4 class and method definitions + "\nsetClass\\(", + "\nsetMethod\\(", + "\nsetGeneric\\(", + # Split along control flow statements + "\nif ", + "\nelse ", + "\nfor ", + "\nwhile ", + "\nrepeat ", + # Split along package loading + "\nlibrary\\(", + "\nrequire\\(", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.RST: + return [ + # Split along section titles + "\n=+\n", + "\n-+\n", + "\n\\*+\n", + # Split along directive markers + "\n\n.. *\n\n", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.RUBY: + return [ + # Split along method definitions + "\ndef ", + "\nclass ", + # Split along control flow statements + "\nif ", + "\nunless ", + "\nwhile ", + "\nfor ", + "\ndo ", + "\nbegin ", + "\nrescue ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.ELIXIR: + return [ + # Split along method function and module definition + "\ndef ", + "\ndefp ", + "\ndefmodule ", + "\ndefprotocol ", + "\ndefmacro ", + "\ndefmacrop ", + # Split along control flow statements + "\nif ", + "\nunless ", + "\nwhile ", + "\ncase ", + "\ncond ", + "\nwith ", + "\nfor ", + "\ndo ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.RUST: + return [ + # Split along function definitions + "\nfn ", + "\nconst ", + "\nlet ", + # Split along control flow statements + "\nif ", + "\nwhile ", + "\nfor ", + "\nloop ", + "\nmatch ", + "\nconst ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.SCALA: + return [ + # Split along class definitions + "\nclass ", + "\nobject ", + # Split along method definitions + "\ndef ", + "\nval ", + "\nvar ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\nmatch ", + "\ncase ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.SWIFT: + return [ + # Split along function definitions + "\nfunc ", + # Split along class definitions + "\nclass ", + "\nstruct ", + "\nenum ", + # Split along control flow statements + "\nif ", + "\nfor ", + "\nwhile ", + "\ndo ", + "\nswitch ", + "\ncase ", + # Split by the normal type of lines + "\n\n", + "\n", + " ", + "", + ] + if language == Language.MARKDOWN: + return [ + # First, try to split along Markdown headings (starting with level 2) + "\n#{1,6} ", + # Note the alternative syntax for headings (below) is not handled here + # Heading level 2 + # --------------- + # End of code block + "```\n", + # Horizontal lines + "\n\\*\\*\\*+\n", + "\n---+\n", + "\n___+\n", + # Note that this splitter doesn't handle horizontal lines defined + # by *three or more* of ***, ---, or ___, but this is not handled + "\n\n", + "\n", + " ", + "", + ] + if language == Language.LATEX: + return [ + # First, try to split along Latex sections + "\n\\\\chapter{", + "\n\\\\section{", + "\n\\\\subsection{", + "\n\\\\subsubsection{", + # Now split by environments + "\n\\\\begin{enumerate}", + "\n\\\\begin{itemize}", + "\n\\\\begin{description}", + "\n\\\\begin{list}", + "\n\\\\begin{quote}", + "\n\\\\begin{quotation}", + "\n\\\\begin{verse}", + "\n\\\\begin{verbatim}", + # Now split by math environments + "\n\\\\begin{align}", + "$$", + "$", + # Now split by the normal type of lines + " ", + "", + ] + if language == Language.HTML: + return [ + # First, try to split along HTML tags + " ResultSet[NavigableString]: + return tag.find_all(string=True, recursive=recursive) + + +def _find_all_tags( + tag: Tag, + *, + name: bool | str | list[str] | None = None, + recursive: bool = True, +) -> ResultSet[Tag]: + return tag.find_all(name, recursive=recursive) + + +class HTMLHeaderTextSplitter: + """Split HTML content into structured Documents based on specified headers. + + Splits HTML content by detecting specified header tags and creating hierarchical + `Document` objects that reflect the semantic structure of the original content. For + each identified section, the splitter associates the extracted text with metadata + corresponding to the encountered headers. + + If no specified headers are found, the entire content is returned as a single + `Document`. This allows for flexible handling of HTML input, ensuring that + information is organized according to its semantic headers. + + The splitter provides the option to return each HTML element as a separate + `Document` or aggregate them into semantically meaningful chunks. It also + gracefully handles multiple levels of nested headers, creating a rich, + hierarchical representation of the content. + + Example: + ```python + from langchain_text_splitters.html_header_text_splitter import ( + HTMLHeaderTextSplitter, + ) + + # Define headers for splitting on h1 and h2 tags. + headers_to_split_on = [("h1", "Main Topic"), ("h2", "Sub Topic")] + + splitter = HTMLHeaderTextSplitter( + headers_to_split_on=headers_to_split_on, + return_each_element=False + ) + + html_content = \"\"\" + + +

Introduction

+

Welcome to the introduction section.

+

Background

+

Some background details here.

+

Conclusion

+

Final thoughts.

+ + + \"\"\" + + documents = splitter.split_text(html_content) + + # 'documents' now contains Document objects reflecting the hierarchy: + # - Document with metadata={"Main Topic": "Introduction"} and + # content="Introduction" + # - Document with metadata={"Main Topic": "Introduction"} and + # content="Welcome to the introduction section." + # - Document with metadata={"Main Topic": "Introduction", + # "Sub Topic": "Background"} and content="Background" + # - Document with metadata={"Main Topic": "Introduction", + # "Sub Topic": "Background"} and content="Some background details here." + # - Document with metadata={"Main Topic": "Conclusion"} and + # content="Conclusion" + # - Document with metadata={"Main Topic": "Conclusion"} and + # content="Final thoughts." + ``` + """ + + def __init__( + self, + headers_to_split_on: list[tuple[str, str]], + return_each_element: bool = False, # noqa: FBT001,FBT002 + ) -> None: + """Initialize with headers to split on. + + Args: + headers_to_split_on: A list of `(header_tag, + header_name)` pairs representing the headers that define splitting + boundaries. + + For example, `[("h1", "Header 1"), ("h2", "Header 2")]` will split + content by `h1` and `h2` tags, assigning their textual content to the + `Document` metadata. + return_each_element: If `True`, every HTML element encountered + (including headers, paragraphs, etc.) is returned as a separate + `Document`. + + If `False`, content under the same header hierarchy is aggregated into + fewer `Document` objects. + """ + # Sort headers by their numeric level so that h1 < h2 < h3... + self.headers_to_split_on = sorted( + headers_to_split_on, key=lambda x: int(x[0][1:]) + ) + self.header_mapping = dict(self.headers_to_split_on) + self.header_tags = [tag for tag, _ in self.headers_to_split_on] + self.return_each_element = return_each_element + + def split_text(self, text: str) -> list[Document]: + """Split the given text into a list of `Document` objects. + + Args: + text: The HTML text to split. + + Returns: + A list of split `Document` objects. + + Each `Document` contains `page_content` holding the extracted text and + `metadata` that maps the header hierarchy to their corresponding titles. + """ + return self.split_text_from_file(StringIO(text)) + + @deprecated( + since="1.1.2", + removal="2.0.0", + message=( + "Please fetch the HTML content from the URL yourself and pass it " + "to split_text." + ), + ) + def split_text_from_url( + self, + url: str, + timeout: int = 10, + **kwargs: Any, # noqa: ARG002 + ) -> list[Document]: + """Fetch text content from a URL and split it into documents. + + Args: + url: The URL to fetch content from. + timeout: Timeout for the request. + **kwargs: Additional keyword arguments for the request. + + Returns: + A list of split `Document` objects. + + Each `Document` contains `page_content` holding the extracted text and + `metadata` that maps the header hierarchy to their corresponding titles. + + Raises: + requests.RequestException: If the HTTP request fails. + """ + from langchain_core._security._transport import ( # noqa: PLC0415 + ssrf_safe_client, + ) + + with ssrf_safe_client() as client: + response = client.get(url, timeout=timeout) + response.raise_for_status() + return self.split_text(response.text) + + def split_text_from_file(self, file: str | IO[str]) -> list[Document]: + """Split HTML content from a file into a list of `Document` objects. + + Args: + file: A file path or a file-like object containing HTML content. + + Returns: + A list of split `Document` objects. + + Each `Document` contains `page_content` holding the extracted text and + `metadata` that maps the header hierarchy to their corresponding titles. + """ + if isinstance(file, str): + html_content = pathlib.Path(file).read_text(encoding="utf-8") + else: + html_content = file.read() + return list(self._generate_documents(html_content)) + + def _generate_documents(self, html_content: str) -> Iterator[Document]: + """Private method that performs a DFS traversal over the DOM and yields. + + Document objects on-the-fly. This approach maintains the same splitting logic + (headers vs. non-headers, chunking, etc.) while walking the DOM explicitly in + code. + + Args: + html_content: The raw HTML content. + + Yields: + Document objects as they are created. + + Raises: + ImportError: If BeautifulSoup is not installed. + """ + if not _HAS_BS4: + msg = ( + "Unable to import BeautifulSoup. Please install via `pip install bs4`." + ) + raise ImportError(msg) + + soup = BeautifulSoup(html_content, "html.parser") + body = soup.body or soup + + # Dictionary of active headers: + # key = user-defined header name (e.g. "Header 1") + # value = tuple of header_text, level, dom_depth + active_headers: dict[str, tuple[str, int, int]] = {} + current_chunk: list[str] = [] + + def finalize_chunk() -> Document | None: + """Finalize the accumulated chunk into a single Document.""" + if not current_chunk: + return None + + final_text = " \n".join(line for line in current_chunk if line.strip()) + current_chunk.clear() + if not final_text.strip(): + return None + + final_meta = {k: v[0] for k, v in active_headers.items()} + return Document(page_content=final_text, metadata=final_meta) + + # We'll use a stack for DFS traversal + stack = [body] + while stack: + node = stack.pop() + children = list(node.children) + + stack.extend( + child for child in reversed(children) if isinstance(child, Tag) + ) + + tag = getattr(node, "name", None) + if not tag: + continue + + text_elements = [ + str(child).strip() for child in _find_all_strings(node, recursive=False) + ] + node_text = " ".join(elem for elem in text_elements if elem) + if not node_text: + continue + + dom_depth = len(list(node.parents)) + + # If this node is one of our headers + if tag in self.header_tags: + # If we're aggregating, finalize whatever chunk we had + if not self.return_each_element: + doc = finalize_chunk() + if doc: + yield doc + + # Determine numeric level (h1->1, h2->2, etc.) + try: + level = int(tag[1:]) + except ValueError: + level = 9999 + + # Remove any active headers that are at or deeper than this new level + headers_to_remove = [ + k for k, (_, lvl, d) in active_headers.items() if lvl >= level + ] + for key in headers_to_remove: + del active_headers[key] + + # Add/Update the active header + header_name = self.header_mapping[tag] + active_headers[header_name] = (node_text, level, dom_depth) + + # Always yield a Document for the header + header_meta = {k: v[0] for k, v in active_headers.items()} + yield Document(page_content=node_text, metadata=header_meta) + + else: + headers_out_of_scope = [ + k for k, (_, _, d) in active_headers.items() if dom_depth < d + ] + for key in headers_out_of_scope: + del active_headers[key] + + if self.return_each_element: + # Yield each element's text as its own Document + meta = {k: v[0] for k, v in active_headers.items()} + yield Document(page_content=node_text, metadata=meta) + else: + # Accumulate text in our chunk + current_chunk.append(node_text) + + # If we're aggregating and have leftover chunk, yield it + if not self.return_each_element: + doc = finalize_chunk() + if doc: + yield doc + + +class HTMLSectionSplitter: + """Splitting HTML files based on specified tag and font sizes. + + Requires lxml package. + """ + + def __init__( + self, + headers_to_split_on: list[tuple[str, str]], + **kwargs: Any, + ) -> None: + """Create a new `HTMLSectionSplitter`. + + Args: + headers_to_split_on: List of tuples of headers we want to track mapped to + (arbitrary) keys for metadata. + + Allowed header values: `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, e.g.: + `[("h1", "Header 1"), ("h2", "Header 2"]`. + **kwargs: Additional optional arguments for customizations. + + """ + self.headers_to_split_on = dict(headers_to_split_on) + self.xslt_path = ( + pathlib.Path(__file__).parent / "xsl/converting_to_header.xslt" + ).absolute() + self.kwargs = kwargs + + def split_documents(self, documents: Iterable[Document]) -> list[Document]: + """Split documents. + + Args: + documents: Iterable of `Document` objects to be split. + + Returns: + A list of split `Document` objects. + """ + texts, metadatas = [], [] + for doc in documents: + texts.append(doc.page_content) + metadatas.append(doc.metadata) + results = self.create_documents(texts, metadatas=metadatas) + + text_splitter = RecursiveCharacterTextSplitter(**self.kwargs) + + return text_splitter.split_documents(results) + + def split_text(self, text: str) -> list[Document]: + """Split HTML text string. + + Args: + text: HTML text + + Returns: + A list of split `Document` objects. + """ + return self.split_text_from_file(StringIO(text)) + + def create_documents( + self, texts: list[str], metadatas: list[dict[Any, Any]] | None = None + ) -> list[Document]: + """Create a list of `Document` objects from a list of texts. + + Args: + texts: A list of texts to be split and converted into documents. + metadatas: Optional list of metadata to associate with each document. + + Returns: + A list of `Document` objects. + """ + metadatas_ = metadatas or [{}] * len(texts) + documents = [] + for i, text in enumerate(texts): + for chunk in self.split_text(text): + metadata = copy.deepcopy(metadatas_[i]) + + for key in chunk.metadata: + if chunk.metadata[key] == "#TITLE#": + chunk.metadata[key] = metadata["Title"] + metadata = {**metadata, **chunk.metadata} + new_doc = Document(page_content=chunk.page_content, metadata=metadata) + documents.append(new_doc) + return documents + + def split_html_by_headers(self, html_doc: str) -> list[dict[str, str | None]]: + """Split an HTML document into sections based on specified header tags. + + This method uses BeautifulSoup to parse the HTML content and divides it into + sections based on headers defined in `headers_to_split_on`. Each section + contains the header text, content under the header, and the tag name. + + Args: + html_doc: The HTML document to be split into sections. + + Returns: + A list of dictionaries representing sections. + + Each dictionary contains: + + * `'header'`: The header text or a default title for the first section. + * `'content'`: The content under the header. + * `'tag_name'`: The name of the header tag (e.g., `h1`, `h2`). + + Raises: + ImportError: If BeautifulSoup is not installed. + """ + if not _HAS_BS4: + msg = "Unable to import BeautifulSoup/PageElement, \ + please install with `pip install \ + bs4`." + raise ImportError(msg) + + soup = BeautifulSoup(html_doc, "html.parser") + header_names = list(self.headers_to_split_on.keys()) + sections: list[dict[str, str | None]] = [] + + headers = _find_all_tags(soup, name=["body", *header_names]) + + for i, header in enumerate(headers): + if i == 0: + current_header = "#TITLE#" + current_header_tag = "h1" + section_content: list[str] = [] + else: + current_header = header.text.strip() + current_header_tag = header.name + section_content = [] + for element in header.next_elements: + if i + 1 < len(headers) and element == headers[i + 1]: + break + if isinstance(element, str): + section_content.append(element) + content = " ".join(section_content).strip() + + if content: + sections.append( + { + "header": current_header, + "content": content, + "tag_name": current_header_tag, + } + ) + + return sections + + def convert_possible_tags_to_header(self, html_content: str) -> str: + """Convert specific HTML tags to headers using an XSLT transformation. + + This method uses an XSLT file to transform the HTML content, converting + certain tags into headers for easier parsing. If no XSLT path is provided, + the HTML content is returned unchanged. + + Args: + html_content: The HTML content to be transformed. + + Returns: + The transformed HTML content as a string. + + Raises: + ImportError: If the `lxml` library is not installed. + """ + if not _HAS_LXML: + msg = "Unable to import lxml, please install with `pip install lxml`." + raise ImportError(msg) + # use lxml library to parse html document and return xml ElementTree + # Create secure parsers to prevent XXE attacks + html_parser = etree.HTMLParser(no_network=True) + xslt_parser = etree.XMLParser( + resolve_entities=False, no_network=True, load_dtd=False + ) + + # Apply XSLT access control to prevent file/network access + # DENY_ALL is a predefined access control that blocks all file/network access + # Type ignore needed due to incomplete lxml type stubs + ac = etree.XSLTAccessControl.DENY_ALL # type: ignore[attr-defined] + + tree = etree.parse(StringIO(html_content), html_parser) + xslt_tree = etree.parse(self.xslt_path, xslt_parser) + transform = etree.XSLT(xslt_tree, access_control=ac) + result = transform(tree) + return str(result) + + def split_text_from_file(self, file: StringIO) -> list[Document]: + """Split HTML content from a file into a list of `Document` objects. + + Args: + file: A file path or a file-like object containing HTML content. + + Returns: + A list of split `Document` objects. + """ + file_content = file.getvalue() + file_content = self.convert_possible_tags_to_header(file_content) + sections = self.split_html_by_headers(file_content) + + return [ + Document( + cast("str", section["content"]), + metadata={ + self.headers_to_split_on[str(section["tag_name"])]: section[ + "header" + ] + }, + ) + for section in sections + ] + + +@beta() +class HTMLSemanticPreservingSplitter(BaseDocumentTransformer): + """Split HTML content preserving semantic structure. + + Splits HTML content by headers into generalized chunks, preserving semantic + structure. If chunks exceed the maximum chunk size, it uses + `RecursiveCharacterTextSplitter` for further splitting. + + The splitter preserves full HTML elements and converts links to Markdown-like links. + It can also preserve images, videos, and audio elements by converting them into + Markdown format. Note that some chunks may exceed the maximum size to maintain + semantic integrity. + + !!! version-added "Added in `langchain-text-splitters` 0.3.5" + + Example: + ```python + from langchain_text_splitters.html import HTMLSemanticPreservingSplitter + + def custom_iframe_extractor(iframe_tag): + ``` + Custom handler function to extract the 'src' attribute from an